From 3de67060dd5e3f542e57177e3bdb186790be5168 Mon Sep 17 00:00:00 2001 From: short <> Date: Tue, 19 Aug 2003 07:38:22 +0000 Subject: [PATCH] http://prdownloads.sourceforge.net/lufs/lufs-0.9.6.tar.gz?download --- AUTHORS | 1 + COPYING | 340 + ChangeLog | 199 + Contributors | 12 + INSTALL | 182 + Makefile.am | 4 + Makefile.in | 565 ++ NEWS | 1 + README | 394 ++ THANKS | 11 + TODO | 3 + aclocal.m4 | 4488 ++++++++++++++ bootstrap | 6 + config.h.in | 97 + config/Makefile.am | 1 + config/Makefile.in | 302 + config/config.guess | 1317 ++++ config/config.sub | 1411 +++++ config/depcomp | 423 ++ config/install-sh | 251 + config/ltmain.sh | 4988 +++++++++++++++ config/missing | 336 + config/mkinstalldirs | 40 + configure | 10884 +++++++++++++++++++++++++++++++++ configure.in | 267 + docs/Makefile.am | 1 + docs/Makefile.in | 301 + docs/cefs.txt | 241 + docs/lufs.html | 1262 ++++ docs/lufs.sxw | Bin 0 -> 17872 bytes docs/lufs.txt | 394 ++ filesystems/Makefile.am | 8 + filesystems/Makefile.in | 458 ++ filesystems/cardfs/Makefile.am | 9 + filesystems/cardfs/Makefile.in | 461 ++ filesystems/cardfs/cardfs.cpp | 453 ++ filesystems/cardfs/cardfs.h | 83 + filesystems/cefs/Makefile.am | 12 + filesystems/cefs/Makefile.in | 606 ++ filesystems/cefs/README | 241 + filesystems/cefs/asyncd/Makefile.am | 8 + filesystems/cefs/asyncd/Makefile.in | 464 ++ filesystems/cefs/asyncd/README | 12 + filesystems/cefs/asyncd/asyncd.c | 449 ++ filesystems/cefs/asyncd/asyncd.h | 12 + filesystems/cefs/asyncd/debug.c | 84 + filesystems/cefs/asyncd/debug.h | 46 + filesystems/cefs/asyncd/socket.c | 191 + filesystems/cefs/asyncd/socket.h | 42 + filesystems/cefs/cefs.cpp | 658 ++ filesystems/cefs/cefs.h | 52 + filesystems/cefs/chunk.c | 471 ++ filesystems/cefs/chunk.h | 176 + filesystems/cefs/little_endian.h | 49 + filesystems/cefs/rapi.c | 2065 +++++++ filesystems/cefs/rapi.h | 435 ++ filesystems/cefs/windows.h | 163 + filesystems/cefs/wine.c | 349 ++ filesystems/ftpfs/Makefile.am | 6 + filesystems/ftpfs/Makefile.in | 466 ++ filesystems/ftpfs/ftpfs.cpp | 550 ++ filesystems/ftpfs/ftpfs.h | 68 + filesystems/ftpfs/ftplib.cpp | 528 ++ filesystems/ftpfs/ftplib.h | 62 + filesystems/ftpfs/ftpsys.h | 38 + filesystems/ftpfs/ftpsys_netware.cpp | 139 + filesystems/ftpfs/ftpsys_netware.h | 36 + filesystems/ftpfs/ftpsys_unix.cpp | 163 + filesystems/ftpfs/ftpsys_unix.h | 38 + filesystems/ftpfs/ftpsys_windows.cpp | 114 + filesystems/ftpfs/ftpsys_windows.h | 38 + filesystems/gnetfs/Makefile.am | 12 + filesystems/gnetfs/Makefile.in | 495 ++ filesystems/gnetfs/gnet.h | 46 + filesystems/gnetfs/gnet_channel.c | 481 ++ filesystems/gnetfs/gnet_channel.h | 52 + filesystems/gnetfs/gnet_defaults.h | 24 + filesystems/gnetfs/gnet_engine.c | 278 + filesystems/gnetfs/gnet_engine.h | 7 + filesystems/gnetfs/gnet_host.c | 134 + filesystems/gnetfs/gnet_host.h | 13 + filesystems/gnetfs/gnet_lib.h | 62 + filesystems/gnetfs/gnet_msg.c | 257 + filesystems/gnetfs/gnet_msg.h | 26 + filesystems/gnetfs/gnet_proto.c | 147 + filesystems/gnetfs/gnet_proto.h | 50 + filesystems/gnetfs/gnet_search.c | 173 + filesystems/gnetfs/gnet_search.h | 17 + filesystems/gnetfs/gnet_xfer.c | 390 ++ filesystems/gnetfs/gnet_xfer.h | 22 + filesystems/gnetfs/gnetfs.c | 376 ++ filesystems/gnetfs/gnetfs.h | 18 + filesystems/gnetfs/list.h | 171 + filesystems/gnetfs/search.c | 246 + filesystems/gnetfs/search.h | 31 + filesystems/gnetfs/vtree.c | 260 + filesystems/gnetfs/vtree.h | 31 + filesystems/gnetfs/xfer.c | 136 + filesystems/gnetfs/xfer.h | 10 + filesystems/gvfs/Makefile.am | 9 + filesystems/gvfs/Makefile.in | 460 ++ filesystems/gvfs/gvfs.cpp | 548 ++ filesystems/gvfs/gvfs.h | 59 + filesystems/localfs/Makefile.am | 6 + filesystems/localfs/Makefile.in | 457 ++ filesystems/localfs/localfs.c | 465 ++ filesystems/locasefs/Makefile.am | 6 + filesystems/locasefs/Makefile.in | 458 ++ filesystems/locasefs/locasefs.cpp | 697 +++ filesystems/locasefs/locasefs.h | 72 + filesystems/sshfs/Makefile.am | 9 + filesystems/sshfs/Makefile.in | 461 ++ filesystems/sshfs/sftplib.cpp | 1039 ++++ filesystems/sshfs/sftplib.h | 174 + filesystems/sshfs/sshfs.cpp | 475 ++ filesystems/sshfs/sshfs.h | 79 + filesystems/wavfs/Makefile.am | 6 + filesystems/wavfs/Makefile.in | 465 ++ filesystems/wavfs/file_handle.cpp | 382 ++ filesystems/wavfs/file_handle.h | 131 + filesystems/wavfs/fs_modules.cpp | 81 + filesystems/wavfs/fs_modules.h | 76 + filesystems/wavfs/glue.cpp | 108 + filesystems/wavfs/handlefs.cpp | 239 + filesystems/wavfs/handlefs.h | 48 + filesystems/wavfs/tools.cpp | 41 + filesystems/wavfs/tools.h | 4 + include/Makefile.am | 1 + include/Makefile.in | 373 ++ include/lufs/fs.h | 112 + include/lufs/proto.h | 106 + kernel/Linux/2.4/Makefile.am | 19 + kernel/Linux/2.4/Makefile.in | 480 ++ kernel/Linux/2.4/dir.c | 579 ++ kernel/Linux/2.4/file.c | 338 + kernel/Linux/2.4/inode.c | 519 ++ kernel/Linux/2.4/lufs.h | 87 + kernel/Linux/2.4/proc.c | 517 ++ kernel/Linux/2.4/proc.h | 51 + kernel/Linux/2.4/symlink.c | 185 + kernel/Linux/2.5/Makefile.am | 19 + kernel/Linux/2.5/Makefile.in | 480 ++ kernel/Linux/2.5/dir.c | 582 ++ kernel/Linux/2.5/file.c | 321 + kernel/Linux/2.5/inode.c | 535 ++ kernel/Linux/2.5/lufs.h | 87 + kernel/Linux/2.5/proc.c | 505 ++ kernel/Linux/2.5/proc.h | 51 + kernel/Linux/2.5/symlink.c | 184 + kernel/Linux/Makefile.am | 2 + kernel/Linux/Makefile.in | 450 ++ kernel/Makefile.am | 2 + kernel/Makefile.in | 450 ++ lufs.spec | 105 + lufsd/Makefile.am | 21 + lufsd/Makefile.in | 528 ++ lufsd/daemon.c | 255 + lufsd/dircache.c | 490 ++ lufsd/dircache.h | 71 + lufsd/filesystem.c | 457 ++ lufsd/filesystem.h | 63 + lufsd/fsctl.c | 505 ++ lufsd/fsctl.h | 54 + lufsd/list.h | 171 + lufsd/lufsd.conf | 45 + lufsd/lussh | 46 + lufsd/message.c | 180 + lufsd/message.h | 41 + lufsd/options.c | 301 + man/Makefile.am | 2 + man/Makefile.in | 355 ++ man/lufsmount.1 | 89 + man/lufsumount.1 | 28 + util/Makefile.am | 19 + util/Makefile.in | 512 ++ util/auto.ftpfs.c | 65 + util/auto.sshfs.c | 41 + util/lufsmnt.c | 180 + util/lufsmount.c | 316 + util/lufsumount.c | 128 + 180 files changed, 62148 insertions(+) create mode 100644 AUTHORS create mode 100644 COPYING create mode 100644 ChangeLog create mode 100644 Contributors create mode 100644 INSTALL create mode 100644 Makefile.am create mode 100644 Makefile.in create mode 100644 NEWS create mode 100644 README create mode 100644 THANKS create mode 100644 TODO create mode 100644 aclocal.m4 create mode 100755 bootstrap create mode 100644 config.h.in create mode 100644 config/Makefile.am create mode 100644 config/Makefile.in create mode 100755 config/config.guess create mode 100755 config/config.sub create mode 100755 config/depcomp create mode 100755 config/install-sh create mode 100644 config/ltmain.sh create mode 100755 config/missing create mode 100755 config/mkinstalldirs create mode 100755 configure create mode 100644 configure.in create mode 100644 docs/Makefile.am create mode 100644 docs/Makefile.in create mode 100644 docs/cefs.txt create mode 100644 docs/lufs.html create mode 100644 docs/lufs.sxw create mode 100644 docs/lufs.txt create mode 100644 filesystems/Makefile.am create mode 100644 filesystems/Makefile.in create mode 100644 filesystems/cardfs/Makefile.am create mode 100644 filesystems/cardfs/Makefile.in create mode 100644 filesystems/cardfs/cardfs.cpp create mode 100644 filesystems/cardfs/cardfs.h create mode 100644 filesystems/cefs/Makefile.am create mode 100644 filesystems/cefs/Makefile.in create mode 100644 filesystems/cefs/README create mode 100644 filesystems/cefs/asyncd/Makefile.am create mode 100644 filesystems/cefs/asyncd/Makefile.in create mode 100644 filesystems/cefs/asyncd/README create mode 100644 filesystems/cefs/asyncd/asyncd.c create mode 100644 filesystems/cefs/asyncd/asyncd.h create mode 100644 filesystems/cefs/asyncd/debug.c create mode 100644 filesystems/cefs/asyncd/debug.h create mode 100644 filesystems/cefs/asyncd/socket.c create mode 100644 filesystems/cefs/asyncd/socket.h create mode 100644 filesystems/cefs/cefs.cpp create mode 100644 filesystems/cefs/cefs.h create mode 100644 filesystems/cefs/chunk.c create mode 100644 filesystems/cefs/chunk.h create mode 100644 filesystems/cefs/little_endian.h create mode 100644 filesystems/cefs/rapi.c create mode 100644 filesystems/cefs/rapi.h create mode 100644 filesystems/cefs/windows.h create mode 100644 filesystems/cefs/wine.c create mode 100644 filesystems/ftpfs/Makefile.am create mode 100644 filesystems/ftpfs/Makefile.in create mode 100644 filesystems/ftpfs/ftpfs.cpp create mode 100644 filesystems/ftpfs/ftpfs.h create mode 100644 filesystems/ftpfs/ftplib.cpp create mode 100644 filesystems/ftpfs/ftplib.h create mode 100644 filesystems/ftpfs/ftpsys.h create mode 100644 filesystems/ftpfs/ftpsys_netware.cpp create mode 100644 filesystems/ftpfs/ftpsys_netware.h create mode 100644 filesystems/ftpfs/ftpsys_unix.cpp create mode 100644 filesystems/ftpfs/ftpsys_unix.h create mode 100644 filesystems/ftpfs/ftpsys_windows.cpp create mode 100644 filesystems/ftpfs/ftpsys_windows.h create mode 100644 filesystems/gnetfs/Makefile.am create mode 100644 filesystems/gnetfs/Makefile.in create mode 100644 filesystems/gnetfs/gnet.h create mode 100644 filesystems/gnetfs/gnet_channel.c create mode 100644 filesystems/gnetfs/gnet_channel.h create mode 100644 filesystems/gnetfs/gnet_defaults.h create mode 100644 filesystems/gnetfs/gnet_engine.c create mode 100644 filesystems/gnetfs/gnet_engine.h create mode 100644 filesystems/gnetfs/gnet_host.c create mode 100644 filesystems/gnetfs/gnet_host.h create mode 100644 filesystems/gnetfs/gnet_lib.h create mode 100644 filesystems/gnetfs/gnet_msg.c create mode 100644 filesystems/gnetfs/gnet_msg.h create mode 100644 filesystems/gnetfs/gnet_proto.c create mode 100644 filesystems/gnetfs/gnet_proto.h create mode 100644 filesystems/gnetfs/gnet_search.c create mode 100644 filesystems/gnetfs/gnet_search.h create mode 100644 filesystems/gnetfs/gnet_xfer.c create mode 100644 filesystems/gnetfs/gnet_xfer.h create mode 100644 filesystems/gnetfs/gnetfs.c create mode 100644 filesystems/gnetfs/gnetfs.h create mode 100644 filesystems/gnetfs/list.h create mode 100644 filesystems/gnetfs/search.c create mode 100644 filesystems/gnetfs/search.h create mode 100644 filesystems/gnetfs/vtree.c create mode 100644 filesystems/gnetfs/vtree.h create mode 100644 filesystems/gnetfs/xfer.c create mode 100644 filesystems/gnetfs/xfer.h create mode 100644 filesystems/gvfs/Makefile.am create mode 100644 filesystems/gvfs/Makefile.in create mode 100644 filesystems/gvfs/gvfs.cpp create mode 100644 filesystems/gvfs/gvfs.h create mode 100644 filesystems/localfs/Makefile.am create mode 100644 filesystems/localfs/Makefile.in create mode 100644 filesystems/localfs/localfs.c create mode 100644 filesystems/locasefs/Makefile.am create mode 100644 filesystems/locasefs/Makefile.in create mode 100644 filesystems/locasefs/locasefs.cpp create mode 100644 filesystems/locasefs/locasefs.h create mode 100644 filesystems/sshfs/Makefile.am create mode 100644 filesystems/sshfs/Makefile.in create mode 100644 filesystems/sshfs/sftplib.cpp create mode 100644 filesystems/sshfs/sftplib.h create mode 100644 filesystems/sshfs/sshfs.cpp create mode 100644 filesystems/sshfs/sshfs.h create mode 100644 filesystems/wavfs/Makefile.am create mode 100644 filesystems/wavfs/Makefile.in create mode 100644 filesystems/wavfs/file_handle.cpp create mode 100644 filesystems/wavfs/file_handle.h create mode 100644 filesystems/wavfs/fs_modules.cpp create mode 100644 filesystems/wavfs/fs_modules.h create mode 100644 filesystems/wavfs/glue.cpp create mode 100644 filesystems/wavfs/handlefs.cpp create mode 100644 filesystems/wavfs/handlefs.h create mode 100644 filesystems/wavfs/tools.cpp create mode 100644 filesystems/wavfs/tools.h create mode 100644 include/Makefile.am create mode 100644 include/Makefile.in create mode 100644 include/lufs/fs.h create mode 100644 include/lufs/proto.h create mode 100644 kernel/Linux/2.4/Makefile.am create mode 100644 kernel/Linux/2.4/Makefile.in create mode 100644 kernel/Linux/2.4/dir.c create mode 100644 kernel/Linux/2.4/file.c create mode 100644 kernel/Linux/2.4/inode.c create mode 100644 kernel/Linux/2.4/lufs.h create mode 100644 kernel/Linux/2.4/proc.c create mode 100644 kernel/Linux/2.4/proc.h create mode 100644 kernel/Linux/2.4/symlink.c create mode 100644 kernel/Linux/2.5/Makefile.am create mode 100644 kernel/Linux/2.5/Makefile.in create mode 100644 kernel/Linux/2.5/dir.c create mode 100644 kernel/Linux/2.5/file.c create mode 100644 kernel/Linux/2.5/inode.c create mode 100644 kernel/Linux/2.5/lufs.h create mode 100644 kernel/Linux/2.5/proc.c create mode 100644 kernel/Linux/2.5/proc.h create mode 100644 kernel/Linux/2.5/symlink.c create mode 100644 kernel/Linux/Makefile.am create mode 100644 kernel/Linux/Makefile.in create mode 100644 kernel/Makefile.am create mode 100644 kernel/Makefile.in create mode 100644 lufs.spec create mode 100644 lufsd/Makefile.am create mode 100644 lufsd/Makefile.in create mode 100644 lufsd/daemon.c create mode 100644 lufsd/dircache.c create mode 100644 lufsd/dircache.h create mode 100644 lufsd/filesystem.c create mode 100644 lufsd/filesystem.h create mode 100644 lufsd/fsctl.c create mode 100644 lufsd/fsctl.h create mode 100644 lufsd/list.h create mode 100644 lufsd/lufsd.conf create mode 100755 lufsd/lussh create mode 100644 lufsd/message.c create mode 100644 lufsd/message.h create mode 100644 lufsd/options.c create mode 100644 man/Makefile.am create mode 100644 man/Makefile.in create mode 100644 man/lufsmount.1 create mode 100644 man/lufsumount.1 create mode 100644 util/Makefile.am create mode 100644 util/Makefile.in create mode 100644 util/auto.ftpfs.c create mode 100644 util/auto.sshfs.c create mode 100644 util/lufsmnt.c create mode 100644 util/lufsmount.c create mode 100644 util/lufsumount.c diff --git a/AUTHORS b/AUTHORS new file mode 100644 index 0000000..8c2abe1 --- /dev/null +++ b/AUTHORS @@ -0,0 +1 @@ +Florin Malita diff --git a/COPYING b/COPYING new file mode 100644 index 0000000..d60c31a --- /dev/null +++ b/COPYING @@ -0,0 +1,340 @@ + GNU GENERAL PUBLIC LICENSE + Version 2, June 1991 + + Copyright (C) 1989, 1991 Free Software Foundation, Inc. + 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The licenses for most software are designed to take away your +freedom to share and change it. By contrast, the GNU General Public +License is intended to guarantee your freedom to share and change free +software--to make sure the software is free for all its users. This +General Public License applies to most of the Free Software +Foundation's software and to any other program whose authors commit to +using it. (Some other Free Software Foundation software is covered by +the GNU Library General Public License instead.) You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +this service if you wish), that you receive source code or can get it +if you want it, that you can change the software or use pieces of it +in new free programs; and that you know you can do these things. + + To protect your rights, we need to make restrictions that forbid +anyone to deny you these rights or to ask you to surrender the rights. +These restrictions translate to certain responsibilities for you if you +distribute copies of the software, or if you modify it. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must give the recipients all the rights that +you have. You must make sure that they, too, receive or can get the +source code. And you must show them these terms so they know their +rights. + + We protect your rights with two steps: (1) copyright the software, and +(2) offer you this license which gives you legal permission to copy, +distribute and/or modify the software. + + Also, for each author's protection and ours, we want to make certain +that everyone understands that there is no warranty for this free +software. If the software is modified by someone else and passed on, we +want its recipients to know that what they have is not the original, so +that any problems introduced by others will not reflect on the original +authors' reputations. + + Finally, any free program is threatened constantly by software +patents. We wish to avoid the danger that redistributors of a free +program will individually obtain patent licenses, in effect making the +program proprietary. To prevent this, we have made it clear that any +patent must be licensed for everyone's free use or not licensed at all. + + The precise terms and conditions for copying, distribution and +modification follow. + + GNU GENERAL PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License applies to any program or other work which contains +a notice placed by the copyright holder saying it may be distributed +under the terms of this General Public License. The "Program", below, +refers to any such program or work, and a "work based on the Program" +means either the Program or any derivative work under copyright law: +that is to say, a work containing the Program or a portion of it, +either verbatim or with modifications and/or translated into another +language. (Hereinafter, translation is included without limitation in +the term "modification".) Each licensee is addressed as "you". + +Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running the Program is not restricted, and the output from the Program +is covered only if its contents constitute a work based on the +Program (independent of having been made by running the Program). +Whether that is true depends on what the Program does. + + 1. You may copy and distribute verbatim copies of the Program's +source code as you receive it, in any medium, provided that you +conspicuously and appropriately publish on each copy an appropriate +copyright notice and disclaimer of warranty; keep intact all the +notices that refer to this License and to the absence of any warranty; +and give any other recipients of the Program a copy of this License +along with the Program. + +You may charge a fee for the physical act of transferring a copy, and +you may at your option offer warranty protection in exchange for a fee. + + 2. You may modify your copy or copies of the Program or any portion +of it, thus forming a work based on the Program, and copy and +distribute such modifications or work under the terms of Section 1 +above, provided that you also meet all of these conditions: + + a) You must cause the modified files to carry prominent notices + stating that you changed the files and the date of any change. + + b) You must cause any work that you distribute or publish, that in + whole or in part contains or is derived from the Program or any + part thereof, to be licensed as a whole at no charge to all third + parties under the terms of this License. + + c) If the modified program normally reads commands interactively + when run, you must cause it, when started running for such + interactive use in the most ordinary way, to print or display an + announcement including an appropriate copyright notice and a + notice that there is no warranty (or else, saying that you provide + a warranty) and that users may redistribute the program under + these conditions, and telling the user how to view a copy of this + License. (Exception: if the Program itself is interactive but + does not normally print such an announcement, your work based on + the Program is not required to print an announcement.) + +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Program, +and can be reasonably considered independent and separate works in +themselves, then this License, and its terms, do not apply to those +sections when you distribute them as separate works. But when you +distribute the same sections as part of a whole which is a work based +on the Program, the distribution of the whole must be on the terms of +this License, whose permissions for other licensees extend to the +entire whole, and thus to each and every part regardless of who wrote it. + +Thus, it is not the intent of this section to claim rights or contest +your rights to work written entirely by you; rather, the intent is to +exercise the right to control the distribution of derivative or +collective works based on the Program. + +In addition, mere aggregation of another work not based on the Program +with the Program (or with a work based on the Program) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this License. + + 3. You may copy and distribute the Program (or a work based on it, +under Section 2) in object code or executable form under the terms of +Sections 1 and 2 above provided that you also do one of the following: + + a) Accompany it with the complete corresponding machine-readable + source code, which must be distributed under the terms of Sections + 1 and 2 above on a medium customarily used for software interchange; or, + + b) Accompany it with a written offer, valid for at least three + years, to give any third party, for a charge no more than your + cost of physically performing source distribution, a complete + machine-readable copy of the corresponding source code, to be + distributed under the terms of Sections 1 and 2 above on a medium + customarily used for software interchange; or, + + c) Accompany it with the information you received as to the offer + to distribute corresponding source code. (This alternative is + allowed only for noncommercial distribution and only if you + received the program in object code or executable form with such + an offer, in accord with Subsection b above.) + +The source code for a work means the preferred form of the work for +making modifications to it. For an executable work, complete source +code means all the source code for all modules it contains, plus any +associated interface definition files, plus the scripts used to +control compilation and installation of the executable. However, as a +special exception, the source code distributed need not include +anything that is normally distributed (in either source or binary +form) with the major components (compiler, kernel, and so on) of the +operating system on which the executable runs, unless that component +itself accompanies the executable. + +If distribution of executable or object code is made by offering +access to copy from a designated place, then offering equivalent +access to copy the source code from the same place counts as +distribution of the source code, even though third parties are not +compelled to copy the source along with the object code. + + 4. You may not copy, modify, sublicense, or distribute the Program +except as expressly provided under this License. Any attempt +otherwise to copy, modify, sublicense or distribute the Program is +void, and will automatically terminate your rights under this License. +However, parties who have received copies, or rights, from you under +this License will not have their licenses terminated so long as such +parties remain in full compliance. + + 5. You are not required to accept this License, since you have not +signed it. However, nothing else grants you permission to modify or +distribute the Program or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Program (or any work based on the +Program), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Program or works based on it. + + 6. Each time you redistribute the Program (or any work based on the +Program), the recipient automatically receives a license from the +original licensor to copy, distribute or modify the Program subject to +these terms and conditions. You may not impose any further +restrictions on the recipients' exercise of the rights granted herein. +You are not responsible for enforcing compliance by third parties to +this License. + + 7. If, as a consequence of a court judgment or allegation of patent +infringement or for any other reason (not limited to patent issues), +conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot +distribute so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you +may not distribute the Program at all. For example, if a patent +license would not permit royalty-free redistribution of the Program by +all those who receive copies directly or indirectly through you, then +the only way you could satisfy both it and this License would be to +refrain entirely from distribution of the Program. + +If any portion of this section is held invalid or unenforceable under +any particular circumstance, the balance of the section is intended to +apply and the section as a whole is intended to apply in other +circumstances. + +It is not the purpose of this section to induce you to infringe any +patents or other property right claims or to contest validity of any +such claims; this section has the sole purpose of protecting the +integrity of the free software distribution system, which is +implemented by public license practices. Many people have made +generous contributions to the wide range of software distributed +through that system in reliance on consistent application of that +system; it is up to the author/donor to decide if he or she is willing +to distribute software through any other system and a licensee cannot +impose that choice. + +This section is intended to make thoroughly clear what is believed to +be a consequence of the rest of this License. + + 8. If the distribution and/or use of the Program is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Program under this License +may add an explicit geographical distribution limitation excluding +those countries, so that distribution is permitted only in or among +countries not thus excluded. In such case, this License incorporates +the limitation as if written in the body of this License. + + 9. The Free Software Foundation may publish revised and/or new versions +of the General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + +Each version is given a distinguishing version number. If the Program +specifies a version number of this License which applies to it and "any +later version", you have the option of following the terms and conditions +either of that version or of any later version published by the Free +Software Foundation. If the Program does not specify a version number of +this License, you may choose any version ever published by the Free Software +Foundation. + + 10. If you wish to incorporate parts of the Program into other free +programs whose distribution conditions are different, write to the author +to ask for permission. For software which is copyrighted by the Free +Software Foundation, write to the Free Software Foundation; we sometimes +make exceptions for this. Our decision will be guided by the two goals +of preserving the free status of all derivatives of our free software and +of promoting the sharing and reuse of software generally. + + NO WARRANTY + + 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY +FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN +OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES +PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED +OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS +TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE +PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, +REPAIR OR CORRECTION. + + 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR +REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, +INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING +OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED +TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY +YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER +PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE +POSSIBILITY OF SUCH DAMAGES. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +convey the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + + +Also add information on how to contact you by electronic and paper mail. + +If the program is interactive, make it output a short notice like this +when it starts in an interactive mode: + + Gnomovision version 69, Copyright (C) year 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 100644 index 0000000..d7585c2 --- /dev/null +++ b/ChangeLog @@ -0,0 +1,199 @@ +[05.28.2003] - Florin Malita + * fixed the "hanging on access" bug (glibc, pthreads linking order issue) + * merged null fsync patch from James Marsh + * merged wavfs from Pierre-Frederic Callaud + +[03.24.2003] - Florin Malita + * updated kernel 2.5 support + +[03.08.2003] - Florin Malita + * added large file support - patch from Eric Green(generic, localfs, sshfs). + * added ftpfs large file support + * fixed lufsmount's port option problem + * fixed (hopefully) the accept failure bug + * updated documentation + +[02.10.2003] - Florin Malita + * fixed password hiding bug (for passwords > 7 chars) + +[02.06.2003] - Florin Malita + * fixed a small ftpfs chmod problem + * changed the debug enabling flag to DEBUG + * fixed mountpoint lookup problem - no more needed, absolute symlinks + are translated to relative + * added a kernel patch and --disable-kernel-support config option + +[01.29.2003] - Florin Malita + * added gnutellafs (gnetfs) - EXPERIMENTAL! + * fixed a segfault on some mount failures + +[01.25.2003] - Florin Malita + * merged interrupted system calls patch from Denys Duchier + * merged root dir patch from Valient Gough + * merged localfs doc patch from Karen Pease + * fixed ".", ".." direntry issues. filesystems are no longer required to + fill these in at the beginning of a directory + +[01.18.2003] - Florin Malita + * added dircache control options ('dir_cache_ttl' & 'dir_cache_entries') + * fixed lufsmount root_dir problem + * slight fs interface change - introduced the global context parameter + this can be safely ignored by most filesystems + +[01.17.2003] - Florin Malita + * fixed a nasty security regression introduced in 0.9: ps showing passwords + +[01.14.2003] - Florin Malita + * fixed direntry case insensitivity problem + * full Linux 2.5 kernel support + +[01.12.2003] - Florin Malita + * fixed annoying page_cache problem + +[01.09.2003] - Florin Malita + * fixed sshfs banner problem + * fixed a write problem introduced in 0.9.0pre1 + +[01.08.2003] - Florin Malita + * ported all utils to C + * took out all fs specific knowledge from lufsmount + +[01.07.2003] - Florin Malita + * initial Linux 2.5 kernel support - probably doesn't work yet... + * fixed a gvfs directory listing bug + * fixed small ftpsys_windows.cpp compile problem + +[01.03.2003] - Florin Malita + * new "--with-ssh=PATH" configure option + +[12.20.2002] - Florin Malita + * added NT FTP support patch from Zach + * unified configuration & options handling + +[12.19.2002] - Florin Malita + * rewrote lufsd in plain C + * the daemon<->fs_modules interface is now C function based + * changed the project dir tree layout + +[12.14.2002] - Florin Malita + * added lufsmount man page + +[12.11.2002] - Florin Malita + * added ftpfs chmod support + * fixed some setattr refresh issues + +[12.09.2002] - Florin Malita + * fixed special character passwords bug + * dynamic loading of fs modules + * kernel module coding style update + +[12.02.2002] - Florin Malita + * cleaned up error logging (less verbose) + * faster/cleaner unmount procedure + * got rid of the "dangerous" tempnam warning + +[11.25.2002] - Florin Malita + * added 'own_fs' support in lufsmount + +[11.23.2002] - Florin Malita + * fixed obscure bug causing "random" directory listing failures + * added autofs support + +[11.21.2002] - Florin Malita + * cefs patch from Fedor + * fixed module symbols problem + * hide password in arguments list + * added "own_fs" option + +[11.07.2002] - Florin Malita + * 0.8.0 is ready: 2 new filesystems (locasefs, gvfs). + +[11.06.2002] - Florin Malita + * merged locasefs by ttimo. + * additional info to mtab record + +[11.05.2002] - Florin Malita + * added initial gnome-vfs (gvfs) support. + +[11.04.2002] - Florin Malita + * added sshfs "port" option. + * fixed build dependencies problem. + +[11.03.2002] - Florin Malita + * weird gcc3.2 bug workaround. + +[10.21.2002] - TTimo + * finished localfs lowercase implementation + +[10.10.2002] - Florin Malita + * lufs blocksize set to 512, for more accurate du results. + +[10.09.2002] - Florin Malita + * added the lussh script for easy ssh public key authentication setup. + +[10.02.2002] - Florin Malita + * added remote credentials checking for accurate permissions mapping. + * merged Fedor's cefs update + * bugfixes + +[09.30.2002] - Florin Malita + * added suid lufsmnt and lufsumount for regular user mounts/umounts. + * redesigned the daemon. it is now started on demand, under regular privileges. + * the "lufs" user is no longer needed. + +[09.15.2002] - Florin Malita + * another "stale NFS file handle" causing bug got fixed. Looks like it's + a whole class... + * added "channels" option to workaround connection limiting servers. + +[09.13.2002] - Florin Malita + * fixed the big bad "NFS file handle" buggy. + * fixed some more symlink bugs. + +[09.11.2002] - Florin Malita + * fixed the gcc3.x compile problem. + * fixed the mountpoint discovery bug. + +[09.02.2002] - Florin Malita + * optimized the I/O path (eliminated unnecessary copy) + * fixed some sshfs symlink bugs + * cleaned up the filesystem API + * added Novell Netware FTP support by Jaroslav Rohel + +[08.28.2002] - Florin Malita + * converted to automake/autoconf + * added cardfs by Martin Preuss + * added cefs by Fedor Bezrukov + +[08.27.2002] - Florin Malita + * rewrote daemon using pthreads + * added remote_root option + +[08.25.2002] - Florin Malita + * fixed localfs read bug + +[08.16.2002] - Florin Malita + * fixed lufsmount compile bug + +[08.14.2002] - Florin Malita + * fixed "stale NFS file handle" bug. + * added lufsmount utility + * replaced fmode/dmode options with fmask/dmask + +[08.10.2002] - Florin Malita + * fixed ftpfs upload bug. + * workaround for gcc2.95 bug. + +[08.08.2002] - Florin Malita + * centralized the dircache. one shared per mountpoint. + * improved install procedure. + +[08.05.2002] - Florin Malita + * added ftpfs + +[07.31.2002] - Florin Malita + * gcc3 tweaking + +[07.08.2002] - Florin Malita + * initial release. + \ No newline at end of file diff --git a/Contributors b/Contributors new file mode 100644 index 0000000..1390548 --- /dev/null +++ b/Contributors @@ -0,0 +1,12 @@ +Martin Preuss - cardfs, initial autotools port. +Fedor Bezrukov - cefs. +Jaroslav Rohel - Novell Netware FTP support. +Timothee Besset - locasefs. +David Wilson <> - rpm spec file. +Zachary Bedell - Windows NT FTP support. +Karen Pease - localfs comments. +Valient Gough - root path fixes. +Denys Duchier <> - restart interrupted syscalls fix. +Eric Green - large file support, various fixes. +James Marsh - fsync support +Pierre-Frederic Caillaud - wavfs diff --git a/INSTALL b/INSTALL new file mode 100644 index 0000000..b42a17a --- /dev/null +++ b/INSTALL @@ -0,0 +1,182 @@ +Basic Installation +================== + + These are generic installation instructions. + + The `configure' shell script attempts to guess correct values for +various system-dependent variables used during compilation. It uses +those values to create a `Makefile' in each directory of the package. +It may also create one or more `.h' files containing system-dependent +definitions. Finally, it creates a shell script `config.status' that +you can run in the future to recreate the current configuration, a file +`config.cache' that saves the results of its tests to speed up +reconfiguring, and a file `config.log' containing compiler output +(useful mainly for debugging `configure'). + + If you need to do unusual things to compile the package, please try +to figure out how `configure' could check whether to do them, and mail +diffs or instructions to the address given in the `README' so they can +be considered for the next release. If at some point `config.cache' +contains results you don't want to keep, you may remove or edit it. + + The file `configure.in' is used to create `configure' by a program +called `autoconf'. You only need `configure.in' if you want to change +it or regenerate `configure' using a newer version of `autoconf'. + +The simplest way to compile this package is: + + 1. `cd' to the directory containing the package's source code and type + `./configure' to configure the package for your system. If you're + using `csh' on an old version of System V, you might need to type + `sh ./configure' instead to prevent `csh' from trying to execute + `configure' itself. + + Running `configure' takes awhile. While running, it prints some + messages telling which features it is checking for. + + 2. Type `make' to compile the package. + + 3. Optionally, type `make check' to run any self-tests that come with + the package. + + 4. Type `make install' to install the programs and any data files and + documentation. + + 5. You can remove the program binaries and object files from the + source code directory by typing `make clean'. To also remove the + files that `configure' created (so you can compile the package for + a different kind of computer), type `make distclean'. There is + also a `make maintainer-clean' target, but that is intended mainly + for the package's developers. If you use it, you may have to get + all sorts of other programs in order to regenerate files that came + with the distribution. + +Compilers and Options +===================== + + Some systems require unusual options for compilation or linking that +the `configure' script does not know about. You can give `configure' +initial values for variables by setting them in the environment. Using +a Bourne-compatible shell, you can do that on the command line like +this: + CC=c89 CFLAGS=-O2 LIBS=-lposix ./configure + +Or on systems that have the `env' program, you can do it like this: + env CPPFLAGS=-I/usr/local/include LDFLAGS=-s ./configure + +Compiling For Multiple Architectures +==================================== + + You can compile the package for more than one kind of computer at the +same time, by placing the object files for each architecture in their +own directory. To do this, you must use a version of `make' that +supports the `VPATH' variable, such as GNU `make'. `cd' to the +directory where you want the object files and executables to go and run +the `configure' script. `configure' automatically checks for the +source code in the directory that `configure' is in and in `..'. + + If you have to use a `make' that does not supports the `VPATH' +variable, you have to compile the package for one architecture at a time +in the source code directory. After you have installed the package for +one architecture, use `make distclean' before reconfiguring for another +architecture. + +Installation Names +================== + + By default, `make install' will install the package's files in +`/usr/local/bin', `/usr/local/man', etc. You can specify an +installation prefix other than `/usr/local' by giving `configure' the +option `--prefix=PATH'. + + You can specify separate installation prefixes for +architecture-specific files and architecture-independent files. If you +give `configure' the option `--exec-prefix=PATH', the package will use +PATH as the prefix for installing programs and libraries. +Documentation and other data files will still use the regular prefix. + + In addition, if you use an unusual directory layout you can give +options like `--bindir=PATH' to specify different values for particular +kinds of files. Run `configure --help' for a list of the directories +you can set and what kinds of files go in them. + + If the package supports it, you can cause programs to be installed +with an extra prefix or suffix on their names by giving `configure' the +option `--program-prefix=PREFIX' or `--program-suffix=SUFFIX'. + +Optional Features +================= + + Some packages pay attention to `--enable-FEATURE' options to +`configure', where FEATURE indicates an optional part of the package. +They may also pay attention to `--with-PACKAGE' options, where PACKAGE +is something like `gnu-as' or `x' (for the X Window System). The +`README' should mention any `--enable-' and `--with-' options that the +package recognizes. + + For packages that use the X Window System, `configure' can usually +find the X include and library files automatically, but if it doesn't, +you can use the `configure' options `--x-includes=DIR' and +`--x-libraries=DIR' to specify their locations. + +Specifying the System Type +========================== + + There may be some features `configure' can not figure out +automatically, but needs to determine by the type of host the package +will run on. Usually `configure' can figure that out, but if it prints +a message saying it can not guess the host type, give it the +`--host=TYPE' option. TYPE can either be a short name for the system +type, such as `sun4', or a canonical name with three fields: + CPU-COMPANY-SYSTEM + +See the file `config.sub' for the possible values of each field. If +`config.sub' isn't included in this package, then this package doesn't +need to know the host type. + + If you are building compiler tools for cross-compiling, you can also +use the `--target=TYPE' option to select the type of system they will +produce code for and the `--build=TYPE' option to select the type of +system on which you are compiling the package. + +Sharing Defaults +================ + + If you want to set default values for `configure' scripts to share, +you can create a site shell script called `config.site' that gives +default values for variables like `CC', `cache_file', and `prefix'. +`configure' looks for `PREFIX/share/config.site' if it exists, then +`PREFIX/etc/config.site' if it exists. Or, you can set the +`CONFIG_SITE' environment variable to the location of the site script. +A warning: not all `configure' scripts look for a site script. + +Operation Controls +================== + + `configure' recognizes the following options to control how it +operates. + +`--cache-file=FILE' + Use and save the results of the tests in FILE instead of + `./config.cache'. Set FILE to `/dev/null' to disable caching, for + debugging `configure'. + +`--help' + Print a summary of the options to `configure', and exit. + +`--quiet' +`--silent' +`-q' + Do not print messages saying which checks are being made. To + suppress all normal output, redirect it to `/dev/null' (any error + messages will still be shown). + +`--srcdir=DIR' + Look for the package's source code in directory DIR. Usually + `configure' can determine that directory automatically. + +`--version' + Print the version of Autoconf used to generate the `configure' + script, and exit. + +`configure' also accepts some other, not widely useful, options. diff --git a/Makefile.am b/Makefile.am new file mode 100644 index 0000000..8f43fa1 --- /dev/null +++ b/Makefile.am @@ -0,0 +1,4 @@ +SUBDIRS=kernel lufsd filesystems util include man +DIST_SUBDIRS=kernel lufsd filesystems util include config docs man + +EXTRA_DIST=bootstrap Contributors lufs.spec diff --git a/Makefile.in b/Makefile.in new file mode 100644 index 0000000..ebe9d3b --- /dev/null +++ b/Makefile.in @@ -0,0 +1,565 @@ +# Makefile.in generated by automake 1.7.5 from Makefile.am. +# @configure_input@ + +# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003 +# Free Software Foundation, Inc. +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ + +srcdir = @srcdir@ +top_srcdir = @top_srcdir@ +VPATH = @srcdir@ +pkgdatadir = $(datadir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +top_builddir = . + +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +INSTALL = @INSTALL@ +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = @build@ +host_triplet = @host@ +target_triplet = @target@ +ACLOCAL = @ACLOCAL@ +AMDEP_FALSE = @AMDEP_FALSE@ +AMDEP_TRUE = @AMDEP_TRUE@ +AMTAR = @AMTAR@ +AUTOCONF = @AUTOCONF@ +AUTOFS_INSTALL = @AUTOFS_INSTALL@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CXX = @CXX@ +CXXDEPMODE = @CXXDEPMODE@ +CXXFLAGS = @CXXFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DEBUG_FLAGS = @DEBUG_FLAGS@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +ECHO = @ECHO@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +EXEEXT = @EXEEXT@ +GCONF = @GCONF@ +GVFSCONF = @GVFSCONF@ +GVFS_CFLAGS = @GVFS_CFLAGS@ +GVFS_LDADD = @GVFS_LDADD@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +KDEBUG_FLAGS = @KDEBUG_FLAGS@ +KERNEL_DIR = @KERNEL_DIR@ +KERNEL_HDR = @KERNEL_HDR@ +LDFLAGS = @LDFLAGS@ +LIBCHIPCARD_INCLUDES = @LIBCHIPCARD_INCLUDES@ +LIBCHIPCARD_LIB = @LIBCHIPCARD_LIB@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LIBTOOL = @LIBTOOL@ +LN_S = @LN_S@ +LTLIBOBJS = @LTLIBOBJS@ +LUFS_SUID = @LUFS_SUID@ +MAKEINFO = @MAKEINFO@ +MODULES_DIR = @MODULES_DIR@ +MODV_FLAGS = @MODV_FLAGS@ +OBJEXT = @OBJEXT@ +OS_DIR = @OS_DIR@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +RANLIB = @RANLIB@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +SSHPROG = @SSHPROG@ +STRIP = @STRIP@ +VERSION = @VERSION@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_CXX = @ac_ct_CXX@ +ac_ct_RANLIB = @ac_ct_RANLIB@ +ac_ct_STRIP = @ac_ct_STRIP@ +all_includes = @all_includes@ +all_libraries = @all_libraries@ +am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ +am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ +am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@ +am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +datadir = @datadir@ +define_has_libchipcard = @define_has_libchipcard@ +exec_prefix = @exec_prefix@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localstatedir = @localstatedir@ +mandir = @mandir@ +oldincludedir = @oldincludedir@ +opt_fs = @opt_fs@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +sysconfdir = @sysconfdir@ +target = @target@ +target_alias = @target_alias@ +target_cpu = @target_cpu@ +target_os = @target_os@ +target_vendor = @target_vendor@ +SUBDIRS = kernel lufsd filesystems util include man +DIST_SUBDIRS = kernel lufsd filesystems util include config docs man + +EXTRA_DIST = bootstrap Contributors lufs.spec +subdir = . +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +mkinstalldirs = $(SHELL) $(top_srcdir)/config/mkinstalldirs +CONFIG_HEADER = config.h +CONFIG_CLEAN_FILES = +DIST_SOURCES = + +RECURSIVE_TARGETS = info-recursive dvi-recursive pdf-recursive \ + ps-recursive install-info-recursive uninstall-info-recursive \ + all-recursive install-data-recursive install-exec-recursive \ + installdirs-recursive install-recursive uninstall-recursive \ + check-recursive installcheck-recursive +DIST_COMMON = README AUTHORS COPYING ChangeLog INSTALL Makefile.am \ + Makefile.in NEWS THANKS TODO aclocal.m4 config.h.in configure \ + configure.in +all: config.h + $(MAKE) $(AM_MAKEFLAGS) all-recursive + +.SUFFIXES: + +am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \ + configure.lineno +$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4) + cd $(top_srcdir) && \ + $(AUTOMAKE) --gnu Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe) + +$(top_builddir)/config.status: $(srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + $(SHELL) ./config.status --recheck +$(srcdir)/configure: $(srcdir)/configure.in $(ACLOCAL_M4) $(CONFIGURE_DEPENDENCIES) + cd $(srcdir) && $(AUTOCONF) + +$(ACLOCAL_M4): configure.in + cd $(srcdir) && $(ACLOCAL) $(ACLOCAL_AMFLAGS) + +config.h: stamp-h1 + @if test ! -f $@; then \ + rm -f stamp-h1; \ + $(MAKE) stamp-h1; \ + else :; fi + +stamp-h1: $(srcdir)/config.h.in $(top_builddir)/config.status + @rm -f stamp-h1 + cd $(top_builddir) && $(SHELL) ./config.status config.h + +$(srcdir)/config.h.in: $(top_srcdir)/configure.in $(ACLOCAL_M4) + cd $(top_srcdir) && $(AUTOHEADER) + touch $(srcdir)/config.h.in + +distclean-hdr: + -rm -f config.h stamp-h1 + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs + +distclean-libtool: + -rm -f libtool +uninstall-info-am: + +# This directory's subdirectories are mostly independent; you can cd +# into them and run `make' without going through this Makefile. +# To change the values of `make' variables: instead of editing Makefiles, +# (1) if the variable is set in `config.status', edit `config.status' +# (which will cause the Makefiles to be regenerated when you run `make'); +# (2) otherwise, pass the desired values on the `make' command line. +$(RECURSIVE_TARGETS): + @set fnord $$MAKEFLAGS; amf=$$2; \ + dot_seen=no; \ + target=`echo $@ | sed s/-recursive//`; \ + list='$(SUBDIRS)'; for subdir in $$list; do \ + echo "Making $$target in $$subdir"; \ + if test "$$subdir" = "."; then \ + dot_seen=yes; \ + local_target="$$target-am"; \ + else \ + local_target="$$target"; \ + fi; \ + (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ + || case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \ + done; \ + if test "$$dot_seen" = "no"; then \ + $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \ + fi; test -z "$$fail" + +mostlyclean-recursive clean-recursive distclean-recursive \ +maintainer-clean-recursive: + @set fnord $$MAKEFLAGS; amf=$$2; \ + dot_seen=no; \ + case "$@" in \ + distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ + *) list='$(SUBDIRS)' ;; \ + esac; \ + rev=''; for subdir in $$list; do \ + if test "$$subdir" = "."; then :; else \ + rev="$$subdir $$rev"; \ + fi; \ + done; \ + rev="$$rev ."; \ + target=`echo $@ | sed s/-recursive//`; \ + for subdir in $$rev; do \ + echo "Making $$target in $$subdir"; \ + if test "$$subdir" = "."; then \ + local_target="$$target-am"; \ + else \ + local_target="$$target"; \ + fi; \ + (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ + || case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \ + done && test -z "$$fail" +tags-recursive: + list='$(SUBDIRS)'; for subdir in $$list; do \ + test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \ + done +ctags-recursive: + list='$(SUBDIRS)'; for subdir in $$list; do \ + test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \ + done + +ETAGS = etags +ETAGSFLAGS = + +CTAGS = ctags +CTAGSFLAGS = + +tags: TAGS + +ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + mkid -fID $$unique + +TAGS: tags-recursive $(HEADERS) $(SOURCES) config.h.in $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + tags=; \ + here=`pwd`; \ + if (etags --etags-include --version) >/dev/null 2>&1; then \ + include_option=--etags-include; \ + else \ + include_option=--include; \ + fi; \ + list='$(SUBDIRS)'; for subdir in $$list; do \ + if test "$$subdir" = .; then :; else \ + test -f $$subdir/TAGS && \ + tags="$$tags $$include_option=$$here/$$subdir/TAGS"; \ + fi; \ + done; \ + list='$(SOURCES) $(HEADERS) config.h.in $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + test -z "$(ETAGS_ARGS)$$tags$$unique" \ + || $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$tags $$unique + +ctags: CTAGS +CTAGS: ctags-recursive $(HEADERS) $(SOURCES) config.h.in $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + tags=; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS) config.h.in $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + test -z "$(CTAGS_ARGS)$$tags$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$tags $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && cd $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) $$here + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) + +top_distdir = . +distdir = $(PACKAGE)-$(VERSION) + +am__remove_distdir = \ + { test ! -d $(distdir) \ + || { find $(distdir) -type d ! -perm -200 -exec chmod u+w {} ';' \ + && rm -fr $(distdir); }; } + +GZIP_ENV = --best +distuninstallcheck_listfiles = find . -type f -print +distcleancheck_listfiles = find . -type f -print + +distdir: $(DISTFILES) + $(am__remove_distdir) + mkdir $(distdir) + @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \ + list='$(DISTFILES)'; for file in $$list; do \ + case $$file in \ + $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ + $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ + esac; \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test "$$dir" != "$$file" && test "$$dir" != "."; then \ + dir="/$$dir"; \ + $(mkinstalldirs) "$(distdir)$$dir"; \ + else \ + dir=''; \ + fi; \ + if test -d $$d/$$file; then \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ + fi; \ + cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ + else \ + test -f $(distdir)/$$file \ + || cp -p $$d/$$file $(distdir)/$$file \ + || exit 1; \ + fi; \ + done + list='$(DIST_SUBDIRS)'; for subdir in $$list; do \ + if test "$$subdir" = .; then :; else \ + test -d $(distdir)/$$subdir \ + || mkdir $(distdir)/$$subdir \ + || exit 1; \ + (cd $$subdir && \ + $(MAKE) $(AM_MAKEFLAGS) \ + top_distdir="$(top_distdir)" \ + distdir=../$(distdir)/$$subdir \ + distdir) \ + || exit 1; \ + fi; \ + done + -find $(distdir) -type d ! -perm -777 -exec chmod a+rwx {} \; -o \ + ! -type d ! -perm -444 -links 1 -exec chmod a+r {} \; -o \ + ! -type d ! -perm -400 -exec chmod a+r {} \; -o \ + ! -type d ! -perm -444 -exec $(SHELL) $(install_sh) -c -m a+r {} {} \; \ + || chmod -R a+r $(distdir) +dist-gzip: distdir + $(AMTAR) chof - $(distdir) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz + $(am__remove_distdir) + +dist dist-all: distdir + $(AMTAR) chof - $(distdir) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz + $(am__remove_distdir) + +# This target untars the dist file and tries a VPATH configuration. Then +# it guarantees that the distribution is self-contained by making another +# tarfile. +distcheck: dist + $(am__remove_distdir) + GZIP=$(GZIP_ENV) gunzip -c $(distdir).tar.gz | $(AMTAR) xf - + chmod -R a-w $(distdir); chmod a+w $(distdir) + mkdir $(distdir)/_build + mkdir $(distdir)/_inst + chmod a-w $(distdir) + dc_install_base=`$(am__cd) $(distdir)/_inst && pwd | sed -e 's,^[^:\\/]:[\\/],/,'` \ + && dc_destdir="$${TMPDIR-/tmp}/am-dc-$$$$/" \ + && cd $(distdir)/_build \ + && ../configure --srcdir=.. --prefix="$$dc_install_base" \ + $(DISTCHECK_CONFIGURE_FLAGS) \ + && $(MAKE) $(AM_MAKEFLAGS) \ + && $(MAKE) $(AM_MAKEFLAGS) dvi \ + && $(MAKE) $(AM_MAKEFLAGS) check \ + && $(MAKE) $(AM_MAKEFLAGS) install \ + && $(MAKE) $(AM_MAKEFLAGS) installcheck \ + && $(MAKE) $(AM_MAKEFLAGS) uninstall \ + && $(MAKE) $(AM_MAKEFLAGS) distuninstallcheck_dir="$$dc_install_base" \ + distuninstallcheck \ + && chmod -R a-w "$$dc_install_base" \ + && ({ \ + (cd ../.. && $(mkinstalldirs) "$$dc_destdir") \ + && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" install \ + && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" uninstall \ + && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" \ + distuninstallcheck_dir="$$dc_destdir" distuninstallcheck; \ + } || { rm -rf "$$dc_destdir"; exit 1; }) \ + && rm -rf "$$dc_destdir" \ + && $(MAKE) $(AM_MAKEFLAGS) dist-gzip \ + && rm -f $(distdir).tar.gz \ + && $(MAKE) $(AM_MAKEFLAGS) distcleancheck + $(am__remove_distdir) + @echo "$(distdir).tar.gz is ready for distribution" | \ + sed 'h;s/./=/g;p;x;p;x' +distuninstallcheck: + @cd $(distuninstallcheck_dir) \ + && test `$(distuninstallcheck_listfiles) | wc -l` -le 1 \ + || { echo "ERROR: files left after uninstall:" ; \ + if test -n "$(DESTDIR)"; then \ + echo " (check DESTDIR support)"; \ + fi ; \ + $(distuninstallcheck_listfiles) ; \ + exit 1; } >&2 +distcleancheck: distclean + @if test '$(srcdir)' = . ; then \ + echo "ERROR: distcleancheck can only run from a VPATH build" ; \ + exit 1 ; \ + fi + @test `$(distcleancheck_listfiles) | wc -l` -eq 0 \ + || { echo "ERROR: files left in build directory after distclean:" ; \ + $(distcleancheck_listfiles) ; \ + exit 1; } >&2 +check-am: all-am +check: check-recursive +all-am: Makefile config.h +installdirs: installdirs-recursive +installdirs-am: + +install: install-recursive +install-exec: install-exec-recursive +install-data: install-data-recursive +uninstall: uninstall-recursive + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-recursive +install-strip: + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + INSTALL_STRIP_FLAG=-s \ + `test -z '$(STRIP)' || \ + echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -rm -f Makefile $(CONFIG_CLEAN_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +clean: clean-recursive + +clean-am: clean-generic clean-libtool mostlyclean-am + +distclean: distclean-recursive + -rm -f $(am__CONFIG_DISTCLEAN_FILES) +distclean-am: clean-am distclean-generic distclean-hdr distclean-libtool \ + distclean-tags + +dvi: dvi-recursive + +dvi-am: + +info: info-recursive + +info-am: + +install-data-am: + +install-exec-am: + +install-info: install-info-recursive + +install-man: + +installcheck-am: + +maintainer-clean: maintainer-clean-recursive + -rm -f $(am__CONFIG_DISTCLEAN_FILES) + -rm -rf autom4te.cache +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-recursive + +mostlyclean-am: mostlyclean-generic mostlyclean-libtool + +pdf: pdf-recursive + +pdf-am: + +ps: ps-recursive + +ps-am: + +uninstall-am: uninstall-info-am + +uninstall-info: uninstall-info-recursive + +.PHONY: $(RECURSIVE_TARGETS) CTAGS GTAGS all all-am check check-am clean \ + clean-generic clean-libtool clean-recursive ctags \ + ctags-recursive dist dist-all dist-gzip distcheck distclean \ + distclean-generic distclean-hdr distclean-libtool \ + distclean-recursive distclean-tags distcleancheck distdir \ + distuninstallcheck dvi dvi-am dvi-recursive info info-am \ + info-recursive install install-am install-data install-data-am \ + install-data-recursive install-exec install-exec-am \ + install-exec-recursive install-info install-info-am \ + install-info-recursive install-man install-recursive \ + install-strip installcheck installcheck-am installdirs \ + installdirs-am installdirs-recursive maintainer-clean \ + maintainer-clean-generic maintainer-clean-recursive mostlyclean \ + mostlyclean-generic mostlyclean-libtool mostlyclean-recursive \ + pdf pdf-am pdf-recursive ps ps-am ps-recursive tags \ + tags-recursive uninstall uninstall-am uninstall-info-am \ + uninstall-info-recursive uninstall-recursive + +# 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 100644 index 0000000..d859b7b --- /dev/null +++ b/NEWS @@ -0,0 +1 @@ +No news is good news ;) diff --git a/README b/README new file mode 100644 index 0000000..455375a --- /dev/null +++ b/README @@ -0,0 +1,394 @@ +LUFS – Linux Userland File System +(sshfs, ftpfs, localfs, locasefs, gnutellafs, gvfs, cardfs, cefs) + +1. INTRODUCTION + +For those not interested in technicalities: + +LUFS is enabling you to mount into your file hierarchy a remote computer's file system, which is accessible by various means (ftp, ssh, etc.). Then, the access to the remote files will be completely network transparent. In other words, you'll be able to read/modify remote files as if they were local, watch movies/listen to MP3s from FTP/SSH/Gnutella servers without copying them locally. Sheer magic. Now skip to the next section. + +LUFS is a hybrid userspace file system framework supporting an indefinite number of file systems transparently for any application. It consists of a kernel module and an userspace daemon. Basically it delegates most of the VFS calls to a specialized daemon which handles them. + +The reason for the userspace stuff: there are operations only suited for userspace (cryptography for example) and implementing them in kernel would be bloat. + +The reason for the kernel stuff: I think it's important to keep the file system access point at the lowest level in order to allow all the applications to use it. Consider KDE: it implements its own virtual file system, a great one, but only KDE applications can take advantage of it. So does GNOME, MC and others. Suddenly we have lots of overlapping userspace file system implementations, a real waste... + +Communication between the kernel module and the daemon is done through UNIX domain sockets. This makes LUFS best suited for networked file systems, where this indirection overhead (userspace <-> kernel <-> userspace) is small compared to the speed penalty due to the network itself. + +LUFS can be regarded as doing the same job as the VFS (virtual file system switch) in the kernel: it is a switch, distributing the file system calls to its supported file systems. With a big difference: LUFS file systems are implemented in userspace. This would be a drawback for local file systems where the access speed is important, but proves to be a huge advantage for networked file systems where the userland flexibility is most important. + +This flexibility allowed for implementation of SSHFS for example, in a pretty straightforward manner, using the already existing openssh infrastructure. Lots of other “exotic” file systems are in the planning phase: socketfs, httpfs, webdavfs, freenetfs, etc. Just imagine mounting a freenet file system and accessing all the goodies as they were local... + +Everything is a file and if not, it should be! + +2. FILE SYSTEMS + +This section describes the file systems distributed with LUFS and provides some real mount examples. Other file systems might also be available. + +The options presented here are file system specific, for a list of the global options please consult the USAGE section and the lufsmount(1) man page. + + + +2.1 LOCALFS + +LocalFS is a proof of concept and didactic file system, meant to demonstrate the framework's power. All it does is mirror the local tree on the mountpoint. Consider it a tutorial ;) + +It is a complete (and inefficient for simplicity's sake) implementation. + +Specific mount options: none. + +Mount example: + +[user@localhost]$ lufsmount localfs:// ~/mnt/lufs -–uid=505 + +or, using mount: +[root@localhost]# mount -t lufs none /mnt/lufs -o fs=localfs,uid=505 + + + + +2.2 LOCASEFS +Contributed by: Timothee Besset + +LoCaseFS provides a lowercase mapping of the local file system. It comes in handy when importing win32 source trees on *nix systems. + +It is a complete implementation (based on localfs, it could use some optimizations). + +Specific mount options: none + +Mount example: + +[user@localhost]$ lufsmount locasefs:// ~/mnt/lufs -–uid=505 + +or, using mount: +[root@localhost]# mount -t lufs none /mnt/lufs -o fs=locasefs,uid=505 + + + + +2.3 SSHFS +Requires: ssh ( http://www.openssh.org ). + +SshFS is probably the most advanced LUFS file system because of its security, usefulness and completeness. It is based on the SFTP protocol and requires openssh. You can mount remote file systems accessible through sftp (scp utility). + +It is a complete implementation. + + +Specific mount options: + +host=server : the sftp server to mount (authentication should be properly configured, see below) +port=port : the port the sftp server is listening on +username=user : the user to authenticate on the server (see INSTALLATION) + +I recommend setting up public key authentication (DSA or RSA based) on the remote system for the mounting user when using sshfs. This will allow the daemon to open several channels without any user interaction. Consult the ssh(1) manual page or try the lussh script for ssh setup. + +lussh is a helper script which tries to automatically setup public key authentication for ssh. You will be prompted for the ssh server and the remote username by the script and for the remote user's password by openssh. If you are prompted for the password more that twice, then public key authentication setup failed for the given server/user. + +It is possible to use sshfs without a public key authentication setup (provided you have openssh-askpass-gnome or some other ssh authentication helper) but you will be asked for passwords interactively. If this is annoying, you can reduce the number of communication channels (channels=1 option). + +Mount example: + +[user@localhost]$ lufsmount sshfs://mali@lufs.sourceforge.net ~/mnt/lufs –-fmask=444 -–dmask=555 + +or, using mount: +[root@localhost]# mount -t lufs none /mnt/lufs -o nosuid,fs=sshfs,host=lufs.sourceforge.net,username=mali,fmode=444,dmode=555 + + + +2.4 FTPFS + +FtpFS is a port of an old kernel implementation ( http://ftpfs.sourceforge.net ). Based on FTP, this file system allows you to mount ftp sites locally. + +Because of FTP's nature, there are some limitations: +the communication is in clear +some operations are not supported by the protocol +some operations are not supported by specific server implementations + +Specific mount options: + +host=server : the ftp server to mount +port=port : the port the ftp server is listening on +username=user : the user to authenticate on the server +password=pass : the user's password +ftpactive : will use active data connection (the server initiates the data connection) instead of passive data connection (the client opens the connection) + +If no username is supplied, LUFS will try anonymous access. +If the ftp server only allows a limited number of logins from a certain IP (1 per IP), you should limit the number of channels with the channels option ( channels=1 ). + +Mount example: + +[user@localhost]$ lufsmount ftpfs://mali:mypass@ftp.sourceforge.net ~/mnt/lufs -o ftpactive + +or, using mount: +[root@localhost]# mount -t lufs none /mnt/lufs -o nosuid,fs=ftpfs,host=ftp.sourceforge.net,username=mali,password=mypass,ftpactive + + + +2.5 GNUTELLAFS (GNETFS) + +OK, it's time to fasten your seatbelt and hold your breath: Kansas is going bye-bye 'cause you're about to swallow the red pill. + +Forget everything you knew about file sharing clients. This is a glimpse of the future... + +You mount a gnetfs in ~/gnet. You wait a couple of minutes so it can establish its peer connections. You start a search by creating a subdirectory of SEARCH: mkdir “~/gnet/SEARCH/metallica mp3”. You wait a few seconds for the results to accumulate. The you chdir to “SEARCH/metallica mp3” and try a ls: surprise – the files are there! You shoot up mpg123 and enjoy... You are happy. + +Sounds too good to be true? Well, it's here... + +GnetFS is a Gnutella network interface. You can perform searches and access resources without downloading them locally. + +Specific options: +known_peers=MAX : maximum number of known peers (see below) +hostX=IP:port : known peer – specify initial peers (X < MAX) + +All these have sane defaults in /etc/lufsd.conf so you can just ignore them. Just make sure you specify a small dir_cache_ttl so that the directory cache won't get in your way (the gnutella results are cached anyway). + +In order to start a search you create a subdirectory of SEARCH. A search for the text in subdirectory's name will be started in background and results added to that dir gradually. Once you have some results, you can start accessing (read-only) them. When you are no longer interested in that search, you simply erase the directory. + +Note: You need some serious bandwidth in order to enjoy gnetfs. LAN is great, DSL will do. Maybe cable too. + +IMPORTANT: gnetfs is EXPERIMENTAL! At least the searches seem to be working OK while for transfers you need to be lucky (but this is no news to gnutella users, is it?:) . The gnutella back-end is incomplete and only implements the bare basics needed for file searching/download – no uploads/sharing (the gnutella guys are probably out to get me as I write :). Hope this will change soon, I'm stuck with a dialup connection for now so I'm counting a LOT on your feedback. + +Mount examples: + +[user@localhost]$ lufsmount gnetfs:// ~/gnet -o dir_cache_ttl=1 + +or, using mount: + +[user@localhost]# mount -t lufs none /mnt/gnet -o fs=gnetfs,dir_cache_ttl=1 + + + +2.6 GVFS (GnomeVFS) +Requires: Gnome, libnomevfs (http://www.gnome.org) + +GVFS is an adapter file system linking lufs to Gnome's vfs. Thus, you gain access to the vfs functionality implemented in Gnome from all the applications. While not a very bright idea in itself (I think Gnome should use lufs or a similar concept) this might add some value to lufs considering the number of existing Gnome vfs modules. + +The functionality is dependent on that of the used Gnome VFS module, which (for gnomevfs-1 at least) isn't exactly impressive. The ftp and ssh modules especially, don't even come close to their lufs native corespondents. + +Specific mount options: + +No specific options, but the root option is mandatory and has a special meaning: it specifies the Gnome VFS URI to mount (thus it includes the protocol, host and all the other meaningful components) preceded by a “/” (example: root=/smb://station2). + +Mount examples: +[user@localhost]$ lufsmount gvfs:///ssh://mali@ssh.sf.net ~/mnt/lufs + +[user@localhost]$ lufsmount gvfs:///file:/ ~/mnt/lufs + +or, using mount: +[root@localhost]# mount -t lufs none /mnt/lufs -o fs=gvfs,root=/ftp://mali:xxxxx@ftp.sf.net + +[root@localhost]# mount -t lufs none /mnt/lufs -o fs=gvfs,root=/start-here:/ + + + +2.7 CARDFS +Contributed by: Martin Preuss < m_preuss@hamburg.de >. +Requires: libchipcard ( http://www.libchipcard.de ). + +This module allows you to mount memory card file systems. It requires the latest CVS libchipcard version. + +You must enable cefs support at configure time, using --enable-cardfs if you want this file system to be built. + +Specific mount options: + +host=teminal@address : terminal is the short name of your terminal (tow1, +pcsc0 or whatever name you assigned to your terminal). If omitted the default terminal will be used. +address is the address the cardfs daemon listens on (cardfsd's -a option) +port=port : the port that cardfsd is listening on (-p option) +username=user : the name used to authorize yourself to the card (only needed if encryption is enabled on the card) +password=pass : the password used for encryption/decryption + +You must start libchipcard's cardfs daemon before mounting the file system: +[root@localhost]# cardfsd -a ADDRESS_TO_BIND_TO -p PORT_TO_BIND_TO + +Mount example: + +[root@localhost]# lufsmount cardfs://myusr:password@ttyS0@127.0.0.1:9770 /mnt/lufs + +or, using mount: +[root@localhost]# mount -t lufs none /mnt/lufs -o nosuid,fs=cardfs,username=myusr,password=mypass,host=ttyS0@127.0.0.1,port=9770 + + + +2.8 CEFS +Contributed by: Fedor Bezrukov < fedor@ms2.inr.ac.ru > + +This lufs module allows access to a CE device's (HP (Compaq) IPAQ, HP Jornada, etc...) file system. + +You must enable cefs support at configure time, using --enable-cefs if you want this file system to be built. + +Specific mount options: + +No specific options here. Simply mount the file system after connecting your PDA. +Check out cefs.txt for detailed information. + +Mount example: + +[user@localhost]$ lufsmount cefs:// ~/mnt/lufs + +or, using mount: +[root@localhost]# mount -t lufs none /mnt/lufs -o nosuid,fs=cefs + +3. BUILD & INSTALLATION + +3.1 SOURCE DISTRIBUTION + +In order to build LUFS you need to have the running kernel's headers installed. Check whether /lib/modules/`uname -r`/build/include is pointing to the running kernel's include dir. + +IMPORTANT: +The kernel module requires the same compiler that was used for your running kernel's build. + +Executing + +[root@localhost]# ./configure [options] +[root@localhost]# make +[root@localhost]# make install + +as root in the top lufs directory should build and install the application. + +The non-standard configure options are: + +--with-kernel=VERSION configure for the specified kernel version (skip +auto-detection) +--with-kheaders=DIR specify the location of the kernel headers (skip +auto-detection) +--with-ssh=SSH specify the location of the ssh executable +--enable-debug enable debug messages from the daemon +--enable-kdebug enable debug messages from the kernel module +--enable-cardfs enable cardfs support +--enable-cefs enable cefs support +--enable-autofs-install enable installing of autofs config file +--enable-modversions force modversions kernel support +--disable-suid lufsmnt and lufsumount will not be made suid (regular +users won't be able to mount lufs). +--disable-kernel-support do not build & install the required kernel module +(useful when your kernel is already patched for lufs support) + + + +3.2 PATCHED KERNEL + +If for some reason (read modversions:) the kernel module fails to compile and install properly, you can try to patch the kernel manually. + +Download the patch for your kernel version (if available) into your kernel's source top directory. Apply it by + +[user@localhost ~/linux-2.4.19]$ zcat lufs-x.x.x-x.x.x.patch.gz | patch -Np1 + +Then proceed with building and installing your kernel, not forgetting to reconfigure it, enabling LUFS under FILE SYSTEMS section first (it requires development/incomplete drivers and UNIX domain sockets). + +The rest of the package can then be easily installed as described above, specifying –disable-kernel-support when running ./configure. + + + +3.3 DEBUG BUILD + +So you've got lufs installed but bumped right into that nasty buggy... The cruel realization of lufs' imperfection overwhelms you... But wait, maybe you can do something about it! + +Don't worry, I'm not gonna tell you to shoot gdb up and start hacking. Just make a debug build of lufs, try to replicate the problem and send me a bug report along with some log files. I will (try to) take care of the rest. + +[root@localhost]# ./configure -–enable-debug -–enable-kdebug +[root@localhost]# make clean +[root@localhost]# make +[root@localhost]# make install + +When mounting, redirect stdout and stderr to some files : + +[root@localhost]# lufsmount ftpfs://mali@ftp.sourceforge.net ~/mnt >lufsd.log 2>lufsd.err + +Now try to replicate the problem and send me a bug report along with lufsd.err and lufsd.log plus a tail of your /var/log/messages (or whatever holds your kernel's logs). The bug report should contain information about you system (distro, kernel version, gcc version, etc.) and a description of what you did to bring up the bug. + +Your help will be appreciated! + + + +4. USAGE + +4.1 MOUNTING: + +NOTE: Regular users can mount/unmount lufs file systems using lufsmount/lufsumount if suid is set on these mount wrappers (see INSTALLATION). + +For your convenience, a mounting utility is provided (lufsmount) which allows a more natural interface. + +Lufsmount ://[[:]@][][:][/] [OPTIONS] + +The -h flag provides a complete description of the available options. + +Notes: +“/”, ”:”, “@” are treated as separators by lufsmount. If one of the parameters contains such characters, you shouldn't use lufsmount. +lufsmount is just a parameter parser actually, which in turn calls lufsd with formated parameters, so you could use lufsd if you run into lufsmount's limitations. + +Another way to mount a LUFS is by calling lufsd directly: + +lufsd none mountpoint -o options[...] + +where the options have exactly the same syntax as when using mount (see below). + +Besides lufsmount & lufsd, you can always count on good ol' mount. You'll probably not be able to use mount as a regular user though... The general syntax for mounting a LUFS file system is + +mount -t lufs none mountpoint -o nosuid,fs=file_system[,uid=id][,gid=id][,fmask=mode][,dmask=mode][,channels=nr_chan][,root=remote_root][,own_fs][,quiet][,...] + +fs=file_system : the file system type to mount (localfs, sshfs, ftpfs) +uid=id : the uid to own the mounted fs +gid=id : the gid to own the mounted fs +fmask=mode : the minimal permissions to be set on each file +dmask=mode : the minimal permissions to be set on each directory +channels=nr_chan : the number of communication channels to open for a mounted fs +root=remote_root : the remote directory to be mapped on the file system's root +own_fs : the whole file system will be owned by the mounting user +quiet : disable all logging (close all file descriptors) +dir_cache_ttl=secs : number of seconds a directory cache entry is valid + +The nosuid option is automatically appended, so that all the remote file systems are treated as untrusted. + +Sensitive information (passwords) will not be written in /etc/mtab. + +The number of communication channels represents the number of independent channels that will be used for a mounted file system. More of these insure better performance when multiple processes access the file system. Ideally, one channel per accessing process would allow optimum performance. There is a channel setup and resource overhead though, so a number of ~7 channels should not be exceeded. In some cases, multiple channels may cause problems (ftp servers only allowing a limited number of logins from a certain IP), so the channels option allows you to specify a reduced number (possibly 1). + +For file system specific options and examples check out the FILE SYSTEMS section. + + + +4.2 UNMOUNTING: + +As root, you can simply use umount in order to unmount a lufs file system. That is: + +#umount /mnt/lufs + +A regular user will have to use the suid-ed lufsumount: + +$lufsumount ~/mnt/lufs + +Of course, a regular user will only be able to unmount file systems mounted by himself. + + +4.3 AUTOFS SUPPORT: + +LUFS provides autofs executable maps for ftpfs and sshfs (auto.ftpfs and auto.sshfs). These can be used in /etc/auto.master as follows: + +# Sample auto.master file +# Format of this file: +# mountpoint map options +# For details of the format look at autofs(8). +/mnt/net/ssh /etc/auto.sshfs --timeout=60 +/mnt/net/ftp /etc/auto.ftpfs --timeout=60 + + +Then, after restarting automount (/etc/init.d/autofs restart), you can access ssh and ftp servers more easily: + +$ cd /mnt/net/ftp/ftp.kernel.org/pub +$ ls -al /mnt/net/ssh/mali@lufs.sourceforge.net + + +Mounting and unmounting is taken care of by autofs. + +Notes: +the --enable-autofs-install configure parameter will configure autofs for /mnt/net/ssh and /mnt/net/ftp automatically. +for sshfs to function properly under autofs, public key authentication must be configured for root (or whoever is running automount - see the SSHFS section). + + +4.4 PERMISSIONS MAPPING + +Two methods are available for mapping remote permissions locally: + +normal mapping: the file/dir permissions are preserved and the owner changed accordingly (either the mounting user, or some neutral – uid=gid=2 – if the file is not owned remotely). This mode is active by default. +forced ownership: all the files/dirs are owned by the mounting user and the permissions are changed to reflect real access rights (if the file is not owned remotely, then the local “user” and “group” permissions will be the same as remote “other”). This mode is activated by the own_fs option. \ No newline at end of file diff --git a/THANKS b/THANKS new file mode 100644 index 0000000..f66eb74 --- /dev/null +++ b/THANKS @@ -0,0 +1,11 @@ +* Steve Grecni - provided valuable debug information. +* Robert Lemmen - gave me access to a Debian box. +* Martin Preuss - contributed cardfs. +* Fedor Bezrukov - contributed cefs. +* Jaroslav Rohel - contributed NetwareFTP parsing code. +* Vladimir Lazarenko - gave me access to his box. +* Timothee Besset - contributed locasefs. +* David Wilson <> - provided the rpm spec. +* Zachary S. Bedell - contributed NT FTP parsing code. +* Eric Green - contributed large file support. +* James Marsh - contributed null fsync. \ No newline at end of file diff --git a/TODO b/TODO new file mode 100644 index 0000000..dcf84a2 --- /dev/null +++ b/TODO @@ -0,0 +1,3 @@ +* gnutellafs (gnetfs) +* (maybe)kio_slaves interface + diff --git a/aclocal.m4 b/aclocal.m4 new file mode 100644 index 0000000..e63673a --- /dev/null +++ b/aclocal.m4 @@ -0,0 +1,4488 @@ +# generated automatically by aclocal 1.7.5 -*- Autoconf -*- + +# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002 +# Free Software Foundation, Inc. +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +# Like AC_CONFIG_HEADER, but automatically create stamp file. -*- Autoconf -*- + +# Copyright 1996, 1997, 2000, 2001 Free Software Foundation, Inc. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2, or (at your option) +# any later version. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. + +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA +# 02111-1307, USA. + +AC_PREREQ([2.52]) + +# serial 6 + +# AM_CONFIG_HEADER is obsolete. It has been replaced by AC_CONFIG_HEADERS. +AU_DEFUN([AM_CONFIG_HEADER], [AC_CONFIG_HEADERS($@)]) + +# Do all the work for Automake. -*- Autoconf -*- + +# 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. + +# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003 +# Free Software Foundation, Inc. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2, or (at your option) +# any later version. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. + +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA +# 02111-1307, USA. + +# serial 10 + +AC_PREREQ([2.54]) + +# Autoconf 2.50 wants to disallow AM_ names. We explicitly allow +# the ones we care about. +m4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl + +# AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE]) +# AM_INIT_AUTOMAKE([OPTIONS]) +# ----------------------------------------------- +# The call with PACKAGE and VERSION arguments is the old style +# call (pre autoconf-2.50), which is being phased out. PACKAGE +# and VERSION should now be passed to AC_INIT and removed from +# the call to AM_INIT_AUTOMAKE. +# We support both call styles for the transition. After +# the next Automake release, Autoconf can make the AC_INIT +# arguments mandatory, and then we can depend on a new Autoconf +# release and drop the old call support. +AC_DEFUN([AM_INIT_AUTOMAKE], +[AC_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl + AC_REQUIRE([AC_PROG_INSTALL])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 + +# test whether we have cygpath +if test -z "$CYGPATH_W"; then + if (cygpath --version) >/dev/null 2>/dev/null; then + CYGPATH_W='cygpath -w' + else + CYGPATH_W=echo + fi +fi +AC_SUBST([CYGPATH_W]) + +# Define the identity of the package. +dnl Distinguish between old-style and new-style calls. +m4_ifval([$2], +[m4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl + AC_SUBST([PACKAGE], [$1])dnl + AC_SUBST([VERSION], [$2])], +[_AM_SET_OPTIONS([$1])dnl + AC_SUBST([PACKAGE], ['AC_PACKAGE_TARNAME'])dnl + AC_SUBST([VERSION], ['AC_PACKAGE_VERSION'])])dnl + +_AM_IF_OPTION([no-define],, +[AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of package]) + AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Version number of package])])dnl + +# Some tools Automake needs. +AC_REQUIRE([AM_SANITY_CHECK])dnl +AC_REQUIRE([AC_ARG_PROGRAM])dnl +AM_MISSING_PROG(ACLOCAL, aclocal-${am__api_version}) +AM_MISSING_PROG(AUTOCONF, autoconf) +AM_MISSING_PROG(AUTOMAKE, automake-${am__api_version}) +AM_MISSING_PROG(AUTOHEADER, autoheader) +AM_MISSING_PROG(MAKEINFO, makeinfo) +AM_MISSING_PROG(AMTAR, tar) +AM_PROG_INSTALL_SH +AM_PROG_INSTALL_STRIP +# We need awk for the "check" target. The system "awk" is bad on +# some platforms. +AC_REQUIRE([AC_PROG_AWK])dnl +AC_REQUIRE([AC_PROG_MAKE_SET])dnl +AC_REQUIRE([AM_SET_LEADING_DOT])dnl + +_AM_IF_OPTION([no-dependencies],, +[AC_PROVIDE_IFELSE([AC_PROG_CC], + [_AM_DEPENDENCIES(CC)], + [define([AC_PROG_CC], + defn([AC_PROG_CC])[_AM_DEPENDENCIES(CC)])])dnl +AC_PROVIDE_IFELSE([AC_PROG_CXX], + [_AM_DEPENDENCIES(CXX)], + [define([AC_PROG_CXX], + defn([AC_PROG_CXX])[_AM_DEPENDENCIES(CXX)])])dnl +]) +]) + + +# When config.status generates a header, we must update the stamp-h file. +# This file resides in the same directory as the config header +# that is generated. The stamp files are numbered to have different names. + +# Autoconf calls _AC_AM_CONFIG_HEADER_HOOK (when defined) in the +# loop where config.status creates the headers, so we can generate +# our stamp files there. +AC_DEFUN([_AC_AM_CONFIG_HEADER_HOOK], +[# Compute $1's index in $config_headers. +_am_stamp_count=1 +for _am_header in $config_headers :; do + case $_am_header in + $1 | $1:* ) + break ;; + * ) + _am_stamp_count=`expr $_am_stamp_count + 1` ;; + esac +done +echo "timestamp for $1" >`AS_DIRNAME([$1])`/stamp-h[]$_am_stamp_count]) + +# 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.7"]) + +# 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.7.5])]) + +# Helper functions for option handling. -*- Autoconf -*- + +# Copyright 2001, 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 +# 02111-1307, USA. + +# serial 2 + +# _AM_MANGLE_OPTION(NAME) +# ----------------------- +AC_DEFUN([_AM_MANGLE_OPTION], +[[_AM_OPTION_]m4_bpatsubst($1, [[^a-zA-Z0-9_]], [_])]) + +# _AM_SET_OPTION(NAME) +# ------------------------------ +# Set option NAME. Presently that only means defining a flag for this option. +AC_DEFUN([_AM_SET_OPTION], +[m4_define(_AM_MANGLE_OPTION([$1]), 1)]) + +# _AM_SET_OPTIONS(OPTIONS) +# ---------------------------------- +# OPTIONS is a space-separated list of Automake options. +AC_DEFUN([_AM_SET_OPTIONS], +[AC_FOREACH([_AM_Option], [$1], [_AM_SET_OPTION(_AM_Option)])]) + +# _AM_IF_OPTION(OPTION, IF-SET, [IF-NOT-SET]) +# ------------------------------------------- +# Execute IF-SET if OPTION is set, IF-NOT-SET otherwise. +AC_DEFUN([_AM_IF_OPTION], +[m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])]) + +# +# Check to make sure that the build environment is sane. +# + +# Copyright 1996, 1997, 2000, 2001 Free Software Foundation, Inc. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2, or (at your option) +# any later version. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. + +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA +# 02111-1307, USA. + +# serial 3 + +# AM_SANITY_CHECK +# --------------- +AC_DEFUN([AM_SANITY_CHECK], +[AC_MSG_CHECKING([whether build environment is sane]) +# Just in case +sleep 1 +echo timestamp > conftest.file +# Do `set' in a subshell so we don't clobber the current shell's +# arguments. Must try -L first in case configure is actually a +# symlink; some systems play weird games with the mod time of symlinks +# (eg FreeBSD returns the mod time of the symlink's containing +# directory). +if ( + set X `ls -Lt $srcdir/configure conftest.file 2> /dev/null` + if test "$[*]" = "X"; then + # -L didn't work. + set X `ls -t $srcdir/configure conftest.file` + fi + rm -f conftest.file + if test "$[*]" != "X $srcdir/configure conftest.file" \ + && test "$[*]" != "X conftest.file $srcdir/configure"; then + + # If neither matched, then we have a broken ls. This can happen + # if, for instance, CONFIG_SHELL is bash and it inherits a + # broken ls alias from the environment. This has actually + # happened. Such a system could not be considered "sane". + AC_MSG_ERROR([ls -t appears to fail. Make sure there is not a broken +alias in your environment]) + fi + + test "$[2]" = conftest.file + ) +then + # Ok. + : +else + AC_MSG_ERROR([newly created file is older than distributed files! +Check your system clock]) +fi +AC_MSG_RESULT(yes)]) + +# -*- Autoconf -*- + + +# Copyright 1997, 1999, 2000, 2001 Free Software Foundation, Inc. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2, or (at your option) +# any later version. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. + +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA +# 02111-1307, USA. + +# serial 3 + +# AM_MISSING_PROG(NAME, PROGRAM) +# ------------------------------ +AC_DEFUN([AM_MISSING_PROG], +[AC_REQUIRE([AM_MISSING_HAS_RUN]) +$1=${$1-"${am_missing_run}$2"} +AC_SUBST($1)]) + + +# AM_MISSING_HAS_RUN +# ------------------ +# Define MISSING if not defined so far and test if it supports --run. +# If it does, set am_missing_run to use it, otherwise, to nothing. +AC_DEFUN([AM_MISSING_HAS_RUN], +[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl +test x"${MISSING+set}" = xset || MISSING="\${SHELL} $am_aux_dir/missing" +# Use eval to expand $SHELL +if eval "$MISSING --run true"; then + am_missing_run="$MISSING --run " +else + am_missing_run= + AC_MSG_WARN([`missing' script is too old or missing]) +fi +]) + +# AM_AUX_DIR_EXPAND + +# Copyright 2001 Free Software Foundation, Inc. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2, or (at your option) +# any later version. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. + +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA +# 02111-1307, USA. + +# For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets +# $ac_aux_dir to `$srcdir/foo'. In other projects, it is set to +# `$srcdir', `$srcdir/..', or `$srcdir/../..'. +# +# Of course, Automake must honor this variable whenever it calls a +# tool from the auxiliary directory. The problem is that $srcdir (and +# therefore $ac_aux_dir as well) can be either absolute or relative, +# depending on how configure is run. This is pretty annoying, since +# it makes $ac_aux_dir quite unusable in subdirectories: in the top +# source directory, any form will work fine, but in subdirectories a +# relative path needs to be adjusted first. +# +# $ac_aux_dir/missing +# fails when called from a subdirectory if $ac_aux_dir is relative +# $top_srcdir/$ac_aux_dir/missing +# fails if $ac_aux_dir is absolute, +# fails when called from a subdirectory in a VPATH build with +# a relative $ac_aux_dir +# +# The reason of the latter failure is that $top_srcdir and $ac_aux_dir +# are both prefixed by $srcdir. In an in-source build this is usually +# harmless because $srcdir is `.', but things will broke when you +# start a VPATH build or use an absolute $srcdir. +# +# So we could use something similar to $top_srcdir/$ac_aux_dir/missing, +# iff we strip the leading $srcdir from $ac_aux_dir. That would be: +# am_aux_dir='\$(top_srcdir)/'`expr "$ac_aux_dir" : "$srcdir//*\(.*\)"` +# and then we would define $MISSING as +# MISSING="\${SHELL} $am_aux_dir/missing" +# This will work as long as MISSING is not called from configure, because +# unfortunately $(top_srcdir) has no meaning in configure. +# However there are other variables, like CC, which are often used in +# configure, and could therefore not use this "fixed" $ac_aux_dir. +# +# Another solution, used here, is to always expand $ac_aux_dir to an +# absolute PATH. The drawback is that using absolute paths prevent a +# configured tree to be moved without reconfiguration. + +# Rely on autoconf to set up CDPATH properly. +AC_PREREQ([2.50]) + +AC_DEFUN([AM_AUX_DIR_EXPAND], [ +# expand $ac_aux_dir to an absolute path +am_aux_dir=`cd $ac_aux_dir && pwd` +]) + +# AM_PROG_INSTALL_SH +# ------------------ +# Define $install_sh. + +# Copyright 2001 Free Software Foundation, Inc. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2, or (at your option) +# any later version. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. + +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA +# 02111-1307, USA. + +AC_DEFUN([AM_PROG_INSTALL_SH], +[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl +install_sh=${install_sh-"$am_aux_dir/install-sh"} +AC_SUBST(install_sh)]) + +# AM_PROG_INSTALL_STRIP + +# Copyright 2001 Free Software Foundation, Inc. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2, or (at your option) +# any later version. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. + +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA +# 02111-1307, USA. + +# One issue with vendor `install' (even GNU) is that you can't +# specify the program used to strip binaries. This is especially +# annoying in cross-compiling environments, where the build's strip +# is unlikely to handle the host's binaries. +# Fortunately install-sh will honor a STRIPPROG variable, so we +# always use install-sh in `make install-strip', and initialize +# STRIPPROG with the value of the STRIP variable (set by the user). +AC_DEFUN([AM_PROG_INSTALL_STRIP], +[AC_REQUIRE([AM_PROG_INSTALL_SH])dnl +# Installed binaries are usually stripped using `strip' when the user +# run `make install-strip'. However `strip' might not be the right +# tool to use in cross-compilation environments, therefore Automake +# will honor the `STRIP' environment variable to overrule this program. +dnl Don't test for $cross_compiling = yes, because it might be `maybe'. +if test "$cross_compiling" != no; then + AC_CHECK_TOOL([STRIP], [strip], :) +fi +INSTALL_STRIP_PROGRAM="\${SHELL} \$(install_sh) -c -s" +AC_SUBST([INSTALL_STRIP_PROGRAM])]) + +# -*- Autoconf -*- +# Copyright (C) 2003 Free Software Foundation, Inc. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2, or (at your option) +# any later version. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. + +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA +# 02111-1307, USA. + +# serial 1 + +# Check whether the underlying file-system supports filenames +# with a leading dot. For instance MS-DOS doesn't. +AC_DEFUN([AM_SET_LEADING_DOT], +[rm -rf .tst 2>/dev/null +mkdir .tst 2>/dev/null +if test -d .tst; then + am__leading_dot=. +else + am__leading_dot=_ +fi +rmdir .tst 2>/dev/null +AC_SUBST([am__leading_dot])]) + +# serial 5 -*- Autoconf -*- + +# Copyright (C) 1999, 2000, 2001, 2002, 2003 Free Software Foundation, Inc. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2, or (at your option) +# any later version. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. + +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA +# 02111-1307, USA. + + +# There are a few dirty hacks below to avoid letting `AC_PROG_CC' be +# written in clear, in which case automake, when reading aclocal.m4, +# will think it sees a *use*, and therefore will trigger all it's +# C support machinery. Also note that it means that autoscan, seeing +# CC etc. in the Makefile, will ask for an AC_PROG_CC use... + + + +# _AM_DEPENDENCIES(NAME) +# ---------------------- +# See how the compiler implements dependency checking. +# NAME is "CC", "CXX", "GCJ", or "OBJC". +# We try a few techniques and use that to set a single cache variable. +# +# We don't AC_REQUIRE the corresponding AC_PROG_CC since the latter was +# modified to invoke _AM_DEPENDENCIES(CC); we would have a circular +# dependency, and given that the user is not expected to run this macro, +# just rely on AC_PROG_CC. +AC_DEFUN([_AM_DEPENDENCIES], +[AC_REQUIRE([AM_SET_DEPDIR])dnl +AC_REQUIRE([AM_OUTPUT_DEPENDENCY_COMMANDS])dnl +AC_REQUIRE([AM_MAKE_INCLUDE])dnl +AC_REQUIRE([AM_DEP_TRACK])dnl + +ifelse([$1], CC, [depcc="$CC" am_compiler_list=], + [$1], CXX, [depcc="$CXX" am_compiler_list=], + [$1], OBJC, [depcc="$OBJC" am_compiler_list='gcc3 gcc'], + [$1], GCJ, [depcc="$GCJ" am_compiler_list='gcc3 gcc'], + [depcc="$$1" am_compiler_list=]) + +AC_CACHE_CHECK([dependency style of $depcc], + [am_cv_$1_dependencies_compiler_type], +[if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then + # We make a subdir and do the tests there. Otherwise we can end up + # making bogus files that we don't know about and never remove. For + # instance it was reported that on HP-UX the gcc test will end up + # making a dummy file named `D' -- because `-MD' means `put the output + # in D'. + mkdir conftest.dir + # Copy depcomp to subdir because otherwise we won't find it if we're + # using a relative directory. + cp "$am_depcomp" conftest.dir + cd conftest.dir + + am_cv_$1_dependencies_compiler_type=none + if test "$am_compiler_list" = ""; then + am_compiler_list=`sed -n ['s/^#*\([a-zA-Z0-9]*\))$/\1/p'] < ./depcomp` + fi + for depmode in $am_compiler_list; do + # We need to recreate these files for each test, as the compiler may + # overwrite some of them when testing with obscure command lines. + # This happens at least with the AIX C compiler. + echo '#include "conftest.h"' > conftest.c + echo 'int i;' > conftest.h + echo "${am__include} ${am__quote}conftest.Po${am__quote}" > confmf + + case $depmode in + nosideeffect) + # after this tag, mechanisms are not by side-effect, so they'll + # only be used when explicitly requested + if test "x$enable_dependency_tracking" = xyes; then + continue + else + break + fi + ;; + none) break ;; + esac + # We check with `-c' and `-o' for the sake of the "dashmstdout" + # mode. It turns out that the SunPro C++ compiler does not properly + # handle `-M -o', and we need to detect this. + if depmode=$depmode \ + source=conftest.c object=conftest.o \ + depfile=conftest.Po tmpdepfile=conftest.TPo \ + $SHELL ./depcomp $depcc -c -o conftest.o conftest.c \ + >/dev/null 2>conftest.err && + grep conftest.h conftest.Po > /dev/null 2>&1 && + ${MAKE-make} -s -f confmf > /dev/null 2>&1; then + # icc doesn't choke on unknown options, it will just issue warnings + # (even with -Werror). So we grep stderr for any message + # that says an option was ignored. + if grep 'ignoring option' conftest.err >/dev/null 2>&1; then :; else + am_cv_$1_dependencies_compiler_type=$depmode + break + fi + fi + done + + cd .. + rm -rf conftest.dir +else + am_cv_$1_dependencies_compiler_type=none +fi +]) +AC_SUBST([$1DEPMODE], [depmode=$am_cv_$1_dependencies_compiler_type]) +AM_CONDITIONAL([am__fastdep$1], [ + test "x$enable_dependency_tracking" != xno \ + && test "$am_cv_$1_dependencies_compiler_type" = gcc3]) +]) + + +# AM_SET_DEPDIR +# ------------- +# Choose a directory name for dependency files. +# This macro is AC_REQUIREd in _AM_DEPENDENCIES +AC_DEFUN([AM_SET_DEPDIR], +[AC_REQUIRE([AM_SET_LEADING_DOT])dnl +AC_SUBST([DEPDIR], ["${am__leading_dot}deps"])dnl +]) + + +# AM_DEP_TRACK +# ------------ +AC_DEFUN([AM_DEP_TRACK], +[AC_ARG_ENABLE(dependency-tracking, +[ --disable-dependency-tracking Speeds up one-time builds + --enable-dependency-tracking Do not reject slow dependency extractors]) +if test "x$enable_dependency_tracking" != xno; then + am_depcomp="$ac_aux_dir/depcomp" + AMDEPBACKSLASH='\' +fi +AM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno]) +AC_SUBST([AMDEPBACKSLASH]) +]) + +# Generate code to set up dependency tracking. -*- Autoconf -*- + +# Copyright 1999, 2000, 2001, 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 +# 02111-1307, USA. + +#serial 2 + +# _AM_OUTPUT_DEPENDENCY_COMMANDS +# ------------------------------ +AC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS], +[for mf in $CONFIG_FILES; do + # Strip MF so we end up with the name of the file. + mf=`echo "$mf" | sed -e 's/:.*$//'` + # Check whether this is an Automake generated Makefile or not. + # We used to match only the files named `Makefile.in', but + # some people rename them; so instead we look at the file content. + # Grep'ing the first line is not enough: some people post-process + # each Makefile.in and add a new line on top of each file to say so. + # So let's grep whole file. + if grep '^#.*generated by automake' $mf > /dev/null 2>&1; then + dirpart=`AS_DIRNAME("$mf")` + else + continue + fi + grep '^DEP_FILES *= *[[^ @%:@]]' < "$mf" > /dev/null || continue + # Extract the definition of DEP_FILES from the Makefile without + # running `make'. + DEPDIR=`sed -n -e '/^DEPDIR = / s///p' < "$mf"` + test -z "$DEPDIR" && continue + # When using ansi2knr, U may be empty or an underscore; expand it + U=`sed -n -e '/^U = / s///p' < "$mf"` + test -d "$dirpart/$DEPDIR" || mkdir "$dirpart/$DEPDIR" + # We invoke sed twice because it is the simplest approach to + # changing $(DEPDIR) to its actual value in the expansion. + for file in `sed -n -e ' + /^DEP_FILES = .*\\\\$/ { + s/^DEP_FILES = // + :loop + s/\\\\$// + p + n + /\\\\$/ b loop + p + } + /^DEP_FILES = / s/^DEP_FILES = //p' < "$mf" | \ + sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g' -e 's/\$U/'"$U"'/g'`; do + # Make sure the directory exists. + test -f "$dirpart/$file" && continue + fdir=`AS_DIRNAME(["$file"])` + AS_MKDIR_P([$dirpart/$fdir]) + # echo "creating $dirpart/$file" + echo '# dummy' > "$dirpart/$file" + done +done +])# _AM_OUTPUT_DEPENDENCY_COMMANDS + + +# AM_OUTPUT_DEPENDENCY_COMMANDS +# ----------------------------- +# This macro should only be invoked once -- use via AC_REQUIRE. +# +# This code is only required when automatic dependency tracking +# is enabled. FIXME. This creates each `.P' file that we will +# need in order to bootstrap the dependency handling code. +AC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS], +[AC_CONFIG_COMMANDS([depfiles], + [test x"$AMDEP_TRUE" != x"" || _AM_OUTPUT_DEPENDENCY_COMMANDS], + [AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir"]) +]) + +# Check to see how 'make' treats includes. -*- Autoconf -*- + +# Copyright (C) 2001, 2002, 2003 Free Software Foundation, Inc. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2, or (at your option) +# any later version. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. + +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA +# 02111-1307, USA. + +# serial 2 + +# AM_MAKE_INCLUDE() +# ----------------- +# Check to see how make treats includes. +AC_DEFUN([AM_MAKE_INCLUDE], +[am_make=${MAKE-make} +cat > confinc << 'END' +am__doit: + @echo done +.PHONY: am__doit +END +# If we don't find an include directive, just comment out the code. +AC_MSG_CHECKING([for style of include used by $am_make]) +am__include="#" +am__quote= +_am_result=none +# First try GNU make style include. +echo "include confinc" > confmf +# We grep out `Entering directory' and `Leaving directory' +# messages which can occur if `w' ends up in MAKEFLAGS. +# In particular we don't look at `^make:' because GNU make might +# be invoked under some other name (usually "gmake"), in which +# case it prints its new name instead of `make'. +if test "`$am_make -s -f confmf 2> /dev/null | grep -v 'ing directory'`" = "done"; then + am__include=include + am__quote= + _am_result=GNU +fi +# Now try BSD make style include. +if test "$am__include" = "#"; then + echo '.include "confinc"' > confmf + if test "`$am_make -s -f confmf 2> /dev/null`" = "done"; then + am__include=.include + am__quote="\"" + _am_result=BSD + fi +fi +AC_SUBST([am__include]) +AC_SUBST([am__quote]) +AC_MSG_RESULT([$_am_result]) +rm -f confinc confmf +]) + +# AM_CONDITIONAL -*- Autoconf -*- + +# Copyright 1997, 2000, 2001 Free Software Foundation, Inc. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2, or (at your option) +# any later version. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. + +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA +# 02111-1307, USA. + +# serial 5 + +AC_PREREQ(2.52) + +# AM_CONDITIONAL(NAME, SHELL-CONDITION) +# ------------------------------------- +# Define a conditional. +AC_DEFUN([AM_CONDITIONAL], +[ifelse([$1], [TRUE], [AC_FATAL([$0: invalid condition: $1])], + [$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl +AC_SUBST([$1_TRUE]) +AC_SUBST([$1_FALSE]) +if $2; then + $1_TRUE= + $1_FALSE='#' +else + $1_TRUE='#' + $1_FALSE= +fi +AC_CONFIG_COMMANDS_PRE( +[if test -z "${$1_TRUE}" && test -z "${$1_FALSE}"; then + AC_MSG_ERROR([conditional "$1" was never defined. +Usually this means the macro was only invoked conditionally.]) +fi])]) + +# libtool.m4 - Configure libtool for the host system. -*-Shell-script-*- + +# serial 46 AC_PROG_LIBTOOL + +AC_DEFUN([AC_PROG_LIBTOOL], +[AC_REQUIRE([AC_LIBTOOL_SETUP])dnl + +# This can be used to rebuild libtool when needed +LIBTOOL_DEPS="$ac_aux_dir/ltmain.sh" + +# Always use our own libtool. +LIBTOOL='$(SHELL) $(top_builddir)/libtool' +AC_SUBST(LIBTOOL)dnl + +# Prevent multiple expansion +define([AC_PROG_LIBTOOL], []) +]) + +AC_DEFUN([AC_LIBTOOL_SETUP], +[AC_PREREQ(2.13)dnl +AC_REQUIRE([AC_ENABLE_SHARED])dnl +AC_REQUIRE([AC_ENABLE_STATIC])dnl +AC_REQUIRE([AC_ENABLE_FAST_INSTALL])dnl +AC_REQUIRE([AC_CANONICAL_HOST])dnl +AC_REQUIRE([AC_CANONICAL_BUILD])dnl +AC_REQUIRE([AC_PROG_CC])dnl +AC_REQUIRE([AC_PROG_LD])dnl +AC_REQUIRE([AC_PROG_LD_RELOAD_FLAG])dnl +AC_REQUIRE([AC_PROG_NM])dnl +AC_REQUIRE([LT_AC_PROG_SED])dnl + +AC_REQUIRE([AC_PROG_LN_S])dnl +AC_REQUIRE([AC_DEPLIBS_CHECK_METHOD])dnl +AC_REQUIRE([AC_OBJEXT])dnl +AC_REQUIRE([AC_EXEEXT])dnl +dnl + +_LT_AC_PROG_ECHO_BACKSLASH +# Only perform the check for file, if the check method requires it +case $deplibs_check_method in +file_magic*) + if test "$file_magic_cmd" = '$MAGIC_CMD'; then + AC_PATH_MAGIC + fi + ;; +esac + +AC_CHECK_TOOL(RANLIB, ranlib, :) +AC_CHECK_TOOL(STRIP, strip, :) + +ifdef([AC_PROVIDE_AC_LIBTOOL_DLOPEN], enable_dlopen=yes, enable_dlopen=no) +ifdef([AC_PROVIDE_AC_LIBTOOL_WIN32_DLL], +enable_win32_dll=yes, enable_win32_dll=no) + +AC_ARG_ENABLE(libtool-lock, + [ --disable-libtool-lock avoid locking (might break parallel builds)]) +test "x$enable_libtool_lock" != xno && enable_libtool_lock=yes + +# Some flags need to be propagated to the compiler or linker for good +# libtool support. +case $host in +*-*-irix6*) + # Find out which ABI we are using. + echo '[#]line __oline__ "configure"' > conftest.$ac_ext + if AC_TRY_EVAL(ac_compile); then + case `/usr/bin/file conftest.$ac_objext` in + *32-bit*) + LD="${LD-ld} -32" + ;; + *N32*) + LD="${LD-ld} -n32" + ;; + *64-bit*) + LD="${LD-ld} -64" + ;; + esac + fi + rm -rf conftest* + ;; + +*-*-linux*) + # Test if the compiler is 64bit + echo 'int i;' > conftest.$ac_ext + lt_cv_cc_64bit_output=no + if AC_TRY_EVAL(ac_compile); then + case `/usr/bin/file conftest.$ac_objext` in + *"ELF 64"*) + lt_cv_cc_64bit_output=yes + ;; + esac + fi + rm -rf conftest* + ;; + +*-*-sco3.2v5*) + # On SCO OpenServer 5, we need -belf to get full-featured binaries. + SAVE_CFLAGS="$CFLAGS" + CFLAGS="$CFLAGS -belf" + AC_CACHE_CHECK([whether the C compiler needs -belf], lt_cv_cc_needs_belf, + [AC_LANG_SAVE + AC_LANG_C + AC_TRY_LINK([],[],[lt_cv_cc_needs_belf=yes],[lt_cv_cc_needs_belf=no]) + AC_LANG_RESTORE]) + if test x"$lt_cv_cc_needs_belf" != x"yes"; then + # this is probably gcc 2.8.0, egcs 1.0 or newer; no need for -belf + CFLAGS="$SAVE_CFLAGS" + fi + ;; + +ifdef([AC_PROVIDE_AC_LIBTOOL_WIN32_DLL], +[*-*-cygwin* | *-*-mingw* | *-*-pw32*) + AC_CHECK_TOOL(DLLTOOL, dlltool, false) + AC_CHECK_TOOL(AS, as, false) + AC_CHECK_TOOL(OBJDUMP, objdump, false) + + # recent cygwin and mingw systems supply a stub DllMain which the user + # can override, but on older systems we have to supply one + AC_CACHE_CHECK([if libtool should supply DllMain function], lt_cv_need_dllmain, + [AC_TRY_LINK([], + [extern int __attribute__((__stdcall__)) DllMain(void*, int, void*); + DllMain (0, 0, 0);], + [lt_cv_need_dllmain=no],[lt_cv_need_dllmain=yes])]) + + case $host/$CC in + *-*-cygwin*/gcc*-mno-cygwin*|*-*-mingw*) + # old mingw systems require "-dll" to link a DLL, while more recent ones + # require "-mdll" + SAVE_CFLAGS="$CFLAGS" + CFLAGS="$CFLAGS -mdll" + AC_CACHE_CHECK([how to link DLLs], lt_cv_cc_dll_switch, + [AC_TRY_LINK([], [], [lt_cv_cc_dll_switch=-mdll],[lt_cv_cc_dll_switch=-dll])]) + CFLAGS="$SAVE_CFLAGS" ;; + *-*-cygwin* | *-*-pw32*) + # cygwin systems need to pass --dll to the linker, and not link + # crt.o which will require a WinMain@16 definition. + lt_cv_cc_dll_switch="-Wl,--dll -nostartfiles" ;; + esac + ;; + ]) +esac + +_LT_AC_LTCONFIG_HACK + +]) + +# AC_LIBTOOL_HEADER_ASSERT +# ------------------------ +AC_DEFUN([AC_LIBTOOL_HEADER_ASSERT], +[AC_CACHE_CHECK([whether $CC supports assert without backlinking], + [lt_cv_func_assert_works], + [case $host in + *-*-solaris*) + if test "$GCC" = yes && test "$with_gnu_ld" != yes; then + case `$CC --version 2>/dev/null` in + [[12]].*) lt_cv_func_assert_works=no ;; + *) lt_cv_func_assert_works=yes ;; + esac + fi + ;; + esac]) + +if test "x$lt_cv_func_assert_works" = xyes; then + AC_CHECK_HEADERS(assert.h) +fi +])# AC_LIBTOOL_HEADER_ASSERT + +# _LT_AC_CHECK_DLFCN +# -------------------- +AC_DEFUN([_LT_AC_CHECK_DLFCN], +[AC_CHECK_HEADERS(dlfcn.h) +])# _LT_AC_CHECK_DLFCN + +# AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE +# --------------------------------- +AC_DEFUN([AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE], +[AC_REQUIRE([AC_CANONICAL_HOST]) +AC_REQUIRE([AC_PROG_NM]) +AC_REQUIRE([AC_OBJEXT]) +# Check for command to grab the raw symbol name followed by C symbol from nm. +AC_MSG_CHECKING([command to parse $NM output]) +AC_CACHE_VAL([lt_cv_sys_global_symbol_pipe], [dnl + +# These are sane defaults that work on at least a few old systems. +# [They come from Ultrix. What could be older than Ultrix?!! ;)] + +# Character class describing NM global symbol codes. +symcode='[[BCDEGRST]]' + +# Regexp to match symbols that can be accessed directly from C. +sympat='\([[_A-Za-z]][[_A-Za-z0-9]]*\)' + +# Transform the above into a raw symbol and a C symbol. +symxfrm='\1 \2\3 \3' + +# Transform an extracted symbol line into a proper C declaration +lt_cv_global_symbol_to_cdecl="sed -n -e 's/^. .* \(.*\)$/extern char \1;/p'" + +# Transform an extracted symbol line into symbol name and symbol address +lt_cv_global_symbol_to_c_name_address="sed -n -e 's/^: \([[^ ]]*\) $/ {\\\"\1\\\", (lt_ptr) 0},/p' -e 's/^$symcode \([[^ ]]*\) \([[^ ]]*\)$/ {\"\2\", (lt_ptr) \&\2},/p'" + +# Define system-specific variables. +case $host_os in +aix*) + symcode='[[BCDT]]' + ;; +cygwin* | mingw* | pw32*) + symcode='[[ABCDGISTW]]' + ;; +hpux*) # Its linker distinguishes data from code symbols + lt_cv_global_symbol_to_cdecl="sed -n -e 's/^T .* \(.*\)$/extern char \1();/p' -e 's/^$symcode* .* \(.*\)$/extern char \1;/p'" + lt_cv_global_symbol_to_c_name_address="sed -n -e 's/^: \([[^ ]]*\) $/ {\\\"\1\\\", (lt_ptr) 0},/p' -e 's/^$symcode* \([[^ ]]*\) \([[^ ]]*\)$/ {\"\2\", (lt_ptr) \&\2},/p'" + ;; +irix* | nonstopux*) + symcode='[[BCDEGRST]]' + ;; +osf*) + symcode='[[BCDEGQRST]]' + ;; +solaris* | sysv5*) + symcode='[[BDT]]' + ;; +sysv4) + symcode='[[DFNSTU]]' + ;; +esac + +# Handle CRLF in mingw tool chain +opt_cr= +case $host_os in +mingw*) + opt_cr=`echo 'x\{0,1\}' | tr x '\015'` # option cr in regexp + ;; +esac + +# If we're using GNU nm, then use its standard symbol codes. +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. +lt_cv_sys_global_symbol_pipe="sed -n -e 's/^.*[[ ]]\($symcode$symcode*\)[[ ]][[ ]]*\($ac_symprfx\)$sympat$opt_cr$/$symxfrm/p'" + + # Check to see that the pipe works correctly. + pipe_works=no + rm -f conftest* + cat > conftest.$ac_ext < $nlist) && test -s "$nlist"; then + # Try sorting and uniquifying the output. + if sort "$nlist" | uniq > "$nlist"T; then + mv -f "$nlist"T "$nlist" + else + rm -f "$nlist"T + fi + + # Make sure that we snagged all the symbols we need. + if egrep ' nm_test_var$' "$nlist" >/dev/null; then + if egrep ' nm_test_func$' "$nlist" >/dev/null; then + cat < conftest.$ac_ext +#ifdef __cplusplus +extern "C" { +#endif + +EOF + # Now generate the symbol file. + eval "$lt_cv_global_symbol_to_cdecl"' < "$nlist" >> conftest.$ac_ext' + + cat <> conftest.$ac_ext +#if defined (__STDC__) && __STDC__ +# define lt_ptr void * +#else +# define lt_ptr char * +# define const +#endif + +/* The mapping between symbol names and symbols. */ +const struct { + const char *name; + lt_ptr address; +} +lt_preloaded_symbols[[]] = +{ +EOF + sed "s/^$symcode$symcode* \(.*\) \(.*\)$/ {\"\2\", (lt_ptr) \&\2},/" < "$nlist" >> conftest.$ac_ext + cat <<\EOF >> conftest.$ac_ext + {0, (lt_ptr) 0} +}; + +#ifdef __cplusplus +} +#endif +EOF + # Now try linking the two files. + mv conftest.$ac_objext conftstm.$ac_objext + save_LIBS="$LIBS" + save_CFLAGS="$CFLAGS" + LIBS="conftstm.$ac_objext" + CFLAGS="$CFLAGS$no_builtin_flag" + if AC_TRY_EVAL(ac_link) && test -s conftest$ac_exeext; then + pipe_works=yes + fi + LIBS="$save_LIBS" + CFLAGS="$save_CFLAGS" + else + echo "cannot find nm_test_func in $nlist" >&AC_FD_CC + fi + else + echo "cannot find nm_test_var in $nlist" >&AC_FD_CC + fi + else + echo "cannot run $lt_cv_sys_global_symbol_pipe" >&AC_FD_CC + fi + else + echo "$progname: failed program was:" >&AC_FD_CC + cat conftest.$ac_ext >&5 + fi + rm -f conftest* conftst* + + # Do not use the global_symbol_pipe unless it works. + if test "$pipe_works" = yes; then + break + else + lt_cv_sys_global_symbol_pipe= + fi +done +]) +global_symbol_pipe="$lt_cv_sys_global_symbol_pipe" +if test -z "$lt_cv_sys_global_symbol_pipe"; then + global_symbol_to_cdecl= + global_symbol_to_c_name_address= +else + global_symbol_to_cdecl="$lt_cv_global_symbol_to_cdecl" + global_symbol_to_c_name_address="$lt_cv_global_symbol_to_c_name_address" +fi +if test -z "$global_symbol_pipe$global_symbol_to_cdec$global_symbol_to_c_name_address"; +then + AC_MSG_RESULT(failed) +else + AC_MSG_RESULT(ok) +fi +]) # AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE + +# _LT_AC_LIBTOOL_SYS_PATH_SEPARATOR +# --------------------------------- +AC_DEFUN([_LT_AC_LIBTOOL_SYS_PATH_SEPARATOR], +[# Find the correct PATH separator. Usually this is `:', but +# DJGPP uses `;' like DOS. +if test "X${PATH_SEPARATOR+set}" != Xset; then + UNAME=${UNAME-`uname 2>/dev/null`} + case X$UNAME in + *-DOS) lt_cv_sys_path_separator=';' ;; + *) lt_cv_sys_path_separator=':' ;; + esac + PATH_SEPARATOR=$lt_cv_sys_path_separator +fi +])# _LT_AC_LIBTOOL_SYS_PATH_SEPARATOR + +# _LT_AC_PROG_ECHO_BACKSLASH +# -------------------------- +# Add some code to the start of the generated configure script which +# will find an echo command which doesn't interpret backslashes. +AC_DEFUN([_LT_AC_PROG_ECHO_BACKSLASH], +[ifdef([AC_DIVERSION_NOTICE], [AC_DIVERT_PUSH(AC_DIVERSION_NOTICE)], + [AC_DIVERT_PUSH(NOTICE)]) +_LT_AC_LIBTOOL_SYS_PATH_SEPARATOR + +# Check that we are running under the correct shell. +SHELL=${CONFIG_SHELL-/bin/sh} + +case X$ECHO in +X*--fallback-echo) + # Remove one level of quotation (which was required for Make). + ECHO=`echo "$ECHO" | sed 's,\\\\\[$]\\[$]0,'[$]0','` + ;; +esac + +echo=${ECHO-echo} +if test "X[$]1" = X--no-reexec; then + # Discard the --no-reexec flag, and continue. + shift +elif test "X[$]1" = X--fallback-echo; then + # Avoid inline document here, it may be left over + : +elif test "X`($echo '\t') 2>/dev/null`" = 'X\t'; then + # Yippee, $echo works! + : +else + # Restart under the correct shell. + exec $SHELL "[$]0" --no-reexec ${1+"[$]@"} +fi + +if test "X[$]1" = X--fallback-echo; then + # used as fallback echo + shift + cat </dev/null && + echo_test_string="`eval $cmd`" && + (test "X$echo_test_string" = "X$echo_test_string") 2>/dev/null + then + break + fi + done +fi + +if test "X`($echo '\t') 2>/dev/null`" = 'X\t' && + echo_testing_string=`($echo "$echo_test_string") 2>/dev/null` && + test "X$echo_testing_string" = "X$echo_test_string"; then + : +else + # The Solaris, AIX, and Digital Unix default echo programs unquote + # backslashes. This makes it impossible to quote backslashes using + # echo "$something" | sed 's/\\/\\\\/g' + # + # So, first we look for a working echo in the user's PATH. + + IFS="${IFS= }"; save_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' && + echo_testing_string=`($dir/echo "$echo_test_string") 2>/dev/null` && + test "X$echo_testing_string" = "X$echo_test_string"; then + echo="$dir/echo" + break + fi + done + IFS="$save_ifs" + + if test "X$echo" = Xecho; then + # We didn't find a better echo, so look for alternatives. + if test "X`(print -r '\t') 2>/dev/null`" = 'X\t' && + echo_testing_string=`(print -r "$echo_test_string") 2>/dev/null` && + test "X$echo_testing_string" = "X$echo_test_string"; then + # This shell has a builtin print -r that does the trick. + echo='print -r' + elif (test -f /bin/ksh || test -f /bin/ksh$ac_exeext) && + test "X$CONFIG_SHELL" != X/bin/ksh; then + # If we have ksh, try running configure again with it. + ORIGINAL_CONFIG_SHELL=${CONFIG_SHELL-/bin/sh} + export ORIGINAL_CONFIG_SHELL + CONFIG_SHELL=/bin/ksh + export CONFIG_SHELL + exec $CONFIG_SHELL "[$]0" --no-reexec ${1+"[$]@"} + else + # Try using printf. + echo='printf %s\n' + if test "X`($echo '\t') 2>/dev/null`" = 'X\t' && + echo_testing_string=`($echo "$echo_test_string") 2>/dev/null` && + test "X$echo_testing_string" = "X$echo_test_string"; then + # Cool, printf works + : + elif echo_testing_string=`($ORIGINAL_CONFIG_SHELL "[$]0" --fallback-echo '\t') 2>/dev/null` && + test "X$echo_testing_string" = 'X\t' && + echo_testing_string=`($ORIGINAL_CONFIG_SHELL "[$]0" --fallback-echo "$echo_test_string") 2>/dev/null` && + test "X$echo_testing_string" = "X$echo_test_string"; then + CONFIG_SHELL=$ORIGINAL_CONFIG_SHELL + export CONFIG_SHELL + SHELL="$CONFIG_SHELL" + export SHELL + echo="$CONFIG_SHELL [$]0 --fallback-echo" + elif echo_testing_string=`($CONFIG_SHELL "[$]0" --fallback-echo '\t') 2>/dev/null` && + test "X$echo_testing_string" = 'X\t' && + echo_testing_string=`($CONFIG_SHELL "[$]0" --fallback-echo "$echo_test_string") 2>/dev/null` && + test "X$echo_testing_string" = "X$echo_test_string"; then + echo="$CONFIG_SHELL [$]0 --fallback-echo" + else + # maybe with a smaller string... + prev=: + + for cmd in 'echo test' 'sed 2q "[$]0"' 'sed 10q "[$]0"' 'sed 20q "[$]0"' 'sed 50q "[$]0"'; do + if (test "X$echo_test_string" = "X`eval $cmd`") 2>/dev/null + then + break + fi + prev="$cmd" + done + + if test "$prev" != 'sed 50q "[$]0"'; then + echo_test_string=`eval $prev` + export echo_test_string + exec ${ORIGINAL_CONFIG_SHELL-${CONFIG_SHELL-/bin/sh}} "[$]0" ${1+"[$]@"} + else + # Oops. We lost completely, so just stick with echo. + echo=echo + fi + fi + fi + fi +fi +fi + +# Copy echo and quote the copy suitably for passing to libtool from +# the Makefile, instead of quoting the original, which is used later. +ECHO=$echo +if test "X$ECHO" = "X$CONFIG_SHELL [$]0 --fallback-echo"; then + ECHO="$CONFIG_SHELL \\\$\[$]0 --fallback-echo" +fi + +AC_SUBST(ECHO) +AC_DIVERT_POP +])# _LT_AC_PROG_ECHO_BACKSLASH + +# _LT_AC_TRY_DLOPEN_SELF (ACTION-IF-TRUE, ACTION-IF-TRUE-W-USCORE, +# ACTION-IF-FALSE, ACTION-IF-CROSS-COMPILING) +# ------------------------------------------------------------------ +AC_DEFUN([_LT_AC_TRY_DLOPEN_SELF], +[if test "$cross_compiling" = yes; then : + [$4] +else + AC_REQUIRE([_LT_AC_CHECK_DLFCN])dnl + lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 + lt_status=$lt_dlunknown + cat > conftest.$ac_ext < +#endif + +#include + +#ifdef RTLD_GLOBAL +# define LT_DLGLOBAL RTLD_GLOBAL +#else +# ifdef DL_GLOBAL +# define LT_DLGLOBAL DL_GLOBAL +# else +# define LT_DLGLOBAL 0 +# endif +#endif + +/* We may have to define LT_DLLAZY_OR_NOW in the command line if we + find out it does not work in some platform. */ +#ifndef LT_DLLAZY_OR_NOW +# ifdef RTLD_LAZY +# define LT_DLLAZY_OR_NOW RTLD_LAZY +# else +# ifdef DL_LAZY +# define LT_DLLAZY_OR_NOW DL_LAZY +# else +# ifdef RTLD_NOW +# define LT_DLLAZY_OR_NOW RTLD_NOW +# else +# ifdef DL_NOW +# define LT_DLLAZY_OR_NOW DL_NOW +# else +# define LT_DLLAZY_OR_NOW 0 +# endif +# endif +# endif +# endif +#endif + +#ifdef __cplusplus +extern "C" void exit (int); +#endif + +void fnord() { int i=42;} +int main () +{ + void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW); + int status = $lt_dlunknown; + + if (self) + { + if (dlsym (self,"fnord")) status = $lt_dlno_uscore; + else if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore; + /* dlclose (self); */ + } + + exit (status); +}] +EOF + if AC_TRY_EVAL(ac_link) && test -s conftest${ac_exeext} 2>/dev/null; then + (./conftest; exit; ) 2>/dev/null + lt_status=$? + case x$lt_status in + x$lt_dlno_uscore) $1 ;; + x$lt_dlneed_uscore) $2 ;; + x$lt_unknown|x*) $3 ;; + esac + else : + # compilation failed + $3 + fi +fi +rm -fr conftest* +])# _LT_AC_TRY_DLOPEN_SELF + +# AC_LIBTOOL_DLOPEN_SELF +# ------------------- +AC_DEFUN([AC_LIBTOOL_DLOPEN_SELF], +[if test "x$enable_dlopen" != xyes; then + enable_dlopen=unknown + enable_dlopen_self=unknown + enable_dlopen_self_static=unknown +else + lt_cv_dlopen=no + lt_cv_dlopen_libs= + + case $host_os in + beos*) + lt_cv_dlopen="load_add_on" + lt_cv_dlopen_libs= + lt_cv_dlopen_self=yes + ;; + + cygwin* | mingw* | pw32*) + lt_cv_dlopen="LoadLibrary" + lt_cv_dlopen_libs= + ;; + + *) + AC_CHECK_FUNC([shl_load], + [lt_cv_dlopen="shl_load"], + [AC_CHECK_LIB([dld], [shl_load], + [lt_cv_dlopen="shl_load" lt_cv_dlopen_libs="-dld"], + [AC_CHECK_FUNC([dlopen], + [lt_cv_dlopen="dlopen"], + [AC_CHECK_LIB([dl], [dlopen], + [lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl"], + [AC_CHECK_LIB([svld], [dlopen], + [lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-lsvld"], + [AC_CHECK_LIB([dld], [dld_link], + [lt_cv_dlopen="dld_link" lt_cv_dlopen_libs="-dld"]) + ]) + ]) + ]) + ]) + ]) + ;; + esac + + if test "x$lt_cv_dlopen" != xno; then + enable_dlopen=yes + else + enable_dlopen=no + fi + + case $lt_cv_dlopen in + dlopen) + save_CPPFLAGS="$CPPFLAGS" + AC_REQUIRE([_LT_AC_CHECK_DLFCN])dnl + test "x$ac_cv_header_dlfcn_h" = xyes && CPPFLAGS="$CPPFLAGS -DHAVE_DLFCN_H" + + save_LDFLAGS="$LDFLAGS" + eval LDFLAGS=\"\$LDFLAGS $export_dynamic_flag_spec\" + + save_LIBS="$LIBS" + LIBS="$lt_cv_dlopen_libs $LIBS" + + AC_CACHE_CHECK([whether a program can dlopen itself], + lt_cv_dlopen_self, [dnl + _LT_AC_TRY_DLOPEN_SELF( + lt_cv_dlopen_self=yes, lt_cv_dlopen_self=yes, + lt_cv_dlopen_self=no, lt_cv_dlopen_self=cross) + ]) + + if test "x$lt_cv_dlopen_self" = xyes; then + LDFLAGS="$LDFLAGS $link_static_flag" + AC_CACHE_CHECK([whether a statically linked program can dlopen itself], + lt_cv_dlopen_self_static, [dnl + _LT_AC_TRY_DLOPEN_SELF( + lt_cv_dlopen_self_static=yes, lt_cv_dlopen_self_static=yes, + lt_cv_dlopen_self_static=no, lt_cv_dlopen_self_static=cross) + ]) + fi + + CPPFLAGS="$save_CPPFLAGS" + LDFLAGS="$save_LDFLAGS" + LIBS="$save_LIBS" + ;; + esac + + case $lt_cv_dlopen_self in + yes|no) enable_dlopen_self=$lt_cv_dlopen_self ;; + *) enable_dlopen_self=unknown ;; + esac + + case $lt_cv_dlopen_self_static in + yes|no) enable_dlopen_self_static=$lt_cv_dlopen_self_static ;; + *) enable_dlopen_self_static=unknown ;; + esac +fi +])# AC_LIBTOOL_DLOPEN_SELF + +AC_DEFUN([_LT_AC_LTCONFIG_HACK], +[AC_REQUIRE([AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE])dnl +# 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' + +# Constants: +rm="rm -f" + +# Global variables: +default_ofile=libtool +can_build_shared=yes + +# All known linkers require a `.a' archive for static linking (except M$VC, +# which needs '.lib'). +libext=a +ltmain="$ac_aux_dir/ltmain.sh" +ofile="$default_ofile" +with_gnu_ld="$lt_cv_prog_gnu_ld" +need_locks="$enable_libtool_lock" + +old_CC="$CC" +old_CFLAGS="$CFLAGS" + +# Set sane defaults for various variables +test -z "$AR" && AR=ar +test -z "$AR_FLAGS" && AR_FLAGS=cru +test -z "$AS" && AS=as +test -z "$CC" && CC=cc +test -z "$DLLTOOL" && DLLTOOL=dlltool +test -z "$LD" && LD=ld +test -z "$LN_S" && LN_S="ln -s" +test -z "$MAGIC_CMD" && MAGIC_CMD=file +test -z "$NM" && NM=nm +test -z "$OBJDUMP" && OBJDUMP=objdump +test -z "$RANLIB" && RANLIB=: +test -z "$STRIP" && STRIP=: +test -z "$ac_objext" && ac_objext=o + +if test x"$host" != x"$build"; then + ac_tool_prefix=${host_alias}- +else + ac_tool_prefix= +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 + +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 $AR_FLAGS $oldlib$oldobjs$old_deplibs' +old_postinstall_cmds='chmod 644 $oldlib' +old_postuninstall_cmds= + +if test -n "$RANLIB"; then + case $host_os in + openbsd*) + old_postinstall_cmds="\$RANLIB -t \$oldlib~$old_postinstall_cmds" + ;; + *) + old_postinstall_cmds="\$RANLIB \$oldlib~$old_postinstall_cmds" + ;; + esac + old_archive_cmds="$old_archive_cmds~\$RANLIB \$oldlib" +fi + +# Allow CC to be a program name with arguments. +set dummy $CC +compiler="[$]2" + +AC_MSG_CHECKING([for objdir]) +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 +AC_MSG_RESULT($objdir) + + +AC_ARG_WITH(pic, +[ --with-pic try to use only PIC/non-PIC objects [default=use both]], +pic_mode="$withval", pic_mode=default) +test -z "$pic_mode" && pic_mode=default + +# We assume here that the value for lt_cv_prog_cc_pic will not be cached +# in isolation, and that seeing it set (from the cache) indicates that +# the associated values are set (in the cache) correctly too. +AC_MSG_CHECKING([for $compiler option to produce PIC]) +AC_CACHE_VAL(lt_cv_prog_cc_pic, +[ lt_cv_prog_cc_pic= + lt_cv_prog_cc_shlib= + lt_cv_prog_cc_wl= + lt_cv_prog_cc_static= + lt_cv_prog_cc_no_builtin= + lt_cv_prog_cc_can_build_shared=$can_build_shared + + if test "$GCC" = yes; then + lt_cv_prog_cc_wl='-Wl,' + lt_cv_prog_cc_static='-static' + + case $host_os in + 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 + # not sure about C++ programs. + lt_cv_prog_cc_static="$lt_cv_prog_cc_static ${lt_cv_prog_cc_wl}-lC" + ;; + amigaos*) + # FIXME: we need at least 68020 code to build shared libraries, but + # adding the `-m68020' flag to GCC prevents building anything better, + # like `-m68040'. + lt_cv_prog_cc_pic='-m68020 -resident32 -malways-restore-a4' + ;; + beos* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*) + # PIC is the default for these OSes. + ;; + darwin* | rhapsody*) + # PIC is the default on this platform + # Common symbols not allowed in MH_DYLIB files + lt_cv_prog_cc_pic='-fno-common' + ;; + cygwin* | mingw* | pw32* | os2*) + # This hack is so that the source file can tell whether it is being + # built for inclusion in a dll (and should export symbols for example). + lt_cv_prog_cc_pic='-DDLL_EXPORT' + ;; + sysv4*MP*) + if test -d /usr/nec; then + lt_cv_prog_cc_pic=-Kconform_pic + fi + ;; + *) + lt_cv_prog_cc_pic='-fPIC' + ;; + esac + else + # PORTME Check for PIC flags for the system compiler. + case $host_os in + aix3* | aix4* | aix5*) + lt_cv_prog_cc_wl='-Wl,' + # All AIX code is PIC. + if test "$host_cpu" = ia64; then + # AIX 5 now supports IA64 processor + lt_cv_prog_cc_static='-Bstatic' + else + lt_cv_prog_cc_static='-bnso -bI:/lib/syscalls.exp' + fi + ;; + + hpux9* | hpux10* | hpux11*) + # Is there a better lt_cv_prog_cc_static that works with the bundled CC? + lt_cv_prog_cc_wl='-Wl,' + lt_cv_prog_cc_static="${lt_cv_prog_cc_wl}-a ${lt_cv_prog_cc_wl}archive" + lt_cv_prog_cc_pic='+Z' + ;; + + irix5* | irix6* | nonstopux*) + lt_cv_prog_cc_wl='-Wl,' + lt_cv_prog_cc_static='-non_shared' + # PIC (with -KPIC) is the default. + ;; + + cygwin* | mingw* | pw32* | os2*) + # This hack is so that the source file can tell whether it is being + # built for inclusion in a dll (and should export symbols for example). + lt_cv_prog_cc_pic='-DDLL_EXPORT' + ;; + + newsos6) + lt_cv_prog_cc_pic='-KPIC' + lt_cv_prog_cc_static='-Bstatic' + ;; + + osf3* | osf4* | osf5*) + # All OSF/1 code is PIC. + lt_cv_prog_cc_wl='-Wl,' + lt_cv_prog_cc_static='-non_shared' + ;; + + sco3.2v5*) + lt_cv_prog_cc_pic='-Kpic' + lt_cv_prog_cc_static='-dn' + lt_cv_prog_cc_shlib='-belf' + ;; + + solaris*) + lt_cv_prog_cc_pic='-KPIC' + lt_cv_prog_cc_static='-Bstatic' + lt_cv_prog_cc_wl='-Wl,' + ;; + + sunos4*) + lt_cv_prog_cc_pic='-PIC' + lt_cv_prog_cc_static='-Bstatic' + lt_cv_prog_cc_wl='-Qoption ld ' + ;; + + sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) + lt_cv_prog_cc_pic='-KPIC' + lt_cv_prog_cc_static='-Bstatic' + lt_cv_prog_cc_wl='-Wl,' + ;; + + uts4*) + lt_cv_prog_cc_pic='-pic' + lt_cv_prog_cc_static='-Bstatic' + ;; + + sysv4*MP*) + if test -d /usr/nec ;then + lt_cv_prog_cc_pic='-Kconform_pic' + lt_cv_prog_cc_static='-Bstatic' + fi + ;; + + *) + lt_cv_prog_cc_can_build_shared=no + ;; + esac + fi +]) +if test -z "$lt_cv_prog_cc_pic"; then + AC_MSG_RESULT([none]) +else + AC_MSG_RESULT([$lt_cv_prog_cc_pic]) + + # Check to make sure the pic_flag actually works. + AC_MSG_CHECKING([if $compiler PIC flag $lt_cv_prog_cc_pic works]) + AC_CACHE_VAL(lt_cv_prog_cc_pic_works, [dnl + save_CFLAGS="$CFLAGS" + CFLAGS="$CFLAGS $lt_cv_prog_cc_pic -DPIC" + AC_TRY_COMPILE([], [], [dnl + 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 + lt_cv_prog_cc_pic_works=no + else + lt_cv_prog_cc_pic_works=yes + fi + ;; + *) + lt_cv_prog_cc_pic_works=yes + ;; + esac + ], [dnl + lt_cv_prog_cc_pic_works=no + ]) + CFLAGS="$save_CFLAGS" + ]) + + if test "X$lt_cv_prog_cc_pic_works" = Xno; then + lt_cv_prog_cc_pic= + lt_cv_prog_cc_can_build_shared=no + else + lt_cv_prog_cc_pic=" $lt_cv_prog_cc_pic" + fi + + AC_MSG_RESULT([$lt_cv_prog_cc_pic_works]) +fi + +# Check for any special shared library compilation flags. +if test -n "$lt_cv_prog_cc_shlib"; then + AC_MSG_WARN([\`$CC' requires \`$lt_cv_prog_cc_shlib' to build shared libraries]) + if echo "$old_CC $old_CFLAGS " | egrep -e "[[ ]]$lt_cv_prog_cc_shlib[[ ]]" >/dev/null; then : + else + AC_MSG_WARN([add \`$lt_cv_prog_cc_shlib' to the CC or CFLAGS env variable and reconfigure]) + lt_cv_prog_cc_can_build_shared=no + fi +fi + +AC_MSG_CHECKING([if $compiler static flag $lt_cv_prog_cc_static works]) +AC_CACHE_VAL([lt_cv_prog_cc_static_works], [dnl + lt_cv_prog_cc_static_works=no + save_LDFLAGS="$LDFLAGS" + LDFLAGS="$LDFLAGS $lt_cv_prog_cc_static" + AC_TRY_LINK([], [], [lt_cv_prog_cc_static_works=yes]) + LDFLAGS="$save_LDFLAGS" +]) + +# Belt *and* braces to stop my trousers falling down: +test "X$lt_cv_prog_cc_static_works" = Xno && lt_cv_prog_cc_static= +AC_MSG_RESULT([$lt_cv_prog_cc_static_works]) + +pic_flag="$lt_cv_prog_cc_pic" +special_shlib_compile_flags="$lt_cv_prog_cc_shlib" +wl="$lt_cv_prog_cc_wl" +link_static_flag="$lt_cv_prog_cc_static" +no_builtin_flag="$lt_cv_prog_cc_no_builtin" +can_build_shared="$lt_cv_prog_cc_can_build_shared" + + +# Check to see if options -o and -c are simultaneously supported by compiler +AC_MSG_CHECKING([if $compiler supports -c -o file.$ac_objext]) +AC_CACHE_VAL([lt_cv_compiler_c_o], [ +$rm -r conftest 2>/dev/null +mkdir conftest +cd conftest +echo "int some_variable = 0;" > conftest.$ac_ext +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.$ac_objext" +compiler_c_o=no +if { (eval echo configure:__oline__: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>out/conftest.err; } && test -s out/conftest2.$ac_objext; then + # The compiler can only warn and ignore the option if not recognized + # So say no if there are warnings + if test -s out/conftest.err; then + lt_cv_compiler_c_o=no + else + lt_cv_compiler_c_o=yes + fi +else + # Append any errors to the config.log. + cat out/conftest.err 1>&AC_FD_CC + lt_cv_compiler_c_o=no +fi +CFLAGS="$save_CFLAGS" +chmod u+w . +$rm conftest* out/* +rmdir out +cd .. +rmdir conftest +$rm -r conftest 2>/dev/null +]) +compiler_c_o=$lt_cv_compiler_c_o +AC_MSG_RESULT([$compiler_c_o]) + +if test x"$compiler_c_o" = x"yes"; then + # Check to see if we can write to a .lo + AC_MSG_CHECKING([if $compiler supports -c -o file.lo]) + AC_CACHE_VAL([lt_cv_compiler_o_lo], [ + lt_cv_compiler_o_lo=no + save_CFLAGS="$CFLAGS" + CFLAGS="$CFLAGS -c -o conftest.lo" + save_objext="$ac_objext" + ac_objext=lo + AC_TRY_COMPILE([], [int some_variable = 0;], [dnl + # 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 + lt_cv_compiler_o_lo=no + else + lt_cv_compiler_o_lo=yes + fi + ]) + ac_objext="$save_objext" + CFLAGS="$save_CFLAGS" + ]) + compiler_o_lo=$lt_cv_compiler_o_lo + AC_MSG_RESULT([$compiler_o_lo]) +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 + AC_MSG_CHECKING([if we can lock with hard links]) + hard_links=yes + $rm conftest* + ln conftest.a conftest.b 2>/dev/null && hard_links=no + touch conftest.a + ln conftest.a conftest.b 2>&5 || hard_links=no + ln conftest.a conftest.b 2>/dev/null && hard_links=no + AC_MSG_RESULT([$hard_links]) + if test "$hard_links" = no; then + AC_MSG_WARN([\`$CC' does not support \`-c -o', so \`make -j' may be unsafe]) + need_locks=warn + fi +else + need_locks=no +fi + +if test "$GCC" = yes; then + # Check to see if options -fno-rtti -fno-exceptions are supported by compiler + AC_MSG_CHECKING([if $compiler supports -fno-rtti -fno-exceptions]) + echo "int some_variable = 0;" > conftest.$ac_ext + save_CFLAGS="$CFLAGS" + CFLAGS="$CFLAGS -fno-rtti -fno-exceptions -c conftest.$ac_ext" + compiler_rtti_exceptions=no + AC_TRY_COMPILE([], [int some_variable = 0;], [dnl + # 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 + compiler_rtti_exceptions=no + else + compiler_rtti_exceptions=yes + fi + ]) + CFLAGS="$save_CFLAGS" + AC_MSG_RESULT([$compiler_rtti_exceptions]) + + if test "$compiler_rtti_exceptions" = "yes"; then + no_builtin_flag=' -fno-builtin -fno-rtti -fno-exceptions' + else + no_builtin_flag=' -fno-builtin' + fi +fi + +# See if the linker supports building shared libraries. +AC_MSG_CHECKING([whether the linker ($LD) supports shared libraries]) + +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= +old_archive_from_expsyms_cmds= +export_dynamic_flag_spec= +whole_archive_flag_spec= +thread_safe_flag_spec= +hardcode_into_libs=no +hardcode_libdir_flag_spec= +hardcode_libdir_separator= +hardcode_direct=no +hardcode_minus_L=no +hardcode_shlibpath_var=unsupported +runpath_var= +link_all_deplibs=unknown +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. +extract_expsyms_cmds= + +case $host_os in +cygwin* | mingw* | pw32*) + # FIXME: the MSVC++ port hasn't been tested in a loooong time + # When not using gcc, we currently assume that we are using + # Microsoft Visual C++. + if test "$GCC" != yes; then + with_gnu_ld=no + fi + ;; +openbsd*) + with_gnu_ld=no + ;; +esac + +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* | aix5*) + # On AIX, the GNU linker is very broken + # Note:Check GNU linker on AIX 5-IA64 when/if it becomes available. + 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 $output_objdir/a2ixlibrary.data~$echo "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$echo "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$echo "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$echo "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' + hardcode_libdir_flag_spec='-L$libdir' + hardcode_minus_L=yes + + # 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 $compiler_flags ${wl}-soname $wl$soname -o $lib' + else + ld_shlibs=no + fi + ;; + + cygwin* | mingw* | pw32*) + # 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_expsyms_cmds='test -f $output_objdir/impgen.c || \ + sed -e "/^# \/\* impgen\.c starts here \*\//,/^# \/\* impgen.c ends here \*\// { s/^# //;s/^# *$//; p; }" -e d < $''0 > $output_objdir/impgen.c~ + test -f $output_objdir/impgen.exe || (cd $output_objdir && \ + if test "x$HOST_CC" != "x" ; then $HOST_CC -o impgen impgen.c ; \ + else $CC -o impgen impgen.c ; fi)~ + $output_objdir/impgen $dir/$soroot > $output_objdir/$soname-def' + + old_archive_from_expsyms_cmds='$DLLTOOL --as=$AS --dllname $soname --def $output_objdir/$soname-def --output-lib $output_objdir/$newlib' + + # cygwin and mingw dlls have different entry points and sets of symbols + # to exclude. + # FIXME: what about values for MSVC? + dll_entry=__cygwin_dll_entry@12 + dll_exclude_symbols=DllMain@12,_cygwin_dll_entry@12,_cygwin_noncygwin_dll_entry@12~ + case $host_os in + mingw*) + # mingw values + dll_entry=_DllMainCRTStartup@12 + dll_exclude_symbols=DllMain@12,DllMainCRTStartup@12,DllEntryPoint@12~ + ;; + esac + + # mingw and cygwin differ, and it's simplest to just exclude the union + # of the two symbol sets. + dll_exclude_symbols=DllMain@12,_cygwin_dll_entry@12,_cygwin_noncygwin_dll_entry@12,DllMainCRTStartup@12,DllEntryPoint@12 + + # recent cygwin and mingw systems supply a stub DllMain which the user + # can override, but on older systems we have to supply one (in ltdll.c) + if test "x$lt_cv_need_dllmain" = "xyes"; then + ltdll_obj='$output_objdir/$soname-ltdll.'"$ac_objext " + ltdll_cmds='test -f $output_objdir/$soname-ltdll.c || sed -e "/^# \/\* ltdll\.c starts here \*\//,/^# \/\* ltdll.c ends here \*\// { s/^# //; p; }" -e d < $''0 > $output_objdir/$soname-ltdll.c~ + test -f $output_objdir/$soname-ltdll.$ac_objext || (cd $output_objdir && $CC -c $soname-ltdll.c)~' + else + ltdll_obj= + ltdll_cmds= + fi + + # 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 be newer dlltools. + export_symbols_cmds="$ltdll_cmds"' + $DLLTOOL --export-all --exclude-symbols '$dll_exclude_symbols' --output-def $output_objdir/$soname-def '$ltdll_obj'$libobjs $convenience~ + sed -e "1,/EXPORTS/d" -e "s/ @ [[0-9]]*//" -e "s/ *;.*$//" < $output_objdir/$soname-def > $export_symbols' + + # If the export-symbols file already is a .def file (1st line + # is EXPORTS), use it as is. + # If DATA tags from a recent dlltool are present, honour them! + archive_expsym_cmds='if test "x`sed 1q $export_symbols`" = xEXPORTS; then + cp $export_symbols $output_objdir/$soname-def; + else + echo EXPORTS > $output_objdir/$soname-def; + _lt_hint=1; + cat $export_symbols | while read symbol; do + set dummy \$symbol; + case \[$]# in + 2) echo " \[$]2 @ \$_lt_hint ; " >> $output_objdir/$soname-def;; + 4) echo " \[$]2 \[$]3 \[$]4 ; " >> $output_objdir/$soname-def; _lt_hint=`expr \$_lt_hint - 1`;; + *) echo " \[$]2 @ \$_lt_hint \[$]3 ; " >> $output_objdir/$soname-def;; + esac; + _lt_hint=`expr 1 + \$_lt_hint`; + done; + fi~ + '"$ltdll_cmds"' + $CC -Wl,--base-file,$output_objdir/$soname-base '$lt_cv_cc_dll_switch' -Wl,-e,'$dll_entry' -o $output_objdir/$soname '$ltdll_obj'$libobjs $deplibs $compiler_flags~ + $DLLTOOL --as=$AS --dllname $soname --exclude-symbols '$dll_exclude_symbols' --def $output_objdir/$soname-def --base-file $output_objdir/$soname-base --output-exp $output_objdir/$soname-exp~ + $CC -Wl,--base-file,$output_objdir/$soname-base $output_objdir/$soname-exp '$lt_cv_cc_dll_switch' -Wl,-e,'$dll_entry' -o $output_objdir/$soname '$ltdll_obj'$libobjs $deplibs $compiler_flags~ + $DLLTOOL --as=$AS --dllname $soname --exclude-symbols '$dll_exclude_symbols' --def $output_objdir/$soname-def --base-file $output_objdir/$soname-base --output-exp $output_objdir/$soname-exp --output-lib $output_objdir/$libname.dll.a~ + $CC $output_objdir/$soname-exp '$lt_cv_cc_dll_switch' -Wl,-e,'$dll_entry' -o $output_objdir/$soname '$ltdll_obj'$libobjs $deplibs $compiler_flags' + ;; + + netbsd*) + if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then + archive_cmds='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib' + wlarc= + else + archive_cmds='$CC -shared -nodefaultlibs $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + archive_expsym_cmds='$CC -shared -nodefaultlibs $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + 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 $compiler_flags ${wl}-soname $wl$soname -o $lib' + archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + else + ld_shlibs=no + fi + ;; + + sunos4*) + archive_cmds='$LD -assert pure-text -Bshareable -o $lib $libobjs $deplibs $linker_flags' + wlarc= + hardcode_direct=yes + hardcode_shlibpath_var=no + ;; + + *) + if $LD --help 2>&1 | egrep ': supported targets:.* elf' > /dev/null; then + archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + else + ld_shlibs=no + fi + ;; + esac + + 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* | pw32*) + # 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 $output_objdir/$soname $libobjs $deplibs $linker_flags -bE:$export_symbols -T512 -H512 -bM:SRE~$AR $AR_FLAGS $lib $output_objdir/$soname' + # Note: this linker hardcodes the directories in LIBPATH if there + # are no directories specified by -L. + hardcode_minus_L=yes + if test "$GCC" = yes && test -z "$link_static_flag"; then + # Neither direct hardcoding nor static linking is supported with a + # broken collect2. + hardcode_direct=unsupported + fi + ;; + + aix4* | aix5*) + if test "$host_cpu" = ia64; then + # On IA64, the linker does run time linking by default, so we don't + # have to do anything special. + aix_use_runtimelinking=no + exp_sym_flag='-Bexport' + no_entry_flag="" + else + aix_use_runtimelinking=no + + # Test if we are trying to use run time linking or normal + # AIX style linking. If -brtl is somewhere in LDFLAGS, we + # need to do runtime linking. + case $host_os in aix4.[[23]]|aix4.[[23]].*|aix5*) + for ld_flag in $LDFLAGS; do + case $ld_flag in + *-brtl*) + aix_use_runtimelinking=yes + break + ;; + esac + done + esac + + exp_sym_flag='-bexport' + no_entry_flag='-bnoentry' + fi + + # When large executables or shared objects are built, AIX ld can + # have problems creating the table of contents. If linking a library + # or program results in "error TOC overflow" add -mminimal-toc to + # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not + # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS. + + hardcode_direct=yes + archive_cmds='' + hardcode_libdir_separator=':' + if test "$GCC" = yes; then + case $host_os in aix4.[[012]]|aix4.[[012]].*) + 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 + esac + + shared_flag='-shared' + else + # not using gcc + if test "$host_cpu" = ia64; then + shared_flag='${wl}-G' + else + if test "$aix_use_runtimelinking" = yes; then + shared_flag='${wl}-G' + else + shared_flag='${wl}-bM:SRE' + fi + fi + fi + + # It seems that -bexpall can do strange things, so it is better to + # generate a list of symbols to export. + always_export_symbols=yes + if test "$aix_use_runtimelinking" = yes; then + # Warning - without using the other runtime loading flags (-brtl), + # -berok will link without error, but may produce a broken library. + allow_undefined_flag='-berok' + hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:/usr/lib:/lib' + archive_expsym_cmds="\$CC"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then echo "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$no_entry_flag \${wl}$exp_sym_flag:\$export_symbols $shared_flag" + else + if test "$host_cpu" = ia64; then + hardcode_libdir_flag_spec='${wl}-R $libdir:/usr/lib:/lib' + allow_undefined_flag="-z nodefs" + archive_expsym_cmds="\$CC $shared_flag"' -o $output_objdir/$soname ${wl}-h$soname $libobjs $deplibs $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$no_entry_flag \${wl}$exp_sym_flag:\$export_symbols" + else + hardcode_libdir_flag_spec='${wl}-bnolibpath ${wl}-blibpath:$libdir:/usr/lib:/lib' + # Warning - without using the other run time loading flags, + # -berok will link without error, but may produce a broken library. + allow_undefined_flag='${wl}-berok' + # This is a bit strange, but is similar to how AIX traditionally builds + # it's shared libraries. + archive_expsym_cmds="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags ${allow_undefined_flag} '"\${wl}$no_entry_flag \${wl}$exp_sym_flag:\$export_symbols"' ~$AR -crlo $objdir/$libname$release.a $objdir/$soname' + fi + fi + ;; + + amigaos*) + archive_cmds='$rm $output_objdir/a2ixlibrary.data~$echo "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$echo "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$echo "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$echo "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' + hardcode_libdir_flag_spec='-L$libdir' + hardcode_minus_L=yes + # see comment about different semantics on the GNU ld section + ld_shlibs=no + ;; + + cygwin* | mingw* | pw32*) + # When not using gcc, we currently assume that we are using + # Microsoft Visual C++. + # hardcode_libdir_flag_spec is actually meaningless, as there is + # no search path for DLLs. + 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 $compiler_flags `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$old_deplibs' + fix_srcfile_path='`cygpath -w "$srcfile"`' + ;; + + darwin* | rhapsody*) + case "$host_os" in + rhapsody* | darwin1.[[012]]) + allow_undefined_flag='-undefined suppress' + ;; + *) # Darwin 1.3 on + allow_undefined_flag='-flat_namespace -undefined suppress' + ;; + esac + # FIXME: Relying on posixy $() will cause problems for + # cross-compilation, but unfortunately the echo tests do not + # yet detect zsh echo's removal of \ escapes. Also zsh mangles + # `"' quotes if we put them in here... so don't! + archive_cmds='$CC -r -keep_private_externs -nostdlib -o ${lib}-master.o $libobjs && $CC $(test .$module = .yes && echo -bundle || echo -dynamiclib) $allow_undefined_flag -o $lib ${lib}-master.o $deplibs$linker_flags $(test .$module != .yes && echo -install_name $rpath/$soname $verstring)' + # We need to add '_' to the symbols in $export_symbols first + #archive_expsym_cmds="$archive_cmds"' && strip -s $export_symbols' + hardcode_direct=yes + hardcode_shlibpath_var=no + whole_archive_flag_spec='-all_load $convenience' + ;; + + 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 $linker_flags /usr/lib/c++rt0.o' + hardcode_libdir_flag_spec='-R$libdir' + hardcode_direct=yes + hardcode_shlibpath_var=no + ;; + + # Unfortunately, older versions of FreeBSD 2 do not have this feature. + freebsd2*) + archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' + hardcode_direct=yes + hardcode_minus_L=yes + hardcode_shlibpath_var=no + ;; + + # FreeBSD 3 and greater uses gcc -shared to do shared libraries. + freebsd*) + archive_cmds='$CC -shared -o $lib $libobjs $deplibs $compiler_flags' + hardcode_libdir_flag_spec='-R$libdir' + hardcode_direct=yes + hardcode_shlibpath_var=no + ;; + + hpux9* | hpux10* | hpux11*) + case $host_os in + hpux9*) archive_cmds='$rm $output_objdir/$soname~$LD -b +b $install_libdir -o $output_objdir/$soname $libobjs $deplibs $linker_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' ;; + *) archive_cmds='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags' ;; + 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* | nonstopux*) + if test "$GCC" = yes; then + archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' + hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' + else + archive_cmds='$LD -shared $libobjs $deplibs $linker_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' + hardcode_libdir_flag_spec='-rpath $libdir' + fi + hardcode_libdir_separator=: + link_all_deplibs=yes + ;; + + netbsd*) + if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then + archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' # a.out + else + archive_cmds='$LD -shared -o $lib $libobjs $deplibs $linker_flags' # ELF + fi + hardcode_libdir_flag_spec='-R$libdir' + hardcode_direct=yes + hardcode_shlibpath_var=no + ;; + + newsos6) + archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_direct=yes + hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' + hardcode_libdir_separator=: + hardcode_shlibpath_var=no + ;; + + openbsd*) + hardcode_direct=yes + hardcode_shlibpath_var=no + if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then + archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' + hardcode_libdir_flag_spec='${wl}-rpath,$libdir' + export_dynamic_flag_spec='${wl}-E' + else + case "$host_os" in + openbsd[[01]].* | openbsd2.[[0-7]] | openbsd2.[[0-7]].*) + archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' + hardcode_libdir_flag_spec='-R$libdir' + ;; + *) + archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' + hardcode_libdir_flag_spec='${wl}-rpath,$libdir' + ;; + esac + fi + ;; + + os2*) + hardcode_libdir_flag_spec='-L$libdir' + hardcode_minus_L=yes + allow_undefined_flag=unsupported + archive_cmds='$echo "LIBRARY $libname INITINSTANCE" > $output_objdir/$libname.def~$echo "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~$echo DATA >> $output_objdir/$libname.def~$echo " SINGLE NONSHARED" >> $output_objdir/$libname.def~$echo EXPORTS >> $output_objdir/$libname.def~emxexp $libobjs >> $output_objdir/$libname.def~$CC -Zdll -Zcrtdll -o $lib $libobjs $deplibs $compiler_flags $output_objdir/$libname.def' + old_archive_from_new_cmds='emximp -o $output_objdir/$libname.a $output_objdir/$libname.def' + ;; + + osf3*) + if test "$GCC" = yes; then + allow_undefined_flag=' ${wl}-expect_unresolved ${wl}\*' + archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' + else + allow_undefined_flag=' -expect_unresolved \*' + archive_cmds='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' + fi + hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' + hardcode_libdir_separator=: + ;; + + osf4* | osf5*) # as osf3* with the addition of -msym flag + if test "$GCC" = yes; then + allow_undefined_flag=' ${wl}-expect_unresolved ${wl}\*' + archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' + hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' + else + allow_undefined_flag=' -expect_unresolved \*' + archive_cmds='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -msym -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' + archive_expsym_cmds='for i in `cat $export_symbols`; do printf "-exported_symbol " >> $lib.exp; echo "\$i" >> $lib.exp; done; echo "-hidden">> $lib.exp~ + $LD -shared${allow_undefined_flag} -input $lib.exp $linker_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${objdir}/so_locations -o $lib~$rm $lib.exp' + + #Both c and cxx compiler support -rpath directly + hardcode_libdir_flag_spec='-rpath $libdir' + fi + hardcode_libdir_separator=: + ;; + + sco3.2v5*) + archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_shlibpath_var=no + runpath_var=LD_RUN_PATH + hardcode_runpath_var=yes + export_dynamic_flag_spec='${wl}-Bexport' + ;; + + solaris*) + # gcc --version < 3.0 without binutils cannot create self contained + # shared libraries reliably, requiring libgcc.a to resolve some of + # the object symbols generated in some cases. Libraries that use + # assert need libgcc.a to resolve __eprintf, for example. Linking + # a copy of libgcc.a into every shared library to guarantee resolving + # such symbols causes other problems: According to Tim Van Holder + # , C++ libraries end up with a separate + # (to the application) exception stack for one thing. + no_undefined_flag=' -z defs' + if test "$GCC" = yes; then + case `$CC --version 2>/dev/null` in + [[12]].*) + cat <&2 + +*** Warning: Releases of GCC earlier than version 3.0 cannot reliably +*** create self contained shared libraries on Solaris systems, without +*** introducing a dependency on libgcc.a. Therefore, libtool is disabling +*** -no-undefined support, which will at least allow you to build shared +*** libraries. However, you may find that when you link such libraries +*** into an application without using GCC, you have to manually add +*** \`gcc --print-libgcc-file-name\` to the link command. We urge you to +*** upgrade to a newer version of GCC. Another option is to rebuild your +*** current GCC to use the GNU linker from GNU binutils 2.9.1 or newer. + +EOF + no_undefined_flag= + ;; + esac + fi + # $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 $linker_flags' + archive_expsym_cmds='$echo "{ global:" > $lib.exp~cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ + $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$rm $lib.exp' + 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 + link_all_deplibs=yes + ;; + + sunos4*) + if test "x$host_vendor" = xsequent; then + # Use $CC to link under sequent, because it throws in some extra .o + # files that make .init and .fini sections work. + archive_cmds='$CC -G ${wl}-h $soname -o $lib $libobjs $deplibs $compiler_flags' + else + archive_cmds='$LD -assert pure-text -Bstatic -o $lib $libobjs $deplibs $linker_flags' + fi + hardcode_libdir_flag_spec='-L$libdir' + hardcode_direct=yes + hardcode_minus_L=yes + hardcode_shlibpath_var=no + ;; + + sysv4) + case $host_vendor in + sni) + archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_direct=yes # is this really true??? + ;; + siemens) + ## LD is ld it makes a PLAMLIB + ## CC just makes a GrossModule. + archive_cmds='$LD -G -o $lib $libobjs $deplibs $linker_flags' + reload_cmds='$CC -r -o $output$reload_objs' + hardcode_direct=no + ;; + motorola) + archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_direct=no #Motorola manual says yes, but my tests say they lie + ;; + esac + runpath_var='LD_RUN_PATH' + hardcode_shlibpath_var=no + ;; + + sysv4.3*) + archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_shlibpath_var=no + export_dynamic_flag_spec='-Bexport' + ;; + + 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 $linker_flags' + archive_expsym_cmds='$echo "{ global:" > $lib.exp~cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ + $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$rm $lib.exp' + hardcode_libdir_flag_spec= + hardcode_shlibpath_var=no + runpath_var='LD_RUN_PATH' + ;; + + uts4*) + archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_libdir_flag_spec='-L$libdir' + hardcode_shlibpath_var=no + ;; + + dgux*) + archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + 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 $linker_flags' + 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 $linker_flags' + hardcode_direct=yes + hardcode_minus_L=no + hardcode_shlibpath_var=no + hardcode_runpath_var=yes + runpath_var=LD_RUN_PATH + ;; + + sysv5uw7* | unixware7*) + no_undefined_flag='${wl}-z ${wl}text' + if test "$GCC" = yes; then + archive_cmds='$CC -shared ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' + else + archive_cmds='$CC -G ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' + fi + runpath_var='LD_RUN_PATH' + hardcode_shlibpath_var=no + ;; + + *) + ld_shlibs=no + ;; + esac +fi +AC_MSG_RESULT([$ld_shlibs]) +test "$ld_shlibs" = no && can_build_shared=no + +# Check hardcoding attributes. +AC_MSG_CHECKING([how to hardcode library paths into programs]) +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 +AC_MSG_RESULT([$hardcode_action]) + +striplib= +old_striplib= +AC_MSG_CHECKING([whether stripping libraries is possible]) +if test -n "$STRIP" && $STRIP -V 2>&1 | grep "GNU strip" >/dev/null; then + test -z "$old_striplib" && old_striplib="$STRIP --strip-debug" + test -z "$striplib" && striplib="$STRIP --strip-unneeded" + AC_MSG_RESULT([yes]) +else + AC_MSG_RESULT([no]) +fi + +reload_cmds='$LD$reload_flag -o $output$reload_objs' +test -z "$deplibs_check_method" && deplibs_check_method=unknown + +# PORTME Fill in your ld.so characteristics +AC_MSG_CHECKING([dynamic linker 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 /usr/X11R6/lib" +sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib /usr/X11R6/lib" + +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* | aix5*) + version_type=linux + need_lib_prefix=no + need_version=no + hardcode_into_libs=yes + if test "$host_cpu" = ia64; then + # AIX 5 supports IA64 + library_names_spec='${libname}${release}.so$major ${libname}${release}.so$versuffix $libname.so' + shlibpath_var=LD_LIBRARY_PATH + else + # With GCC up to 2.95.x, collect2 would create an import file + # for dependence libraries. The import file would start with + # the line `#! .'. This would cause the generated library to + # depend on `.', always an invalid library. This was fixed in + # development snapshots of GCC prior to 3.0. + case $host_os in + aix4 | aix4.[[01]] | aix4.[[01]].*) + if { echo '#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 97)' + echo ' yes ' + echo '#endif'; } | ${CC} -E - | grep yes > /dev/null; then + : + else + can_build_shared=no + fi + ;; + esac + # AIX (on Power*) has no versioning support, so currently we can + # not hardcode correct soname into executable. Probably we can + # add versioning support to collect2, so additional links can + # be useful in future. + if test "$aix_use_runtimelinking" = yes; then + # If using run time linking (on AIX 4.2 or later) use lib.so + # instead of lib.a to let people know that these are not + # typical AIX shared libraries. + library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so' + else + # We preserve .a as extension for shared libraries through AIX4.2 + # and later when we are not doing run time linking. + library_names_spec='${libname}${release}.a $libname.a' + soname_spec='${libname}${release}.so$major' + fi + shlibpath_var=LIBPATH + fi + hardcode_into_libs=yes + ;; + +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 + ;; + +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 + 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* | pw32*) + version_type=windows + need_version=no + need_lib_prefix=no + case $GCC,$host_os in + yes,cygwin*) + library_names_spec='$libname.dll.a' + soname_spec='`echo ${libname} | sed -e 's/^lib/cyg/'``echo ${release} | sed -e 's/[[.]]/-/g'`${versuffix}.dll' + postinstall_cmds='dlpath=`bash 2>&1 -c '\''. $dir/${file}i;echo \$dlname'\''`~ + dldir=$destdir/`dirname \$dlpath`~ + test -d \$dldir || mkdir -p \$dldir~ + $install_prog .libs/$dlname \$dldir/$dlname' + postuninstall_cmds='dldll=`bash 2>&1 -c '\''. $file; echo \$dlname'\''`~ + dlpath=$dir/\$dldll~ + $rm \$dlpath' + ;; + yes,mingw*) + library_names_spec='${libname}`echo ${release} | sed -e 's/[[.]]/-/g'`${versuffix}.dll' + sys_lib_search_path_spec=`$CC -print-search-dirs | grep "^libraries:" | sed -e "s/^libraries://" -e "s/;/ /g" -e "s,=/,/,g"` + ;; + yes,pw32*) + library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | sed -e 's/[.]/-/g'`${versuffix}.dll' + ;; + *) + library_names_spec='${libname}`echo ${release} | sed -e 's/[[.]]/-/g'`${versuffix}.dll $libname.lib' + ;; + esac + dynamic_linker='Win32 ld.exe' + # FIXME: first we should search . and the directory the executable is in + shlibpath_var=PATH + ;; + +darwin* | rhapsody*) + dynamic_linker="$host_os dyld" + version_type=darwin + need_lib_prefix=no + need_version=no + # FIXME: Relying on posixy $() will cause problems for + # cross-compilation, but unfortunately the echo tests do not + # yet detect zsh echo's removal of \ escapes. + library_names_spec='${libname}${release}${versuffix}.$(test .$module = .yes && echo so || echo dylib) ${libname}${release}${major}.$(test .$module = .yes && echo so || echo dylib) ${libname}.$(test .$module = .yes && echo so || echo dylib)' + soname_spec='${libname}${release}${major}.$(test .$module = .yes && echo so || echo dylib)' + shlibpath_overrides_runpath=yes + shlibpath_var=DYLD_LIBRARY_PATH + ;; + +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*) + library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so $libname.so' + need_version=no + need_lib_prefix=no + ;; + freebsd-*) + library_names_spec='${libname}${release}.so$versuffix $libname.so$versuffix' + need_version=yes + ;; + esac + shlibpath_var=LD_LIBRARY_PATH + case $host_os in + freebsd2*) + shlibpath_overrides_runpath=yes + ;; + *) + shlibpath_overrides_runpath=no + hardcode_into_libs=yes + ;; + esac + ;; + +gnu*) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so${major} ${libname}.so' + soname_spec='${libname}${release}.so$major' + shlibpath_var=LD_LIBRARY_PATH + hardcode_into_libs=yes + ;; + +hpux9* | hpux10* | hpux11*) + # Give a soname corresponding to the major version so that dld.sl refuses to + # link against other versions. + 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' + ;; + +irix5* | irix6* | nonstopux*) + case $host_os in + nonstopux*) version_type=nonstopux ;; + *) version_type=irix ;; + esac + 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* | nonstopux*) + libsuff= shlibsuff= + ;; + *) + 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}" + ;; + +# 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 + # This implies no fast_install, which is unacceptable. + # Some rework will be needed to allow for fast_install + # before this can be enabled. + hardcode_into_libs=yes + + case $host_cpu:$lt_cv_cc_64bit_output in + powerpc64:yes | s390x:yes | sparc64:yes | x86_64:yes) + sys_lib_dlsearch_path_spec="/lib64 /usr/lib64 /usr/X11R6/lib64" + sys_lib_search_path_spec="/lib64 /usr/lib64 /usr/local/lib64 /usr/X11R6/lib64" + ;; + esac + + # We used to test for /lib/ld.so.1 and disable shared libraries on + # powerpc, because MkLinux only supported shared libraries with the + # GNU dynamic linker. Since this was broken with cross compilers, + # most powerpc-linux boxes support dynamic linking these days and + # people can always --disable-shared, the test was removed, and we + # assume the GNU/Linux dynamic linker is in use. + dynamic_linker='GNU/Linux ld.so' + ;; + +netbsd*) + version_type=sunos + need_lib_prefix=no + need_version=no + if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then + library_names_spec='${libname}${release}.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 + shlibpath_overrides_runpath=yes + hardcode_into_libs=yes + ;; + +newsos6) + version_type=linux + library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + ;; + +openbsd*) + version_type=sunos + need_lib_prefix=no + need_version=no + if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then + case "$host_os" in + openbsd2.[[89]] | openbsd2.[[89]].*) + shlibpath_overrides_runpath=no + ;; + *) + shlibpath_overrides_runpath=yes + ;; + esac + else + shlibpath_overrides_runpath=yes + fi + 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$major' + library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so' + shlibpath_var=LD_LIBRARY_PATH + sys_lib_search_path_spec="/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /usr/local/lib /var/shlib" + sys_lib_dlsearch_path_spec="$sys_lib_search_path_spec" + hardcode_into_libs=yes + ;; + +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 + hardcode_into_libs=yes + # ldd complains unless libraries are executable + postinstall_cmds='chmod +x $lib' + ;; + +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 + sni) + shlibpath_overrides_runpath=no + need_lib_prefix=no + export_dynamic_flag_spec='${wl}-Blargedynsym' + runpath_var=LD_RUN_PATH + ;; + siemens) + need_lib_prefix=no + ;; + motorola) + need_lib_prefix=no + need_version=no + shlibpath_overrides_runpath=no + sys_lib_search_path_spec='/lib /usr/lib /usr/ccs/lib' + ;; + esac + ;; + +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 +AC_MSG_RESULT([$dynamic_linker]) +test "$dynamic_linker" = no && can_build_shared=no + +# Report the final consequences. +AC_MSG_CHECKING([if libtool supports shared libraries]) +AC_MSG_RESULT([$can_build_shared]) + +AC_MSG_CHECKING([whether to build shared libraries]) +test "$can_build_shared" = "no" && enable_shared=no + +# On AIX, shared libraries and static libraries use the same namespace, and +# are all built from PIC. +case "$host_os" in +aix3*) + test "$enable_shared" = yes && enable_static=no + if test -n "$RANLIB"; then + archive_cmds="$archive_cmds~\$RANLIB \$lib" + postinstall_cmds='$RANLIB $lib' + fi + ;; + +aix4*) + if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then + test "$enable_shared" = yes && enable_static=no + fi + ;; +esac +AC_MSG_RESULT([$enable_shared]) + +AC_MSG_CHECKING([whether to build static libraries]) +# Make sure either enable_shared or enable_static is yes. +test "$enable_shared" = yes || enable_static=yes +AC_MSG_RESULT([$enable_static]) + +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 + +variables_saved_for_relink="PATH $shlibpath_var $runpath_var" +if test "$GCC" = yes; then + variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH" +fi + +AC_LIBTOOL_DLOPEN_SELF + +if test "$enable_shared" = yes && test "$GCC" = yes; then + case $archive_cmds in + *'~'*) + # FIXME: we may have to deal with multi-command sequences. + ;; + '$CC '*) + # Test whether the compiler implicitly links with -lc since on some + # systems, -lgcc has to come before -lc. If gcc already passes -lc + # to ld, don't add -lc before -lgcc. + AC_MSG_CHECKING([whether -lc should be explicitly linked in]) + AC_CACHE_VAL([lt_cv_archive_cmds_need_lc], + [$rm conftest* + echo 'static int dummy;' > conftest.$ac_ext + + if AC_TRY_EVAL(ac_compile); then + soname=conftest + lib=conftest + libobjs=conftest.$ac_objext + deplibs= + wl=$lt_cv_prog_cc_wl + compiler_flags=-v + linker_flags=-v + verstring= + output_objdir=. + libname=conftest + save_allow_undefined_flag=$allow_undefined_flag + allow_undefined_flag= + if AC_TRY_EVAL(archive_cmds 2\>\&1 \| grep \" -lc \" \>/dev/null 2\>\&1) + then + lt_cv_archive_cmds_need_lc=no + else + lt_cv_archive_cmds_need_lc=yes + fi + allow_undefined_flag=$save_allow_undefined_flag + else + cat conftest.err 1>&5 + fi]) + AC_MSG_RESULT([$lt_cv_archive_cmds_need_lc]) + ;; + esac +fi +need_lc=${lt_cv_archive_cmds_need_lc-yes} + +# The second clause should only fire when bootstrapping the +# libtool distribution, otherwise you forgot to ship ltmain.sh +# with your package, and you will get complaints that there are +# no rules to generate ltmain.sh. +if test -f "$ltmain"; then + : +else + # If there is no Makefile yet, we rely on a make rule to execute + # `config.status --recheck' to rerun these tests and create the + # libtool script then. + test -f Makefile && make "$ltmain" +fi + +if test -f "$ltmain"; then + trap "$rm \"${ofile}T\"; exit 1" 1 2 15 + $rm -f "${ofile}T" + + echo creating $ofile + + # Now quote all the things that may contain metacharacters while being + # careful not to overquote the AC_SUBSTed values. We take copies of the + # variables and quote the copies for generation of the libtool script. + for var in echo old_CC old_CFLAGS SED \ + AR AR_FLAGS CC LD LN_S NM SHELL \ + 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 extract_expsyms_cmds old_archive_from_expsyms_cmds \ + old_striplib striplib 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 \ + global_symbol_to_c_name_address \ + 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 | \ + extract_expsyms_cmds | old_archive_from_expsyms_cmds | \ + postinstall_cmds | postuninstall_cmds | \ + finish_cmds | sys_lib_search_path_spec | sys_lib_dlsearch_path_spec) + # Double-quote double-evaled strings. + eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$double_quote_subst\" -e \"\$sed_quote_subst\" -e \"\$delay_variable_subst\"\`\\\"" + ;; + *) + eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$sed_quote_subst\"\`\\\"" + ;; + esac + done + + cat <<__EOF__ > "${ofile}T" +#! $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 ltmain.sh. +# +# Copyright (C) 1996-2000 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. + +# A sed that does not truncate output. +SED=$lt_SED + +# Sed that helps us avoid accidentally triggering echo(1) options like -n. +Xsed="${SED} -e s/^X//" + +# The HP-UX ksh and POSIX shell print the target directory to stdout +# if CDPATH is set. +if test "X\${CDPATH+set}" = Xset; then CDPATH=:; export CDPATH; fi + +# ### BEGIN LIBTOOL CONFIG + +# Libtool was configured on host `(hostname || uname -n) 2>/dev/null | sed 1q`: + +# Shell to use when invoking shell scripts. +SHELL=$lt_SHELL + +# Whether or not to build shared libraries. +build_libtool_libs=$enable_shared + +# Whether or not to build static libraries. +build_old_libs=$enable_static + +# Whether or not to add -lc for building shared libraries. +build_libtool_need_lc=$need_lc + +# Whether or not to optimize for fast installation. +fast_install=$enable_fast_install + +# The host system. +host_alias=$host_alias +host=$host + +# An echo program that does not interpret backslashes. +echo=$lt_echo + +# The archiver. +AR=$lt_AR +AR_FLAGS=$lt_AR_FLAGS + +# The default C compiler. +CC=$lt_CC + +# Is the compiler the GNU C compiler? +with_gcc=$GCC + +# The linker used to build libraries. +LD=$lt_LD + +# Whether we need hard or soft links. +LN_S=$lt_LN_S + +# A BSD-compatible nm program. +NM=$lt_NM + +# A symbol stripping program +STRIP=$STRIP + +# Used to examine libraries when file_magic_cmd begins "file" +MAGIC_CMD=$MAGIC_CMD + +# Used on cygwin: DLL creation program. +DLLTOOL="$DLLTOOL" + +# Used on cygwin: object dumper. +OBJDUMP="$OBJDUMP" + +# Used on cygwin: assembler. +AS="$AS" + +# The name of the directory that contains temporary libtool files. +objdir=$objdir + +# How to create reloadable object files. +reload_flag=$lt_reload_flag +reload_cmds=$lt_reload_cmds + +# How to pass a linker flag through the compiler. +wl=$lt_wl + +# Object file suffix (normally "o"). +objext="$ac_objext" + +# Old archive suffix (normally "a"). +libext="$libext" + +# Executable file suffix (normally ""). +exeext="$exeext" + +# Additional compiler flags for building library objects. +pic_flag=$lt_pic_flag +pic_mode=$pic_mode + +# Does compiler simultaneously support -c and -o options? +compiler_c_o=$lt_compiler_c_o + +# Can we write directly to a .lo ? +compiler_o_lo=$lt_compiler_o_lo + +# Must we lock files when doing compilation ? +need_locks=$lt_need_locks + +# Do we need the lib prefix for modules? +need_lib_prefix=$need_lib_prefix + +# Do we need a version for libraries? +need_version=$need_version + +# Whether dlopen is supported. +dlopen_support=$enable_dlopen + +# Whether dlopen of programs is supported. +dlopen_self=$enable_dlopen_self + +# Whether dlopen of statically linked programs is supported. +dlopen_self_static=$enable_dlopen_self_static + +# Compiler flag to prevent dynamic linking. +link_static_flag=$lt_link_static_flag + +# Compiler flag to turn off builtin functions. +no_builtin_flag=$lt_no_builtin_flag + +# Compiler flag to allow reflexive dlopens. +export_dynamic_flag_spec=$lt_export_dynamic_flag_spec + +# Compiler flag to generate shared objects directly from archives. +whole_archive_flag_spec=$lt_whole_archive_flag_spec + +# Compiler flag to generate thread-safe objects. +thread_safe_flag_spec=$lt_thread_safe_flag_spec + +# Library versioning type. +version_type=$version_type + +# Format of library name prefix. +libname_spec=$lt_libname_spec + +# List of archive names. First name is the real one, the rest are links. +# The last name is the one that the linker finds with -lNAME. +library_names_spec=$lt_library_names_spec + +# The coded name of the library, if different from the real name. +soname_spec=$lt_soname_spec + +# Commands used to build and install an old-style archive. +RANLIB=$lt_RANLIB +old_archive_cmds=$lt_old_archive_cmds +old_postinstall_cmds=$lt_old_postinstall_cmds +old_postuninstall_cmds=$lt_old_postuninstall_cmds + +# Create an old-style archive from a shared archive. +old_archive_from_new_cmds=$lt_old_archive_from_new_cmds + +# Create a temporary old-style archive to link instead of a shared archive. +old_archive_from_expsyms_cmds=$lt_old_archive_from_expsyms_cmds + +# Commands used to build and install a shared archive. +archive_cmds=$lt_archive_cmds +archive_expsym_cmds=$lt_archive_expsym_cmds +postinstall_cmds=$lt_postinstall_cmds +postuninstall_cmds=$lt_postuninstall_cmds + +# Commands to strip libraries. +old_striplib=$lt_old_striplib +striplib=$lt_striplib + +# Method to check whether dependent libraries are shared objects. +deplibs_check_method=$lt_deplibs_check_method + +# Command to use when deplibs_check_method == file_magic. +file_magic_cmd=$lt_file_magic_cmd + +# Flag that allows shared libraries with undefined symbols to be built. +allow_undefined_flag=$lt_allow_undefined_flag + +# Flag that forces no undefined symbols. +no_undefined_flag=$lt_no_undefined_flag + +# Commands used to finish a libtool library installation in a directory. +finish_cmds=$lt_finish_cmds + +# Same as above, but a single script fragment to be evaled but not shown. +finish_eval=$lt_finish_eval + +# Take the output of nm and produce a listing of raw symbols and C names. +global_symbol_pipe=$lt_global_symbol_pipe + +# Transform the output of nm in a proper C declaration +global_symbol_to_cdecl=$lt_global_symbol_to_cdecl + +# Transform the output of nm in a C name address pair +global_symbol_to_c_name_address=$lt_global_symbol_to_c_name_address + +# This is the shared library runtime path variable. +runpath_var=$runpath_var + +# This is the shared library path variable. +shlibpath_var=$shlibpath_var + +# Is shlibpath searched before the hard-coded library search path? +shlibpath_overrides_runpath=$shlibpath_overrides_runpath + +# How to hardcode a shared library path into an executable. +hardcode_action=$hardcode_action + +# Whether we should hardcode library paths into libraries. +hardcode_into_libs=$hardcode_into_libs + +# Flag to hardcode \$libdir into a binary during linking. +# This must work even if \$libdir does not exist. +hardcode_libdir_flag_spec=$lt_hardcode_libdir_flag_spec + +# Whether we need a single -rpath flag with a separated argument. +hardcode_libdir_separator=$lt_hardcode_libdir_separator + +# Set to yes if using DIR/libNAME.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 + +# Variables whose values should be saved in libtool wrapper scripts and +# restored at relink time. +variables_saved_for_relink="$variables_saved_for_relink" + +# Whether libtool must link a program against all its dependency libraries. +link_all_deplibs=$link_all_deplibs + +# Compile-time system search path for libraries +sys_lib_search_path_spec=$lt_sys_lib_search_path_spec + +# Run-time system search path for libraries +sys_lib_dlsearch_path_spec=$lt_sys_lib_dlsearch_path_spec + +# Fix the shell variable \$srcfile for the compiler. +fix_srcfile_path="$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=$lt_export_symbols_cmds + +# The commands to extract the exported symbol list from a shared archive. +extract_expsyms_cmds=$lt_extract_expsyms_cmds + +# Symbols that should not be listed in the preloaded symbols. +exclude_expsyms=$lt_exclude_expsyms + +# Symbols that must always be exported. +include_expsyms=$lt_include_expsyms + +# ### END LIBTOOL CONFIG + +__EOF__ + + case $host_os in + aix3*) + cat <<\EOF >> "${ofile}T" + +# 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 + + case $host_os in + cygwin* | mingw* | pw32* | os2*) + cat <<'EOF' >> "${ofile}T" + # 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-2000 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() */ +# +# /* O_BINARY isn't required (or even defined sometimes) under Unix */ +# #ifndef O_BINARY +# #define O_BINARY 0 +# #endif +# +# 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 < 1) +# 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> "${ofile}T" || (rm -f "${ofile}T"; exit 1) + + mv -f "${ofile}T" "$ofile" || \ + (rm -f "$ofile" && cp "${ofile}T" "$ofile" && rm -f "${ofile}T") + chmod +x "$ofile" +fi + +])# _LT_AC_LTCONFIG_HACK + +# AC_LIBTOOL_DLOPEN - enable checks for dlopen support +AC_DEFUN([AC_LIBTOOL_DLOPEN], [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])]) + +# AC_LIBTOOL_WIN32_DLL - declare package support for building win32 dll's +AC_DEFUN([AC_LIBTOOL_WIN32_DLL], [AC_BEFORE([$0], [AC_LIBTOOL_SETUP])]) + +# AC_ENABLE_SHARED - implement the --enable-shared flag +# Usage: AC_ENABLE_SHARED[(DEFAULT)] +# Where DEFAULT is either `yes' or `no'. If omitted, it defaults to +# `yes'. +AC_DEFUN([AC_ENABLE_SHARED], +[define([AC_ENABLE_SHARED_DEFAULT], ifelse($1, no, no, yes))dnl +AC_ARG_ENABLE(shared, +changequote(<<, >>)dnl +<< --enable-shared[=PKGS] build shared libraries [default=>>AC_ENABLE_SHARED_DEFAULT], +changequote([, ])dnl +[p=${PACKAGE-default} +case $enableval in +yes) enable_shared=yes ;; +no) enable_shared=no ;; +*) + enable_shared=no + # Look at the argument we got. We use all the common list separators. + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:," + for pkg in $enableval; do + if test "X$pkg" = "X$p"; then + enable_shared=yes + fi + done + IFS="$ac_save_ifs" + ;; +esac], +enable_shared=AC_ENABLE_SHARED_DEFAULT)dnl +]) + +# AC_DISABLE_SHARED - set the default shared flag to --disable-shared +AC_DEFUN([AC_DISABLE_SHARED], +[AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl +AC_ENABLE_SHARED(no)]) + +# AC_ENABLE_STATIC - implement the --enable-static flag +# Usage: AC_ENABLE_STATIC[(DEFAULT)] +# Where DEFAULT is either `yes' or `no'. If omitted, it defaults to +# `yes'. +AC_DEFUN([AC_ENABLE_STATIC], +[define([AC_ENABLE_STATIC_DEFAULT], ifelse($1, no, no, yes))dnl +AC_ARG_ENABLE(static, +changequote(<<, >>)dnl +<< --enable-static[=PKGS] build static libraries [default=>>AC_ENABLE_STATIC_DEFAULT], +changequote([, ])dnl +[p=${PACKAGE-default} +case $enableval in +yes) enable_static=yes ;; +no) enable_static=no ;; +*) + enable_static=no + # Look at the argument we got. We use all the common list separators. + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:," + for pkg in $enableval; do + if test "X$pkg" = "X$p"; then + enable_static=yes + fi + done + IFS="$ac_save_ifs" + ;; +esac], +enable_static=AC_ENABLE_STATIC_DEFAULT)dnl +]) + +# AC_DISABLE_STATIC - set the default static flag to --disable-static +AC_DEFUN([AC_DISABLE_STATIC], +[AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl +AC_ENABLE_STATIC(no)]) + + +# AC_ENABLE_FAST_INSTALL - implement the --enable-fast-install flag +# Usage: AC_ENABLE_FAST_INSTALL[(DEFAULT)] +# Where DEFAULT is either `yes' or `no'. If omitted, it defaults to +# `yes'. +AC_DEFUN([AC_ENABLE_FAST_INSTALL], +[define([AC_ENABLE_FAST_INSTALL_DEFAULT], ifelse($1, no, no, yes))dnl +AC_ARG_ENABLE(fast-install, +changequote(<<, >>)dnl +<< --enable-fast-install[=PKGS] optimize for fast installation [default=>>AC_ENABLE_FAST_INSTALL_DEFAULT], +changequote([, ])dnl +[p=${PACKAGE-default} +case $enableval in +yes) enable_fast_install=yes ;; +no) enable_fast_install=no ;; +*) + enable_fast_install=no + # Look at the argument we got. We use all the common list separators. + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:," + for pkg in $enableval; do + if test "X$pkg" = "X$p"; then + enable_fast_install=yes + fi + done + IFS="$ac_save_ifs" + ;; +esac], +enable_fast_install=AC_ENABLE_FAST_INSTALL_DEFAULT)dnl +]) + +# AC_DISABLE_FAST_INSTALL - set the default to --disable-fast-install +AC_DEFUN([AC_DISABLE_FAST_INSTALL], +[AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl +AC_ENABLE_FAST_INSTALL(no)]) + +# AC_LIBTOOL_PICMODE - implement the --with-pic flag +# Usage: AC_LIBTOOL_PICMODE[(MODE)] +# Where MODE is either `yes' or `no'. If omitted, it defaults to +# `both'. +AC_DEFUN([AC_LIBTOOL_PICMODE], +[AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl +pic_mode=ifelse($#,1,$1,default)]) + + +# AC_PATH_TOOL_PREFIX - find a file program which can recognise shared library +AC_DEFUN([AC_PATH_TOOL_PREFIX], +[AC_MSG_CHECKING([for $1]) +AC_CACHE_VAL(lt_cv_path_MAGIC_CMD, +[case $MAGIC_CMD in + /*) + lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a path. + ;; + ?:/*) + lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a dos path. + ;; + *) + ac_save_MAGIC_CMD="$MAGIC_CMD" + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" +dnl $ac_dummy forces splitting on constant user-supplied paths. +dnl POSIX.2 word splitting is done only on the output of word expansions, +dnl not every word. This closes a longstanding sh security hole. + ac_dummy="ifelse([$2], , $PATH, [$2])" + for ac_dir in $ac_dummy; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$1; then + lt_cv_path_MAGIC_CMD="$ac_dir/$1" + if test -n "$file_magic_test_file"; then + case $deplibs_check_method in + "file_magic "*) + file_magic_regex="`expr \"$deplibs_check_method\" : \"file_magic \(.*\)\"`" + MAGIC_CMD="$lt_cv_path_MAGIC_CMD" + if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null | + egrep "$file_magic_regex" > /dev/null; then + : + else + cat <&2 + +*** Warning: the command libtool uses to detect shared libraries, +*** $file_magic_cmd, produces output that libtool cannot recognize. +*** The result is that libtool may fail to recognize shared libraries +*** as such. This will affect the creation of libtool libraries that +*** depend on shared libraries, but programs linked with such libtool +*** libraries will work regardless of this problem. Nevertheless, you +*** may want to report the problem to your system manager and/or to +*** bug-libtool@gnu.org + +EOF + fi ;; + esac + fi + break + fi + done + IFS="$ac_save_ifs" + MAGIC_CMD="$ac_save_MAGIC_CMD" + ;; +esac]) +MAGIC_CMD="$lt_cv_path_MAGIC_CMD" +if test -n "$MAGIC_CMD"; then + AC_MSG_RESULT($MAGIC_CMD) +else + AC_MSG_RESULT(no) +fi +]) + + +# AC_PATH_MAGIC - find a file program which can recognise a shared library +AC_DEFUN([AC_PATH_MAGIC], +[AC_REQUIRE([AC_CHECK_TOOL_PREFIX])dnl +AC_PATH_TOOL_PREFIX(${ac_tool_prefix}file, /usr/bin:$PATH) +if test -z "$lt_cv_path_MAGIC_CMD"; then + if test -n "$ac_tool_prefix"; then + AC_PATH_TOOL_PREFIX(file, /usr/bin:$PATH) + else + MAGIC_CMD=: + fi +fi +]) + + +# AC_PROG_LD - find the path to the GNU or non-GNU linker +AC_DEFUN([AC_PROG_LD], +[AC_ARG_WITH(gnu-ld, +[ --with-gnu-ld assume the C compiler uses GNU ld [default=no]], +test "$withval" = no || with_gnu_ld=yes, with_gnu_ld=no) +AC_REQUIRE([AC_PROG_CC])dnl +AC_REQUIRE([AC_CANONICAL_HOST])dnl +AC_REQUIRE([AC_CANONICAL_BUILD])dnl +AC_REQUIRE([_LT_AC_LIBTOOL_SYS_PATH_SEPARATOR])dnl +ac_prog=ld +if test "$GCC" = yes; then + # Check if gcc -print-prog-name=ld gives a path. + AC_MSG_CHECKING([for ld used by GCC]) + case $host in + *-*-mingw*) + # gcc leaves a trailing carriage return which upsets mingw + ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;; + *) + ac_prog=`($CC -print-prog-name=ld) 2>&5` ;; + esac + case $ac_prog in + # Accept absolute paths. + [[\\/]]* | [[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 aren't using GCC. + ac_prog=ld + ;; + *) + # If it is relative, then search for the first ld in PATH. + with_gnu_ld=unknown + ;; + esac +elif test "$with_gnu_ld" = yes; then + AC_MSG_CHECKING([for GNU ld]) +else + AC_MSG_CHECKING([for non-GNU ld]) +fi +AC_CACHE_VAL(lt_cv_path_LD, +[if test -z "$LD"; then + IFS="${IFS= }"; ac_save_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 + lt_cv_path_LD="$ac_dir/$ac_prog" + # Check to see if the program is GNU ld. I'd rather use --version, + # but apparently some GNU ld's only accept -v. + # Break only if it was the GNU/non-GNU ld that we prefer. + if "$lt_cv_path_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" +else + lt_cv_path_LD="$LD" # Let the user override the test with a path. +fi]) +LD="$lt_cv_path_LD" +if test -n "$LD"; then + AC_MSG_RESULT($LD) +else + AC_MSG_RESULT(no) +fi +test -z "$LD" && AC_MSG_ERROR([no acceptable ld found in \$PATH]) +AC_PROG_LD_GNU +]) + +# AC_PROG_LD_GNU - +AC_DEFUN([AC_PROG_LD_GNU], +[AC_CACHE_CHECK([if the linker ($LD) is GNU ld], lt_cv_prog_gnu_ld, +[# I'd rather use --version here, but apparently some GNU ld's only accept -v. +if $LD -v 2>&1 &5; then + lt_cv_prog_gnu_ld=yes +else + lt_cv_prog_gnu_ld=no +fi]) +with_gnu_ld=$lt_cv_prog_gnu_ld +]) + +# AC_PROG_LD_RELOAD_FLAG - find reload flag for linker +# -- PORTME Some linkers may need a different reload flag. +AC_DEFUN([AC_PROG_LD_RELOAD_FLAG], +[AC_CACHE_CHECK([for $LD option to reload object files], lt_cv_ld_reload_flag, +[lt_cv_ld_reload_flag='-r']) +reload_flag=$lt_cv_ld_reload_flag +test -n "$reload_flag" && reload_flag=" $reload_flag" +]) + +# AC_DEPLIBS_CHECK_METHOD - how to check for library dependencies +# -- PORTME fill in with the dynamic library characteristics +AC_DEFUN([AC_DEPLIBS_CHECK_METHOD], +[AC_CACHE_CHECK([how to recognise dependent libraries], +lt_cv_deplibs_check_method, +[lt_cv_file_magic_cmd='$MAGIC_CMD' +lt_cv_file_magic_test_file= +lt_cv_deplibs_check_method='unknown' +# Need to set the preceding variable on all platforms that support +# interlibrary dependencies. +# 'none' -- dependencies not supported. +# `unknown' -- same as none, but documents that we really don't know. +# 'pass_all' -- all dependencies passed with no checks. +# 'test_compile' -- check by making test program. +# 'file_magic [[regex]]' -- check by looking for files in library path +# which responds to the $file_magic_cmd with a given 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. + +case $host_os in +aix4* | aix5*) + lt_cv_deplibs_check_method=pass_all + ;; + +beos*) + lt_cv_deplibs_check_method=pass_all + ;; + +bsdi4*) + lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[ML]]SB (shared object|dynamic lib)' + lt_cv_file_magic_cmd='/usr/bin/file -L' + lt_cv_file_magic_test_file=/shlib/libc.so + ;; + +cygwin* | mingw* | pw32*) + lt_cv_deplibs_check_method='file_magic file format pei*-i386(.*architecture: i386)?' + lt_cv_file_magic_cmd='$OBJDUMP -f' + ;; + +darwin* | rhapsody*) + lt_cv_deplibs_check_method='file_magic Mach-O dynamically linked shared library' + lt_cv_file_magic_cmd='/usr/bin/file -L' + case "$host_os" in + rhapsody* | darwin1.[[012]]) + lt_cv_file_magic_test_file=`echo /System/Library/Frameworks/System.framework/Versions/*/System | head -1` + ;; + *) # Darwin 1.3 on + lt_cv_file_magic_test_file='/usr/lib/libSystem.dylib' + ;; + esac + ;; + +freebsd*) + if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then + case $host_cpu in + i*86 ) + # Not sure whether the presence of OpenBSD here was a mistake. + # Let's accept both of them until this is cleared up. + lt_cv_deplibs_check_method='file_magic (FreeBSD|OpenBSD)/i[[3-9]]86 (compact )?demand paged shared library' + lt_cv_file_magic_cmd=/usr/bin/file + lt_cv_file_magic_test_file=`echo /usr/lib/libc.so.*` + ;; + esac + else + lt_cv_deplibs_check_method=pass_all + fi + ;; + +gnu*) + lt_cv_deplibs_check_method=pass_all + ;; + +hpux10.20*|hpux11*) + lt_cv_deplibs_check_method='file_magic (s[[0-9]][[0-9]][[0-9]]|PA-RISC[[0-9]].[[0-9]]) shared library' + lt_cv_file_magic_cmd=/usr/bin/file + lt_cv_file_magic_test_file=/usr/lib/libc.sl + ;; + +irix5* | irix6* | nonstopux*) + case $host_os in + irix5* | nonstopux*) + # this will be overridden with pass_all, but let us keep it just in case + lt_cv_deplibs_check_method="file_magic ELF 32-bit MSB dynamic lib MIPS - version 1" + ;; + *) + case $LD in + *-32|*"-32 ") libmagic=32-bit;; + *-n32|*"-n32 ") libmagic=N32;; + *-64|*"-64 ") libmagic=64-bit;; + *) libmagic=never-match;; + esac + # this will be overridden with pass_all, but let us keep it just in case + lt_cv_deplibs_check_method="file_magic ELF ${libmagic} MSB mips-[[1234]] dynamic lib MIPS - version 1" + ;; + esac + lt_cv_file_magic_test_file=`echo /lib${libsuff}/libc.so*` + lt_cv_deplibs_check_method=pass_all + ;; + +# This must be Linux ELF. +linux-gnu*) + case $host_cpu in + alpha* | hppa* | i*86 | mips | mipsel | powerpc* | sparc* | ia64* | x86_64*) + lt_cv_deplibs_check_method=pass_all ;; + *) + # glibc up to 2.1.1 does not perform some relocations on ARM + lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[LM]]SB (shared object|dynamic lib )' ;; + esac + lt_cv_file_magic_test_file=`echo /lib/libc.so* /lib/libc-*.so` + ;; + +netbsd*) + if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then + lt_cv_deplibs_check_method='match_pattern /lib[[^/\.]]+\.so\.[[0-9]]+\.[[0-9]]+$' + else + lt_cv_deplibs_check_method='match_pattern /lib[[^/\.]]+\.so$' + fi + ;; + +newos6*) + lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[ML]]SB (executable|dynamic lib)' + lt_cv_file_magic_cmd=/usr/bin/file + lt_cv_file_magic_test_file=/usr/lib/libnls.so + ;; + +openbsd*) + lt_cv_file_magic_cmd=/usr/bin/file + lt_cv_file_magic_test_file=`echo /usr/lib/libc.so.*` + if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then + lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[LM]]SB shared object' + else + lt_cv_deplibs_check_method='file_magic OpenBSD.* shared library' + fi + ;; + +osf3* | osf4* | osf5*) + # this will be overridden with pass_all, but let us keep it just in case + lt_cv_deplibs_check_method='file_magic COFF format alpha shared library' + lt_cv_file_magic_test_file=/shlib/libc.so + lt_cv_deplibs_check_method=pass_all + ;; + +sco3.2v5*) + lt_cv_deplibs_check_method=pass_all + ;; + +solaris*) + lt_cv_deplibs_check_method=pass_all + lt_cv_file_magic_test_file=/lib/libc.so + ;; + +sysv5uw[[78]]* | sysv4*uw2*) + lt_cv_deplibs_check_method=pass_all + ;; + +sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) + case $host_vendor in + motorola) + lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[ML]]SB (shared object|dynamic lib) M[[0-9]][[0-9]]* Version [[0-9]]' + lt_cv_file_magic_test_file=`echo /usr/lib/libc.so*` + ;; + ncr) + lt_cv_deplibs_check_method=pass_all + ;; + sequent) + lt_cv_file_magic_cmd='/bin/file' + lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[LM]]SB (shared object|dynamic lib )' + ;; + sni) + lt_cv_file_magic_cmd='/bin/file' + lt_cv_deplibs_check_method="file_magic ELF [[0-9]][[0-9]]*-bit [[LM]]SB dynamic lib" + lt_cv_file_magic_test_file=/lib/libc.so + ;; + siemens) + lt_cv_deplibs_check_method=pass_all + ;; + esac + ;; +esac +]) +file_magic_cmd=$lt_cv_file_magic_cmd +deplibs_check_method=$lt_cv_deplibs_check_method +]) + + +# AC_PROG_NM - find the path to a BSD-compatible name lister +AC_DEFUN([AC_PROG_NM], +[AC_REQUIRE([_LT_AC_LIBTOOL_SYS_PATH_SEPARATOR])dnl +AC_MSG_CHECKING([for BSD-compatible nm]) +AC_CACHE_VAL(lt_cv_path_NM, +[if test -n "$NM"; then + # Let the user override the test. + lt_cv_path_NM="$NM" +else + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=$PATH_SEPARATOR + for ac_dir in $PATH /usr/ccs/bin /usr/ucb /bin; do + test -z "$ac_dir" && ac_dir=. + tmp_nm=$ac_dir/${ac_tool_prefix}nm + if test -f $tmp_nm || test -f $tmp_nm$ac_exeext ; then + # Check to see if the nm accepts a BSD-compat flag. + # Adding the `sed 1q' prevents false positives on HP-UX, which says: + # nm: unknown option "B" ignored + # Tru64's nm complains that /dev/null is an invalid object file + if ($tmp_nm -B /dev/null 2>&1 | sed '1q'; exit 0) | egrep '(/dev/null|Invalid file or object type)' >/dev/null; then + lt_cv_path_NM="$tmp_nm -B" + break + elif ($tmp_nm -p /dev/null 2>&1 | sed '1q'; exit 0) | egrep /dev/null >/dev/null; then + lt_cv_path_NM="$tmp_nm -p" + break + else + lt_cv_path_NM=${lt_cv_path_NM="$tmp_nm"} # keep the first match, but + continue # so that we can try to find one that supports BSD flags + fi + fi + done + IFS="$ac_save_ifs" + test -z "$lt_cv_path_NM" && lt_cv_path_NM=nm +fi]) +NM="$lt_cv_path_NM" +AC_MSG_RESULT([$NM]) +]) + +# AC_CHECK_LIBM - check for math library +AC_DEFUN([AC_CHECK_LIBM], +[AC_REQUIRE([AC_CANONICAL_HOST])dnl +LIBM= +case $host in +*-*-beos* | *-*-cygwin* | *-*-pw32*) + # These system don't have libm + ;; +*-ncr-sysv4.3*) + AC_CHECK_LIB(mw, _mwvalidcheckl, LIBM="-lmw") + AC_CHECK_LIB(m, main, LIBM="$LIBM -lm") + ;; +*) + AC_CHECK_LIB(m, main, LIBM="-lm") + ;; +esac +]) + +# AC_LIBLTDL_CONVENIENCE[(dir)] - sets LIBLTDL to the link flags for +# the libltdl convenience library and LTDLINCL to the include flags for +# the libltdl header and adds --enable-ltdl-convenience to the +# configure arguments. Note that LIBLTDL and LTDLINCL are not +# AC_SUBSTed, nor is AC_CONFIG_SUBDIRS called. If DIR is not +# provided, it is assumed to be `libltdl'. LIBLTDL will be prefixed +# with '${top_builddir}/' and LTDLINCL will be prefixed with +# '${top_srcdir}/' (note the single quotes!). If your package is not +# flat and you're not using automake, define top_builddir and +# top_srcdir appropriately in the Makefiles. +AC_DEFUN([AC_LIBLTDL_CONVENIENCE], +[AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl + case $enable_ltdl_convenience in + no) AC_MSG_ERROR([this package needs a convenience libltdl]) ;; + "") enable_ltdl_convenience=yes + ac_configure_args="$ac_configure_args --enable-ltdl-convenience" ;; + esac + LIBLTDL='${top_builddir}/'ifelse($#,1,[$1],['libltdl'])/libltdlc.la + LTDLINCL='-I${top_srcdir}/'ifelse($#,1,[$1],['libltdl']) + # For backwards non-gettext consistent compatibility... + INCLTDL="$LTDLINCL" +]) + +# AC_LIBLTDL_INSTALLABLE[(dir)] - sets LIBLTDL to the link flags for +# the libltdl installable library and LTDLINCL to the include flags for +# the libltdl header and adds --enable-ltdl-install to the configure +# arguments. Note that LIBLTDL and LTDLINCL are not AC_SUBSTed, nor is +# AC_CONFIG_SUBDIRS called. If DIR is not provided and an installed +# libltdl is not found, it is assumed to be `libltdl'. LIBLTDL will +# be prefixed with '${top_builddir}/' and LTDLINCL will be prefixed +# with '${top_srcdir}/' (note the single quotes!). If your package is +# not flat and you're not using automake, define top_builddir and +# top_srcdir appropriately in the Makefiles. +# In the future, this macro may have to be called after AC_PROG_LIBTOOL. +AC_DEFUN([AC_LIBLTDL_INSTALLABLE], +[AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl + AC_CHECK_LIB(ltdl, main, + [test x"$enable_ltdl_install" != xyes && enable_ltdl_install=no], + [if test x"$enable_ltdl_install" = xno; then + AC_MSG_WARN([libltdl not installed, but installation disabled]) + else + enable_ltdl_install=yes + fi + ]) + if test x"$enable_ltdl_install" = x"yes"; then + ac_configure_args="$ac_configure_args --enable-ltdl-install" + LIBLTDL='${top_builddir}/'ifelse($#,1,[$1],['libltdl'])/libltdl.la + LTDLINCL='-I${top_srcdir}/'ifelse($#,1,[$1],['libltdl']) + else + ac_configure_args="$ac_configure_args --enable-ltdl-install=no" + LIBLTDL="-lltdl" + LTDLINCL= + fi + # For backwards non-gettext consistent compatibility... + INCLTDL="$LTDLINCL" +]) + +# old names +AC_DEFUN([AM_PROG_LIBTOOL], [AC_PROG_LIBTOOL]) +AC_DEFUN([AM_ENABLE_SHARED], [AC_ENABLE_SHARED($@)]) +AC_DEFUN([AM_ENABLE_STATIC], [AC_ENABLE_STATIC($@)]) +AC_DEFUN([AM_DISABLE_SHARED], [AC_DISABLE_SHARED($@)]) +AC_DEFUN([AM_DISABLE_STATIC], [AC_DISABLE_STATIC($@)]) +AC_DEFUN([AM_PROG_LD], [AC_PROG_LD]) +AC_DEFUN([AM_PROG_NM], [AC_PROG_NM]) + +# This is just to silence aclocal about the macro not being used +ifelse([AC_DISABLE_FAST_INSTALL]) + +# NOTE: This macro has been submitted for inclusion into # +# GNU Autoconf as AC_PROG_SED. When it is available in # +# a released version of Autoconf we should remove this # +# macro and use it instead. # +# LT_AC_PROG_SED +# -------------- +# Check for a fully-functional sed program, that truncates +# as few characters as possible. Prefer GNU sed if found. +AC_DEFUN([LT_AC_PROG_SED], +[AC_MSG_CHECKING([for a sed that does not truncate output]) +AC_CACHE_VAL(lt_cv_path_SED, +[# Loop through the user's path and test for sed and gsed. +# Then use that list of sed's as ones to test for truncation. +as_executable_p="test -f" +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_prog in sed gsed; do + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_prog$ac_exec_ext"; then + _sed_list="$_sed_list $as_dir/$ac_prog$ac_exec_ext" + fi + done + done +done + + # Create a temporary directory, and hook for its removal unless debugging. +$debug || +{ + trap 'exit_status=$?; rm -rf $tmp && exit $exit_status' 0 + trap '{ (exit 1); exit 1; }' 1 2 13 15 +} + +# Create a (secure) tmp directory for tmp files. +: ${TMPDIR=/tmp} +{ + tmp=`(umask 077 && mktemp -d -q "$TMPDIR/sedXXXXXX") 2>/dev/null` && + test -n "$tmp" && test -d "$tmp" +} || +{ + tmp=$TMPDIR/sed$$-$RANDOM + (umask 077 && mkdir $tmp) +} || +{ + echo "$me: cannot create a temporary directory in $TMPDIR" >&2 + { (exit 1); exit 1; } +} + _max=0 + _count=0 + # Add /usr/xpg4/bin/sed as it is typically found on Solaris + # along with /bin/sed that truncates output. + for _sed in $_sed_list /usr/xpg4/bin/sed; do + test ! -f ${_sed} && break + cat /dev/null > "$tmp/sed.in" + _count=0 + echo ${ECHO_N-$ac_n} "0123456789${ECHO_C-$ac_c}" >"$tmp/sed.in" + # Check for GNU sed and select it if it is found. + if "${_sed}" --version 2>&1 < /dev/null | egrep '(GNU)' > /dev/null; then + lt_cv_path_SED=${_sed} + break + fi + while true; do + cat "$tmp/sed.in" "$tmp/sed.in" >"$tmp/sed.tmp" + mv "$tmp/sed.tmp" "$tmp/sed.in" + cp "$tmp/sed.in" "$tmp/sed.nl" + echo >>"$tmp/sed.nl" + ${_sed} -e 's/a$//' < "$tmp/sed.nl" >"$tmp/sed.out" || break + cmp -s "$tmp/sed.out" "$tmp/sed.nl" || break + # 40000 chars as input seems more than enough + test $_count -gt 10 && break + _count=`expr $_count + 1` + if test $_count -gt $_max; then + _max=$_count + lt_cv_path_SED=$_sed + fi + done + done + rm -rf "$tmp" +]) +if test "X$SED" != "X"; then + lt_cv_path_SED=$SED +else + SED=$lt_cv_path_SED +fi +AC_MSG_RESULT([$SED]) +]) + diff --git a/bootstrap b/bootstrap new file mode 100755 index 0000000..60e3818 --- /dev/null +++ b/bootstrap @@ -0,0 +1,6 @@ +#!/bin/sh +set -x +aclocal -I config +autoheader +automake --add-missing --copy +autoconf diff --git a/config.h.in b/config.h.in new file mode 100644 index 0000000..8161c06 --- /dev/null +++ b/config.h.in @@ -0,0 +1,97 @@ +/* config.h.in. Generated from configure.in by autoheader. */ + +/* Define if cefs is to be built. */ +#undef HAS_CEFS + +/* Define if gvfs is to be built. */ +#undef HAS_GVFS + +/* Define if libchipcard is present. */ +#undef HAS_LIBCHIPCARD + +/* Define if ssh is found. */ +#undef HAS_SSH + +/* Define to 1 if you have the header file. */ +#undef HAVE_BYTESWAP_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_DLFCN_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_ENDIAN_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_INTTYPES_H + +/* Define to 1 if you have the `pthread' library (-lpthread). */ +#undef HAVE_LIBPTHREAD + +/* Define to 1 if you have the header file. */ +#undef HAVE_MACHINE_ENDIAN_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_MEMORY_H + +/* Define to 1 if you have the `mkdir' function. */ +#undef HAVE_MKDIR + +/* Define to 1 if you have the `rmdir' function. */ +#undef HAVE_RMDIR + +/* Define to 1 if you have the header file. */ +#undef HAVE_STDINT_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_STDLIB_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_STRINGS_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_STRING_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_BYTESWAP_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_STAT_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_TYPES_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_UNISTD_H + +/* Path to the information file for the RAPI library */ +#undef INFOFILE + +/* Name of package */ +#undef PACKAGE + +/* Define to the address where bug reports for this package should be sent. */ +#undef PACKAGE_BUGREPORT + +/* Define to the full name of this package. */ +#undef PACKAGE_NAME + +/* Define to the full name and version of this package. */ +#undef PACKAGE_STRING + +/* Define to the one symbol short name of this package. */ +#undef PACKAGE_TARNAME + +/* Define to the version of this package. */ +#undef PACKAGE_VERSION + +/* Define to 1 if you have the ANSI C header files. */ +#undef STDC_HEADERS + +/* Version number of package */ +#undef VERSION + +/* Define to empty if `const' does not conform to ANSI C. */ +#undef const + +/* Define to `int' if does not define. */ +#undef pid_t diff --git a/config/Makefile.am b/config/Makefile.am new file mode 100644 index 0000000..bb265da --- /dev/null +++ b/config/Makefile.am @@ -0,0 +1 @@ +AUX_DIST=config.guess config.sub install-sh ltmain.sh missing mkinstalldirs diff --git a/config/Makefile.in b/config/Makefile.in new file mode 100644 index 0000000..7f33d9c --- /dev/null +++ b/config/Makefile.in @@ -0,0 +1,302 @@ +# Makefile.in generated by automake 1.7.5 from Makefile.am. +# @configure_input@ + +# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003 +# Free Software Foundation, Inc. +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ + +srcdir = @srcdir@ +top_srcdir = @top_srcdir@ +VPATH = @srcdir@ +pkgdatadir = $(datadir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +top_builddir = .. + +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +INSTALL = @INSTALL@ +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = @build@ +host_triplet = @host@ +target_triplet = @target@ +ACLOCAL = @ACLOCAL@ +AMDEP_FALSE = @AMDEP_FALSE@ +AMDEP_TRUE = @AMDEP_TRUE@ +AMTAR = @AMTAR@ +AUTOCONF = @AUTOCONF@ +AUTOFS_INSTALL = @AUTOFS_INSTALL@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CXX = @CXX@ +CXXDEPMODE = @CXXDEPMODE@ +CXXFLAGS = @CXXFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DEBUG_FLAGS = @DEBUG_FLAGS@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +ECHO = @ECHO@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +EXEEXT = @EXEEXT@ +GCONF = @GCONF@ +GVFSCONF = @GVFSCONF@ +GVFS_CFLAGS = @GVFS_CFLAGS@ +GVFS_LDADD = @GVFS_LDADD@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +KDEBUG_FLAGS = @KDEBUG_FLAGS@ +KERNEL_DIR = @KERNEL_DIR@ +KERNEL_HDR = @KERNEL_HDR@ +LDFLAGS = @LDFLAGS@ +LIBCHIPCARD_INCLUDES = @LIBCHIPCARD_INCLUDES@ +LIBCHIPCARD_LIB = @LIBCHIPCARD_LIB@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LIBTOOL = @LIBTOOL@ +LN_S = @LN_S@ +LTLIBOBJS = @LTLIBOBJS@ +LUFS_SUID = @LUFS_SUID@ +MAKEINFO = @MAKEINFO@ +MODULES_DIR = @MODULES_DIR@ +MODV_FLAGS = @MODV_FLAGS@ +OBJEXT = @OBJEXT@ +OS_DIR = @OS_DIR@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +RANLIB = @RANLIB@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +SSHPROG = @SSHPROG@ +STRIP = @STRIP@ +VERSION = @VERSION@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_CXX = @ac_ct_CXX@ +ac_ct_RANLIB = @ac_ct_RANLIB@ +ac_ct_STRIP = @ac_ct_STRIP@ +all_includes = @all_includes@ +all_libraries = @all_libraries@ +am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ +am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ +am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@ +am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +datadir = @datadir@ +define_has_libchipcard = @define_has_libchipcard@ +exec_prefix = @exec_prefix@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localstatedir = @localstatedir@ +mandir = @mandir@ +oldincludedir = @oldincludedir@ +opt_fs = @opt_fs@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +sysconfdir = @sysconfdir@ +target = @target@ +target_alias = @target_alias@ +target_cpu = @target_cpu@ +target_os = @target_os@ +target_vendor = @target_vendor@ +AUX_DIST = config.guess config.sub install-sh ltmain.sh missing mkinstalldirs +subdir = config +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +mkinstalldirs = $(SHELL) $(top_srcdir)/config/mkinstalldirs +CONFIG_HEADER = $(top_builddir)/config.h +CONFIG_CLEAN_FILES = +DIST_SOURCES = +DIST_COMMON = Makefile.am Makefile.in config.guess config.sub depcomp \ + install-sh ltmain.sh missing mkinstalldirs +all: all-am + +.SUFFIXES: +$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4) + cd $(top_srcdir) && \ + $(AUTOMAKE) --gnu config/Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe) + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs + +distclean-libtool: + -rm -f libtool +uninstall-info-am: +tags: TAGS +TAGS: + +ctags: CTAGS +CTAGS: + +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) + +top_distdir = .. +distdir = $(top_distdir)/$(PACKAGE)-$(VERSION) + +distdir: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \ + list='$(DISTFILES)'; for file in $$list; do \ + case $$file in \ + $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ + $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ + esac; \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test "$$dir" != "$$file" && test "$$dir" != "."; then \ + dir="/$$dir"; \ + $(mkinstalldirs) "$(distdir)$$dir"; \ + else \ + dir=''; \ + fi; \ + if test -d $$d/$$file; then \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ + fi; \ + cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ + else \ + test -f $(distdir)/$$file \ + || cp -p $$d/$$file $(distdir)/$$file \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-am +all-am: Makefile + +installdirs: +install: install-am +install-exec: install-exec-am +install-data: install-data-am +uninstall: uninstall-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-am +install-strip: + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + INSTALL_STRIP_FLAG=-s \ + `test -z '$(STRIP)' || \ + echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -rm -f Makefile $(CONFIG_CLEAN_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +clean: clean-am + +clean-am: clean-generic clean-libtool mostlyclean-am + +distclean: distclean-am + +distclean-am: clean-am distclean-generic distclean-libtool + +dvi: dvi-am + +dvi-am: + +info: info-am + +info-am: + +install-data-am: + +install-exec-am: + +install-info: install-info-am + +install-man: + +installcheck-am: + +maintainer-clean: maintainer-clean-am + +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-generic mostlyclean-libtool + +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + +uninstall-am: uninstall-info-am + +.PHONY: all all-am check check-am clean clean-generic clean-libtool \ + distclean distclean-generic distclean-libtool distdir dvi \ + dvi-am info info-am install install-am install-data \ + install-data-am install-exec install-exec-am install-info \ + install-info-am install-man install-strip installcheck \ + installcheck-am installdirs maintainer-clean \ + maintainer-clean-generic mostlyclean mostlyclean-generic \ + mostlyclean-libtool pdf pdf-am ps ps-am uninstall uninstall-am \ + uninstall-info-am + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/config/config.guess b/config/config.guess new file mode 100755 index 0000000..dff9e48 --- /dev/null +++ b/config/config.guess @@ -0,0 +1,1317 @@ +#! /bin/sh +# Attempt to guess a canonical system name. +# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001 +# Free Software Foundation, Inc. + +timestamp='2001-09-04' + +# 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. + +# Written by Per Bothner . +# Please send patches to . +# +# This script attempts to guess a canonical system name similar to +# config.sub. If it succeeds, it prints the system name on stdout, and +# exits with 0. Otherwise, it exits with 1. +# +# The plan is that this can be called by configure scripts if you +# don't specify an explicit build system type. + +me=`echo "$0" | sed -e 's,.*/,,'` + +usage="\ +Usage: $0 [OPTION] + +Output the configuration name of the system \`$me' is run on. + +Operation modes: + -h, --help print this help, then exit + -t, --time-stamp print date of last modification, then exit + -v, --version print version number, then exit + +Report bugs and patches to ." + +version="\ +GNU config.guess ($timestamp) + +Originally written by Per Bothner. +Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001 +Free Software Foundation, Inc. + +This is free software; see the source for copying conditions. There is NO +warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." + +help=" +Try \`$me --help' for more information." + +# Parse command line +while test $# -gt 0 ; do + case $1 in + --time-stamp | --time* | -t ) + echo "$timestamp" ; exit 0 ;; + --version | -v ) + echo "$version" ; exit 0 ;; + --help | --h* | -h ) + echo "$usage"; exit 0 ;; + -- ) # Stop option processing + shift; break ;; + - ) # Use stdin as input. + break ;; + -* ) + echo "$me: invalid option $1$help" >&2 + exit 1 ;; + * ) + break ;; + esac +done + +if test $# != 0; then + echo "$me: too many arguments$help" >&2 + exit 1 +fi + + +dummy=dummy-$$ +trap 'rm -f $dummy.c $dummy.o $dummy.rel $dummy; exit 1' 1 2 15 + +# CC_FOR_BUILD -- compiler used by this script. +# Historically, `CC_FOR_BUILD' used to be named `HOST_CC'. We still +# use `HOST_CC' if defined, but it is deprecated. + +set_cc_for_build='case $CC_FOR_BUILD,$HOST_CC,$CC in + ,,) echo "int dummy(){}" > $dummy.c ; + for c in cc gcc c89 ; do + ($c $dummy.c -c -o $dummy.o) >/dev/null 2>&1 ; + if test $? = 0 ; then + CC_FOR_BUILD="$c"; break ; + fi ; + done ; + rm -f $dummy.c $dummy.o $dummy.rel ; + if test x"$CC_FOR_BUILD" = x ; then + CC_FOR_BUILD=no_compiler_found ; + fi + ;; + ,,*) CC_FOR_BUILD=$CC ;; + ,*,*) CC_FOR_BUILD=$HOST_CC ;; +esac' + +# This is needed to find uname on a Pyramid OSx when run in the BSD universe. +# (ghazi@noc.rutgers.edu 1994-08-24) +if (test -f /.attbin/uname) >/dev/null 2>&1 ; then + PATH=$PATH:/.attbin ; export PATH +fi + +UNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown +UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown +UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown +UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown + +# Note: order is significant - the case branches are not exclusive. + +case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in + *:NetBSD:*:*) + # Netbsd (nbsd) targets should (where applicable) match one or + # more of the tupples: *-*-netbsdelf*, *-*-netbsdaout*, + # *-*-netbsdecoff* and *-*-netbsd*. For targets that recently + # switched to ELF, *-*-netbsd* would select the old + # object file format. This provides both forward + # compatibility and a consistent mechanism for selecting the + # object file format. + # Determine the machine/vendor (is the vendor relevant). + case "${UNAME_MACHINE}" in + amiga) machine=m68k-unknown ;; + arm32) machine=arm-unknown ;; + atari*) machine=m68k-atari ;; + sun3*) machine=m68k-sun ;; + mac68k) machine=m68k-apple ;; + macppc) machine=powerpc-apple ;; + hp3[0-9][05]) machine=m68k-hp ;; + ibmrt|romp-ibm) machine=romp-ibm ;; + *) machine=${UNAME_MACHINE}-unknown ;; + esac + # The Operating System including object format, if it has switched + # to ELF recently, or will in the future. + case "${UNAME_MACHINE}" in + i386|sparc|amiga|arm*|hp300|mvme68k|vax|atari|luna68k|mac68k|news68k|next68k|pc532|sun3*|x68k) + eval $set_cc_for_build + if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \ + | grep __ELF__ >/dev/null + then + # Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout). + # Return netbsd for either. FIX? + os=netbsd + else + os=netbsdelf + fi + ;; + *) + os=netbsd + ;; + esac + # The OS release + release=`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'` + # Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM: + # contains redundant information, the shorter form: + # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used. + echo "${machine}-${os}${release}" + exit 0 ;; + alpha:OSF1:*:*) + if test $UNAME_RELEASE = "V4.0"; then + UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'` + fi + # A Vn.n version is a released version. + # A Tn.n version is a released field test version. + # A Xn.n version is an unreleased experimental baselevel. + # 1.2 uses "1.2" for uname -r. + cat <$dummy.s + .data +\$Lformat: + .byte 37,100,45,37,120,10,0 # "%d-%x\n" + + .text + .globl main + .align 4 + .ent main +main: + .frame \$30,16,\$26,0 + ldgp \$29,0(\$27) + .prologue 1 + .long 0x47e03d80 # implver \$0 + lda \$2,-1 + .long 0x47e20c21 # amask \$2,\$1 + lda \$16,\$Lformat + mov \$0,\$17 + not \$1,\$18 + jsr \$26,printf + ldgp \$29,0(\$26) + mov 0,\$16 + jsr \$26,exit + .end main +EOF + eval $set_cc_for_build + $CC_FOR_BUILD $dummy.s -o $dummy 2>/dev/null + if test "$?" = 0 ; then + case `./$dummy` in + 0-0) + UNAME_MACHINE="alpha" + ;; + 1-0) + UNAME_MACHINE="alphaev5" + ;; + 1-1) + UNAME_MACHINE="alphaev56" + ;; + 1-101) + UNAME_MACHINE="alphapca56" + ;; + 2-303) + UNAME_MACHINE="alphaev6" + ;; + 2-307) + UNAME_MACHINE="alphaev67" + ;; + 2-1307) + UNAME_MACHINE="alphaev68" + ;; + esac + fi + rm -f $dummy.s $dummy + echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[VTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` + exit 0 ;; + Alpha\ *:Windows_NT*:*) + # How do we know it's Interix rather than the generic POSIX subsystem? + # Should we change UNAME_MACHINE based on the output of uname instead + # of the specific Alpha model? + echo alpha-pc-interix + exit 0 ;; + 21064:Windows_NT:50:3) + echo alpha-dec-winnt3.5 + exit 0 ;; + Amiga*:UNIX_System_V:4.0:*) + echo m68k-unknown-sysv4 + exit 0;; + amiga:OpenBSD:*:*) + echo m68k-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + *:[Aa]miga[Oo][Ss]:*:*) + echo ${UNAME_MACHINE}-unknown-amigaos + exit 0 ;; + arc64:OpenBSD:*:*) + echo mips64el-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + arc:OpenBSD:*:*) + echo mipsel-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + hkmips:OpenBSD:*:*) + echo mips-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + pmax:OpenBSD:*:*) + echo mipsel-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + sgi:OpenBSD:*:*) + echo mips-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + wgrisc:OpenBSD:*:*) + echo mipsel-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + *:OS/390:*:*) + echo i370-ibm-openedition + exit 0 ;; + arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*) + echo arm-acorn-riscix${UNAME_RELEASE} + exit 0;; + SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*) + echo hppa1.1-hitachi-hiuxmpp + exit 0;; + Pyramid*:OSx*:*:* | MIS*:OSx*:*:* | MIS*:SMP_DC-OSx*:*:*) + # akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE. + if test "`(/bin/universe) 2>/dev/null`" = att ; then + echo pyramid-pyramid-sysv3 + else + echo pyramid-pyramid-bsd + fi + exit 0 ;; + NILE*:*:*:dcosx) + echo pyramid-pyramid-svr4 + exit 0 ;; + sun4H:SunOS:5.*:*) + echo sparc-hal-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` + exit 0 ;; + sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*) + echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` + exit 0 ;; + i86pc:SunOS:5.*:*) + echo i386-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` + exit 0 ;; + sun4*:SunOS:6*:*) + # According to config.sub, this is the proper way to canonicalize + # SunOS6. Hard to guess exactly what SunOS6 will be like, but + # it's likely to be more like Solaris than SunOS4. + echo sparc-sun-solaris3`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` + exit 0 ;; + sun4*:SunOS:*:*) + case "`/usr/bin/arch -k`" in + Series*|S4*) + UNAME_RELEASE=`uname -v` + ;; + esac + # Japanese Language versions have a version number like `4.1.3-JL'. + echo sparc-sun-sunos`echo ${UNAME_RELEASE}|sed -e 's/-/_/'` + exit 0 ;; + sun3*:SunOS:*:*) + echo m68k-sun-sunos${UNAME_RELEASE} + exit 0 ;; + sun*:*:4.2BSD:*) + UNAME_RELEASE=`(head -1 /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null` + test "x${UNAME_RELEASE}" = "x" && UNAME_RELEASE=3 + case "`/bin/arch`" in + sun3) + echo m68k-sun-sunos${UNAME_RELEASE} + ;; + sun4) + echo sparc-sun-sunos${UNAME_RELEASE} + ;; + esac + exit 0 ;; + aushp:SunOS:*:*) + echo sparc-auspex-sunos${UNAME_RELEASE} + exit 0 ;; + sparc*:NetBSD:*) + echo `uname -p`-unknown-netbsd${UNAME_RELEASE} + exit 0 ;; + atari*:OpenBSD:*:*) + echo m68k-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + # The situation for MiNT is a little confusing. The machine name + # can be virtually everything (everything which is not + # "atarist" or "atariste" at least should have a processor + # > m68000). The system name ranges from "MiNT" over "FreeMiNT" + # to the lowercase version "mint" (or "freemint"). Finally + # the system name "TOS" denotes a system which is actually not + # MiNT. But MiNT is downward compatible to TOS, so this should + # be no problem. + atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*) + echo m68k-atari-mint${UNAME_RELEASE} + exit 0 ;; + atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*) + echo m68k-atari-mint${UNAME_RELEASE} + exit 0 ;; + *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*) + echo m68k-atari-mint${UNAME_RELEASE} + exit 0 ;; + milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*) + echo m68k-milan-mint${UNAME_RELEASE} + exit 0 ;; + hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*) + echo m68k-hades-mint${UNAME_RELEASE} + exit 0 ;; + *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*) + echo m68k-unknown-mint${UNAME_RELEASE} + exit 0 ;; + sun3*:OpenBSD:*:*) + echo m68k-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + mac68k:OpenBSD:*:*) + echo m68k-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + mvme68k:OpenBSD:*:*) + echo m68k-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + mvme88k:OpenBSD:*:*) + echo m88k-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + powerpc:machten:*:*) + echo powerpc-apple-machten${UNAME_RELEASE} + exit 0 ;; + RISC*:Mach:*:*) + echo mips-dec-mach_bsd4.3 + exit 0 ;; + RISC*:ULTRIX:*:*) + echo mips-dec-ultrix${UNAME_RELEASE} + exit 0 ;; + VAX*:ULTRIX*:*:*) + echo vax-dec-ultrix${UNAME_RELEASE} + exit 0 ;; + 2020:CLIX:*:* | 2430:CLIX:*:*) + echo clipper-intergraph-clix${UNAME_RELEASE} + exit 0 ;; + mips:*:*:UMIPS | mips:*:*:RISCos) + eval $set_cc_for_build + sed 's/^ //' << EOF >$dummy.c +#ifdef __cplusplus +#include /* for printf() prototype */ + int main (int argc, char *argv[]) { +#else + int main (argc, argv) int argc; char *argv[]; { +#endif + #if defined (host_mips) && defined (MIPSEB) + #if defined (SYSTYPE_SYSV) + printf ("mips-mips-riscos%ssysv\n", argv[1]); exit (0); + #endif + #if defined (SYSTYPE_SVR4) + printf ("mips-mips-riscos%ssvr4\n", argv[1]); exit (0); + #endif + #if defined (SYSTYPE_BSD43) || defined(SYSTYPE_BSD) + printf ("mips-mips-riscos%sbsd\n", argv[1]); exit (0); + #endif + #endif + exit (-1); + } +EOF + $CC_FOR_BUILD $dummy.c -o $dummy \ + && ./$dummy `echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` \ + && rm -f $dummy.c $dummy && exit 0 + rm -f $dummy.c $dummy + echo mips-mips-riscos${UNAME_RELEASE} + exit 0 ;; + Motorola:PowerMAX_OS:*:*) + echo powerpc-motorola-powermax + exit 0 ;; + Night_Hawk:Power_UNIX:*:*) + echo powerpc-harris-powerunix + exit 0 ;; + m88k:CX/UX:7*:*) + echo m88k-harris-cxux7 + exit 0 ;; + m88k:*:4*:R4*) + echo m88k-motorola-sysv4 + exit 0 ;; + m88k:*:3*:R3*) + echo m88k-motorola-sysv3 + exit 0 ;; + AViiON:dgux:*:*) + # DG/UX returns AViiON for all architectures + UNAME_PROCESSOR=`/usr/bin/uname -p` + if [ $UNAME_PROCESSOR = mc88100 ] || [ $UNAME_PROCESSOR = mc88110 ] + then + if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx ] || \ + [ ${TARGET_BINARY_INTERFACE}x = x ] + then + echo m88k-dg-dgux${UNAME_RELEASE} + else + echo m88k-dg-dguxbcs${UNAME_RELEASE} + fi + else + echo i586-dg-dgux${UNAME_RELEASE} + fi + exit 0 ;; + M88*:DolphinOS:*:*) # DolphinOS (SVR3) + echo m88k-dolphin-sysv3 + exit 0 ;; + M88*:*:R3*:*) + # Delta 88k system running SVR3 + echo m88k-motorola-sysv3 + exit 0 ;; + XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3) + echo m88k-tektronix-sysv3 + exit 0 ;; + Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD) + echo m68k-tektronix-bsd + exit 0 ;; + *:IRIX*:*:*) + echo mips-sgi-irix`echo ${UNAME_RELEASE}|sed -e 's/-/_/g'` + exit 0 ;; + ????????:AIX?:[12].1:2) # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX. + echo romp-ibm-aix # uname -m gives an 8 hex-code CPU id + exit 0 ;; # Note that: echo "'`uname -s`'" gives 'AIX ' + i*86:AIX:*:*) + echo i386-ibm-aix + exit 0 ;; + ia64:AIX:*:*) + if [ -x /usr/bin/oslevel ] ; then + IBM_REV=`/usr/bin/oslevel` + else + IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE} + fi + echo ${UNAME_MACHINE}-ibm-aix${IBM_REV} + exit 0 ;; + *:AIX:2:3) + if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then + eval $set_cc_for_build + sed 's/^ //' << EOF >$dummy.c + #include + + main() + { + if (!__power_pc()) + exit(1); + puts("powerpc-ibm-aix3.2.5"); + exit(0); + } +EOF + $CC_FOR_BUILD $dummy.c -o $dummy && ./$dummy && rm -f $dummy.c $dummy && exit 0 + rm -f $dummy.c $dummy + echo rs6000-ibm-aix3.2.5 + elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then + echo rs6000-ibm-aix3.2.4 + else + echo rs6000-ibm-aix3.2 + fi + exit 0 ;; + *:AIX:*:[45]) + IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | head -1 | awk '{ print $1 }'` + if /usr/sbin/lsattr -El ${IBM_CPU_ID} | grep ' POWER' >/dev/null 2>&1; then + IBM_ARCH=rs6000 + else + IBM_ARCH=powerpc + fi + if [ -x /usr/bin/oslevel ] ; then + IBM_REV=`/usr/bin/oslevel` + else + IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE} + fi + echo ${IBM_ARCH}-ibm-aix${IBM_REV} + exit 0 ;; + *:AIX:*:*) + echo rs6000-ibm-aix + exit 0 ;; + ibmrt:4.4BSD:*|romp-ibm:BSD:*) + echo romp-ibm-bsd4.4 + exit 0 ;; + ibmrt:*BSD:*|romp-ibm:BSD:*) # covers RT/PC BSD and + echo romp-ibm-bsd${UNAME_RELEASE} # 4.3 with uname added to + exit 0 ;; # report: romp-ibm BSD 4.3 + *:BOSX:*:*) + echo rs6000-bull-bosx + exit 0 ;; + DPX/2?00:B.O.S.:*:*) + echo m68k-bull-sysv3 + exit 0 ;; + 9000/[34]??:4.3bsd:1.*:*) + echo m68k-hp-bsd + exit 0 ;; + hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*) + echo m68k-hp-bsd4.4 + exit 0 ;; + 9000/[34678]??:HP-UX:*:*) + HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` + case "${UNAME_MACHINE}" in + 9000/31? ) HP_ARCH=m68000 ;; + 9000/[34]?? ) HP_ARCH=m68k ;; + 9000/[678][0-9][0-9]) + case "${HPUX_REV}" in + 11.[0-9][0-9]) + if [ -x /usr/bin/getconf ]; then + sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null` + sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null` + case "${sc_cpu_version}" in + 523) HP_ARCH="hppa1.0" ;; # CPU_PA_RISC1_0 + 528) HP_ARCH="hppa1.1" ;; # CPU_PA_RISC1_1 + 532) # CPU_PA_RISC2_0 + case "${sc_kernel_bits}" in + 32) HP_ARCH="hppa2.0n" ;; + 64) HP_ARCH="hppa2.0w" ;; + esac ;; + esac + fi ;; + esac + if [ "${HP_ARCH}" = "" ]; then + eval $set_cc_for_build + sed 's/^ //' << EOF >$dummy.c + + #define _HPUX_SOURCE + #include + #include + + int main () + { + #if defined(_SC_KERNEL_BITS) + long bits = sysconf(_SC_KERNEL_BITS); + #endif + long cpu = sysconf (_SC_CPU_VERSION); + + switch (cpu) + { + case CPU_PA_RISC1_0: puts ("hppa1.0"); break; + case CPU_PA_RISC1_1: puts ("hppa1.1"); break; + case CPU_PA_RISC2_0: + #if defined(_SC_KERNEL_BITS) + switch (bits) + { + case 64: puts ("hppa2.0w"); break; + case 32: puts ("hppa2.0n"); break; + default: puts ("hppa2.0"); break; + } break; + #else /* !defined(_SC_KERNEL_BITS) */ + puts ("hppa2.0"); break; + #endif + default: puts ("hppa1.0"); break; + } + exit (0); + } +EOF + (CCOPTS= $CC_FOR_BUILD $dummy.c -o $dummy 2>/dev/null ) && HP_ARCH=`./$dummy` + if test -z "$HP_ARCH"; then HP_ARCH=hppa; fi + rm -f $dummy.c $dummy + fi ;; + esac + echo ${HP_ARCH}-hp-hpux${HPUX_REV} + exit 0 ;; + ia64:HP-UX:*:*) + HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` + echo ia64-hp-hpux${HPUX_REV} + exit 0 ;; + 3050*:HI-UX:*:*) + eval $set_cc_for_build + sed 's/^ //' << EOF >$dummy.c + #include + int + main () + { + long cpu = sysconf (_SC_CPU_VERSION); + /* The order matters, because CPU_IS_HP_MC68K erroneously returns + true for CPU_PA_RISC1_0. CPU_IS_PA_RISC returns correct + results, however. */ + if (CPU_IS_PA_RISC (cpu)) + { + switch (cpu) + { + case CPU_PA_RISC1_0: puts ("hppa1.0-hitachi-hiuxwe2"); break; + case CPU_PA_RISC1_1: puts ("hppa1.1-hitachi-hiuxwe2"); break; + case CPU_PA_RISC2_0: puts ("hppa2.0-hitachi-hiuxwe2"); break; + default: puts ("hppa-hitachi-hiuxwe2"); break; + } + } + else if (CPU_IS_HP_MC68K (cpu)) + puts ("m68k-hitachi-hiuxwe2"); + else puts ("unknown-hitachi-hiuxwe2"); + exit (0); + } +EOF + $CC_FOR_BUILD $dummy.c -o $dummy && ./$dummy && rm -f $dummy.c $dummy && exit 0 + rm -f $dummy.c $dummy + echo unknown-hitachi-hiuxwe2 + exit 0 ;; + 9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:* ) + echo hppa1.1-hp-bsd + exit 0 ;; + 9000/8??:4.3bsd:*:*) + echo hppa1.0-hp-bsd + exit 0 ;; + *9??*:MPE/iX:*:* | *3000*:MPE/iX:*:*) + echo hppa1.0-hp-mpeix + exit 0 ;; + hp7??:OSF1:*:* | hp8?[79]:OSF1:*:* ) + echo hppa1.1-hp-osf + exit 0 ;; + hp8??:OSF1:*:*) + echo hppa1.0-hp-osf + exit 0 ;; + i*86:OSF1:*:*) + if [ -x /usr/sbin/sysversion ] ; then + echo ${UNAME_MACHINE}-unknown-osf1mk + else + echo ${UNAME_MACHINE}-unknown-osf1 + fi + exit 0 ;; + parisc*:Lites*:*:*) + echo hppa1.1-hp-lites + exit 0 ;; + hppa*:OpenBSD:*:*) + echo hppa-unknown-openbsd + exit 0 ;; + C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*) + echo c1-convex-bsd + exit 0 ;; + C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*) + if getsysinfo -f scalar_acc + then echo c32-convex-bsd + else echo c2-convex-bsd + fi + exit 0 ;; + C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*) + echo c34-convex-bsd + exit 0 ;; + C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*) + echo c38-convex-bsd + exit 0 ;; + C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*) + echo c4-convex-bsd + exit 0 ;; + CRAY*X-MP:*:*:*) + echo xmp-cray-unicos + exit 0 ;; + CRAY*Y-MP:*:*:*) + echo ymp-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' + exit 0 ;; + CRAY*[A-Z]90:*:*:*) + echo ${UNAME_MACHINE}-cray-unicos${UNAME_RELEASE} \ + | sed -e 's/CRAY.*\([A-Z]90\)/\1/' \ + -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ \ + -e 's/\.[^.]*$/.X/' + exit 0 ;; + CRAY*TS:*:*:*) + echo t90-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' + exit 0 ;; + CRAY*T3D:*:*:*) + echo alpha-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' + exit 0 ;; + CRAY*T3E:*:*:*) + echo alphaev5-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' + exit 0 ;; + CRAY*SV1:*:*:*) + echo sv1-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' + exit 0 ;; + CRAY-2:*:*:*) + echo cray2-cray-unicos + exit 0 ;; + F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*) + FUJITSU_PROC=`uname -m | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` + FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` + FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'` + echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" + exit 0 ;; + hp300:OpenBSD:*:*) + echo m68k-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*) + echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE} + exit 0 ;; + sparc*:BSD/OS:*:*) + echo sparc-unknown-bsdi${UNAME_RELEASE} + exit 0 ;; + *:BSD/OS:*:*) + echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE} + exit 0 ;; + *:FreeBSD:*:*) + echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` + exit 0 ;; + *:OpenBSD:*:*) + echo ${UNAME_MACHINE}-unknown-openbsd`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'` + exit 0 ;; + i*:CYGWIN*:*) + echo ${UNAME_MACHINE}-pc-cygwin + exit 0 ;; + i*:MINGW*:*) + echo ${UNAME_MACHINE}-pc-mingw32 + exit 0 ;; + i*:PW*:*) + echo ${UNAME_MACHINE}-pc-pw32 + exit 0 ;; + i*:Windows_NT*:* | Pentium*:Windows_NT*:*) + # How do we know it's Interix rather than the generic POSIX subsystem? + # It also conflicts with pre-2.0 versions of AT&T UWIN. Should we + # UNAME_MACHINE based on the output of uname instead of i386? + echo i386-pc-interix + exit 0 ;; + i*:UWIN*:*) + echo ${UNAME_MACHINE}-pc-uwin + exit 0 ;; + p*:CYGWIN*:*) + echo powerpcle-unknown-cygwin + exit 0 ;; + prep*:SunOS:5.*:*) + echo powerpcle-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` + exit 0 ;; + *:GNU:*:*) + echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'` + exit 0 ;; + i*86:Minix:*:*) + echo ${UNAME_MACHINE}-pc-minix + exit 0 ;; + arm*:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit 0 ;; + ia64:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux + exit 0 ;; + m68*:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit 0 ;; + mips:Linux:*:*) + case `sed -n '/^byte/s/^.*: \(.*\) endian/\1/p' < /proc/cpuinfo` in + big) echo mips-unknown-linux-gnu && exit 0 ;; + little) echo mipsel-unknown-linux-gnu && exit 0 ;; + esac + ;; + ppc:Linux:*:*) + echo powerpc-unknown-linux-gnu + exit 0 ;; + ppc64:Linux:*:*) + echo powerpc64-unknown-linux-gnu + exit 0 ;; + alpha:Linux:*:*) + case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in + EV5) UNAME_MACHINE=alphaev5 ;; + EV56) UNAME_MACHINE=alphaev56 ;; + PCA56) UNAME_MACHINE=alphapca56 ;; + PCA57) UNAME_MACHINE=alphapca56 ;; + EV6) UNAME_MACHINE=alphaev6 ;; + EV67) UNAME_MACHINE=alphaev67 ;; + EV68*) UNAME_MACHINE=alphaev68 ;; + esac + objdump --private-headers /bin/sh | grep ld.so.1 >/dev/null + if test "$?" = 0 ; then LIBC="libc1" ; else LIBC="" ; fi + echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC} + exit 0 ;; + parisc:Linux:*:* | hppa:Linux:*:*) + # Look for CPU level + case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in + PA7*) echo hppa1.1-unknown-linux-gnu ;; + PA8*) echo hppa2.0-unknown-linux-gnu ;; + *) echo hppa-unknown-linux-gnu ;; + esac + exit 0 ;; + parisc64:Linux:*:* | hppa64:Linux:*:*) + echo hppa64-unknown-linux-gnu + exit 0 ;; + s390:Linux:*:* | s390x:Linux:*:*) + echo ${UNAME_MACHINE}-ibm-linux + exit 0 ;; + sh*:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit 0 ;; + sparc:Linux:*:* | sparc64:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit 0 ;; + x86_64:Linux:*:*) + echo x86_64-unknown-linux-gnu + exit 0 ;; + i*86:Linux:*:*) + # The BFD linker knows what the default object file format is, so + # first see if it will tell us. cd to the root directory to prevent + # problems with other programs or directories called `ld' in the path. + ld_supported_targets=`cd /; ld --help 2>&1 \ + | sed -ne '/supported targets:/!d + s/[ ][ ]*/ /g + s/.*supported targets: *// + s/ .*// + p'` + case "$ld_supported_targets" in + elf32-i386) + TENTATIVE="${UNAME_MACHINE}-pc-linux-gnu" + ;; + a.out-i386-linux) + echo "${UNAME_MACHINE}-pc-linux-gnuaout" + exit 0 ;; + coff-i386) + echo "${UNAME_MACHINE}-pc-linux-gnucoff" + exit 0 ;; + "") + # Either a pre-BFD a.out linker (linux-gnuoldld) or + # one that does not give us useful --help. + echo "${UNAME_MACHINE}-pc-linux-gnuoldld" + exit 0 ;; + esac + # Determine whether the default compiler is a.out or elf + eval $set_cc_for_build + cat >$dummy.c < +#ifdef __cplusplus +#include /* for printf() prototype */ + int main (int argc, char *argv[]) { +#else + int main (argc, argv) int argc; char *argv[]; { +#endif +#ifdef __ELF__ +# ifdef __GLIBC__ +# if __GLIBC__ >= 2 + printf ("%s-pc-linux-gnu\n", argv[1]); +# else + printf ("%s-pc-linux-gnulibc1\n", argv[1]); +# endif +# else + printf ("%s-pc-linux-gnulibc1\n", argv[1]); +# endif +#else + printf ("%s-pc-linux-gnuaout\n", argv[1]); +#endif + return 0; +} +EOF + $CC_FOR_BUILD $dummy.c -o $dummy 2>/dev/null && ./$dummy "${UNAME_MACHINE}" && rm -f $dummy.c $dummy && exit 0 + rm -f $dummy.c $dummy + test x"${TENTATIVE}" != x && echo "${TENTATIVE}" && exit 0 + ;; + i*86:DYNIX/ptx:4*:*) + # ptx 4.0 does uname -s correctly, with DYNIX/ptx in there. + # earlier versions are messed up and put the nodename in both + # sysname and nodename. + echo i386-sequent-sysv4 + exit 0 ;; + i*86:UNIX_SV:4.2MP:2.*) + # Unixware is an offshoot of SVR4, but it has its own version + # number series starting with 2... + # I am not positive that other SVR4 systems won't match this, + # I just have to hope. -- rms. + # Use sysv4.2uw... so that sysv4* matches it. + echo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION} + exit 0 ;; + i*86:*:4.*:* | i*86:SYSTEM_V:4.*:*) + UNAME_REL=`echo ${UNAME_RELEASE} | sed 's/\/MP$//'` + if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then + echo ${UNAME_MACHINE}-univel-sysv${UNAME_REL} + else + echo ${UNAME_MACHINE}-pc-sysv${UNAME_REL} + fi + exit 0 ;; + i*86:*:5:[78]*) + case `/bin/uname -X | grep "^Machine"` in + *486*) UNAME_MACHINE=i486 ;; + *Pentium) UNAME_MACHINE=i586 ;; + *Pent*|*Celeron) UNAME_MACHINE=i686 ;; + esac + echo ${UNAME_MACHINE}-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}${UNAME_VERSION} + exit 0 ;; + i*86:*:3.2:*) + if test -f /usr/options/cb.name; then + UNAME_REL=`sed -n 's/.*Version //p' /dev/null >/dev/null ; then + UNAME_REL=`(/bin/uname -X|egrep Release|sed -e 's/.*= //')` + (/bin/uname -X|egrep i80486 >/dev/null) && UNAME_MACHINE=i486 + (/bin/uname -X|egrep '^Machine.*Pentium' >/dev/null) \ + && UNAME_MACHINE=i586 + (/bin/uname -X|egrep '^Machine.*Pent ?II' >/dev/null) \ + && UNAME_MACHINE=i686 + (/bin/uname -X|egrep '^Machine.*Pentium Pro' >/dev/null) \ + && UNAME_MACHINE=i686 + echo ${UNAME_MACHINE}-pc-sco$UNAME_REL + else + echo ${UNAME_MACHINE}-pc-sysv32 + fi + exit 0 ;; + i*86:*DOS:*:*) + echo ${UNAME_MACHINE}-pc-msdosdjgpp + exit 0 ;; + pc:*:*:*) + # Left here for compatibility: + # uname -m prints for DJGPP always 'pc', but it prints nothing about + # the processor, so we play safe by assuming i386. + echo i386-pc-msdosdjgpp + exit 0 ;; + Intel:Mach:3*:*) + echo i386-pc-mach3 + exit 0 ;; + paragon:*:*:*) + echo i860-intel-osf1 + exit 0 ;; + i860:*:4.*:*) # i860-SVR4 + if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then + echo i860-stardent-sysv${UNAME_RELEASE} # Stardent Vistra i860-SVR4 + else # Add other i860-SVR4 vendors below as they are discovered. + echo i860-unknown-sysv${UNAME_RELEASE} # Unknown i860-SVR4 + fi + exit 0 ;; + mini*:CTIX:SYS*5:*) + # "miniframe" + echo m68010-convergent-sysv + exit 0 ;; + M68*:*:R3V[567]*:*) + test -r /sysV68 && echo 'm68k-motorola-sysv' && exit 0 ;; + 3[34]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 4850:*:4.0:3.0) + OS_REL='' + test -r /etc/.relid \ + && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid` + /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ + && echo i486-ncr-sysv4.3${OS_REL} && exit 0 + /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \ + && echo i586-ncr-sysv4.3${OS_REL} && exit 0 ;; + 3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*) + /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ + && echo i486-ncr-sysv4 && exit 0 ;; + m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*) + echo m68k-unknown-lynxos${UNAME_RELEASE} + exit 0 ;; + mc68030:UNIX_System_V:4.*:*) + echo m68k-atari-sysv4 + exit 0 ;; + i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.0*:*) + echo i386-unknown-lynxos${UNAME_RELEASE} + exit 0 ;; + TSUNAMI:LynxOS:2.*:*) + echo sparc-unknown-lynxos${UNAME_RELEASE} + exit 0 ;; + rs6000:LynxOS:2.*:*) + echo rs6000-unknown-lynxos${UNAME_RELEASE} + exit 0 ;; + PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.0*:*) + echo powerpc-unknown-lynxos${UNAME_RELEASE} + exit 0 ;; + SM[BE]S:UNIX_SV:*:*) + echo mips-dde-sysv${UNAME_RELEASE} + exit 0 ;; + RM*:ReliantUNIX-*:*:*) + echo mips-sni-sysv4 + exit 0 ;; + RM*:SINIX-*:*:*) + echo mips-sni-sysv4 + exit 0 ;; + *:SINIX-*:*:*) + if uname -p 2>/dev/null >/dev/null ; then + UNAME_MACHINE=`(uname -p) 2>/dev/null` + echo ${UNAME_MACHINE}-sni-sysv4 + else + echo ns32k-sni-sysv + fi + exit 0 ;; + PENTIUM:*:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort + # says + echo i586-unisys-sysv4 + exit 0 ;; + *:UNIX_System_V:4*:FTX*) + # From Gerald Hewes . + # How about differentiating between stratus architectures? -djm + echo hppa1.1-stratus-sysv4 + exit 0 ;; + *:*:*:FTX*) + # From seanf@swdc.stratus.com. + echo i860-stratus-sysv4 + exit 0 ;; + *:VOS:*:*) + # From Paul.Green@stratus.com. + echo hppa1.1-stratus-vos + exit 0 ;; + mc68*:A/UX:*:*) + echo m68k-apple-aux${UNAME_RELEASE} + exit 0 ;; + news*:NEWS-OS:6*:*) + echo mips-sony-newsos6 + exit 0 ;; + R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*) + if [ -d /usr/nec ]; then + echo mips-nec-sysv${UNAME_RELEASE} + else + echo mips-unknown-sysv${UNAME_RELEASE} + fi + exit 0 ;; + BeBox:BeOS:*:*) # BeOS running on hardware made by Be, PPC only. + echo powerpc-be-beos + exit 0 ;; + BeMac:BeOS:*:*) # BeOS running on Mac or Mac clone, PPC only. + echo powerpc-apple-beos + exit 0 ;; + BePC:BeOS:*:*) # BeOS running on Intel PC compatible. + echo i586-pc-beos + exit 0 ;; + SX-4:SUPER-UX:*:*) + echo sx4-nec-superux${UNAME_RELEASE} + exit 0 ;; + SX-5:SUPER-UX:*:*) + echo sx5-nec-superux${UNAME_RELEASE} + exit 0 ;; + Power*:Rhapsody:*:*) + echo powerpc-apple-rhapsody${UNAME_RELEASE} + exit 0 ;; + *:Rhapsody:*:*) + echo ${UNAME_MACHINE}-apple-rhapsody${UNAME_RELEASE} + exit 0 ;; + *:Darwin:*:*) + echo `uname -p`-apple-darwin${UNAME_RELEASE} + exit 0 ;; + *:procnto*:*:* | *:QNX:[0123456789]*:*) + if test "${UNAME_MACHINE}" = "x86pc"; then + UNAME_MACHINE=pc + fi + echo `uname -p`-${UNAME_MACHINE}-nto-qnx + exit 0 ;; + *:QNX:*:4*) + echo i386-pc-qnx + exit 0 ;; + NSR-[KW]:NONSTOP_KERNEL:*:*) + echo nsr-tandem-nsk${UNAME_RELEASE} + exit 0 ;; + *:NonStop-UX:*:*) + echo mips-compaq-nonstopux + exit 0 ;; + BS2000:POSIX*:*:*) + echo bs2000-siemens-sysv + exit 0 ;; + DS/*:UNIX_System_V:*:*) + echo ${UNAME_MACHINE}-${UNAME_SYSTEM}-${UNAME_RELEASE} + exit 0 ;; + *:Plan9:*:*) + # "uname -m" is not consistent, so use $cputype instead. 386 + # is converted to i386 for consistency with other x86 + # operating systems. + if test "$cputype" = "386"; then + UNAME_MACHINE=i386 + else + UNAME_MACHINE="$cputype" + fi + echo ${UNAME_MACHINE}-unknown-plan9 + exit 0 ;; + i*86:OS/2:*:*) + # If we were able to find `uname', then EMX Unix compatibility + # is probably installed. + echo ${UNAME_MACHINE}-pc-os2-emx + exit 0 ;; + *:TOPS-10:*:*) + echo pdp10-unknown-tops10 + exit 0 ;; + *:TENEX:*:*) + echo pdp10-unknown-tenex + exit 0 ;; + KS10:TOPS-20:*:* | KL10:TOPS-20:*:* | TYPE4:TOPS-20:*:*) + echo pdp10-dec-tops20 + exit 0 ;; + XKL-1:TOPS-20:*:* | TYPE5:TOPS-20:*:*) + echo pdp10-xkl-tops20 + exit 0 ;; + *:TOPS-20:*:*) + echo pdp10-unknown-tops20 + exit 0 ;; + *:ITS:*:*) + echo pdp10-unknown-its + exit 0 ;; + i*86:XTS-300:*:STOP) + echo ${UNAME_MACHINE}-unknown-stop + exit 0 ;; + i*86:atheos:*:*) + echo ${UNAME_MACHINE}-unknown-atheos + exit 0 ;; +esac + +#echo '(No uname command or uname output not recognized.)' 1>&2 +#echo "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" 1>&2 + +eval $set_cc_for_build +cat >$dummy.c < +# include +#endif +main () +{ +#if defined (sony) +#if defined (MIPSEB) + /* BFD wants "bsd" instead of "newsos". Perhaps BFD should be changed, + I don't know.... */ + printf ("mips-sony-bsd\n"); exit (0); +#else +#include + printf ("m68k-sony-newsos%s\n", +#ifdef NEWSOS4 + "4" +#else + "" +#endif + ); exit (0); +#endif +#endif + +#if defined (__arm) && defined (__acorn) && defined (__unix) + printf ("arm-acorn-riscix"); exit (0); +#endif + +#if defined (hp300) && !defined (hpux) + printf ("m68k-hp-bsd\n"); exit (0); +#endif + +#if defined (NeXT) +#if !defined (__ARCHITECTURE__) +#define __ARCHITECTURE__ "m68k" +#endif + int version; + version=`(hostinfo | sed -n 's/.*NeXT Mach \([0-9]*\).*/\1/p') 2>/dev/null`; + if (version < 4) + printf ("%s-next-nextstep%d\n", __ARCHITECTURE__, version); + else + printf ("%s-next-openstep%d\n", __ARCHITECTURE__, version); + exit (0); +#endif + +#if defined (MULTIMAX) || defined (n16) +#if defined (UMAXV) + printf ("ns32k-encore-sysv\n"); exit (0); +#else +#if defined (CMU) + printf ("ns32k-encore-mach\n"); exit (0); +#else + printf ("ns32k-encore-bsd\n"); exit (0); +#endif +#endif +#endif + +#if defined (__386BSD__) + printf ("i386-pc-bsd\n"); exit (0); +#endif + +#if defined (sequent) +#if defined (i386) + printf ("i386-sequent-dynix\n"); exit (0); +#endif +#if defined (ns32000) + printf ("ns32k-sequent-dynix\n"); exit (0); +#endif +#endif + +#if defined (_SEQUENT_) + struct utsname un; + + uname(&un); + + if (strncmp(un.version, "V2", 2) == 0) { + printf ("i386-sequent-ptx2\n"); exit (0); + } + if (strncmp(un.version, "V1", 2) == 0) { /* XXX is V1 correct? */ + printf ("i386-sequent-ptx1\n"); exit (0); + } + printf ("i386-sequent-ptx\n"); exit (0); + +#endif + +#if defined (vax) +# if !defined (ultrix) +# include +# if defined (BSD) +# if BSD == 43 + printf ("vax-dec-bsd4.3\n"); exit (0); +# else +# if BSD == 199006 + printf ("vax-dec-bsd4.3reno\n"); exit (0); +# else + printf ("vax-dec-bsd\n"); exit (0); +# endif +# endif +# else + printf ("vax-dec-bsd\n"); exit (0); +# endif +# else + printf ("vax-dec-ultrix\n"); exit (0); +# endif +#endif + +#if defined (alliant) && defined (i860) + printf ("i860-alliant-bsd\n"); exit (0); +#endif + + exit (1); +} +EOF + +$CC_FOR_BUILD $dummy.c -o $dummy 2>/dev/null && ./$dummy && rm -f $dummy.c $dummy && exit 0 +rm -f $dummy.c $dummy + +# Apollos put the system type in the environment. + +test -d /usr/apollo && { echo ${ISP}-apollo-${SYSTYPE}; exit 0; } + +# Convex versions that predate uname can use getsysinfo(1) + +if [ -x /usr/convex/getsysinfo ] +then + case `getsysinfo -f cpu_type` in + c1*) + echo c1-convex-bsd + exit 0 ;; + c2*) + if getsysinfo -f scalar_acc + then echo c32-convex-bsd + else echo c2-convex-bsd + fi + exit 0 ;; + c34*) + echo c34-convex-bsd + exit 0 ;; + c38*) + echo c38-convex-bsd + exit 0 ;; + c4*) + echo c4-convex-bsd + exit 0 ;; + esac +fi + +cat >&2 < in order to provide the needed +information to handle your system. + +config.guess timestamp = $timestamp + +uname -m = `(uname -m) 2>/dev/null || echo unknown` +uname -r = `(uname -r) 2>/dev/null || echo unknown` +uname -s = `(uname -s) 2>/dev/null || echo unknown` +uname -v = `(uname -v) 2>/dev/null || echo unknown` + +/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null` +/bin/uname -X = `(/bin/uname -X) 2>/dev/null` + +hostinfo = `(hostinfo) 2>/dev/null` +/bin/universe = `(/bin/universe) 2>/dev/null` +/usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null` +/bin/arch = `(/bin/arch) 2>/dev/null` +/usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null` +/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null` + +UNAME_MACHINE = ${UNAME_MACHINE} +UNAME_RELEASE = ${UNAME_RELEASE} +UNAME_SYSTEM = ${UNAME_SYSTEM} +UNAME_VERSION = ${UNAME_VERSION} +EOF + +exit 1 + +# Local variables: +# eval: (add-hook 'write-file-hooks 'time-stamp) +# time-stamp-start: "timestamp='" +# time-stamp-format: "%:y-%02m-%02d" +# time-stamp-end: "'" +# End: diff --git a/config/config.sub b/config/config.sub new file mode 100755 index 0000000..393f13d --- /dev/null +++ b/config/config.sub @@ -0,0 +1,1411 @@ +#! /bin/sh +# Configuration validation subroutine script. +# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001 +# Free Software Foundation, Inc. + +timestamp='2001-09-07' + +# This file is (in principle) common to ALL GNU software. +# The presence of a machine in this file suggests that SOME GNU software +# can handle that machine. It does not imply ALL GNU software can. +# +# This file is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, +# Boston, MA 02111-1307, USA. + +# As a special exception to the GNU General Public License, if you +# distribute this file as part of a program that contains a +# configuration script generated by Autoconf, you may include it under +# the same distribution terms that you use for the rest of that program. + +# Please send patches to . +# +# Configuration subroutine to validate and canonicalize a configuration type. +# Supply the specified configuration type as an argument. +# If it is invalid, we print an error message on stderr and exit with code 1. +# Otherwise, we print the canonical config type on stdout and succeed. + +# This file is supposed to be the same for all GNU packages +# and recognize all the CPU types, system types and aliases +# that are meaningful with *any* GNU software. +# Each package is responsible for reporting which valid configurations +# it does not support. The user should be able to distinguish +# a failure to support a valid configuration from a meaningless +# configuration. + +# The goal of this file is to map all the various variations of a given +# machine specification into a single specification in the form: +# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM +# or in some cases, the newer four-part form: +# CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM +# It is wrong to echo any other type of specification. + +me=`echo "$0" | sed -e 's,.*/,,'` + +usage="\ +Usage: $0 [OPTION] CPU-MFR-OPSYS + $0 [OPTION] ALIAS + +Canonicalize a configuration name. + +Operation modes: + -h, --help print this help, then exit + -t, --time-stamp print date of last modification, then exit + -v, --version print version number, then exit + +Report bugs and patches to ." + +version="\ +GNU config.sub ($timestamp) + +Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001 +Free Software Foundation, Inc. + +This is free software; see the source for copying conditions. There is NO +warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." + +help=" +Try \`$me --help' for more information." + +# Parse command line +while test $# -gt 0 ; do + case $1 in + --time-stamp | --time* | -t ) + echo "$timestamp" ; exit 0 ;; + --version | -v ) + echo "$version" ; exit 0 ;; + --help | --h* | -h ) + echo "$usage"; exit 0 ;; + -- ) # Stop option processing + shift; break ;; + - ) # Use stdin as input. + break ;; + -* ) + echo "$me: invalid option $1$help" + exit 1 ;; + + *local*) + # First pass through any local machine types. + echo $1 + exit 0;; + + * ) + break ;; + esac +done + +case $# in + 0) echo "$me: missing argument$help" >&2 + exit 1;; + 1) ;; + *) echo "$me: too many arguments$help" >&2 + exit 1;; +esac + +# Separate what the user gave into CPU-COMPANY and OS or KERNEL-OS (if any). +# Here we must recognize all the valid KERNEL-OS combinations. +maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'` +case $maybe_os in + nto-qnx* | linux-gnu* | storm-chaos* | os2-emx* | windows32-*) + os=-$maybe_os + basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'` + ;; + *) + basic_machine=`echo $1 | sed 's/-[^-]*$//'` + if [ $basic_machine != $1 ] + then os=`echo $1 | sed 's/.*-/-/'` + else os=; fi + ;; +esac + +### Let's recognize common machines as not being operating systems so +### that things like config.sub decstation-3100 work. We also +### recognize some manufacturers as not being operating systems, so we +### can provide default operating systems below. +case $os in + -sun*os*) + # Prevent following clause from handling this invalid input. + ;; + -dec* | -mips* | -sequent* | -encore* | -pc532* | -sgi* | -sony* | \ + -att* | -7300* | -3300* | -delta* | -motorola* | -sun[234]* | \ + -unicom* | -ibm* | -next | -hp | -isi* | -apollo | -altos* | \ + -convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\ + -c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \ + -harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \ + -apple | -axis) + os= + basic_machine=$1 + ;; + -sim | -cisco | -oki | -wec | -winbond) + os= + basic_machine=$1 + ;; + -scout) + ;; + -wrs) + os=-vxworks + basic_machine=$1 + ;; + -chorusos*) + os=-chorusos + basic_machine=$1 + ;; + -chorusrdb) + os=-chorusrdb + basic_machine=$1 + ;; + -hiux*) + os=-hiuxwe2 + ;; + -sco5) + os=-sco3.2v5 + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -sco4) + os=-sco3.2v4 + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -sco3.2.[4-9]*) + os=`echo $os | sed -e 's/sco3.2./sco3.2v/'` + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -sco3.2v[4-9]*) + # Don't forget version if it is 3.2v4 or newer. + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -sco*) + os=-sco3.2v2 + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -udk*) + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -isc) + os=-isc2.2 + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -clix*) + basic_machine=clipper-intergraph + ;; + -isc*) + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -lynx*) + os=-lynxos + ;; + -ptx*) + basic_machine=`echo $1 | sed -e 's/86-.*/86-sequent/'` + ;; + -windowsnt*) + os=`echo $os | sed -e 's/windowsnt/winnt/'` + ;; + -psos*) + os=-psos + ;; + -mint | -mint[0-9]*) + basic_machine=m68k-atari + os=-mint + ;; +esac + +# Decode aliases for certain CPU-COMPANY combinations. +case $basic_machine in + # Recognize the basic CPU types without company name. + # Some are omitted here because they have special meanings below. + 1750a | 580 \ + | a29k \ + | alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \ + | arc | arm | arm[bl]e | arme[lb] | armv[2345] | armv[345][lb] | avr \ + | c4x | clipper \ + | d10v | d30v | dsp16xx \ + | fr30 \ + | h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \ + | i370 | i860 | i960 | ia64 \ + | m32r | m68000 | m68k | m88k | mcore \ + | mips16 | mips64 | mips64el | mips64orion | mips64orionel \ + | mips64vr4100 | mips64vr4100el | mips64vr4300 \ + | mips64vr4300el | mips64vr5000 | mips64vr5000el \ + | mipsbe | mipseb | mipsel | mipsle | mipstx39 | mipstx39el \ + | mipsisa32 \ + | mn10200 | mn10300 \ + | ns16k | ns32k \ + | openrisc \ + | pdp10 | pdp11 | pj | pjl \ + | powerpc | powerpc64 | powerpc64le | powerpcle | ppcbe \ + | pyramid \ + | s390 | s390x \ + | sh | sh[34] | sh[34]eb | shbe | shle \ + | sparc | sparc64 | sparclet | sparclite | sparcv9 | sparcv9b \ + | stormy16 | strongarm \ + | tahoe | thumb | tic80 | tron \ + | v850 \ + | we32k \ + | x86 | xscale \ + | z8k) + basic_machine=$basic_machine-unknown + ;; + m6811 | m68hc11 | m6812 | m68hc12) + # Motorola 68HC11/12. + basic_machine=$basic_machine-unknown + os=-none + ;; + m88110 | m680[12346]0 | m683?2 | m68360 | m5200 | v70 | w65 | z8k) + ;; + + # We use `pc' rather than `unknown' + # because (1) that's what they normally are, and + # (2) the word "unknown" tends to confuse beginning users. + i*86 | x86_64) + basic_machine=$basic_machine-pc + ;; + # Object if more than one company name word. + *-*-*) + echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2 + exit 1 + ;; + # Recognize the basic CPU types with company name. + 580-* \ + | a29k-* \ + | alpha-* | alphaev[4-8]-* | alphaev56-* | alphaev6[78]-* \ + | alphapca5[67]-* | arc-* \ + | arm-* | armbe-* | armle-* | armv*-* \ + | bs2000-* \ + | c[123]* | c30-* | [cjt]90-* | c54x-* \ + | clipper-* | cray2-* | cydra-* \ + | d10v-* | d30v-* \ + | elxsi-* \ + | f30[01]-* | f700-* | fr30-* | fx80-* \ + | h8300-* | h8500-* \ + | hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \ + | i*86-* | i860-* | i960-* | ia64-* \ + | m32r-* \ + | m68000-* | m680[01234]0-* | m68360-* | m683?2-* | m68k-* \ + | m88110-* | m88k-* | mcore-* \ + | mips-* | mips16-* | mips64-* | mips64el-* | mips64orion-* \ + | mips64orionel-* | mips64vr4100-* | mips64vr4100el-* \ + | mips64vr4300-* | mips64vr4300el-* | mipsbe-* | mipseb-* \ + | mipsle-* | mipsel-* | mipstx39-* | mipstx39el-* \ + | none-* | np1-* | ns16k-* | ns32k-* \ + | orion-* \ + | pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \ + | powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* | ppcbe-* \ + | pyramid-* \ + | romp-* | rs6000-* \ + | s390-* | s390x-* \ + | sh-* | sh[34]-* | sh[34]eb-* | shbe-* | shle-* \ + | sparc-* | sparc64-* | sparc86x-* | sparclite-* \ + | sparcv9-* | sparcv9b-* | stormy16-* | strongarm-* | sv1-* \ + | t3e-* | tahoe-* | thumb-* | tic30-* | tic54x-* | tic80-* | tron-* \ + | v850-* | vax-* \ + | we32k-* \ + | x86-* | x86_64-* | xmp-* | xps100-* | xscale-* \ + | ymp-* \ + | z8k-*) + ;; + # Recognize the various machine names and aliases which stand + # for a CPU type and a company and sometimes even an OS. + 386bsd) + basic_machine=i386-unknown + os=-bsd + ;; + 3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc) + basic_machine=m68000-att + ;; + 3b*) + basic_machine=we32k-att + ;; + a29khif) + basic_machine=a29k-amd + os=-udi + ;; + adobe68k) + basic_machine=m68010-adobe + os=-scout + ;; + alliant | fx80) + basic_machine=fx80-alliant + ;; + altos | altos3068) + basic_machine=m68k-altos + ;; + am29k) + basic_machine=a29k-none + os=-bsd + ;; + amdahl) + basic_machine=580-amdahl + os=-sysv + ;; + amiga | amiga-*) + basic_machine=m68k-unknown + ;; + amigaos | amigados) + basic_machine=m68k-unknown + os=-amigaos + ;; + amigaunix | amix) + basic_machine=m68k-unknown + os=-sysv4 + ;; + apollo68) + basic_machine=m68k-apollo + os=-sysv + ;; + apollo68bsd) + basic_machine=m68k-apollo + os=-bsd + ;; + aux) + basic_machine=m68k-apple + os=-aux + ;; + balance) + basic_machine=ns32k-sequent + os=-dynix + ;; + convex-c1) + basic_machine=c1-convex + os=-bsd + ;; + convex-c2) + basic_machine=c2-convex + os=-bsd + ;; + convex-c32) + basic_machine=c32-convex + os=-bsd + ;; + convex-c34) + basic_machine=c34-convex + os=-bsd + ;; + convex-c38) + basic_machine=c38-convex + os=-bsd + ;; + cray | ymp) + basic_machine=ymp-cray + os=-unicos + ;; + cray2) + basic_machine=cray2-cray + os=-unicos + ;; + [cjt]90) + basic_machine=${basic_machine}-cray + os=-unicos + ;; + crds | unos) + basic_machine=m68k-crds + ;; + cris | cris-* | etrax*) + basic_machine=cris-axis + ;; + da30 | da30-*) + basic_machine=m68k-da30 + ;; + decstation | decstation-3100 | pmax | pmax-* | pmin | dec3100 | decstatn) + basic_machine=mips-dec + ;; + delta | 3300 | motorola-3300 | motorola-delta \ + | 3300-motorola | delta-motorola) + basic_machine=m68k-motorola + ;; + delta88) + basic_machine=m88k-motorola + os=-sysv3 + ;; + dpx20 | dpx20-*) + basic_machine=rs6000-bull + os=-bosx + ;; + dpx2* | dpx2*-bull) + basic_machine=m68k-bull + os=-sysv3 + ;; + ebmon29k) + basic_machine=a29k-amd + os=-ebmon + ;; + elxsi) + basic_machine=elxsi-elxsi + os=-bsd + ;; + encore | umax | mmax) + basic_machine=ns32k-encore + ;; + es1800 | OSE68k | ose68k | ose | OSE) + basic_machine=m68k-ericsson + os=-ose + ;; + fx2800) + basic_machine=i860-alliant + ;; + genix) + basic_machine=ns32k-ns + ;; + gmicro) + basic_machine=tron-gmicro + os=-sysv + ;; + go32) + basic_machine=i386-pc + os=-go32 + ;; + h3050r* | hiux*) + basic_machine=hppa1.1-hitachi + os=-hiuxwe2 + ;; + h8300hms) + basic_machine=h8300-hitachi + os=-hms + ;; + h8300xray) + basic_machine=h8300-hitachi + os=-xray + ;; + h8500hms) + basic_machine=h8500-hitachi + os=-hms + ;; + harris) + basic_machine=m88k-harris + os=-sysv3 + ;; + hp300-*) + basic_machine=m68k-hp + ;; + hp300bsd) + basic_machine=m68k-hp + os=-bsd + ;; + hp300hpux) + basic_machine=m68k-hp + os=-hpux + ;; + hp3k9[0-9][0-9] | hp9[0-9][0-9]) + basic_machine=hppa1.0-hp + ;; + hp9k2[0-9][0-9] | hp9k31[0-9]) + basic_machine=m68000-hp + ;; + hp9k3[2-9][0-9]) + basic_machine=m68k-hp + ;; + hp9k6[0-9][0-9] | hp6[0-9][0-9]) + basic_machine=hppa1.0-hp + ;; + hp9k7[0-79][0-9] | hp7[0-79][0-9]) + basic_machine=hppa1.1-hp + ;; + hp9k78[0-9] | hp78[0-9]) + # FIXME: really hppa2.0-hp + basic_machine=hppa1.1-hp + ;; + hp9k8[67]1 | hp8[67]1 | hp9k80[24] | hp80[24] | hp9k8[78]9 | hp8[78]9 | hp9k893 | hp893) + # FIXME: really hppa2.0-hp + basic_machine=hppa1.1-hp + ;; + hp9k8[0-9][13679] | hp8[0-9][13679]) + basic_machine=hppa1.1-hp + ;; + hp9k8[0-9][0-9] | hp8[0-9][0-9]) + basic_machine=hppa1.0-hp + ;; + hppa-next) + os=-nextstep3 + ;; + hppaosf) + basic_machine=hppa1.1-hp + os=-osf + ;; + hppro) + basic_machine=hppa1.1-hp + os=-proelf + ;; + i370-ibm* | ibm*) + basic_machine=i370-ibm + ;; +# I'm not sure what "Sysv32" means. Should this be sysv3.2? + i*86v32) + basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` + os=-sysv32 + ;; + i*86v4*) + basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` + os=-sysv4 + ;; + i*86v) + basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` + os=-sysv + ;; + i*86sol2) + basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` + os=-solaris2 + ;; + i386mach) + basic_machine=i386-mach + os=-mach + ;; + i386-vsta | vsta) + basic_machine=i386-unknown + os=-vsta + ;; + iris | iris4d) + basic_machine=mips-sgi + case $os in + -irix*) + ;; + *) + os=-irix4 + ;; + esac + ;; + isi68 | isi) + basic_machine=m68k-isi + os=-sysv + ;; + m88k-omron*) + basic_machine=m88k-omron + ;; + magnum | m3230) + basic_machine=mips-mips + os=-sysv + ;; + merlin) + basic_machine=ns32k-utek + os=-sysv + ;; + mingw32) + basic_machine=i386-pc + os=-mingw32 + ;; + miniframe) + basic_machine=m68000-convergent + ;; + *mint | -mint[0-9]* | *MiNT | *MiNT[0-9]*) + basic_machine=m68k-atari + os=-mint + ;; + mipsel*-linux*) + basic_machine=mipsel-unknown + os=-linux-gnu + ;; + mips*-linux*) + basic_machine=mips-unknown + os=-linux-gnu + ;; + mips3*-*) + basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'` + ;; + mips3*) + basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`-unknown + ;; + mmix*) + basic_machine=mmix-knuth + os=-mmixware + ;; + monitor) + basic_machine=m68k-rom68k + os=-coff + ;; + msdos) + basic_machine=i386-pc + os=-msdos + ;; + mvs) + basic_machine=i370-ibm + os=-mvs + ;; + ncr3000) + basic_machine=i486-ncr + os=-sysv4 + ;; + netbsd386) + basic_machine=i386-unknown + os=-netbsd + ;; + netwinder) + basic_machine=armv4l-rebel + os=-linux + ;; + news | news700 | news800 | news900) + basic_machine=m68k-sony + os=-newsos + ;; + news1000) + basic_machine=m68030-sony + os=-newsos + ;; + news-3600 | risc-news) + basic_machine=mips-sony + os=-newsos + ;; + necv70) + basic_machine=v70-nec + os=-sysv + ;; + next | m*-next ) + basic_machine=m68k-next + case $os in + -nextstep* ) + ;; + -ns2*) + os=-nextstep2 + ;; + *) + os=-nextstep3 + ;; + esac + ;; + nh3000) + basic_machine=m68k-harris + os=-cxux + ;; + nh[45]000) + basic_machine=m88k-harris + os=-cxux + ;; + nindy960) + basic_machine=i960-intel + os=-nindy + ;; + mon960) + basic_machine=i960-intel + os=-mon960 + ;; + nonstopux) + basic_machine=mips-compaq + os=-nonstopux + ;; + np1) + basic_machine=np1-gould + ;; + nsr-tandem) + basic_machine=nsr-tandem + ;; + op50n-* | op60c-*) + basic_machine=hppa1.1-oki + os=-proelf + ;; + OSE68000 | ose68000) + basic_machine=m68000-ericsson + os=-ose + ;; + os68k) + basic_machine=m68k-none + os=-os68k + ;; + pa-hitachi) + basic_machine=hppa1.1-hitachi + os=-hiuxwe2 + ;; + paragon) + basic_machine=i860-intel + os=-osf + ;; + pbd) + basic_machine=sparc-tti + ;; + pbb) + basic_machine=m68k-tti + ;; + pc532 | pc532-*) + basic_machine=ns32k-pc532 + ;; + pentium | p5 | k5 | k6 | nexgen) + basic_machine=i586-pc + ;; + pentiumpro | p6 | 6x86 | athlon) + basic_machine=i686-pc + ;; + pentiumii | pentium2) + basic_machine=i686-pc + ;; + pentium-* | p5-* | k5-* | k6-* | nexgen-*) + basic_machine=i586-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + pentiumpro-* | p6-* | 6x86-* | athlon-*) + basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + pentiumii-* | pentium2-*) + basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + pn) + basic_machine=pn-gould + ;; + power) basic_machine=power-ibm + ;; + ppc) basic_machine=powerpc-unknown + ;; + ppc-*) basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + ppcle | powerpclittle | ppc-le | powerpc-little) + basic_machine=powerpcle-unknown + ;; + ppcle-* | powerpclittle-*) + basic_machine=powerpcle-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + ppc64) basic_machine=powerpc64-unknown + ;; + ppc64-*) basic_machine=powerpc64-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + ppc64le | powerpc64little | ppc64-le | powerpc64-little) + basic_machine=powerpc64le-unknown + ;; + ppc64le-* | powerpc64little-*) + basic_machine=powerpc64le-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + ps2) + basic_machine=i386-ibm + ;; + pw32) + basic_machine=i586-unknown + os=-pw32 + ;; + rom68k) + basic_machine=m68k-rom68k + os=-coff + ;; + rm[46]00) + basic_machine=mips-siemens + ;; + rtpc | rtpc-*) + basic_machine=romp-ibm + ;; + sa29200) + basic_machine=a29k-amd + os=-udi + ;; + sequent) + basic_machine=i386-sequent + ;; + sh) + basic_machine=sh-hitachi + os=-hms + ;; + sparclite-wrs) + basic_machine=sparclite-wrs + os=-vxworks + ;; + sps7) + basic_machine=m68k-bull + os=-sysv2 + ;; + spur) + basic_machine=spur-unknown + ;; + st2000) + basic_machine=m68k-tandem + ;; + stratus) + basic_machine=i860-stratus + os=-sysv4 + ;; + sun2) + basic_machine=m68000-sun + ;; + sun2os3) + basic_machine=m68000-sun + os=-sunos3 + ;; + sun2os4) + basic_machine=m68000-sun + os=-sunos4 + ;; + sun3os3) + basic_machine=m68k-sun + os=-sunos3 + ;; + sun3os4) + basic_machine=m68k-sun + os=-sunos4 + ;; + sun4os3) + basic_machine=sparc-sun + os=-sunos3 + ;; + sun4os4) + basic_machine=sparc-sun + os=-sunos4 + ;; + sun4sol2) + basic_machine=sparc-sun + os=-solaris2 + ;; + sun3 | sun3-*) + basic_machine=m68k-sun + ;; + sun4) + basic_machine=sparc-sun + ;; + sun386 | sun386i | roadrunner) + basic_machine=i386-sun + ;; + sv1) + basic_machine=sv1-cray + os=-unicos + ;; + symmetry) + basic_machine=i386-sequent + os=-dynix + ;; + t3e) + basic_machine=t3e-cray + os=-unicos + ;; + tic54x | c54x*) + basic_machine=tic54x-unknown + os=-coff + ;; + tx39) + basic_machine=mipstx39-unknown + ;; + tx39el) + basic_machine=mipstx39el-unknown + ;; + tower | tower-32) + basic_machine=m68k-ncr + ;; + udi29k) + basic_machine=a29k-amd + os=-udi + ;; + ultra3) + basic_machine=a29k-nyu + os=-sym1 + ;; + v810 | necv810) + basic_machine=v810-nec + os=-none + ;; + vaxv) + basic_machine=vax-dec + os=-sysv + ;; + vms) + basic_machine=vax-dec + os=-vms + ;; + vpp*|vx|vx-*) + basic_machine=f301-fujitsu + ;; + vxworks960) + basic_machine=i960-wrs + os=-vxworks + ;; + vxworks68) + basic_machine=m68k-wrs + os=-vxworks + ;; + vxworks29k) + basic_machine=a29k-wrs + os=-vxworks + ;; + w65*) + basic_machine=w65-wdc + os=-none + ;; + w89k-*) + basic_machine=hppa1.1-winbond + os=-proelf + ;; + windows32) + basic_machine=i386-pc + os=-windows32-msvcrt + ;; + xmp) + basic_machine=xmp-cray + os=-unicos + ;; + xps | xps100) + basic_machine=xps100-honeywell + ;; + z8k-*-coff) + basic_machine=z8k-unknown + os=-sim + ;; + none) + basic_machine=none-none + os=-none + ;; + +# Here we handle the default manufacturer of certain CPU types. It is in +# some cases the only manufacturer, in others, it is the most popular. + w89k) + basic_machine=hppa1.1-winbond + ;; + op50n) + basic_machine=hppa1.1-oki + ;; + op60c) + basic_machine=hppa1.1-oki + ;; + mips) + if [ x$os = x-linux-gnu ]; then + basic_machine=mips-unknown + else + basic_machine=mips-mips + fi + ;; + romp) + basic_machine=romp-ibm + ;; + rs6000) + basic_machine=rs6000-ibm + ;; + vax) + basic_machine=vax-dec + ;; + pdp10) + # there are many clones, so DEC is not a safe bet + basic_machine=pdp10-unknown + ;; + pdp11) + basic_machine=pdp11-dec + ;; + we32k) + basic_machine=we32k-att + ;; + sh3 | sh4 | sh3eb | sh4eb) + basic_machine=sh-unknown + ;; + sparc | sparcv9 | sparcv9b) + basic_machine=sparc-sun + ;; + cydra) + basic_machine=cydra-cydrome + ;; + orion) + basic_machine=orion-highlevel + ;; + orion105) + basic_machine=clipper-highlevel + ;; + mac | mpw | mac-mpw) + basic_machine=m68k-apple + ;; + pmac | pmac-mpw) + basic_machine=powerpc-apple + ;; + c4x*) + basic_machine=c4x-none + os=-coff + ;; + *-unknown) + # Make sure to match an already-canonicalized machine name. + ;; + *) + echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2 + exit 1 + ;; +esac + +# Here we canonicalize certain aliases for manufacturers. +case $basic_machine in + *-digital*) + basic_machine=`echo $basic_machine | sed 's/digital.*/dec/'` + ;; + *-commodore*) + basic_machine=`echo $basic_machine | sed 's/commodore.*/cbm/'` + ;; + *) + ;; +esac + +# Decode manufacturer-specific aliases for certain operating systems. + +if [ x"$os" != x"" ] +then +case $os in + # First match some system type aliases + # that might get confused with valid system types. + # -solaris* is a basic system type, with this one exception. + -solaris1 | -solaris1.*) + os=`echo $os | sed -e 's|solaris1|sunos4|'` + ;; + -solaris) + os=-solaris2 + ;; + -svr4*) + os=-sysv4 + ;; + -unixware*) + os=-sysv4.2uw + ;; + -gnu/linux*) + os=`echo $os | sed -e 's|gnu/linux|linux-gnu|'` + ;; + # First accept the basic system types. + # The portable systems comes first. + # Each alternative MUST END IN A *, to match a version number. + # -sysv* is not here because it comes later, after sysvr4. + -gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \ + | -*vms* | -sco* | -esix* | -isc* | -aix* | -sunos | -sunos[34]*\ + | -hpux* | -unos* | -osf* | -luna* | -dgux* | -solaris* | -sym* \ + | -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \ + | -aos* \ + | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \ + | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \ + | -hiux* | -386bsd* | -netbsd* | -openbsd* | -freebsd* | -riscix* \ + | -lynxos* | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \ + | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \ + | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \ + | -chorusos* | -chorusrdb* \ + | -cygwin* | -pe* | -psos* | -moss* | -proelf* | -rtems* \ + | -mingw32* | -linux-gnu* | -uxpv* | -beos* | -mpeix* | -udk* \ + | -interix* | -uwin* | -rhapsody* | -darwin* | -opened* \ + | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \ + | -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \ + | -os2* | -vos*) + # Remember, each alternative MUST END IN *, to match a version number. + ;; + -qnx*) + case $basic_machine in + x86-* | i*86-*) + ;; + *) + os=-nto$os + ;; + esac + ;; + -nto*) + os=-nto-qnx + ;; + -sim | -es1800* | -hms* | -xray | -os68k* | -none* | -v88r* \ + | -windows* | -osx | -abug | -netware* | -os9* | -beos* \ + | -macos* | -mpw* | -magic* | -mmixware* | -mon960* | -lnews*) + ;; + -mac*) + os=`echo $os | sed -e 's|mac|macos|'` + ;; + -linux*) + os=`echo $os | sed -e 's|linux|linux-gnu|'` + ;; + -sunos5*) + os=`echo $os | sed -e 's|sunos5|solaris2|'` + ;; + -sunos6*) + os=`echo $os | sed -e 's|sunos6|solaris3|'` + ;; + -opened*) + os=-openedition + ;; + -wince*) + os=-wince + ;; + -osfrose*) + os=-osfrose + ;; + -osf*) + os=-osf + ;; + -utek*) + os=-bsd + ;; + -dynix*) + os=-bsd + ;; + -acis*) + os=-aos + ;; + -386bsd) + os=-bsd + ;; + -ctix* | -uts*) + os=-sysv + ;; + -ns2 ) + os=-nextstep2 + ;; + -nsk*) + os=-nsk + ;; + # Preserve the version number of sinix5. + -sinix5.*) + os=`echo $os | sed -e 's|sinix|sysv|'` + ;; + -sinix*) + os=-sysv4 + ;; + -triton*) + os=-sysv3 + ;; + -oss*) + os=-sysv3 + ;; + -svr4) + os=-sysv4 + ;; + -svr3) + os=-sysv3 + ;; + -sysvr4) + os=-sysv4 + ;; + # This must come after -sysvr4. + -sysv*) + ;; + -ose*) + os=-ose + ;; + -es1800*) + os=-ose + ;; + -xenix) + os=-xenix + ;; + -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) + os=-mint + ;; + -none) + ;; + *) + # Get rid of the `-' at the beginning of $os. + os=`echo $os | sed 's/[^-]*-//'` + echo Invalid configuration \`$1\': system \`$os\' not recognized 1>&2 + exit 1 + ;; +esac +else + +# Here we handle the default operating systems that come with various machines. +# The value should be what the vendor currently ships out the door with their +# machine or put another way, the most popular os provided with the machine. + +# Note that if you're going to try to match "-MANUFACTURER" here (say, +# "-sun"), then you have to tell the case statement up towards the top +# that MANUFACTURER isn't an operating system. Otherwise, code above +# will signal an error saying that MANUFACTURER isn't an operating +# system, and we'll never get to this point. + +case $basic_machine in + *-acorn) + os=-riscix1.2 + ;; + arm*-rebel) + os=-linux + ;; + arm*-semi) + os=-aout + ;; + pdp10-*) + os=-tops20 + ;; + pdp11-*) + os=-none + ;; + *-dec | vax-*) + os=-ultrix4.2 + ;; + m68*-apollo) + os=-domain + ;; + i386-sun) + os=-sunos4.0.2 + ;; + m68000-sun) + os=-sunos3 + # This also exists in the configure program, but was not the + # default. + # os=-sunos4 + ;; + m68*-cisco) + os=-aout + ;; + mips*-cisco) + os=-elf + ;; + mips*-*) + os=-elf + ;; + *-tti) # must be before sparc entry or we get the wrong os. + os=-sysv3 + ;; + sparc-* | *-sun) + os=-sunos4.1.1 + ;; + *-be) + os=-beos + ;; + *-ibm) + os=-aix + ;; + *-wec) + os=-proelf + ;; + *-winbond) + os=-proelf + ;; + *-oki) + os=-proelf + ;; + *-hp) + os=-hpux + ;; + *-hitachi) + os=-hiux + ;; + i860-* | *-att | *-ncr | *-altos | *-motorola | *-convergent) + os=-sysv + ;; + *-cbm) + os=-amigaos + ;; + *-dg) + os=-dgux + ;; + *-dolphin) + os=-sysv3 + ;; + m68k-ccur) + os=-rtu + ;; + m88k-omron*) + os=-luna + ;; + *-next ) + os=-nextstep + ;; + *-sequent) + os=-ptx + ;; + *-crds) + os=-unos + ;; + *-ns) + os=-genix + ;; + i370-*) + os=-mvs + ;; + *-next) + os=-nextstep3 + ;; + *-gould) + os=-sysv + ;; + *-highlevel) + os=-bsd + ;; + *-encore) + os=-bsd + ;; + *-sgi) + os=-irix + ;; + *-siemens) + os=-sysv4 + ;; + *-masscomp) + os=-rtu + ;; + f30[01]-fujitsu | f700-fujitsu) + os=-uxpv + ;; + *-rom68k) + os=-coff + ;; + *-*bug) + os=-coff + ;; + *-apple) + os=-macos + ;; + *-atari*) + os=-mint + ;; + *) + os=-none + ;; +esac +fi + +# Here we handle the case where we know the os, and the CPU type, but not the +# manufacturer. We pick the logical manufacturer. +vendor=unknown +case $basic_machine in + *-unknown) + case $os in + -riscix*) + vendor=acorn + ;; + -sunos*) + vendor=sun + ;; + -aix*) + vendor=ibm + ;; + -beos*) + vendor=be + ;; + -hpux*) + vendor=hp + ;; + -mpeix*) + vendor=hp + ;; + -hiux*) + vendor=hitachi + ;; + -unos*) + vendor=crds + ;; + -dgux*) + vendor=dg + ;; + -luna*) + vendor=omron + ;; + -genix*) + vendor=ns + ;; + -mvs* | -opened*) + vendor=ibm + ;; + -ptx*) + vendor=sequent + ;; + -vxsim* | -vxworks*) + vendor=wrs + ;; + -aux*) + vendor=apple + ;; + -hms*) + vendor=hitachi + ;; + -mpw* | -macos*) + vendor=apple + ;; + -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) + vendor=atari + ;; + -vos*) + vendor=stratus + ;; + esac + basic_machine=`echo $basic_machine | sed "s/unknown/$vendor/"` + ;; +esac + +echo $basic_machine$os +exit 0 + +# Local variables: +# eval: (add-hook 'write-file-hooks 'time-stamp) +# time-stamp-start: "timestamp='" +# time-stamp-format: "%:y-%02m-%02d" +# time-stamp-end: "'" +# End: diff --git a/config/depcomp b/config/depcomp new file mode 100755 index 0000000..807b991 --- /dev/null +++ b/config/depcomp @@ -0,0 +1,423 @@ +#! /bin/sh + +# depcomp - compile a program generating dependencies as side-effects +# Copyright 1999, 2000 Free Software Foundation, Inc. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2, or (at your option) +# any later version. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. + +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA +# 02111-1307, USA. + +# As a special exception to the GNU General Public License, if you +# distribute this file as part of a program that contains a +# configuration script generated by Autoconf, you may include it under +# the same distribution terms that you use for the rest of that program. + +# Originally written by Alexandre Oliva . + +if test -z "$depmode" || test -z "$source" || test -z "$object"; then + echo "depcomp: Variables source, object and depmode must be set" 1>&2 + exit 1 +fi +# `libtool' can also be set to `yes' or `no'. + +if test -z "$depfile"; then + base=`echo "$object" | sed -e 's,^.*/,,' -e 's,\.\([^.]*\)$,.P\1,'` + dir=`echo "$object" | sed 's,/.*$,/,'` + if test "$dir" = "$object"; then + dir= + fi + # FIXME: should be _deps on DOS. + depfile="$dir.deps/$base" +fi + +tmpdepfile=${tmpdepfile-`echo "$depfile" | sed 's/\.\([^.]*\)$/.T\1/'`} + +rm -f "$tmpdepfile" + +# Some modes work just like other modes, but use different flags. We +# parameterize here, but still list the modes in the big case below, +# to make depend.m4 easier to write. Note that we *cannot* use a case +# here, because this file can only contain one case statement. +if test "$depmode" = hp; then + # HP compiler uses -M and no extra arg. + gccflag=-M + depmode=gcc +fi + +if test "$depmode" = dashXmstdout; then + # This is just like dashmstdout with a different argument. + dashmflag=-xM + depmode=dashmstdout +fi + +case "$depmode" in +gcc3) +## gcc 3 implements dependency tracking that does exactly what +## we want. Yay! Note: for some reason libtool 1.4 doesn't like +## it if -MD -MP comes after the -MF stuff. Hmm. + "$@" -MT "$object" -MD -MP -MF "$tmpdepfile" + stat=$? + if test $stat -eq 0; then : + else + rm -f "$tmpdepfile" + exit $stat + fi + mv "$tmpdepfile" "$depfile" + ;; + +gcc) +## There are various ways to get dependency output from gcc. Here's +## why we pick this rather obscure method: +## - Don't want to use -MD because we'd like the dependencies to end +## up in a subdir. Having to rename by hand is ugly. +## (We might end up doing this anyway to support other compilers.) +## - The DEPENDENCIES_OUTPUT environment variable makes gcc act like +## -MM, not -M (despite what the docs say). +## - Using -M directly means running the compiler twice (even worse +## than renaming). + if test -z "$gccflag"; then + gccflag=-MD, + fi + "$@" -Wp,"$gccflag$tmpdepfile" + stat=$? + if test $stat -eq 0; then : + else + rm -f "$tmpdepfile" + exit $stat + fi + rm -f "$depfile" + echo "$object : \\" > "$depfile" + alpha=ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz +## The second -e expression handles DOS-style file names with drive letters. + sed -e 's/^[^:]*: / /' \ + -e 's/^['$alpha']:\/[^:]*: / /' < "$tmpdepfile" >> "$depfile" +## This next piece of magic avoids the `deleted header file' problem. +## The problem is that when a header file which appears in a .P file +## is deleted, the dependency causes make to die (because there is +## typically no way to rebuild the header). We avoid this by adding +## dummy dependencies for each header file. Too bad gcc doesn't do +## this for us directly. + tr ' ' ' +' < "$tmpdepfile" | +## Some versions of gcc put a space before the `:'. On the theory +## that the space means something, we add a space to the output as +## well. +## Some versions of the HPUX 10.20 sed can't process this invocation +## correctly. Breaking it into two sed invocations is a workaround. + sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile" + rm -f "$tmpdepfile" + ;; + +hp) + # This case exists only to let depend.m4 do its work. It works by + # looking at the text of this script. This case will never be run, + # since it is checked for above. + exit 1 + ;; + +sgi) + if test "$libtool" = yes; then + "$@" "-Wp,-MDupdate,$tmpdepfile" + else + "$@" -MDupdate "$tmpdepfile" + fi + stat=$? + if test $stat -eq 0; then : + else + rm -f "$tmpdepfile" + exit $stat + fi + rm -f "$depfile" + + if test -f "$tmpdepfile"; then # yes, the sourcefile depend on other files + echo "$object : \\" > "$depfile" + + # Clip off the initial element (the dependent). Don't try to be + # clever and replace this with sed code, as IRIX sed won't handle + # lines with more than a fixed number of characters (4096 in + # IRIX 6.2 sed, 8192 in IRIX 6.5). We also remove comment lines; + # the IRIX cc adds comments like `#:fec' to the end of the + # dependency line. + tr ' ' ' +' < "$tmpdepfile" \ + | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' | \ + tr ' +' ' ' >> $depfile + echo >> $depfile + + # The second pass generates a dummy entry for each header file. + tr ' ' ' +' < "$tmpdepfile" \ + | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' -e 's/$/:/' \ + >> $depfile + else + # The sourcefile does not contain any dependencies, so just + # store a dummy comment line, to avoid errors with the Makefile + # "include basename.Plo" scheme. + echo "#dummy" > "$depfile" + fi + rm -f "$tmpdepfile" + ;; + +aix) + # The C for AIX Compiler uses -M and outputs the dependencies + # in a .u file. This file always lives in the current directory. + # Also, the AIX compiler puts `$object:' at the start of each line; + # $object doesn't have directory information. + stripped=`echo "$object" | sed -e 's,^.*/,,' -e 's/\(.*\)\..*$/\1/'` + tmpdepfile="$stripped.u" + outname="$stripped.o" + if test "$libtool" = yes; then + "$@" -Wc,-M + else + "$@" -M + fi + + stat=$? + if test $stat -eq 0; then : + else + rm -f "$tmpdepfile" + exit $stat + fi + + if test -f "$tmpdepfile"; then + # Each line is of the form `foo.o: dependent.h'. + # Do two passes, one to just change these to + # `$object: dependent.h' and one to simply `dependent.h:'. + sed -e "s,^$outname:,$object :," < "$tmpdepfile" > "$depfile" + sed -e "s,^$outname: \(.*\)$,\1:," < "$tmpdepfile" >> "$depfile" + else + # The sourcefile does not contain any dependencies, so just + # store a dummy comment line, to avoid errors with the Makefile + # "include basename.Plo" scheme. + echo "#dummy" > "$depfile" + fi + rm -f "$tmpdepfile" + ;; + +tru64) + # The Tru64 compiler uses -MD to generate dependencies as a side + # effect. `cc -MD -o foo.o ...' puts the dependencies into `foo.o.d'. + # At least on Alpha/Redhat 6.1, Compaq CCC V6.2-504 seems to put + # dependencies in `foo.d' instead, so we check for that too. + # Subdirectories are respected. + dir=`echo "$object" | sed -e 's|/[^/]*$|/|'` + test "x$dir" = "x$object" && dir= + base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'` + + if test "$libtool" = yes; then + tmpdepfile1="$dir.libs/$base.lo.d" + tmpdepfile2="$dir.libs/$base.d" + "$@" -Wc,-MD + else + tmpdepfile1="$dir$base.o.d" + tmpdepfile2="$dir$base.d" + "$@" -MD + fi + + stat=$? + if test $stat -eq 0; then : + else + rm -f "$tmpdepfile1" "$tmpdepfile2" + exit $stat + fi + + if test -f "$tmpdepfile1"; then + tmpdepfile="$tmpdepfile1" + else + tmpdepfile="$tmpdepfile2" + fi + if test -f "$tmpdepfile"; then + sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile" + # That's a space and a tab in the []. + sed -e 's,^.*\.[a-z]*:[ ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile" + else + echo "#dummy" > "$depfile" + fi + rm -f "$tmpdepfile" + ;; + +#nosideeffect) + # This comment above is used by automake to tell side-effect + # dependency tracking mechanisms from slower ones. + +dashmstdout) + # Important note: in order to support this mode, a compiler *must* + # always write the proprocessed file to stdout, regardless of -o. + "$@" || exit $? + + # Remove the call to Libtool. + if test "$libtool" = yes; then + while test $1 != '--mode=compile'; do + shift + done + shift + fi + + # Remove `-o $object'. We will use -o /dev/null later, + # however we can't do the remplacement now because + # `-o $object' might simply not be used + IFS=" " + for arg + do + case $arg in + -o) + shift + ;; + $object) + shift + ;; + *) + set fnord "$@" "$arg" + shift # fnord + shift # $arg + ;; + esac + done + + test -z "$dashmflag" && dashmflag=-M + "$@" -o /dev/null $dashmflag | sed 's:^[^:]*\:[ ]*:'"$object"'\: :' > "$tmpdepfile" + rm -f "$depfile" + cat < "$tmpdepfile" > "$depfile" + tr ' ' ' +' < "$tmpdepfile" | \ +## Some versions of the HPUX 10.20 sed can't process this invocation +## correctly. Breaking it into two sed invocations is a workaround. + sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile" + rm -f "$tmpdepfile" + ;; + +dashXmstdout) + # This case only exists to satisfy depend.m4. It is never actually + # run, as this mode is specially recognized in the preamble. + exit 1 + ;; + +makedepend) + "$@" || exit $? + # X makedepend + shift + cleared=no + for arg in "$@"; do + case $cleared in + no) + set ""; shift + cleared=yes ;; + esac + case "$arg" in + -D*|-I*) + set fnord "$@" "$arg"; shift ;; + -*) + ;; + *) + set fnord "$@" "$arg"; shift ;; + esac + done + obj_suffix="`echo $object | sed 's/^.*\././'`" + touch "$tmpdepfile" + ${MAKEDEPEND-makedepend} -o"$obj_suffix" -f"$tmpdepfile" "$@" + rm -f "$depfile" + cat < "$tmpdepfile" > "$depfile" + sed '1,2d' "$tmpdepfile" | tr ' ' ' +' | \ +## Some versions of the HPUX 10.20 sed can't process this invocation +## correctly. Breaking it into two sed invocations is a workaround. + sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile" + rm -f "$tmpdepfile" "$tmpdepfile".bak + ;; + +cpp) + # Important note: in order to support this mode, a compiler *must* + # always write the proprocessed file to stdout. + "$@" || exit $? + + # Remove the call to Libtool. + if test "$libtool" = yes; then + while test $1 != '--mode=compile'; do + shift + done + shift + fi + + # Remove `-o $object'. + IFS=" " + for arg + do + case $arg in + -o) + shift + ;; + $object) + shift + ;; + *) + set fnord "$@" "$arg" + shift # fnord + shift # $arg + ;; + esac + done + + "$@" -E | + sed -n '/^# [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' | + sed '$ s: \\$::' > "$tmpdepfile" + rm -f "$depfile" + echo "$object : \\" > "$depfile" + cat < "$tmpdepfile" >> "$depfile" + sed < "$tmpdepfile" '/^$/d;s/^ //;s/ \\$//;s/$/ :/' >> "$depfile" + rm -f "$tmpdepfile" + ;; + +msvisualcpp) + # Important note: in order to support this mode, a compiler *must* + # always write the proprocessed file to stdout, regardless of -o, + # because we must use -o when running libtool. + "$@" || exit $? + IFS=" " + for arg + do + case "$arg" in + "-Gm"|"/Gm"|"-Gi"|"/Gi"|"-ZI"|"/ZI") + set fnord "$@" + shift + shift + ;; + *) + set fnord "$@" "$arg" + shift + shift + ;; + esac + done + "$@" -E | + sed -n '/^#line [0-9][0-9]* "\([^"]*\)"/ s::echo "`cygpath -u \\"\1\\"`":p' | sort | uniq > "$tmpdepfile" + rm -f "$depfile" + echo "$object : \\" > "$depfile" + . "$tmpdepfile" | sed 's% %\\ %g' | sed -n '/^\(.*\)$/ s:: \1 \\:p' >> "$depfile" + echo " " >> "$depfile" + . "$tmpdepfile" | sed 's% %\\ %g' | sed -n '/^\(.*\)$/ s::\1\::p' >> "$depfile" + rm -f "$tmpdepfile" + ;; + +none) + exec "$@" + ;; + +*) + echo "Unknown depmode $depmode" 1>&2 + exit 1 + ;; +esac + +exit 0 diff --git a/config/install-sh b/config/install-sh new file mode 100755 index 0000000..e9de238 --- /dev/null +++ b/config/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/config/ltmain.sh b/config/ltmain.sh new file mode 100644 index 0000000..7b739c8 --- /dev/null +++ b/config/ltmain.sh @@ -0,0 +1,4988 @@ +# ltmain.sh - Provide generalized library-building support services. +# NOTE: Changing this file will not affect anything until you rerun configure. +# +# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001 +# Free Software Foundation, Inc. +# Originally by Gordon Matzigkeit , 1996 +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 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 + +# 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) + execute_dlfiles="$execute_dlfiles $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 this variable is set in any of the actions, the command in it +# will be execed at the end. This prevents here-documents from being +# left over by shells. +exec_cmd= + +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= + prev= + lastarg= + srcfile="$nonopt" + suppress_output= + + user_target=no + for arg + do + case $prev in + "") ;; + xcompiler) + # Aesthetically quote the previous argument. + prev= + lastarg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` + + case $arg in + # Double-quote args containing other shell metacharacters. + # Many Bourne shells cannot handle close brackets correctly + # in scan sets, so we specify it separately. + *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") + arg="\"$arg\"" + ;; + esac + + # Add the previous argument to base_compile. + if test -z "$base_compile"; then + base_compile="$lastarg" + else + base_compile="$base_compile $lastarg" + fi + continue + ;; + esac + + # 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 + ;; + + -prefer-pic) + pic_mode=yes + continue + ;; + + -prefer-non-pic) + pic_mode=no + continue + ;; + + -Xcompiler) + prev=xcompiler + continue + ;; + + -Wc,*) + args=`$echo "X$arg" | $Xsed -e "s/^-Wc,//"` + lastarg= + save_ifs="$IFS"; IFS=',' + for arg in $args; do + IFS="$save_ifs" + + # Double-quote args containing other shell metacharacters. + # Many Bourne shells cannot handle close brackets correctly + # in scan sets, so we specify it separately. + case $arg in + *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") + arg="\"$arg\"" + ;; + esac + lastarg="$lastarg $arg" + done + IFS="$save_ifs" + lastarg=`$echo "X$lastarg" | $Xsed -e "s/^ //"` + + # Add the arguments to base_compile. + if test -z "$base_compile"; then + base_compile="$lastarg" + else + base_compile="$base_compile $lastarg" + fi + 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 + + # On Cygwin there's no "real" PIC flag so we must build both object types + case $host_os in + cygwin* | mingw* | pw32* | os2*) + pic_mode=default + ;; + esac + if test "$pic_mode" = no && test "$deplibs_check_method" != pass_all; then + # non-PIC code in shared libraries is not supported + pic_mode=default + fi + + # Calculate the filename of the output object if compiler does + # not support -o with -c + if test "$compiler_c_o" = no; then + output_obj=`$echo "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 $run 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 + + if test "$pic_mode" != no; then + # All platforms use -DPIC, to notify preprocessed assembler code. + command="$base_compile $srcfile $pic_flag -DPIC" + else + # Don't build PIC code + command="$base_compile $srcfile" + fi + 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 "$pic_mode" != default) && + 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 + # Unlock the critical section if it was locked + if test "$need_locks" != no; then + $run $rm "$lockfile" + fi + 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 + if test "$pic_mode" != yes; then + # Don't build PIC code + command="$base_compile $srcfile" + else + # All platforms use -DPIC, to notify preprocessed assembler code. + command="$base_compile $srcfile $pic_flag -DPIC" + fi + 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 + $run $rm "$lockfile" + fi + + exit 0 + ;; + + # libtool link mode + link | relink) + modename="$modename: link" + case $host in + *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-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 + ;; + *) + allow_undefined=yes + ;; + esac + libtool_args="$nonopt" + compile_command="$nonopt" + finalize_command="$nonopt" + + compile_rpath= + finalize_rpath= + compile_shlibpath= + finalize_shlibpath= + convenience= + old_convenience= + deplibs= + old_deplibs= + compiler_flags= + linker_flags= + dllsearchpath= + lib_search_path=`pwd` + + avoid_version=no + dlfiles= + dlprefiles= + dlself=no + export_dynamic=no + export_symbols= + export_symbols_regex= + generated= + libobjs= + ltlibs= + module=no + no_install=no + objs= + prefer_static_libs=no + preload=no + prev= + prevarg= + release= + rpath= + xrpath= + perm_rpath= + temp_rpath= + thread_safe=no + vinfo= + + # We need to know -static, to get the right output filenames. + for arg + do + case $arg in + -all-static | -static) + if test "X$arg" = "X-all-static"; then + if test "$build_libtool_libs" = yes && test -z "$link_static_flag"; then + $echo "$modename: warning: complete static linking is impossible in this configuration" 1>&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 + case $arg in + *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") + qarg=\"`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`\" ### testsuite: skip nested quoting test + ;; + *) qarg=$arg ;; + esac + libtool_args="$libtool_args $qarg" + + # 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= + continue + ;; + 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 + ;; + xcompiler) + compiler_flags="$compiler_flags $qarg" + prev= + compile_command="$compile_command $qarg" + finalize_command="$finalize_command $qarg" + continue + ;; + xlinker) + linker_flags="$linker_flags $qarg" + compiler_flags="$compiler_flags $wl$qarg" + prev= + compile_command="$compile_command $wl$qarg" + finalize_command="$finalize_command $wl$qarg" + continue + ;; + *) + eval "$prev=\"\$arg\"" + prev= + continue + ;; + esac + fi # test -n $prev + + prevarg="$arg" + + case $arg in + -all-static) + if test -n "$link_static_flag"; then + 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: more than one -exported-symbols argument is not allowed" + exit 1 + fi + if test "X$arg" = "X-export-symbols"; then + prev=expsyms + else + prev=expsyms_regex + fi + continue + ;; + + # The native IRIX linker understands -LANG:*, -LIST:* and -LNO:* + # so, if we see these flags be careful not to treat them like -L + -L[A-Z][A-Z]*:*) + case $with_gcc/$host in + no/*-*-irix*) + compile_command="$compile_command $arg" + finalize_command="$finalize_command $arg" + ;; + esac + 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: cannot determine absolute directory name of \`$dir'" 1>&2 + exit 1 + fi + dir="$absdir" + ;; + esac + case "$deplibs " in + *" -L$dir "*) ;; + *) + deplibs="$deplibs -L$dir" + lib_search_path="$lib_search_path $dir" + ;; + esac + case $host in + *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*) + case :$dllsearchpath: in + *":$dir:"*) ;; + *) dllsearchpath="$dllsearchpath:$dir";; + esac + ;; + esac + continue + ;; + + -l*) + if test "X$arg" = "X-lc" || test "X$arg" = "X-lm"; then + case $host in + *-*-cygwin* | *-*-pw32* | *-*-beos*) + # These systems don't actually have a C or math library (as such) + continue + ;; + *-*-mingw* | *-*-os2*) + # These systems don't actually have a C library (as such) + test "X$arg" = "X-lc" && continue + ;; + *-*-openbsd*) + # Do not include libc due to us having libc/libc_r. + test "X$arg" = "X-lc" && continue + ;; + esac + elif test "X$arg" = "X-lc_r"; then + case $host in + *-*-openbsd*) + # Do not include libc_r directly, use -pthread flag. + continue + ;; + esac + fi + deplibs="$deplibs $arg" + continue + ;; + + -module) + module=yes + continue + ;; + + -no-fast-install) + fast_install=no + continue + ;; + + -no-install) + case $host in + *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*) + # The PATH hackery in wrapper scripts is required on Windows + # in order for the loader to find any dlls it needs. + $echo "$modename: warning: \`-no-install' is ignored for $host" 1>&2 + $echo "$modename: warning: assuming \`-no-fast-install' instead" 1>&2 + fast_install=no + ;; + *) no_install=yes ;; + esac + 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) + # The effects of -static are defined in a previous loop. + # We used to do the same as -all-static on platforms that + # didn't have a PIC flag, but the assumption that the effects + # would be equivalent was wrong. It would break on at least + # Digital Unix and AIX. + continue + ;; + + -thread-safe) + thread_safe=yes + continue + ;; + + -version-info) + prev=vinfo + continue + ;; + + -Wc,*) + args=`$echo "X$arg" | $Xsed -e "$sed_quote_subst" -e 's/^-Wc,//'` + arg= + save_ifs="$IFS"; IFS=',' + for flag in $args; do + IFS="$save_ifs" + case $flag in + *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") + flag="\"$flag\"" + ;; + esac + arg="$arg $wl$flag" + compiler_flags="$compiler_flags $flag" + done + IFS="$save_ifs" + arg=`$echo "X$arg" | $Xsed -e "s/^ //"` + ;; + + -Wl,*) + args=`$echo "X$arg" | $Xsed -e "$sed_quote_subst" -e 's/^-Wl,//'` + arg= + save_ifs="$IFS"; IFS=',' + for flag in $args; do + IFS="$save_ifs" + case $flag in + *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") + flag="\"$flag\"" + ;; + esac + arg="$arg $wl$flag" + compiler_flags="$compiler_flags $wl$flag" + linker_flags="$linker_flags $flag" + done + IFS="$save_ifs" + arg=`$echo "X$arg" | $Xsed -e "s/^ //"` + ;; + + -Xcompiler) + prev=xcompiler + continue + ;; + + -Xlinker) + prev=xlinker + 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 + ;; + + *.lo | *.$objext) + # A library or standard object. + if test "$prev" = dlfiles; then + # This file was specified with -dlopen. + if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then + dlfiles="$dlfiles $arg" + 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= + else + case $arg in + *.lo) libobjs="$libobjs $arg" ;; + *) objs="$objs $arg" ;; + esac + fi + ;; + + *.$libext) + # An archive. + deplibs="$deplibs $arg" + old_deplibs="$old_deplibs $arg" + continue + ;; + + *.la) + # A libtool-controlled library. + + if test "$prev" = dlfiles; then + # This library was specified with -dlopen. + dlfiles="$dlfiles $arg" + prev= + elif test "$prev" = dlprefiles; then + # The library was specified with -dlpreopen. + dlprefiles="$dlprefiles $arg" + prev= + else + deplibs="$deplibs $arg" + fi + continue + ;; + + # Some other compiler argument. + *) + # Unknown arguments in both finalize_command and compile_command need + # to be aesthetically quoted because they are evaled later. + arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` + case $arg in + *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") + arg="\"$arg\"" + ;; + esac + ;; + esac # arg + + # 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 # argument parsing loop + + 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 + + # calculate the name of the file, without its directory + outputname=`$echo "X$output" | $Xsed -e 's%^.*/%%'` + libobjs_save="$libobjs" + + if test -n "$shlibpath_var"; then + # get the directories listed in $shlibpath_var + eval shlib_search_path=\`\$echo \"X\${$shlibpath_var}\" \| \$Xsed -e \'s/:/ /g\'\` + else + shlib_search_path= + fi + eval sys_lib_search_path=\"$sys_lib_search_path_spec\" + eval sys_lib_dlsearch_path=\"$sys_lib_dlsearch_path_spec\" + + 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 object directory. + 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 + + # Determine the type of output + case $output in + "") + $echo "$modename: you must specify an output file" 1>&2 + $echo "$help" 1>&2 + exit 1 + ;; + *.$libext) linkmode=oldlib ;; + *.lo | *.$objext) linkmode=obj ;; + *.la) linkmode=lib ;; + *) linkmode=prog ;; # Anything else should be a program. + esac + + specialdeplibs= + libs= + # Find all interdependent deplibs by searching for libraries + # that are linked more than once (e.g. -la -lb -la) + for deplib in $deplibs; do + case "$libs " in + *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;; + esac + libs="$libs $deplib" + done + deplibs= + newdependency_libs= + newlib_search_path= + need_relink=no # whether we're linking any uninstalled libtool libraries + notinst_deplibs= # not-installed libtool libraries + notinst_path= # paths that contain not-installed libtool libraries + case $linkmode in + lib) + passes="conv link" + for file in $dlfiles $dlprefiles; do + case $file in + *.la) ;; + *) + $echo "$modename: libraries can \`-dlopen' only libtool libraries: $file" 1>&2 + exit 1 + ;; + esac + done + ;; + prog) + compile_deplibs= + finalize_deplibs= + alldeplibs=no + newdlfiles= + newdlprefiles= + passes="conv scan dlopen dlpreopen link" + ;; + *) passes="conv" + ;; + esac + for pass in $passes; do + if test "$linkmode" = prog; then + # Determine which files to process + case $pass in + dlopen) + libs="$dlfiles" + save_deplibs="$deplibs" # Collect dlpreopened libraries + deplibs= + ;; + dlpreopen) libs="$dlprefiles" ;; + link) libs="$deplibs %DEPLIBS% $dependency_libs" ;; + esac + fi + for deplib in $libs; do + lib= + found=no + case $deplib in + -l*) + if test "$linkmode" = oldlib && test "$linkmode" = obj; then + $echo "$modename: warning: \`-l' is ignored for archives/objects: $deplib" 1>&2 + continue + fi + if test "$pass" = conv; then + deplibs="$deplib $deplibs" + continue + fi + name=`$echo "X$deplib" | $Xsed -e 's/^-l//'` + for searchdir in $newlib_search_path $lib_search_path $sys_lib_search_path $shlib_search_path; do + # Search the libtool library + lib="$searchdir/lib${name}.la" + if test -f "$lib"; then + found=yes + break + fi + done + if test "$found" != yes; then + # deplib doesn't seem to be a libtool library + if test "$linkmode,$pass" = "prog,link"; then + compile_deplibs="$deplib $compile_deplibs" + finalize_deplibs="$deplib $finalize_deplibs" + else + deplibs="$deplib $deplibs" + test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs" + fi + continue + fi + ;; # -l + -L*) + case $linkmode in + lib) + deplibs="$deplib $deplibs" + test "$pass" = conv && continue + newdependency_libs="$deplib $newdependency_libs" + newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'` + ;; + prog) + if test "$pass" = conv; then + deplibs="$deplib $deplibs" + continue + fi + if test "$pass" = scan; then + deplibs="$deplib $deplibs" + newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'` + else + compile_deplibs="$deplib $compile_deplibs" + finalize_deplibs="$deplib $finalize_deplibs" + fi + ;; + *) + $echo "$modename: warning: \`-L' is ignored for archives/objects: $deplib" 1>&2 + ;; + esac # linkmode + continue + ;; # -L + -R*) + if test "$pass" = link; then + dir=`$echo "X$deplib" | $Xsed -e 's/^-R//'` + # Make sure the xrpath contains only unique directories. + case "$xrpath " in + *" $dir "*) ;; + *) xrpath="$xrpath $dir" ;; + esac + fi + deplibs="$deplib $deplibs" + continue + ;; + *.la) lib="$deplib" ;; + *.$libext) + if test "$pass" = conv; then + deplibs="$deplib $deplibs" + continue + fi + case $linkmode in + lib) + if test "$deplibs_check_method" != pass_all; then + echo + echo "*** Warning: This library needs some functionality provided by $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." + else + echo + echo "*** Warning: Linking the shared library $output against the" + echo "*** static library $deplib is not portable!" + deplibs="$deplib $deplibs" + fi + continue + ;; + prog) + if test "$pass" != link; then + deplibs="$deplib $deplibs" + else + compile_deplibs="$deplib $compile_deplibs" + finalize_deplibs="$deplib $finalize_deplibs" + fi + continue + ;; + esac # linkmode + ;; # *.$libext + *.lo | *.$objext) + if test "$pass" = dlpreopen || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then + # If there is no dlopen support or we're linking statically, + # we need to preload. + newdlprefiles="$newdlprefiles $deplib" + compile_deplibs="$deplib $compile_deplibs" + finalize_deplibs="$deplib $finalize_deplibs" + else + newdlfiles="$newdlfiles $deplib" + fi + continue + ;; + %DEPLIBS%) + alldeplibs=yes + continue + ;; + esac # case $deplib + if test "$found" = yes || test -f "$lib"; then : + else + $echo "$modename: cannot find the library \`$lib'" 1>&2 + exit 1 + fi + + # Check to see that this really is a libtool archive. + if (sed -e '2q' $lib | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then : + else + $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2 + exit 1 + fi + + ladir=`$echo "X$lib" | $Xsed -e 's%/[^/]*$%%'` + test "X$ladir" = "X$lib" && ladir="." + + dlname= + dlopen= + dlpreopen= + libdir= + library_names= + old_library= + # If the library was installed with an old release of libtool, + # it will not redefine variable installed. + installed=yes + + # Read the .la file + case $lib in + */* | *\\*) . $lib ;; + *) . ./$lib ;; + esac + + if test "$linkmode,$pass" = "lib,link" || + test "$linkmode,$pass" = "prog,scan" || + { test "$linkmode" = oldlib && test "$linkmode" = obj; }; then + # Add dl[pre]opened files of deplib + test -n "$dlopen" && dlfiles="$dlfiles $dlopen" + test -n "$dlpreopen" && dlprefiles="$dlprefiles $dlpreopen" + fi + + if test "$pass" = conv; then + # Only check for convenience libraries + deplibs="$lib $deplibs" + if test -z "$libdir"; then + if test -z "$old_library"; then + $echo "$modename: cannot find name of link library for \`$lib'" 1>&2 + exit 1 + fi + # It is a libtool convenience library, so add in its objects. + convenience="$convenience $ladir/$objdir/$old_library" + old_convenience="$old_convenience $ladir/$objdir/$old_library" + tmp_libs= + for deplib in $dependency_libs; do + deplibs="$deplib $deplibs" + case "$tmp_libs " in + *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;; + esac + tmp_libs="$tmp_libs $deplib" + done + elif test "$linkmode" != prog && test "$linkmode" != lib; then + $echo "$modename: \`$lib' is not a convenience library" 1>&2 + exit 1 + fi + continue + fi # $pass = conv + + # 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 \`$lib'" 1>&2 + exit 1 + fi + + # This library was specified with -dlopen. + if test "$pass" = dlopen; then + if test -z "$libdir"; then + $echo "$modename: cannot -dlopen a convenience library: \`$lib'" 1>&2 + exit 1 + fi + if test -z "$dlname" || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then + # If there is no dlname, no dlopen support or we're linking + # statically, we need to preload. + dlprefiles="$dlprefiles $lib" + else + newdlfiles="$newdlfiles $lib" + fi + continue + fi # $pass = dlopen + + # We need an absolute path. + case $ladir in + [\\/]* | [A-Za-z]:[\\/]*) abs_ladir="$ladir" ;; + *) + abs_ladir=`cd "$ladir" && pwd` + if test -z "$abs_ladir"; then + $echo "$modename: warning: cannot determine absolute directory name of \`$ladir'" 1>&2 + $echo "$modename: passing it literally to the linker, although it might fail" 1>&2 + abs_ladir="$ladir" + fi + ;; + esac + laname=`$echo "X$lib" | $Xsed -e 's%^.*/%%'` + + # Find the relevant object directory and library name. + if test "X$installed" = Xyes; then + if test ! -f "$libdir/$linklib" && test -f "$abs_ladir/$linklib"; then + $echo "$modename: warning: library \`$lib' was moved." 1>&2 + dir="$ladir" + absdir="$abs_ladir" + libdir="$abs_ladir" + else + dir="$libdir" + absdir="$libdir" + fi + else + dir="$ladir/$objdir" + absdir="$abs_ladir/$objdir" + # Remove this search path later + notinst_path="$notinst_path $abs_ladir" + fi # $installed = yes + name=`$echo "X$laname" | $Xsed -e 's/\.la$//' -e 's/^lib//'` + + # This library was specified with -dlpreopen. + if test "$pass" = dlpreopen; then + if test -z "$libdir"; then + $echo "$modename: cannot -dlpreopen a convenience library: \`$lib'" 1>&2 + exit 1 + fi + # Prefer using a static library (so that no silly _DYNAMIC symbols + # are required to link). + if test -n "$old_library"; then + newdlprefiles="$newdlprefiles $dir/$old_library" + # Otherwise, use the dlname, so that lt_dlopen finds it. + elif test -n "$dlname"; then + newdlprefiles="$newdlprefiles $dir/$dlname" + else + newdlprefiles="$newdlprefiles $dir/$linklib" + fi + fi # $pass = dlpreopen + + if test -z "$libdir"; then + # Link the convenience library + if test "$linkmode" = lib; then + deplibs="$dir/$old_library $deplibs" + elif test "$linkmode,$pass" = "prog,link"; then + compile_deplibs="$dir/$old_library $compile_deplibs" + finalize_deplibs="$dir/$old_library $finalize_deplibs" + else + deplibs="$lib $deplibs" + fi + continue + fi + + if test "$linkmode" = prog && test "$pass" != link; then + newlib_search_path="$newlib_search_path $ladir" + deplibs="$lib $deplibs" + + linkalldeplibs=no + if test "$link_all_deplibs" != no || test -z "$library_names" || + test "$build_libtool_libs" = no; then + linkalldeplibs=yes + fi + + tmp_libs= + for deplib in $dependency_libs; do + case $deplib in + -L*) newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`;; ### testsuite: skip nested quoting test + esac + # Need to link against all dependency_libs? + if test "$linkalldeplibs" = yes; then + deplibs="$deplib $deplibs" + else + # Need to hardcode shared library paths + # or/and link against static libraries + newdependency_libs="$deplib $newdependency_libs" + fi + case "$tmp_libs " in + *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;; + esac + tmp_libs="$tmp_libs $deplib" + done # for deplib + continue + fi # $linkmode = prog... + + link_static=no # Whether the deplib will be linked statically + if test -n "$library_names" && + { test "$prefer_static_libs" = no || test -z "$old_library"; }; then + # Link against this shared library + + if test "$linkmode,$pass" = "prog,link" || + { test "$linkmode" = lib && test "$hardcode_into_libs" = yes; }; then + # Hardcode the library path. + # Skip directories that are in the system default run-time + # search path. + case " $sys_lib_dlsearch_path " in + *" $absdir "*) ;; + *) + case "$compile_rpath " in + *" $absdir "*) ;; + *) 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 + if test "$linkmode" = prog; then + # We need to hardcode the library path + if test -n "$shlibpath_var"; then + # Make sure the rpath contains only unique directories. + case "$temp_rpath " in + *" $dir "*) ;; + *" $absdir "*) ;; + *) temp_rpath="$temp_rpath $dir" ;; + esac + fi + fi + fi # $linkmode,$pass = prog,link... + + if test "$alldeplibs" = yes && + { test "$deplibs_check_method" = pass_all || + { test "$build_libtool_libs" = yes && + test -n "$library_names"; }; }; then + # We only need to search for static libraries + continue + fi + + if test "$installed" = no; then + notinst_deplibs="$notinst_deplibs $lib" + need_relink=yes + fi + + if test -n "$old_archive_from_expsyms_cmds"; then + # figure out the soname + set dummy $library_names + realname="$2" + shift; shift + libname=`eval \\$echo \"$libname_spec\"` + # use dlname if we got it. it's perfectly good, no? + if test -n "$dlname"; then + soname="$dlname" + elif test -n "$soname_spec"; then + # bleh windows + case $host in + *cygwin*) + major=`expr $current - $age` + versuffix="-$major" + ;; + esac + eval soname=\"$soname_spec\" + else + soname="$realname" + fi + + # Make a new name for the extract_expsyms_cmds to use + soroot="$soname" + soname=`echo $soroot | sed -e 's/^.*\///'` + newlib="libimp-`echo $soname | sed 's/^lib//;s/\.dll$//'`.a" + + # If the library has no export list, then create one now + if test -f "$output_objdir/$soname-def"; then : + else + $show "extracting exported symbol list from \`$soname'" + save_ifs="$IFS"; IFS='~' + eval cmds=\"$extract_expsyms_cmds\" + for cmd in $cmds; do + IFS="$save_ifs" + $show "$cmd" + $run eval "$cmd" || exit $? + done + IFS="$save_ifs" + fi + + # Create $newlib + if test -f "$output_objdir/$newlib"; then :; else + $show "generating import library for \`$soname'" + save_ifs="$IFS"; IFS='~' + eval cmds=\"$old_archive_from_expsyms_cmds\" + for cmd in $cmds; do + IFS="$save_ifs" + $show "$cmd" + $run eval "$cmd" || exit $? + done + IFS="$save_ifs" + fi + # make sure the library variables are pointing to the new library + dir=$output_objdir + linklib=$newlib + fi # test -n "$old_archive_from_expsyms_cmds" + + if test "$linkmode" = prog || test "$mode" != relink; then + add_shlibpath= + add_dir= + add= + lib_linked=yes + case $hardcode_action in + immediate | unsupported) + if test "$hardcode_direct" = no; then + add="$dir/$linklib" + elif test "$hardcode_minus_L" = no; then + case $host in + *-*-sunos*) add_shlibpath="$dir" ;; + esac + add_dir="-L$dir" + add="-l$name" + elif test "$hardcode_shlibpath_var" = no; then + add_shlibpath="$dir" + add="-l$name" + else + lib_linked=no + fi + ;; + relink) + if test "$hardcode_direct" = yes; then + add="$dir/$linklib" + elif test "$hardcode_minus_L" = yes; then + add_dir="-L$dir" + add="-l$name" + elif test "$hardcode_shlibpath_var" = yes; then + add_shlibpath="$dir" + add="-l$name" + else + lib_linked=no + fi + ;; + *) lib_linked=no ;; + esac + + if test "$lib_linked" != yes; then + $echo "$modename: configuration error: unsupported hardcode properties" + exit 1 + fi + + if test -n "$add_shlibpath"; then + case :$compile_shlibpath: in + *":$add_shlibpath:"*) ;; + *) compile_shlibpath="$compile_shlibpath$add_shlibpath:" ;; + esac + fi + if test "$linkmode" = prog; then + test -n "$add_dir" && compile_deplibs="$add_dir $compile_deplibs" + test -n "$add" && compile_deplibs="$add $compile_deplibs" + else + test -n "$add_dir" && deplibs="$add_dir $deplibs" + test -n "$add" && deplibs="$add $deplibs" + if test "$hardcode_direct" != yes && \ + test "$hardcode_minus_L" != yes && \ + test "$hardcode_shlibpath_var" = yes; then + case :$finalize_shlibpath: in + *":$libdir:"*) ;; + *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;; + esac + fi + fi + fi + + if test "$linkmode" = prog || test "$mode" = relink; then + add_shlibpath= + add_dir= + add= + # Finalize command for both is simple: just hardcode it. + if test "$hardcode_direct" = yes; then + add="$libdir/$linklib" + elif test "$hardcode_minus_L" = yes; then + add_dir="-L$libdir" + add="-l$name" + elif test "$hardcode_shlibpath_var" = yes; then + case :$finalize_shlibpath: in + *":$libdir:"*) ;; + *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;; + esac + add="-l$name" + else + # We cannot seem to hardcode it, guess we'll fake it. + add_dir="-L$libdir" + add="-l$name" + fi + + if test "$linkmode" = prog; then + test -n "$add_dir" && finalize_deplibs="$add_dir $finalize_deplibs" + test -n "$add" && finalize_deplibs="$add $finalize_deplibs" + else + test -n "$add_dir" && deplibs="$add_dir $deplibs" + test -n "$add" && deplibs="$add $deplibs" + fi + fi + elif test "$linkmode" = prog; then + if test "$alldeplibs" = yes && + { test "$deplibs_check_method" = pass_all || + { test "$build_libtool_libs" = yes && + test -n "$library_names"; }; }; then + # We only need to search for static libraries + continue + fi + + # Try to link the static library + # Here we assume that one of hardcode_direct or hardcode_minus_L + # is not unsupported. This is valid on all known static and + # shared platforms. + if test "$hardcode_direct" != unsupported; then + test -n "$old_library" && linklib="$old_library" + compile_deplibs="$dir/$linklib $compile_deplibs" + finalize_deplibs="$dir/$linklib $finalize_deplibs" + else + compile_deplibs="-l$name -L$dir $compile_deplibs" + finalize_deplibs="-l$name -L$dir $finalize_deplibs" + fi + elif test "$build_libtool_libs" = yes; then + # Not a shared library + if test "$deplibs_check_method" != pass_all; then + # We're trying link a shared library against a static one + # but the system doesn't support it. + + # Just print a warning and add the library to dependency_libs so + # that the program can be linked against the static library. + echo + echo "*** Warning: This library needs some functionality provided by $lib." + echo "*** I have the capability to make that library automatically link in when" + echo "*** you link to this library. But I can only do this if you have a" + echo "*** shared version of the library, which you do not appear to have." + if test "$module" = yes; then + echo "*** Therefore, libtool will create a static module, that should work " + echo "*** as long as the dlopening 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 + build_libtool_libs=module + build_old_libs=yes + else + build_libtool_libs=no + fi + fi + else + convenience="$convenience $dir/$old_library" + old_convenience="$old_convenience $dir/$old_library" + deplibs="$dir/$old_library $deplibs" + link_static=yes + fi + fi # link shared/static library? + + if test "$linkmode" = lib; then + if test -n "$dependency_libs" && + { test "$hardcode_into_libs" != yes || test "$build_old_libs" = yes || + test "$link_static" = yes; }; then + # Extract -R from dependency_libs + temp_deplibs= + for libdir in $dependency_libs; do + case $libdir in + -R*) temp_xrpath=`$echo "X$libdir" | $Xsed -e 's/^-R//'` + case " $xrpath " in + *" $temp_xrpath "*) ;; + *) xrpath="$xrpath $temp_xrpath";; + esac;; + *) temp_deplibs="$temp_deplibs $libdir";; + esac + done + dependency_libs="$temp_deplibs" + fi + + newlib_search_path="$newlib_search_path $absdir" + # Link against this library + test "$link_static" = no && newdependency_libs="$abs_ladir/$laname $newdependency_libs" + # ... and its dependency_libs + tmp_libs= + for deplib in $dependency_libs; do + newdependency_libs="$deplib $newdependency_libs" + case "$tmp_libs " in + *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;; + esac + tmp_libs="$tmp_libs $deplib" + done + + if test "$link_all_deplibs" != no; then + # Add the search paths of all dependency libraries + for deplib in $dependency_libs; do + case $deplib in + -L*) path="$deplib" ;; + *.la) + dir=`$echo "X$deplib" | $Xsed -e 's%/[^/]*$%%'` + test "X$dir" = "X$deplib" && dir="." + # 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 + absdir="$dir" + fi + ;; + esac + if grep "^installed=no" $deplib > /dev/null; then + path="-L$absdir/$objdir" + else + eval libdir=`sed -n -e 's/^libdir=\(.*\)$/\1/p' $deplib` + if test -z "$libdir"; then + $echo "$modename: \`$deplib' is not a valid libtool archive" 1>&2 + exit 1 + fi + if test "$absdir" != "$libdir"; then + $echo "$modename: warning: \`$deplib' seems to be moved" 1>&2 + fi + path="-L$absdir" + fi + ;; + *) continue ;; + esac + case " $deplibs " in + *" $path "*) ;; + *) deplibs="$deplibs $path" ;; + esac + done + fi # link_all_deplibs != no + fi # linkmode = lib + done # for deplib in $libs + if test "$pass" = dlpreopen; then + # Link the dlpreopened libraries before other libraries + for deplib in $save_deplibs; do + deplibs="$deplib $deplibs" + done + fi + if test "$pass" != dlopen; then + test "$pass" != scan && dependency_libs="$newdependency_libs" + if test "$pass" != conv; then + # Make sure lib_search_path contains only unique directories. + lib_search_path= + for dir in $newlib_search_path; do + case "$lib_search_path " in + *" $dir "*) ;; + *) lib_search_path="$lib_search_path $dir" ;; + esac + done + newlib_search_path= + fi + + if test "$linkmode,$pass" != "prog,link"; then + vars="deplibs" + else + vars="compile_deplibs finalize_deplibs" + fi + for var in $vars dependency_libs; do + # Add libraries to $var in reverse order + eval tmp_libs=\"\$$var\" + new_libs= + for deplib in $tmp_libs; do + case $deplib in + -L*) new_libs="$deplib $new_libs" ;; + *) + case " $specialdeplibs " in + *" $deplib "*) new_libs="$deplib $new_libs" ;; + *) + case " $new_libs " in + *" $deplib "*) ;; + *) new_libs="$deplib $new_libs" ;; + esac + ;; + esac + ;; + esac + done + tmp_libs= + for deplib in $new_libs; do + case $deplib in + -L*) + case " $tmp_libs " in + *" $deplib "*) ;; + *) tmp_libs="$tmp_libs $deplib" ;; + esac + ;; + *) tmp_libs="$tmp_libs $deplib" ;; + esac + done + eval $var=\"$tmp_libs\" + done # for var + fi + if test "$pass" = "conv" && + { test "$linkmode" = "lib" || test "$linkmode" = "prog"; }; then + libs="$deplibs" # reset libs + deplibs= + fi + done # for pass + if test "$linkmode" = prog; then + dlfiles="$newdlfiles" + dlprefiles="$newdlprefiles" + fi + + case $linkmode in + oldlib) + 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" + objs="$objs$old_deplibs" + ;; + + lib) + # 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 + + if test -n "$objs"; then + if test "$deplibs_check_method" != pass_all; then + $echo "$modename: cannot build libtool library \`$output' from non-libtool objects on this host:$objs" 2>&1 + exit 1 + else + echo + echo "*** Warning: Linking the shared library $output against the non-libtool" + echo "*** objects $objs is not portable!" + libobjs="$libobjs $objs" + fi + fi + + if test "$dlself" != no; then + $echo "$modename: warning: \`-dlopen self' 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 + + 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. + 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-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-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-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) ;; + + darwin) + # Like Linux, but with the current version available in + # verstring for coding it into the library header + major=.`expr $current - $age` + versuffix="$major.$age.$revision" + # Darwin ld doesn't like 0 for these options... + minor_current=`expr $current + 1` + verstring="-compatibility_version $minor_current -current_version $minor_current.$revision" + ;; + + freebsd-aout) + major=".$current" + versuffix=".$current.$revision"; + ;; + + freebsd-elf) + major=".$current" + versuffix=".$current"; + ;; + + irix) + major=`expr $current - $age + 1` + verstring="sgi$major.$revision" + + # Add in all the interfaces that we are compatible with. + loop=$revision + while test "$loop" -ne 0; do + iface=`expr $revision - $loop` + loop=`expr $loop - 1` + verstring="sgi$major.$iface:$verstring" + done + + # Before this point, $major must not contain `.'. + major=.$major + versuffix="$major.$revision" + ;; + + 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" -ne 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" + ;; + + windows) + # Use '-' rather than '.', since we only want one + # extension on DOS 8.3 filesystems. + major=`expr $current - $age` + versuffix="-$major" + ;; + + *) + $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" + case $version_type in + darwin) + # we can't check for "0.0" in archive_cmds due to quoting + # problems, so we reset it completely + verstring="" + ;; + *) + verstring="0.0" + ;; + esac + if test "$need_version" = no; then + versuffix= + else + versuffix=".0.0" + fi + fi + + # Remove version info from name if versioning should be avoided + if test "$avoid_version" = yes && test "$need_version" = no; then + major= + versuffix= + verstring="" + fi + + # Check to see if the archive will have undefined symbols. + if test "$allow_undefined" = yes; then + if test "$allow_undefined_flag" = unsupported; then + $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 + fi + + if test "$mode" != relink; then + # Remove our outputs. + $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}.* + 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 + + # Eliminate all temporary directories. + for path in $notinst_path; do + lib_search_path=`echo "$lib_search_path " | sed -e 's% $path % %g'` + deplibs=`echo "$deplibs " | sed -e 's% -L$path % %g'` + dependency_libs=`echo "$dependency_libs " | sed -e 's% -L$path % %g'` + done + + if test -n "$xrpath"; then + # If the user specified any rpath flags, then add them. + temp_xrpath= + for libdir in $xrpath; do + temp_xrpath="$temp_xrpath -R$libdir" + case "$finalize_rpath " in + *" $libdir "*) ;; + *) finalize_rpath="$finalize_rpath $libdir" ;; + esac + done + if test "$hardcode_into_libs" != yes || test "$build_old_libs" = yes; then + dependency_libs="$temp_xrpath $dependency_libs" + fi + fi + + # Make sure dlfiles contains only unique files that won't be dlpreopened + old_dlfiles="$dlfiles" + dlfiles= + for lib in $old_dlfiles; do + case " $dlprefiles $dlfiles " in + *" $lib "*) ;; + *) dlfiles="$dlfiles $lib" ;; + esac + done + + # Make sure dlprefiles contains only unique files + old_dlprefiles="$dlprefiles" + dlprefiles= + for lib in $old_dlprefiles; do + case "$dlprefiles " in + *" $lib "*) ;; + *) dlprefiles="$dlprefiles $lib" ;; + esac + done + + if test "$build_libtool_libs" = yes; then + if test -n "$rpath"; then + case $host in + *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-beos*) + # these systems don't actually have a c library (as such)! + ;; + *-*-rhapsody* | *-*-darwin1.[012]) + # Rhapsody C library is in the System framework + deplibs="$deplibs -framework System" + ;; + *-*-netbsd*) + # Don't link with libc until the a.out ld.so is fixed. + ;; + *-*-openbsd*) + # Do not include libc due to us having libc/libc_r. + ;; + *) + # Add libc to deplibs on all other systems if necessary. + if test "$build_libtool_need_lc" = "yes"; then + deplibs="$deplibs -lc" + fi + ;; + esac + fi + + # Transform deplibs into only deplibs that can be linked in shared. + name_save=$name + libname_save=$libname + release_save=$release + versuffix_save=$versuffix + major_save=$major + # I'm not sure if I'm treating the release correctly. I think + # release should show up in the -l (ie -lgmp5) so we don't want to + # add it in twice. Is that correct? + release="" + versuffix="" + major="" + newdeplibs= + droppeddeps=no + case $deplibs_check_method in + pass_all) + # Don't check for shared/static. Everything works. + # This might be a little naive. We might want to check + # whether the library exists or not. But this is on + # osf3 & osf4 and I'm not really sure... Just + # implementing what was already the 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. + ;; + match_pattern*) + set dummy $deplibs_check_method + match_pattern_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"` + for a_deplib in $deplibs; do + name="`expr $a_deplib : '-l\(.*\)'`" + # If $name is empty we are operating on a -L argument. + if test -n "$name" && test "$name" != "0"; then + libname=`eval \\$echo \"$libname_spec\"` + for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do + potential_libs=`ls $i/$libname[.-]* 2>/dev/null` + for potent_lib in $potential_libs; do + if eval echo \"$potent_lib\" 2>/dev/null \ + | sed 10q \ + | egrep "$match_pattern_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 + + case $host in + *-*-rhapsody* | *-*-darwin1.[012]) + # On Rhapsody replace the C library is the System framework + newdeplibs=`$echo "X $newdeplibs" | $Xsed -e 's/ -lc / -framework System /'` + ;; + esac + + if test "$droppeddeps" = yes; then + if test "$module" = yes; then + echo + echo "*** Warning: libtool could not satisfy all declared inter-library" + echo "*** dependencies of module $libname. Therefore, libtool will create" + echo "*** a static module, that should work as long as the dlopening" + echo "*** application is linked with the -dlopen flag." + if test -z "$global_symbol_pipe"; then + echo + echo "*** However, this would only work if libtool was able to extract symbol" + echo "*** lists from a program, using \`nm' or equivalent, but libtool could" + echo "*** not find such a program. So, this module is probably useless." + echo "*** \`nm' from GNU binutils and a full rebuild may help." + fi + if test "$build_old_libs" = no; then + oldlibs="$output_objdir/$libname.$libext" + build_libtool_libs=module + build_old_libs=yes + else + build_libtool_libs=no + fi + else + echo "*** The inter-library dependencies that have been dropped here will be" + echo "*** automatically added whenever a program is linked with this library" + echo "*** or is declared to -dlopen it." + + if test "$allow_undefined" = no; then + echo + echo "*** Since this library must not contain undefined symbols," + echo "*** because either the platform does not support them or" + echo "*** it was explicitly requested with -no-undefined," + echo "*** libtool will only create a static version of it." + if test "$build_old_libs" = no; then + oldlibs="$output_objdir/$libname.$libext" + build_libtool_libs=module + build_old_libs=yes + else + build_libtool_libs=no + fi + fi + fi + fi + # Done checking deplibs! + deplibs=$newdeplibs + fi + + # 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 + if test "$hardcode_into_libs" = yes; then + # Hardcode the library paths + hardcode_libdirs= + dep_rpath= + rpath="$finalize_rpath" + test "$mode" != relink && rpath="$compile_rpath$rpath" + for libdir in $rpath; do + if test -n "$hardcode_libdir_flag_spec"; then + if test -n "$hardcode_libdir_separator"; then + 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\" + dep_rpath="$dep_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 dep_rpath=\"$hardcode_libdir_flag_spec\" + fi + if test -n "$runpath_var" && test -n "$perm_rpath"; then + # We should set the runpath_var. + rpath= + for dir in $perm_rpath; do + rpath="$rpath$dir:" + done + eval "$runpath_var='$rpath\$$runpath_var'; export $runpath_var" + fi + test -n "$dep_rpath" && deplibs="$dep_rpath $deplibs" + fi + + shlibpath="$finalize_shlibpath" + test "$mode" != relink && shlibpath="$compile_shlibpath$shlibpath" + if test -n "$shlibpath"; then + eval "$shlibpath_var='$shlibpath\$$shlibpath_var'; export $shlibpath_var" + fi + + # Get the real and link names of the library. + eval 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 + test -z "$dlname" && dlname=$soname + + 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\" + 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\" + linker_flags="$linker_flags $flag" + fi + + # Make a backup of the uninstalled library when relinking + if test "$mode" = relink; then + $run eval '(cd $output_objdir && $rm ${realname}U && $mv $realname ${realname}U)' || exit $? + 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 + save_ifs="$IFS"; IFS='~' + for cmd in $cmds; do + IFS="$save_ifs" + $show "$cmd" + $run eval "$cmd" || exit $? + done + IFS="$save_ifs" + + # Restore the uninstalled library and exit + if test "$mode" = relink; then + $run eval '(cd $output_objdir && $rm ${realname}T && $mv $realname ${realname}T && $mv "$realname"U $realname)' || exit $? + exit 0 + fi + + # 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 + ;; + + obj) + 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$old_deplibs"; 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$old_deplibs "`$echo "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}$'/d' -e '/\.lib$/d' -e "$lo2o" | $NL2SP`" $reload_conv_objs" ### testsuite: skip nested quoting test + + output="$obj" + eval cmds=\"$reload_cmds\" + 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" || test "$pic_mode" != default; then + # Only do commands if we really have different PIC objects. + reload_objs="$libobjs $reload_conv_objs" + output="$libobj" + eval cmds=\"$reload_cmds\" + 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 + ;; + + prog) + case $host in + *cygwin*) output=`echo $output | sed -e 's,.exe$,,;s,$,.exe,'` ;; + esac + 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_support" = 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 + + case $host in + *-*-rhapsody* | *-*-darwin1.[012]) + # On Rhapsody replace the C library is the System framework + compile_deplibs=`$echo "X $compile_deplibs" | $Xsed -e 's/ -lc / -framework System /'` + finalize_deplibs=`$echo "X $finalize_deplibs" | $Xsed -e 's/ -lc / -framework System /'` + ;; + esac + + compile_command="$compile_command $compile_deplibs" + finalize_command="$finalize_command $finalize_deplibs" + + if test -n "$rpath$xrpath"; then + # If the user specified any rpath flags, then add them. + for libdir in $rpath $xrpath; do + # This is the magic to use -rpath. + case "$finalize_rpath " in + *" $libdir "*) ;; + *) 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 + case $host in + *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*) + case :$dllsearchpath: in + *":$libdir:"*) ;; + *) dllsearchpath="$dllsearchpath:$libdir";; + esac + ;; + esac + done + # Substitute the hardcoded libdirs into the rpath. + if test -n "$hardcode_libdir_separator" && + test -n "$hardcode_libdirs"; then + libdir="$hardcode_libdirs" + eval rpath=\" $hardcode_libdir_flag_spec\" + fi + compile_rpath="$rpath" + + rpath= + hardcode_libdirs= + for libdir in $finalize_rpath; do + if test -n "$hardcode_libdir_flag_spec"; then + if test -n "$hardcode_libdir_separator"; then + if test -z "$hardcode_libdirs"; then + hardcode_libdirs="$libdir" + else + # Just accumulate the unique libdirs. + case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in + *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) + ;; + *) + 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" + + 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$old_deplibs" | $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 void * +#else +# define lt_ptr char * +# define const +#endif + +/* The mapping between symbol names and symbols. */ +const struct { + const char *name; + lt_ptr address; +} +lt_preloaded_symbols[] = +{\ +" + + eval "$global_symbol_to_c_name_address" < "$nlist" >> "$output_objdir/$dlsyms" + + $echo >> "$output_objdir/$dlsyms" "\ + {0, (lt_ptr) 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 "$need_relink" = no || 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 "$no_install" = yes; then + # We don't need to create a wrapper script. + link_command="$compile_var$compile_command$compile_rpath" + # Replace the output file specification. + link_command=`$echo "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'` + # Delete the old output file. + $run $rm $output + # Link the executable and exit + $show "$link_command" + $run eval "$link_command" || exit $? + exit 0 + 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 + # Preserve any variables that may affect compiler behavior + for var in $variables_saved_for_relink; do + if eval test -z \"\${$var+set}\"; then + relink_command="{ test -z \"\${$var+set}\" || unset $var || { $var=; export $var; }; }; $relink_command" + elif eval var_value=\$$var; test -z "$var_value"; then + relink_command="$var=; export $var; $relink_command" + else + var_value=`$echo "X$var_value" | $Xsed -e "$sed_quote_subst"` + relink_command="$var=\"$var_value\"; export $var; $relink_command" + fi + done + relink_command="(cd `pwd`; $relink_command)" + 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 + # test for cygwin because mv fails w/o .exe extensions + case $host in + *cygwin*) exeext=.exe ;; + *) exeext= ;; + 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: + notinst_deplibs='$notinst_deplibs' +else + # When we are sourced in execute mode, \$file and \$echo are already set. + if test \"\$libtool_execute_magic\" != \"$magic\"; then + 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'$exeext + progdir=\"\$thisdir/$objdir\" + + if test ! -f \"\$progdir/\$program\" || \\ + { file=\`ls -1dt \"\$progdir/\$program\" \"\$progdir/../\$program\" 2>/dev/null | sed 1q\`; \\ + test \"X\$file\" != \"X\$progdir/\$program\"; }; then + + file=\"\$\$-\$program\" + + if test ! -d \"\$progdir\"; then + $mkdir \"\$progdir\" + else + $rm \"\$progdir/\$file\" + fi" + + echo >> $output "\ + + # relink executable if necessary + if test -n \"\$relink_command\"; then + if relink_command_output=\`eval \$relink_command 2>&1\`; then : + else + $echo \"\$relink_command_output\" >&2 + $rm \"\$progdir/\$file\" + exit 1 + fi + fi + + $mv \"\$progdir/\$file\" \"\$progdir/\$program\" 2>/dev/null || + { $rm \"\$progdir/\$program\"; + $mv \"\$progdir/\$file\" \"\$progdir/\$program\"; } + $rm \"\$progdir/\$file\" + fi" + else + echo >> $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* | *-*-pw32*) + $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$old_deplibs "`$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 + 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" + + # Preserve any variables that may affect compiler behavior + for var in $variables_saved_for_relink; do + if eval test -z \"\${$var+set}\"; then + relink_command="{ test -z \"\${$var+set}\" || unset $var || { $var=; export $var; }; }; $relink_command" + elif eval var_value=\$$var; test -z "$var_value"; then + relink_command="$var=; export $var; $relink_command" + else + var_value=`$echo "X$var_value" | $Xsed -e "$sed_quote_subst"` + relink_command="$var=\"$var_value\"; export $var; $relink_command" + fi + done + # Quote the link command for shipping. + relink_command="(cd `pwd`; $SHELL $0 --mode=relink $libtool_args)" + relink_command=`$echo "X$relink_command" | $Xsed -e "$sed_quote_subst"` + + # 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 + # Replace all uninstalled libtool libraries with the installed ones + newdependency_libs= + for deplib in $dependency_libs; do + case $deplib in + *.la) + name=`$echo "X$deplib" | $Xsed -e 's%^.*/%%'` + eval libdir=`sed -n -e 's/^libdir=\(.*\)$/\1/p' $deplib` + if test -z "$libdir"; then + $echo "$modename: \`$deplib' is not a valid libtool archive" 1>&2 + exit 1 + fi + newdependency_libs="$newdependency_libs $libdir/$name" + ;; + *) newdependency_libs="$newdependency_libs $deplib" ;; + esac + done + dependency_libs="$newdependency_libs" + newdlfiles= + for lib in $dlfiles; do + name=`$echo "X$lib" | $Xsed -e 's%^.*/%%'` + eval libdir=`sed -n -e 's/^libdir=\(.*\)$/\1/p' $lib` + if test -z "$libdir"; then + $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2 + exit 1 + fi + newdlfiles="$newdlfiles $libdir/$name" + done + dlfiles="$newdlfiles" + newdlprefiles= + for lib in $dlprefiles; do + name=`$echo "X$lib" | $Xsed -e 's%^.*/%%'` + eval libdir=`sed -n -e 's/^libdir=\(.*\)$/\1/p' $lib` + if test -z "$libdir"; then + $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2 + exit 1 + fi + newdlprefiles="$newdlprefiles $libdir/$name" + done + dlprefiles="$newdlprefiles" + fi + $rm $output + # place dlname in correct position for cygwin + tdlname=$dlname + case $host,$output,$installed,$module,$dlname in + *cygwin*,*lai,yes,no,*.dll) tdlname=../bin/$dlname ;; + esac + $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='$tdlname' + +# 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 + +# Files to dlopen/dlpreopen +dlopen='$dlfiles' +dlpreopen='$dlprefiles' + +# Directory that this library needs to be installed in: +libdir='$install_libdir'" + if test "$installed" = no && test "$need_relink" = yes; then + $echo >> $output "\ +relink_command=\"$relink_command\"" + fi + done + 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 || + # Allow the use of GNU shtool's install command. + $echo "X$nonopt" | $Xsed | grep shtool > /dev/null; 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 + *.$libext) + # 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= + relink_command= + # 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" + + if test -n "$relink_command"; then + $echo "$modename: warning: relinking \`$file'" 1>&2 + $show "$relink_command" + if $run eval "$relink_command"; then : + else + $echo "$modename: error: relink \`$file' with the above command before installing it" 1>&2 + continue + fi + fi + + # See the names of the shared library. + set dummy $library_names + if test -n "$2"; then + realname="$2" + shift + shift + + srcname="$realname" + test -n "$relink_command" && srcname="$realname"T + + # Install the shared library and build the symlinks. + $show "$install_prog $dir/$srcname $destdir/$realname" + $run eval "$install_prog $dir/$srcname $destdir/$realname" || exit $? + if test -n "$stripme" && test -n "$striplib"; then + $show "$striplib $destdir/$realname" + $run eval "$striplib $destdir/$realname" || exit $? + fi + + 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\" + 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"` + ;; + *.$objext) + 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 + notinst_deplibs= + 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 "$notinst_deplibs"; then + $echo "$modename: invalid libtool wrapper script \`$file'" 1>&2 + exit 1 + fi + + finalize=yes + for lib in $notinst_deplibs; 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'` ### testsuite: skip nested quoting test + if test -n "$libdir" && test ! -f "$libfile"; then + $echo "$modename: warning: \`$lib' has not been installed in \`$libdir'" 1>&2 + finalize=no + fi + done + + relink_command= + # If there is no directory component, then add one. + case $file in + */* | *\\*) . $file ;; + *) . ./$file ;; + esac + + 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=`mktemp -d $tmpdir/libtool-XXXXXX 2> /dev/null` + if test $? = 0 ; then : + else + tmpdir="$tmpdir/libtool-$$" + fi + if $mkdir -p "$tmpdir" && chmod 700 "$tmpdir"; then : + else + $echo "$modename: error: cannot create temporary directory \`$tmpdir'" 1>&2 + continue + fi + file=`$echo "X$file" | $Xsed -e 's%^.*/%%'` + 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 + + # remove .exe since cygwin /usr/bin/install will append another + # one anyways + case $install_prog,$host in + /usr/bin/install*,*cygwin*) + case $file:$destfile in + *.exe:*.exe) + # this is ok + ;; + *.exe:*) + destfile=$destfile.exe + ;; + *:*.exe) + destfile=`echo $destfile | sed -e 's,.exe$,,'` + ;; + esac + ;; + esac + $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 $? + + if test -n "$stripme" && test -n "$striplib"; then + $show "$old_striplib $oldlib" + $run eval "$old_striplib $oldlib" || exit $? + fi + + # Do each command in the postinstall commands. + eval cmds=\"$old_postinstall_cmds\" + 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_cmd='$SHELL $0 --finish$current_libdirs' + else + exit 0 + fi + ;; + + # 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\" + 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 the \`-LLIBDIR'" + echo "flag during linking and do at least one of the following:" + if test -n "$shlibpath_var"; then + echo " - add LIBDIR to the \`$shlibpath_var' environment variable" + echo " during execution" + fi + if test -n "$runpath_var"; then + echo " - add LIBDIR to the \`$runpath_var' environment variable" + echo " during linking" + fi + if test -n "$hardcode_libdir_flag_spec"; then + libdir=LIBDIR + eval flag=\"$hardcode_libdir_flag_spec\" + + echo " - use the \`$flag' linker flag" + fi + if test -n "$admincmds"; then + echo " - have your system administrator run these commands:$admincmds" + fi + if test -f /etc/ld.so.conf; then + echo " - have your system administrator add LIBDIR to \`/etc/ld.so.conf'" + fi + echo + echo "See any operating system documentation about shared libraries for" + 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 prepare to actually exec the command. + exec_cmd="\$cmd$args" + else + # Display what would be done. + if test -n "$shlibpath_var"; then + eval "\$echo \"\$shlibpath_var=\$$shlibpath_var\"" + $echo "export $shlibpath_var" + fi + $echo "$cmd$args" + exit 0 + fi + ;; + + # libtool clean and uninstall mode + clean | uninstall) + modename="$modename: $mode" + rm="$nonopt" + files= + rmforce= + exit_status=0 + + # This variable tells wrapper scripts just to set variables rather + # than running their programs. + libtool_install_magic="$magic" + + for arg + do + case $arg in + -f) rm="$rm $arg"; rmforce=yes ;; + -*) 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 + + rmdirs= + + for file in $files; do + dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'` + if test "X$dir" = "X$file"; then + dir=. + objdir="$objdir" + else + objdir="$dir/$objdir" + fi + name=`$echo "X$file" | $Xsed -e 's%^.*/%%'` + test "$mode" = uninstall && objdir="$dir" + + # Remember objdir for removal later, being careful to avoid duplicates + if test "$mode" = clean; then + case " $rmdirs " in + *" $objdir "*) ;; + *) rmdirs="$rmdirs $objdir" ;; + esac + fi + + # Don't error if the file doesn't exist and rm -f was used. + if (test -L "$file") >/dev/null 2>&1 \ + || (test -h "$file") >/dev/null 2>&1 \ + || test -f "$file"; then + : + elif test -d "$file"; then + exit_status=1 + continue + elif test "$rmforce" = yes; then + continue + fi + + rmfiles="$file" + + case $name in + *.la) + # Possibly a libtool archive, so verify it. + if (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 $objdir/$n" + done + test -n "$old_library" && rmfiles="$rmfiles $objdir/$old_library" + test "$mode" = clean && rmfiles="$rmfiles $objdir/$name $objdir/${name}i" + + if test "$mode" = uninstall; then + if test -n "$library_names"; then + # Do each command in the postuninstall commands. + eval cmds=\"$postuninstall_cmds\" + save_ifs="$IFS"; IFS='~' + for cmd in $cmds; do + IFS="$save_ifs" + $show "$cmd" + $run eval "$cmd" + if test "$?" -ne 0 && test "$rmforce" != yes; then + exit_status=1 + fi + done + IFS="$save_ifs" + fi + + if test -n "$old_library"; then + # Do each command in the old_postuninstall commands. + eval cmds=\"$old_postuninstall_cmds\" + save_ifs="$IFS"; IFS='~' + for cmd in $cmds; do + IFS="$save_ifs" + $show "$cmd" + $run eval "$cmd" + if test "$?" -ne 0 && test "$rmforce" != yes; then + exit_status=1 + fi + done + IFS="$save_ifs" + fi + # FIXME: should reinstall the best remaining shared library. + fi + fi + ;; + + *.lo) + if test "$build_old_libs" = yes; then + oldobj=`$echo "X$name" | $Xsed -e "$lo2o"` + rmfiles="$rmfiles $dir/$oldobj" + fi + ;; + + *) + # Do a test to see if this is a libtool program. + if test "$mode" = clean && + (sed -e '4q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then + relink_command= + . $dir/$file + + rmfiles="$rmfiles $objdir/$name $objdir/${name}S.${objext}" + if test "$fast_install" = yes && test -n "$relink_command"; then + rmfiles="$rmfiles $objdir/lt-$name" + fi + fi + ;; + esac + $show "$rm $rmfiles" + $run $rm $rmfiles || exit_status=1 + done + + # Try to remove the ${objdir}s in the directories where we deleted files + for dir in $rmdirs; do + if test -d "$dir"; then + $show "rmdir $dir" + $run rmdir $dir >/dev/null 2>&1 + fi + done + + exit $exit_status + ;; + + "") + $echo "$modename: you must specify a MODE" 1>&2 + $echo "$generic_help" 1>&2 + exit 1 + ;; + esac + + if test -z "$exec_cmd"; then + $echo "$modename: invalid operation mode \`$mode'" 1>&2 + $echo "$generic_help" 1>&2 + exit 1 + fi +fi # test -z "$show_help" + +if test -n "$exec_cmd"; then + eval exec $exec_cmd + exit 1 +fi + +# 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: + + clean remove files from the build directory + compile compile a source file into a libtool object + execute automatically set library path, then run a program + finish complete the installation of libtool libraries + install install libraries or executables + link create a library or an executable + uninstall remove libraries from an installed directory + +MODE-ARGS vary depending on the MODE. Try \`$modename --help --mode=MODE' for +a more detailed description of MODE." + exit 0 + ;; + +clean) + $echo \ +"Usage: $modename [OPTION]... --mode=clean RM [RM-OPTION]... FILE... + +Remove files from the build directory. + +RM is the name of the program to use to delete files associated with each FILE +(typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed +to RM. + +If FILE is a libtool library, object or program, all the files associated +with it are deleted. Otherwise, only FILE itself is deleted using RM." + ;; + +compile) + $echo \ +"Usage: $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 + -prefer-pic try to building PIC objects only + -prefer-non-pic try to building non-PIC objects only + -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-fast-install disable the fast-install mode + -no-install link a not-installable executable + -no-undefined declare that a library does not refer to external symbols + -o OUTPUT-FILE create OUTPUT-FILE from the specified objects + -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/config/missing b/config/missing new file mode 100755 index 0000000..6a37006 --- /dev/null +++ b/config/missing @@ -0,0 +1,336 @@ +#! /bin/sh +# Common stub for a few missing GNU programs while installing. +# Copyright (C) 1996, 1997, 1999, 2000, 2002 Free Software Foundation, Inc. +# Originally by Fran,cois 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. + +# As a special exception to the GNU General Public License, if you +# distribute this file as part of a program that contains a +# configuration script generated by Autoconf, you may include it under +# the same distribution terms that you use for the rest of that program. + +if test $# -eq 0; then + echo 1>&2 "Try \`$0 --help' for more information" + exit 1 +fi + +run=: + +# In the cases where this matters, `missing' is being run in the +# srcdir already. +if test -f configure.ac; then + configure_ac=configure.ac +else + configure_ac=configure.in +fi + +case "$1" in +--run) + # Try to run requested program, and just exit if it succeeds. + run= + shift + "$@" && exit 0 + ;; +esac + +# If it does not exist, or fails to run (possibly an outdated version), +# try to emulate it. +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 + --run try to run the given command, and emulate it if it fails + +Supported PROGRAM values: + aclocal touch file \`aclocal.m4' + autoconf touch file \`configure' + autoheader touch file \`config.h.in' + automake touch all \`Makefile.in' files + bison create \`y.tab.[ch]', if possible, from existing .[ch] + flex create \`lex.yy.c', if possible, from existing .c + help2man touch the output file + lex create \`lex.yy.c', if possible, from existing .c + makeinfo touch the output file + tar try tar, gnutar, gtar, then tar without non-portable flags + yacc create \`y.tab.[ch]', if possible, from existing .[ch]" + ;; + + -v|--v|--ve|--ver|--vers|--versi|--versio|--version) + echo "missing 0.4 - GNU automake" + ;; + + -*) + echo 1>&2 "$0: Unknown \`$1' option" + echo 1>&2 "Try \`$0 --help' for more information" + exit 1 + ;; + + aclocal*) + if test -z "$run" && ($1 --version) > /dev/null 2>&1; then + # We have it, but it failed. + exit 1 + fi + + echo 1>&2 "\ +WARNING: \`$1' is missing on your system. You should only need it if + you modified \`acinclude.m4' or \`${configure_ac}'. You might want + to install the \`Automake' and \`Perl' packages. Grab them from + any GNU archive site." + touch aclocal.m4 + ;; + + autoconf) + if test -z "$run" && ($1 --version) > /dev/null 2>&1; then + # We have it, but it failed. + exit 1 + fi + + echo 1>&2 "\ +WARNING: \`$1' is missing on your system. You should only need it if + you modified \`${configure_ac}'. You might want to install the + \`Autoconf' and \`GNU m4' packages. Grab them from any GNU + archive site." + touch configure + ;; + + autoheader) + if test -z "$run" && ($1 --version) > /dev/null 2>&1; then + # We have it, but it failed. + exit 1 + fi + + echo 1>&2 "\ +WARNING: \`$1' is missing on your system. You should only need it if + you modified \`acconfig.h' or \`${configure_ac}'. You might want + to install the \`Autoconf' and \`GNU m4' packages. Grab them + from any GNU archive site." + files=`sed -n 's/^[ ]*A[CM]_CONFIG_HEADER(\([^)]*\)).*/\1/p' ${configure_ac}` + test -z "$files" && files="config.h" + touch_files= + for f in $files; do + case "$f" in + *:*) touch_files="$touch_files "`echo "$f" | + sed -e 's/^[^:]*://' -e 's/:.*//'`;; + *) touch_files="$touch_files $f.in";; + esac + done + touch $touch_files + ;; + + automake*) + if test -z "$run" && ($1 --version) > /dev/null 2>&1; then + # We have it, but it failed. + exit 1 + fi + + echo 1>&2 "\ +WARNING: \`$1' is missing on your system. You should only need it if + you modified \`Makefile.am', \`acinclude.m4' or \`${configure_ac}'. + You might want to install the \`Automake' and \`Perl' packages. + Grab them from any GNU archive site." + find . -type f -name Makefile.am -print | + sed 's/\.am$/.in/' | + while read f; do touch "$f"; done + ;; + + autom4te) + if test -z "$run" && ($1 --version) > /dev/null 2>&1; then + # We have it, but it failed. + exit 1 + fi + + 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. + You can get \`$1Help2man' as part of \`Autoconf' from any GNU + archive site." + + file=`echo "$*" | sed -n 's/.*--output[ =]*\([^ ]*\).*/\1/p'` + test -z "$file" && file=`echo "$*" | sed -n 's/.*-o[ ]*\([^ ]*\).*/\1/p'` + if test -f "$file"; then + touch $file + else + test -z "$file" || exec >$file + echo "#! /bin/sh" + echo "# Created by GNU Automake missing as a replacement of" + echo "# $ $@" + echo "exit 0" + chmod +x $file + exit 1 + fi + ;; + + bison|yacc) + echo 1>&2 "\ +WARNING: \`$1' 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 + ;; + + help2man) + if test -z "$run" && ($1 --version) > /dev/null 2>&1; then + # We have it, but it failed. + exit 1 + fi + + echo 1>&2 "\ +WARNING: \`$1' is missing on your system. You should only need it if + you modified a dependency of a manual page. You may need the + \`Help2man' package in order for those modifications to take + effect. You can get \`Help2man' from any GNU archive site." + + file=`echo "$*" | sed -n 's/.*-o \([^ ]*\).*/\1/p'` + if test -z "$file"; then + file=`echo "$*" | sed -n 's/.*--output=\([^ ]*\).*/\1/p'` + fi + if [ -f "$file" ]; then + touch $file + else + test -z "$file" || exec >$file + echo ".ab help2man is required to generate this page" + exit 1 + fi + ;; + + makeinfo) + if test -z "$run" && (makeinfo --version) > /dev/null 2>&1; then + # We have makeinfo, but it failed. + exit 1 + fi + + 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 + ;; + + tar) + shift + if test -n "$run"; then + echo 1>&2 "ERROR: \`tar' requires --run" + exit 1 + fi + + # We have already tried tar in the generic part. + # Look for gnutar/gtar before invocation to avoid ugly error + # messages. + if (gnutar --version > /dev/null 2>&1); then + gnutar "$@" && exit 0 + fi + if (gtar --version > /dev/null 2>&1); then + gtar "$@" && exit 0 + fi + firstarg="$1" + if shift; then + case "$firstarg" in + *o*) + firstarg=`echo "$firstarg" | sed s/o//` + tar "$firstarg" "$@" && exit 0 + ;; + esac + case "$firstarg" in + *h*) + firstarg=`echo "$firstarg" | sed s/h//` + tar "$firstarg" "$@" && exit 0 + ;; + esac + fi + + echo 1>&2 "\ +WARNING: I can't seem to be able to run \`tar' with the given arguments. + You may want to install GNU tar or Free paxutils, or check the + command line arguments." + exit 1 + ;; + + *) + echo 1>&2 "\ +WARNING: \`$1' is needed, and 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/config/mkinstalldirs b/config/mkinstalldirs new file mode 100755 index 0000000..6b3b5fc --- /dev/null +++ b/config/mkinstalldirs @@ -0,0 +1,40 @@ +#! /bin/sh +# mkinstalldirs --- make directory hierarchy +# Author: Noah Friedman +# Created: 1993-05-16 +# Public domain + +# $Id$ + +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/configure b/configure new file mode 100755 index 0000000..e8a9fa2 --- /dev/null +++ b/configure @@ -0,0 +1,10884 @@ +#! /bin/sh +# Guess values for system-dependent variables and create Makefiles. +# Generated by GNU Autoconf 2.57. +# +# Copyright 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, 2002 +# Free Software Foundation, Inc. +# This configure script is free software; the Free Software Foundation +# gives unlimited permission to copy, distribute and modify it. +## --------------------- ## +## M4sh Initialization. ## +## --------------------- ## + +# Be Bourne compatible +if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then + emulate sh + NULLCMD=: + # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which + # is contrary to our usage. Disable this feature. + alias -g '${1+"$@"}'='"$@"' +elif test -n "${BASH_VERSION+set}" && (set -o posix) >/dev/null 2>&1; then + set -o posix +fi + +# Support unset when possible. +if (FOO=FOO; unset FOO) >/dev/null 2>&1; then + as_unset=unset +else + as_unset=false +fi + + +# Work around bugs in pre-3.0 UWIN ksh. +$as_unset ENV MAIL MAILPATH +PS1='$ ' +PS2='> ' +PS4='+ ' + +# NLS nuisances. +for as_var in \ + LANG LANGUAGE LC_ADDRESS LC_ALL LC_COLLATE LC_CTYPE LC_IDENTIFICATION \ + LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER \ + LC_TELEPHONE LC_TIME +do + if (set +x; test -n "`(eval $as_var=C; export $as_var) 2>&1`"); then + eval $as_var=C; export $as_var + else + $as_unset $as_var + fi +done + +# Required to use basename. +if expr a : '\(a\)' >/dev/null 2>&1; then + as_expr=expr +else + as_expr=false +fi + +if (basename /) >/dev/null 2>&1 && test "X`basename / 2>&1`" = "X/"; then + as_basename=basename +else + as_basename=false +fi + + +# Name of the executable. +as_me=`$as_basename "$0" || +$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ + X"$0" : 'X\(//\)$' \| \ + X"$0" : 'X\(/\)$' \| \ + . : '\(.\)' 2>/dev/null || +echo X/"$0" | + sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/; q; } + /^X\/\(\/\/\)$/{ s//\1/; q; } + /^X\/\(\/\).*/{ s//\1/; q; } + s/.*/./; q'` + + +# PATH needs CR, and LINENO needs CR and PATH. +# Avoid depending upon Character Ranges. +as_cr_letters='abcdefghijklmnopqrstuvwxyz' +as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' +as_cr_Letters=$as_cr_letters$as_cr_LETTERS +as_cr_digits='0123456789' +as_cr_alnum=$as_cr_Letters$as_cr_digits + +# The user is always right. +if test "${PATH_SEPARATOR+set}" != set; then + echo "#! /bin/sh" >conf$$.sh + echo "exit 0" >>conf$$.sh + chmod +x conf$$.sh + if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then + PATH_SEPARATOR=';' + else + PATH_SEPARATOR=: + fi + rm -f conf$$.sh +fi + + + as_lineno_1=$LINENO + as_lineno_2=$LINENO + as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null` + test "x$as_lineno_1" != "x$as_lineno_2" && + test "x$as_lineno_3" = "x$as_lineno_2" || { + # Find who we are. Look in the path if we contain no path at all + # relative or not. + case $0 in + *[\\/]* ) as_myself=$0 ;; + *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break +done + + ;; + esac + # We did not find ourselves, most probably we were run as `sh COMMAND' + # in which case we are not to be found in the path. + if test "x$as_myself" = x; then + as_myself=$0 + fi + if test ! -f "$as_myself"; then + { echo "$as_me: error: cannot find myself; rerun with an absolute path" >&2 + { (exit 1); exit 1; }; } + fi + case $CONFIG_SHELL in + '') + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for as_base in sh bash ksh sh5; do + case $as_dir in + /*) + if ("$as_dir/$as_base" -c ' + as_lineno_1=$LINENO + as_lineno_2=$LINENO + as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null` + test "x$as_lineno_1" != "x$as_lineno_2" && + test "x$as_lineno_3" = "x$as_lineno_2" ') 2>/dev/null; then + $as_unset BASH_ENV || test "${BASH_ENV+set}" != set || { BASH_ENV=; export BASH_ENV; } + $as_unset ENV || test "${ENV+set}" != set || { ENV=; export ENV; } + CONFIG_SHELL=$as_dir/$as_base + export CONFIG_SHELL + exec "$CONFIG_SHELL" "$0" ${1+"$@"} + fi;; + esac + done +done +;; + esac + + # Create $as_me.lineno as a copy of $as_myself, but with $LINENO + # uniformly replaced by the line number. The first 'sed' inserts a + # line-number line before each line; the second 'sed' does the real + # work. The second script uses 'N' to pair each line-number line + # with the numbered line, and appends trailing '-' during + # substitution so that $LINENO is not a special case at line end. + # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the + # second 'sed' script. Blame Lee E. McMahon for sed's syntax. :-) + sed '=' <$as_myself | + sed ' + N + s,$,-, + : loop + s,^\(['$as_cr_digits']*\)\(.*\)[$]LINENO\([^'$as_cr_alnum'_]\),\1\2\1\3, + t loop + s,-$,, + s,^['$as_cr_digits']*\n,, + ' >$as_me.lineno && + chmod +x $as_me.lineno || + { echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2 + { (exit 1); exit 1; }; } + + # Don't try to exec as it changes $[0], causing all sort of problems + # (the dirname of $[0] is not the place where we might find the + # original and so on. Autoconf is especially sensible to this). + . ./$as_me.lineno + # Exit status is that of the last command. + exit +} + + +case `echo "testing\c"; echo 1,2,3`,`echo -n testing; echo 1,2,3` in + *c*,-n*) ECHO_N= ECHO_C=' +' ECHO_T=' ' ;; + *c*,* ) ECHO_N=-n ECHO_C= ECHO_T= ;; + *) ECHO_N= ECHO_C='\c' ECHO_T= ;; +esac + +if expr a : '\(a\)' >/dev/null 2>&1; then + as_expr=expr +else + as_expr=false +fi + +rm -f conf$$ conf$$.exe conf$$.file +echo >conf$$.file +if ln -s conf$$.file conf$$ 2>/dev/null; then + # We could just check for DJGPP; but this test a) works b) is more generic + # and c) will remain valid once DJGPP supports symlinks (DJGPP 2.04). + if test -f conf$$.exe; then + # Don't use ln at all; we don't have any links + as_ln_s='cp -p' + else + as_ln_s='ln -s' + fi +elif ln conf$$.file conf$$ 2>/dev/null; then + as_ln_s=ln +else + as_ln_s='cp -p' +fi +rm -f conf$$ conf$$.exe conf$$.file + +if mkdir -p . 2>/dev/null; then + as_mkdir_p=: +else + as_mkdir_p=false +fi + +as_executable_p="test -f" + +# Sed expression to map a string onto a valid CPP name. +as_tr_cpp="sed y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g" + +# Sed expression to map a string onto a valid variable name. +as_tr_sh="sed y%*+%pp%;s%[^_$as_cr_alnum]%_%g" + + +# IFS +# We need space, tab and new line, in precisely that order. +as_nl=' +' +IFS=" $as_nl" + +# CDPATH. +$as_unset CDPATH + + +# Find the correct PATH separator. Usually this is `:', but +# DJGPP uses `;' like DOS. +if test "X${PATH_SEPARATOR+set}" != Xset; then + UNAME=${UNAME-`uname 2>/dev/null`} + case X$UNAME in + *-DOS) lt_cv_sys_path_separator=';' ;; + *) lt_cv_sys_path_separator=':' ;; + esac + PATH_SEPARATOR=$lt_cv_sys_path_separator +fi + + +# Check that we are running under the correct shell. +SHELL=${CONFIG_SHELL-/bin/sh} + +case X$ECHO in +X*--fallback-echo) + # Remove one level of quotation (which was required for Make). + ECHO=`echo "$ECHO" | sed 's,\\\\\$\\$0,'$0','` + ;; +esac + +echo=${ECHO-echo} +if test "X$1" = X--no-reexec; then + # Discard the --no-reexec flag, and continue. + shift +elif test "X$1" = X--fallback-echo; then + # Avoid inline document here, it may be left over + : +elif test "X`($echo '\t') 2>/dev/null`" = 'X\t'; then + # Yippee, $echo works! + : +else + # Restart under the correct shell. + exec $SHELL "$0" --no-reexec ${1+"$@"} +fi + +if test "X$1" = X--fallback-echo; then + # used as fallback echo + shift + cat </dev/null && + echo_test_string="`eval $cmd`" && + (test "X$echo_test_string" = "X$echo_test_string") 2>/dev/null + then + break + fi + done +fi + +if test "X`($echo '\t') 2>/dev/null`" = 'X\t' && + echo_testing_string=`($echo "$echo_test_string") 2>/dev/null` && + test "X$echo_testing_string" = "X$echo_test_string"; then + : +else + # The Solaris, AIX, and Digital Unix default echo programs unquote + # backslashes. This makes it impossible to quote backslashes using + # echo "$something" | sed 's/\\/\\\\/g' + # + # So, first we look for a working echo in the user's PATH. + + IFS="${IFS= }"; save_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' && + echo_testing_string=`($dir/echo "$echo_test_string") 2>/dev/null` && + test "X$echo_testing_string" = "X$echo_test_string"; then + echo="$dir/echo" + break + fi + done + IFS="$save_ifs" + + if test "X$echo" = Xecho; then + # We didn't find a better echo, so look for alternatives. + if test "X`(print -r '\t') 2>/dev/null`" = 'X\t' && + echo_testing_string=`(print -r "$echo_test_string") 2>/dev/null` && + test "X$echo_testing_string" = "X$echo_test_string"; then + # This shell has a builtin print -r that does the trick. + echo='print -r' + elif (test -f /bin/ksh || test -f /bin/ksh$ac_exeext) && + test "X$CONFIG_SHELL" != X/bin/ksh; then + # If we have ksh, try running configure again with it. + ORIGINAL_CONFIG_SHELL=${CONFIG_SHELL-/bin/sh} + export ORIGINAL_CONFIG_SHELL + CONFIG_SHELL=/bin/ksh + export CONFIG_SHELL + exec $CONFIG_SHELL "$0" --no-reexec ${1+"$@"} + else + # Try using printf. + echo='printf %s\n' + if test "X`($echo '\t') 2>/dev/null`" = 'X\t' && + echo_testing_string=`($echo "$echo_test_string") 2>/dev/null` && + test "X$echo_testing_string" = "X$echo_test_string"; then + # Cool, printf works + : + elif echo_testing_string=`($ORIGINAL_CONFIG_SHELL "$0" --fallback-echo '\t') 2>/dev/null` && + test "X$echo_testing_string" = 'X\t' && + echo_testing_string=`($ORIGINAL_CONFIG_SHELL "$0" --fallback-echo "$echo_test_string") 2>/dev/null` && + test "X$echo_testing_string" = "X$echo_test_string"; then + CONFIG_SHELL=$ORIGINAL_CONFIG_SHELL + export CONFIG_SHELL + SHELL="$CONFIG_SHELL" + export SHELL + echo="$CONFIG_SHELL $0 --fallback-echo" + elif echo_testing_string=`($CONFIG_SHELL "$0" --fallback-echo '\t') 2>/dev/null` && + test "X$echo_testing_string" = 'X\t' && + echo_testing_string=`($CONFIG_SHELL "$0" --fallback-echo "$echo_test_string") 2>/dev/null` && + test "X$echo_testing_string" = "X$echo_test_string"; then + echo="$CONFIG_SHELL $0 --fallback-echo" + else + # maybe with a smaller string... + prev=: + + for cmd in 'echo test' 'sed 2q "$0"' 'sed 10q "$0"' 'sed 20q "$0"' 'sed 50q "$0"'; do + if (test "X$echo_test_string" = "X`eval $cmd`") 2>/dev/null + then + break + fi + prev="$cmd" + done + + if test "$prev" != 'sed 50q "$0"'; then + echo_test_string=`eval $prev` + export echo_test_string + exec ${ORIGINAL_CONFIG_SHELL-${CONFIG_SHELL-/bin/sh}} "$0" ${1+"$@"} + else + # Oops. We lost completely, so just stick with echo. + echo=echo + fi + fi + fi + fi +fi +fi + +# Copy echo and quote the copy suitably for passing to libtool from +# the Makefile, instead of quoting the original, which is used later. +ECHO=$echo +if test "X$ECHO" = "X$CONFIG_SHELL $0 --fallback-echo"; then + ECHO="$CONFIG_SHELL \\\$\$0 --fallback-echo" +fi + + + +# Name of the host. +# hostname on some systems (SVR3.2, Linux) returns a bogus exit status, +# so uname gets run too. +ac_hostname=`(hostname || uname -n) 2>/dev/null | sed 1q` + +exec 6>&1 + +# +# Initializations. +# +ac_default_prefix=/usr/local +ac_config_libobj_dir=. +cross_compiling=no +subdirs= +MFLAGS= +MAKEFLAGS= +SHELL=${CONFIG_SHELL-/bin/sh} + +# Maximum number of lines to put in a shell here document. +# This variable seems obsolete. It should probably be removed, and +# only ac_max_sed_lines should be used. +: ${ac_max_here_lines=38} + +# Identity of this package. +PACKAGE_NAME= +PACKAGE_TARNAME= +PACKAGE_VERSION= +PACKAGE_STRING= +PACKAGE_BUGREPORT= + +ac_unique_file="AUTHORS" +# Factoring default headers for most tests. +ac_includes_default="\ +#include +#if HAVE_SYS_TYPES_H +# include +#endif +#if HAVE_SYS_STAT_H +# include +#endif +#if STDC_HEADERS +# include +# include +#else +# if HAVE_STDLIB_H +# include +# endif +#endif +#if HAVE_STRING_H +# if !STDC_HEADERS && HAVE_MEMORY_H +# include +# endif +# include +#endif +#if HAVE_STRINGS_H +# include +#endif +#if HAVE_INTTYPES_H +# include +#else +# if HAVE_STDINT_H +# include +# endif +#endif +#if HAVE_UNISTD_H +# include +#endif" + +ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS build build_cpu build_vendor build_os host host_cpu host_vendor host_os target target_cpu target_vendor target_os INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA CYGPATH_W PACKAGE VERSION ACLOCAL AUTOCONF AUTOMAKE AUTOHEADER MAKEINFO AMTAR install_sh STRIP ac_ct_STRIP INSTALL_STRIP_PROGRAM AWK SET_MAKE am__leading_dot MODV_FLAGS KERNEL_DIR MODULES_DIR KERNEL_HDR OS_DIR DEBUG_FLAGS KDEBUG_FLAGS AUTOFS_INSTALL LUFS_SUID CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT DEPDIR am__include am__quote AMDEP_TRUE AMDEP_FALSE AMDEPBACKSLASH CCDEPMODE am__fastdepCC_TRUE am__fastdepCC_FALSE CPP CXX CXXFLAGS ac_ct_CXX CXXDEPMODE am__fastdepCXX_TRUE am__fastdepCXX_FALSE LN_S ECHO RANLIB ac_ct_RANLIB EGREP LIBTOOL SSHPROG GCONF GVFSCONF GVFS_LDADD GVFS_CFLAGS define_has_libchipcard LIBCHIPCARD_LIB LIBCHIPCARD_INCLUDES opt_fs all_includes all_libraries LIBOBJS LTLIBOBJS' +ac_subst_files='' + +# Initialize some variables set by options. +ac_init_help= +ac_init_version=false +# The variables have the same names as the options, with +# dashes changed to underlines. +cache_file=/dev/null +exec_prefix=NONE +no_create= +no_recursion= +prefix=NONE +program_prefix=NONE +program_suffix=NONE +program_transform_name=s,x,x, +silent= +site= +srcdir= +verbose= +x_includes=NONE +x_libraries=NONE + +# Installation directory options. +# These are left unexpanded so users can "make install exec_prefix=/foo" +# and all the variables that are supposed to be based on exec_prefix +# by default will actually change. +# Use braces instead of parens because sh, perl, etc. also accept them. +bindir='${exec_prefix}/bin' +sbindir='${exec_prefix}/sbin' +libexecdir='${exec_prefix}/libexec' +datadir='${prefix}/share' +sysconfdir='${prefix}/etc' +sharedstatedir='${prefix}/com' +localstatedir='${prefix}/var' +libdir='${exec_prefix}/lib' +includedir='${prefix}/include' +oldincludedir='/usr/include' +infodir='${prefix}/info' +mandir='${prefix}/man' + +ac_prev= +for ac_option +do + # If the previous option needs an argument, assign it. + if test -n "$ac_prev"; then + eval "$ac_prev=\$ac_option" + ac_prev= + continue + fi + + ac_optarg=`expr "x$ac_option" : 'x[^=]*=\(.*\)'` + + # Accept the important Cygnus configure options, so we can diagnose typos. + + case $ac_option in + + -bindir | --bindir | --bindi | --bind | --bin | --bi) + ac_prev=bindir ;; + -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*) + bindir=$ac_optarg ;; + + -build | --build | --buil | --bui | --bu) + ac_prev=build_alias ;; + -build=* | --build=* | --buil=* | --bui=* | --bu=*) + build_alias=$ac_optarg ;; + + -cache-file | --cache-file | --cache-fil | --cache-fi \ + | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c) + ac_prev=cache_file ;; + -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \ + | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*) + cache_file=$ac_optarg ;; + + --config-cache | -C) + cache_file=config.cache ;; + + -datadir | --datadir | --datadi | --datad | --data | --dat | --da) + ac_prev=datadir ;; + -datadir=* | --datadir=* | --datadi=* | --datad=* | --data=* | --dat=* \ + | --da=*) + datadir=$ac_optarg ;; + + -disable-* | --disable-*) + ac_feature=`expr "x$ac_option" : 'x-*disable-\(.*\)'` + # Reject names that are not valid shell variable names. + expr "x$ac_feature" : ".*[^-_$as_cr_alnum]" >/dev/null && + { echo "$as_me: error: invalid feature name: $ac_feature" >&2 + { (exit 1); exit 1; }; } + ac_feature=`echo $ac_feature | sed 's/-/_/g'` + eval "enable_$ac_feature=no" ;; + + -enable-* | --enable-*) + ac_feature=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'` + # Reject names that are not valid shell variable names. + expr "x$ac_feature" : ".*[^-_$as_cr_alnum]" >/dev/null && + { echo "$as_me: error: invalid feature name: $ac_feature" >&2 + { (exit 1); exit 1; }; } + ac_feature=`echo $ac_feature | sed 's/-/_/g'` + case $ac_option in + *=*) ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"`;; + *) ac_optarg=yes ;; + esac + eval "enable_$ac_feature='$ac_optarg'" ;; + + -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \ + | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \ + | --exec | --exe | --ex) + ac_prev=exec_prefix ;; + -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \ + | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \ + | --exec=* | --exe=* | --ex=*) + exec_prefix=$ac_optarg ;; + + -gas | --gas | --ga | --g) + # Obsolete; use --with-gas. + with_gas=yes ;; + + -help | --help | --hel | --he | -h) + ac_init_help=long ;; + -help=r* | --help=r* | --hel=r* | --he=r* | -hr*) + ac_init_help=recursive ;; + -help=s* | --help=s* | --hel=s* | --he=s* | -hs*) + ac_init_help=short ;; + + -host | --host | --hos | --ho) + ac_prev=host_alias ;; + -host=* | --host=* | --hos=* | --ho=*) + host_alias=$ac_optarg ;; + + -includedir | --includedir | --includedi | --included | --include \ + | --includ | --inclu | --incl | --inc) + ac_prev=includedir ;; + -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \ + | --includ=* | --inclu=* | --incl=* | --inc=*) + includedir=$ac_optarg ;; + + -infodir | --infodir | --infodi | --infod | --info | --inf) + ac_prev=infodir ;; + -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*) + infodir=$ac_optarg ;; + + -libdir | --libdir | --libdi | --libd) + ac_prev=libdir ;; + -libdir=* | --libdir=* | --libdi=* | --libd=*) + libdir=$ac_optarg ;; + + -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \ + | --libexe | --libex | --libe) + ac_prev=libexecdir ;; + -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \ + | --libexe=* | --libex=* | --libe=*) + libexecdir=$ac_optarg ;; + + -localstatedir | --localstatedir | --localstatedi | --localstated \ + | --localstate | --localstat | --localsta | --localst \ + | --locals | --local | --loca | --loc | --lo) + ac_prev=localstatedir ;; + -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \ + | --localstate=* | --localstat=* | --localsta=* | --localst=* \ + | --locals=* | --local=* | --loca=* | --loc=* | --lo=*) + localstatedir=$ac_optarg ;; + + -mandir | --mandir | --mandi | --mand | --man | --ma | --m) + ac_prev=mandir ;; + -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*) + mandir=$ac_optarg ;; + + -nfp | --nfp | --nf) + # Obsolete; use --without-fp. + with_fp=no ;; + + -no-create | --no-create | --no-creat | --no-crea | --no-cre \ + | --no-cr | --no-c | -n) + no_create=yes ;; + + -no-recursion | --no-recursion | --no-recursio | --no-recursi \ + | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) + no_recursion=yes ;; + + -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \ + | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \ + | --oldin | --oldi | --old | --ol | --o) + ac_prev=oldincludedir ;; + -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \ + | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \ + | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*) + oldincludedir=$ac_optarg ;; + + -prefix | --prefix | --prefi | --pref | --pre | --pr | --p) + ac_prev=prefix ;; + -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*) + prefix=$ac_optarg ;; + + -program-prefix | --program-prefix | --program-prefi | --program-pref \ + | --program-pre | --program-pr | --program-p) + ac_prev=program_prefix ;; + -program-prefix=* | --program-prefix=* | --program-prefi=* \ + | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*) + program_prefix=$ac_optarg ;; + + -program-suffix | --program-suffix | --program-suffi | --program-suff \ + | --program-suf | --program-su | --program-s) + ac_prev=program_suffix ;; + -program-suffix=* | --program-suffix=* | --program-suffi=* \ + | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*) + program_suffix=$ac_optarg ;; + + -program-transform-name | --program-transform-name \ + | --program-transform-nam | --program-transform-na \ + | --program-transform-n | --program-transform- \ + | --program-transform | --program-transfor \ + | --program-transfo | --program-transf \ + | --program-trans | --program-tran \ + | --progr-tra | --program-tr | --program-t) + ac_prev=program_transform_name ;; + -program-transform-name=* | --program-transform-name=* \ + | --program-transform-nam=* | --program-transform-na=* \ + | --program-transform-n=* | --program-transform-=* \ + | --program-transform=* | --program-transfor=* \ + | --program-transfo=* | --program-transf=* \ + | --program-trans=* | --program-tran=* \ + | --progr-tra=* | --program-tr=* | --program-t=*) + program_transform_name=$ac_optarg ;; + + -q | -quiet | --quiet | --quie | --qui | --qu | --q \ + | -silent | --silent | --silen | --sile | --sil) + silent=yes ;; + + -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb) + ac_prev=sbindir ;; + -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \ + | --sbi=* | --sb=*) + sbindir=$ac_optarg ;; + + -sharedstatedir | --sharedstatedir | --sharedstatedi \ + | --sharedstated | --sharedstate | --sharedstat | --sharedsta \ + | --sharedst | --shareds | --shared | --share | --shar \ + | --sha | --sh) + ac_prev=sharedstatedir ;; + -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \ + | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \ + | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \ + | --sha=* | --sh=*) + sharedstatedir=$ac_optarg ;; + + -site | --site | --sit) + ac_prev=site ;; + -site=* | --site=* | --sit=*) + site=$ac_optarg ;; + + -srcdir | --srcdir | --srcdi | --srcd | --src | --sr) + ac_prev=srcdir ;; + -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*) + srcdir=$ac_optarg ;; + + -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \ + | --syscon | --sysco | --sysc | --sys | --sy) + ac_prev=sysconfdir ;; + -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \ + | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*) + sysconfdir=$ac_optarg ;; + + -target | --target | --targe | --targ | --tar | --ta | --t) + ac_prev=target_alias ;; + -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*) + target_alias=$ac_optarg ;; + + -v | -verbose | --verbose | --verbos | --verbo | --verb) + verbose=yes ;; + + -version | --version | --versio | --versi | --vers | -V) + ac_init_version=: ;; + + -with-* | --with-*) + ac_package=`expr "x$ac_option" : 'x-*with-\([^=]*\)'` + # Reject names that are not valid shell variable names. + expr "x$ac_package" : ".*[^-_$as_cr_alnum]" >/dev/null && + { echo "$as_me: error: invalid package name: $ac_package" >&2 + { (exit 1); exit 1; }; } + ac_package=`echo $ac_package| sed 's/-/_/g'` + case $ac_option in + *=*) ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"`;; + *) ac_optarg=yes ;; + esac + eval "with_$ac_package='$ac_optarg'" ;; + + -without-* | --without-*) + ac_package=`expr "x$ac_option" : 'x-*without-\(.*\)'` + # Reject names that are not valid shell variable names. + expr "x$ac_package" : ".*[^-_$as_cr_alnum]" >/dev/null && + { echo "$as_me: error: invalid package name: $ac_package" >&2 + { (exit 1); exit 1; }; } + ac_package=`echo $ac_package | sed 's/-/_/g'` + eval "with_$ac_package=no" ;; + + --x) + # Obsolete; use --with-x. + with_x=yes ;; + + -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \ + | --x-incl | --x-inc | --x-in | --x-i) + ac_prev=x_includes ;; + -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \ + | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*) + x_includes=$ac_optarg ;; + + -x-libraries | --x-libraries | --x-librarie | --x-librari \ + | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l) + ac_prev=x_libraries ;; + -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \ + | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*) + x_libraries=$ac_optarg ;; + + -*) { echo "$as_me: error: unrecognized option: $ac_option +Try \`$0 --help' for more information." >&2 + { (exit 1); exit 1; }; } + ;; + + *=*) + ac_envvar=`expr "x$ac_option" : 'x\([^=]*\)='` + # Reject names that are not valid shell variable names. + expr "x$ac_envvar" : ".*[^_$as_cr_alnum]" >/dev/null && + { echo "$as_me: error: invalid variable name: $ac_envvar" >&2 + { (exit 1); exit 1; }; } + ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` + eval "$ac_envvar='$ac_optarg'" + export $ac_envvar ;; + + *) + # FIXME: should be removed in autoconf 3.0. + echo "$as_me: WARNING: you should use --build, --host, --target" >&2 + expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null && + echo "$as_me: WARNING: invalid host type: $ac_option" >&2 + : ${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option} + ;; + + esac +done + +if test -n "$ac_prev"; then + ac_option=--`echo $ac_prev | sed 's/_/-/g'` + { echo "$as_me: error: missing argument to $ac_option" >&2 + { (exit 1); exit 1; }; } +fi + +# Be sure to have absolute paths. +for ac_var in exec_prefix prefix +do + eval ac_val=$`echo $ac_var` + case $ac_val in + [\\/$]* | ?:[\\/]* | NONE | '' ) ;; + *) { echo "$as_me: error: expected an absolute directory name for --$ac_var: $ac_val" >&2 + { (exit 1); exit 1; }; };; + esac +done + +# Be sure to have absolute paths. +for ac_var in bindir sbindir libexecdir datadir sysconfdir sharedstatedir \ + localstatedir libdir includedir oldincludedir infodir mandir +do + eval ac_val=$`echo $ac_var` + case $ac_val in + [\\/$]* | ?:[\\/]* ) ;; + *) { echo "$as_me: error: expected an absolute directory name for --$ac_var: $ac_val" >&2 + { (exit 1); exit 1; }; };; + esac +done + +# There might be people who depend on the old broken behavior: `$host' +# used to hold the argument of --host etc. +# FIXME: To remove some day. +build=$build_alias +host=$host_alias +target=$target_alias + +# FIXME: To remove some day. +if test "x$host_alias" != x; then + if test "x$build_alias" = x; then + cross_compiling=maybe + echo "$as_me: WARNING: If you wanted to set the --build type, don't use --host. + If a cross compiler is detected then cross compile mode will be used." >&2 + elif test "x$build_alias" != "x$host_alias"; then + cross_compiling=yes + fi +fi + +ac_tool_prefix= +test -n "$host_alias" && ac_tool_prefix=$host_alias- + +test "$silent" = yes && exec 6>/dev/null + + +# Find the source files, if location was not specified. +if test -z "$srcdir"; then + ac_srcdir_defaulted=yes + # Try the directory containing this script, then its parent. + ac_confdir=`(dirname "$0") 2>/dev/null || +$as_expr X"$0" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$0" : 'X\(//\)[^/]' \| \ + X"$0" : 'X\(//\)$' \| \ + X"$0" : 'X\(/\)' \| \ + . : '\(.\)' 2>/dev/null || +echo X"$0" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } + /^X\(\/\/\)[^/].*/{ s//\1/; q; } + /^X\(\/\/\)$/{ s//\1/; q; } + /^X\(\/\).*/{ s//\1/; q; } + s/.*/./; q'` + srcdir=$ac_confdir + if test ! -r $srcdir/$ac_unique_file; then + srcdir=.. + fi +else + ac_srcdir_defaulted=no +fi +if test ! -r $srcdir/$ac_unique_file; then + if test "$ac_srcdir_defaulted" = yes; then + { echo "$as_me: error: cannot find sources ($ac_unique_file) in $ac_confdir or .." >&2 + { (exit 1); exit 1; }; } + else + { echo "$as_me: error: cannot find sources ($ac_unique_file) in $srcdir" >&2 + { (exit 1); exit 1; }; } + fi +fi +(cd $srcdir && test -r ./$ac_unique_file) 2>/dev/null || + { echo "$as_me: error: sources are in $srcdir, but \`cd $srcdir' does not work" >&2 + { (exit 1); exit 1; }; } +srcdir=`echo "$srcdir" | sed 's%\([^\\/]\)[\\/]*$%\1%'` +ac_env_build_alias_set=${build_alias+set} +ac_env_build_alias_value=$build_alias +ac_cv_env_build_alias_set=${build_alias+set} +ac_cv_env_build_alias_value=$build_alias +ac_env_host_alias_set=${host_alias+set} +ac_env_host_alias_value=$host_alias +ac_cv_env_host_alias_set=${host_alias+set} +ac_cv_env_host_alias_value=$host_alias +ac_env_target_alias_set=${target_alias+set} +ac_env_target_alias_value=$target_alias +ac_cv_env_target_alias_set=${target_alias+set} +ac_cv_env_target_alias_value=$target_alias +ac_env_CC_set=${CC+set} +ac_env_CC_value=$CC +ac_cv_env_CC_set=${CC+set} +ac_cv_env_CC_value=$CC +ac_env_CFLAGS_set=${CFLAGS+set} +ac_env_CFLAGS_value=$CFLAGS +ac_cv_env_CFLAGS_set=${CFLAGS+set} +ac_cv_env_CFLAGS_value=$CFLAGS +ac_env_LDFLAGS_set=${LDFLAGS+set} +ac_env_LDFLAGS_value=$LDFLAGS +ac_cv_env_LDFLAGS_set=${LDFLAGS+set} +ac_cv_env_LDFLAGS_value=$LDFLAGS +ac_env_CPPFLAGS_set=${CPPFLAGS+set} +ac_env_CPPFLAGS_value=$CPPFLAGS +ac_cv_env_CPPFLAGS_set=${CPPFLAGS+set} +ac_cv_env_CPPFLAGS_value=$CPPFLAGS +ac_env_CPP_set=${CPP+set} +ac_env_CPP_value=$CPP +ac_cv_env_CPP_set=${CPP+set} +ac_cv_env_CPP_value=$CPP +ac_env_CXX_set=${CXX+set} +ac_env_CXX_value=$CXX +ac_cv_env_CXX_set=${CXX+set} +ac_cv_env_CXX_value=$CXX +ac_env_CXXFLAGS_set=${CXXFLAGS+set} +ac_env_CXXFLAGS_value=$CXXFLAGS +ac_cv_env_CXXFLAGS_set=${CXXFLAGS+set} +ac_cv_env_CXXFLAGS_value=$CXXFLAGS + +# +# Report the --help message. +# +if test "$ac_init_help" = "long"; then + # Omit some internal or obsolete options to make the list less imposing. + # This message is too long to be a string in the A/UX 3.1 sh. + cat <<_ACEOF +\`configure' configures this package to adapt to many kinds of systems. + +Usage: $0 [OPTION]... [VAR=VALUE]... + +To assign environment variables (e.g., CC, CFLAGS...), specify them as +VAR=VALUE. See below for descriptions of some of the useful variables. + +Defaults for the options are specified in brackets. + +Configuration: + -h, --help display this help and exit + --help=short display options specific to this package + --help=recursive display the short help of all the included packages + -V, --version display version information and exit + -q, --quiet, --silent do not print \`checking...' messages + --cache-file=FILE cache test results in FILE [disabled] + -C, --config-cache alias for \`--cache-file=config.cache' + -n, --no-create do not create output files + --srcdir=DIR find the sources in DIR [configure dir or \`..'] + +_ACEOF + + cat <<_ACEOF +Installation directories: + --prefix=PREFIX install architecture-independent files in PREFIX + [$ac_default_prefix] + --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX + [PREFIX] + +By default, \`make install' will install all the files in +\`$ac_default_prefix/bin', \`$ac_default_prefix/lib' etc. You can specify +an installation prefix other than \`$ac_default_prefix' using \`--prefix', +for instance \`--prefix=\$HOME'. + +For better control, use the options below. + +Fine tuning of the installation directories: + --bindir=DIR user executables [EPREFIX/bin] + --sbindir=DIR system admin executables [EPREFIX/sbin] + --libexecdir=DIR program executables [EPREFIX/libexec] + --datadir=DIR read-only architecture-independent data [PREFIX/share] + --sysconfdir=DIR read-only single-machine data [PREFIX/etc] + --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com] + --localstatedir=DIR modifiable single-machine data [PREFIX/var] + --libdir=DIR object code libraries [EPREFIX/lib] + --includedir=DIR C header files [PREFIX/include] + --oldincludedir=DIR C header files for non-gcc [/usr/include] + --infodir=DIR info documentation [PREFIX/info] + --mandir=DIR man documentation [PREFIX/man] +_ACEOF + + cat <<\_ACEOF + +Program names: + --program-prefix=PREFIX prepend PREFIX to installed program names + --program-suffix=SUFFIX append SUFFIX to installed program names + --program-transform-name=PROGRAM run sed PROGRAM on installed program names + +System types: + --build=BUILD configure for building on BUILD [guessed] + --host=HOST cross-compile to build programs to run on HOST [BUILD] + --target=TARGET configure for building compilers for TARGET [HOST] +_ACEOF +fi + +if test -n "$ac_init_help"; then + + cat <<\_ACEOF + +Optional Features: + --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no) + --enable-FEATURE[=ARG] include FEATURE [ARG=yes] + --enable-kernel-support enable building of the kernel module (default=yes) + --enable-modversions enable modeversions support (default=auto-detect) + --enable-debug enable debug messages to stdout (default=no) + --enable-kdebug enable kernel module debug messages (default=no) + --enable-autofs-install enable installing of autofs configuration (default=no) + --enable-suid make lufsmnt and lufsumount suid root (default=yes) + --enable-static=PKGS build static libraries default=no + --disable-dependency-tracking Speeds up one-time builds + --enable-dependency-tracking Do not reject slow dependency extractors + --enable-shared=PKGS build shared libraries default=yes + --enable-fast-install=PKGS optimize for fast installation default=yes + --disable-libtool-lock avoid locking (might break parallel builds) + --enable-wavfs build wavfs support (default=no) + --enable-cefs build cefs support (default=no) + --enable-cardfs build cardfs support (default=no) + +Optional Packages: + --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] + --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) + --with-kernel=VERSION specify a kernel version to compile for + --with-kheaders=DIR specify the location of the kernel headers + --with-gnu-ld assume the C compiler uses GNU ld default=no + --with-pic try to use only PIC/non-PIC objects default=use both + --with-ssh=PATH specify the path to the ssh executable + --with-chipcard-dir=DIR uses libchipcard from given dir + +Some influential environment variables: + CC C compiler command + CFLAGS C compiler flags + LDFLAGS linker flags, e.g. -L if you have libraries in a + nonstandard directory + CPPFLAGS C/C++ preprocessor flags, e.g. -I if you have + headers in a nonstandard directory + CPP C preprocessor + CXX C++ compiler command + CXXFLAGS C++ compiler flags + +Use these variables to override the choices made by `configure' or to help +it to find libraries and programs with nonstandard names/locations. + +_ACEOF +fi + +if test "$ac_init_help" = "recursive"; then + # If there are subdirs, report their specific --help. + ac_popdir=`pwd` + for ac_dir in : $ac_subdirs_all; do test "x$ac_dir" = x: && continue + test -d $ac_dir || continue + ac_builddir=. + +if test "$ac_dir" != .; then + ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'` + # A "../" for each directory in $ac_dir_suffix. + ac_top_builddir=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,../,g'` +else + ac_dir_suffix= ac_top_builddir= +fi + +case $srcdir in + .) # No --srcdir option. We are building in place. + ac_srcdir=. + if test -z "$ac_top_builddir"; then + ac_top_srcdir=. + else + ac_top_srcdir=`echo $ac_top_builddir | sed 's,/$,,'` + fi ;; + [\\/]* | ?:[\\/]* ) # Absolute path. + ac_srcdir=$srcdir$ac_dir_suffix; + ac_top_srcdir=$srcdir ;; + *) # Relative path. + ac_srcdir=$ac_top_builddir$srcdir$ac_dir_suffix + ac_top_srcdir=$ac_top_builddir$srcdir ;; +esac +# Don't blindly perform a `cd "$ac_dir"/$ac_foo && pwd` since $ac_foo can be +# absolute. +ac_abs_builddir=`cd "$ac_dir" && cd $ac_builddir && pwd` +ac_abs_top_builddir=`cd "$ac_dir" && cd ${ac_top_builddir}. && pwd` +ac_abs_srcdir=`cd "$ac_dir" && cd $ac_srcdir && pwd` +ac_abs_top_srcdir=`cd "$ac_dir" && cd $ac_top_srcdir && pwd` + + cd $ac_dir + # Check for guested configure; otherwise get Cygnus style configure. + if test -f $ac_srcdir/configure.gnu; then + echo + $SHELL $ac_srcdir/configure.gnu --help=recursive + elif test -f $ac_srcdir/configure; then + echo + $SHELL $ac_srcdir/configure --help=recursive + elif test -f $ac_srcdir/configure.ac || + test -f $ac_srcdir/configure.in; then + echo + $ac_configure --help + else + echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2 + fi + cd $ac_popdir + done +fi + +test -n "$ac_init_help" && exit 0 +if $ac_init_version; then + cat <<\_ACEOF + +Copyright 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, 2002 +Free Software Foundation, Inc. +This configure script is free software; the Free Software Foundation +gives unlimited permission to copy, distribute and modify it. +_ACEOF + exit 0 +fi +exec 5>config.log +cat >&5 <<_ACEOF +This file contains any messages produced by compilers while +running configure, to aid debugging if configure makes a mistake. + +It was created by $as_me, which was +generated by GNU Autoconf 2.57. Invocation command line was + + $ $0 $@ + +_ACEOF +{ +cat <<_ASUNAME +## --------- ## +## Platform. ## +## --------- ## + +hostname = `(hostname || uname -n) 2>/dev/null | sed 1q` +uname -m = `(uname -m) 2>/dev/null || echo unknown` +uname -r = `(uname -r) 2>/dev/null || echo unknown` +uname -s = `(uname -s) 2>/dev/null || echo unknown` +uname -v = `(uname -v) 2>/dev/null || echo unknown` + +/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null || echo unknown` +/bin/uname -X = `(/bin/uname -X) 2>/dev/null || echo unknown` + +/bin/arch = `(/bin/arch) 2>/dev/null || echo unknown` +/usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null || echo unknown` +/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null || echo unknown` +hostinfo = `(hostinfo) 2>/dev/null || echo unknown` +/bin/machine = `(/bin/machine) 2>/dev/null || echo unknown` +/usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null || echo unknown` +/bin/universe = `(/bin/universe) 2>/dev/null || echo unknown` + +_ASUNAME + +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + echo "PATH: $as_dir" +done + +} >&5 + +cat >&5 <<_ACEOF + + +## ----------- ## +## Core tests. ## +## ----------- ## + +_ACEOF + + +# Keep a trace of the command line. +# Strip out --no-create and --no-recursion so they do not pile up. +# Strip out --silent because we don't want to record it for future runs. +# Also quote any args containing shell meta-characters. +# Make two passes to allow for proper duplicate-argument suppression. +ac_configure_args= +ac_configure_args0= +ac_configure_args1= +ac_sep= +ac_must_keep_next=false +for ac_pass in 1 2 +do + for ac_arg + do + case $ac_arg in + -no-create | --no-c* | -n | -no-recursion | --no-r*) continue ;; + -q | -quiet | --quiet | --quie | --qui | --qu | --q \ + | -silent | --silent | --silen | --sile | --sil) + continue ;; + *" "*|*" "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?\"\']*) + ac_arg=`echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;; + esac + case $ac_pass in + 1) ac_configure_args0="$ac_configure_args0 '$ac_arg'" ;; + 2) + ac_configure_args1="$ac_configure_args1 '$ac_arg'" + if test $ac_must_keep_next = true; then + ac_must_keep_next=false # Got value, back to normal. + else + case $ac_arg in + *=* | --config-cache | -C | -disable-* | --disable-* \ + | -enable-* | --enable-* | -gas | --g* | -nfp | --nf* \ + | -q | -quiet | --q* | -silent | --sil* | -v | -verb* \ + | -with-* | --with-* | -without-* | --without-* | --x) + case "$ac_configure_args0 " in + "$ac_configure_args1"*" '$ac_arg' "* ) continue ;; + esac + ;; + -* ) ac_must_keep_next=true ;; + esac + fi + ac_configure_args="$ac_configure_args$ac_sep'$ac_arg'" + # Get rid of the leading space. + ac_sep=" " + ;; + esac + done +done +$as_unset ac_configure_args0 || test "${ac_configure_args0+set}" != set || { ac_configure_args0=; export ac_configure_args0; } +$as_unset ac_configure_args1 || test "${ac_configure_args1+set}" != set || { ac_configure_args1=; export ac_configure_args1; } + +# When interrupted or exit'd, cleanup temporary files, and complete +# config.log. We remove comments because anyway the quotes in there +# would cause problems or look ugly. +# WARNING: Be sure not to use single quotes in there, as some shells, +# such as our DU 5.0 friend, will then `close' the trap. +trap 'exit_status=$? + # Save into config.log some information that might help in debugging. + { + echo + + cat <<\_ASBOX +## ---------------- ## +## Cache variables. ## +## ---------------- ## +_ASBOX + echo + # The following way of writing the cache mishandles newlines in values, +{ + (set) 2>&1 | + case `(ac_space='"'"' '"'"'; set | grep ac_space) 2>&1` in + *ac_space=\ *) + sed -n \ + "s/'"'"'/'"'"'\\\\'"'"''"'"'/g; + s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='"'"'\\2'"'"'/p" + ;; + *) + sed -n \ + "s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1=\\2/p" + ;; + esac; +} + echo + + cat <<\_ASBOX +## ----------------- ## +## Output variables. ## +## ----------------- ## +_ASBOX + echo + for ac_var in $ac_subst_vars + do + eval ac_val=$`echo $ac_var` + echo "$ac_var='"'"'$ac_val'"'"'" + done | sort + echo + + if test -n "$ac_subst_files"; then + cat <<\_ASBOX +## ------------- ## +## Output files. ## +## ------------- ## +_ASBOX + echo + for ac_var in $ac_subst_files + do + eval ac_val=$`echo $ac_var` + echo "$ac_var='"'"'$ac_val'"'"'" + done | sort + echo + fi + + if test -s confdefs.h; then + cat <<\_ASBOX +## ----------- ## +## confdefs.h. ## +## ----------- ## +_ASBOX + echo + sed "/^$/d" confdefs.h | sort + echo + fi + test "$ac_signal" != 0 && + echo "$as_me: caught signal $ac_signal" + echo "$as_me: exit $exit_status" + } >&5 + rm -f core core.* *.core && + rm -rf conftest* confdefs* conf$$* $ac_clean_files && + exit $exit_status + ' 0 +for ac_signal in 1 2 13 15; do + trap 'ac_signal='$ac_signal'; { (exit 1); exit 1; }' $ac_signal +done +ac_signal=0 + +# confdefs.h avoids OS command line length limits that DEFS can exceed. +rm -rf conftest* confdefs.h +# AIX cpp loses on an empty file, so make sure it contains at least a newline. +echo >confdefs.h + +# Predefined preprocessor variables. + +cat >>confdefs.h <<_ACEOF +#define PACKAGE_NAME "$PACKAGE_NAME" +_ACEOF + + +cat >>confdefs.h <<_ACEOF +#define PACKAGE_TARNAME "$PACKAGE_TARNAME" +_ACEOF + + +cat >>confdefs.h <<_ACEOF +#define PACKAGE_VERSION "$PACKAGE_VERSION" +_ACEOF + + +cat >>confdefs.h <<_ACEOF +#define PACKAGE_STRING "$PACKAGE_STRING" +_ACEOF + + +cat >>confdefs.h <<_ACEOF +#define PACKAGE_BUGREPORT "$PACKAGE_BUGREPORT" +_ACEOF + + +# Let the site file select an alternate cache file if it wants to. +# Prefer explicitly selected file to automatically selected ones. +if test -z "$CONFIG_SITE"; then + if test "x$prefix" != xNONE; then + CONFIG_SITE="$prefix/share/config.site $prefix/etc/config.site" + else + CONFIG_SITE="$ac_default_prefix/share/config.site $ac_default_prefix/etc/config.site" + fi +fi +for ac_site_file in $CONFIG_SITE; do + if test -r "$ac_site_file"; then + { echo "$as_me:$LINENO: loading site script $ac_site_file" >&5 +echo "$as_me: loading site script $ac_site_file" >&6;} + sed 's/^/| /' "$ac_site_file" >&5 + . "$ac_site_file" + fi +done + +if test -r "$cache_file"; then + # Some versions of bash will fail to source /dev/null (special + # files actually), so we avoid doing that. + if test -f "$cache_file"; then + { echo "$as_me:$LINENO: loading cache $cache_file" >&5 +echo "$as_me: loading cache $cache_file" >&6;} + case $cache_file in + [\\/]* | ?:[\\/]* ) . $cache_file;; + *) . ./$cache_file;; + esac + fi +else + { echo "$as_me:$LINENO: creating cache $cache_file" >&5 +echo "$as_me: creating cache $cache_file" >&6;} + >$cache_file +fi + +# Check that the precious variables saved in the cache have kept the same +# value. +ac_cache_corrupted=false +for ac_var in `(set) 2>&1 | + sed -n 's/^ac_env_\([a-zA-Z_0-9]*\)_set=.*/\1/p'`; do + eval ac_old_set=\$ac_cv_env_${ac_var}_set + eval ac_new_set=\$ac_env_${ac_var}_set + eval ac_old_val="\$ac_cv_env_${ac_var}_value" + eval ac_new_val="\$ac_env_${ac_var}_value" + case $ac_old_set,$ac_new_set in + set,) + { echo "$as_me:$LINENO: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5 +echo "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;} + ac_cache_corrupted=: ;; + ,set) + { echo "$as_me:$LINENO: error: \`$ac_var' was not set in the previous run" >&5 +echo "$as_me: error: \`$ac_var' was not set in the previous run" >&2;} + ac_cache_corrupted=: ;; + ,);; + *) + if test "x$ac_old_val" != "x$ac_new_val"; then + { echo "$as_me:$LINENO: error: \`$ac_var' has changed since the previous run:" >&5 +echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;} + { echo "$as_me:$LINENO: former value: $ac_old_val" >&5 +echo "$as_me: former value: $ac_old_val" >&2;} + { echo "$as_me:$LINENO: current value: $ac_new_val" >&5 +echo "$as_me: current value: $ac_new_val" >&2;} + ac_cache_corrupted=: + fi;; + esac + # Pass precious variables to config.status. + if test "$ac_new_set" = set; then + case $ac_new_val in + *" "*|*" "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?\"\']*) + ac_arg=$ac_var=`echo "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;; + *) ac_arg=$ac_var=$ac_new_val ;; + esac + case " $ac_configure_args " in + *" '$ac_arg' "*) ;; # Avoid dups. Use of quotes ensures accuracy. + *) ac_configure_args="$ac_configure_args '$ac_arg'" ;; + esac + fi +done +if $ac_cache_corrupted; then + { echo "$as_me:$LINENO: error: changes in the environment can compromise the build" >&5 +echo "$as_me: error: changes in the environment can compromise the build" >&2;} + { { echo "$as_me:$LINENO: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&5 +echo "$as_me: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&2;} + { (exit 1); exit 1; }; } +fi + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + + + + + + + + + + + + + + + + + + + +ac_aux_dir= +for ac_dir in config $srcdir/config; do + if test -f $ac_dir/install-sh; then + ac_aux_dir=$ac_dir + ac_install_sh="$ac_aux_dir/install-sh -c" + break + elif test -f $ac_dir/install.sh; then + ac_aux_dir=$ac_dir + ac_install_sh="$ac_aux_dir/install.sh -c" + break + elif test -f $ac_dir/shtool; then + ac_aux_dir=$ac_dir + ac_install_sh="$ac_aux_dir/shtool install -c" + break + fi +done +if test -z "$ac_aux_dir"; then + { { echo "$as_me:$LINENO: error: cannot find install-sh or install.sh in config $srcdir/config" >&5 +echo "$as_me: error: cannot find install-sh or install.sh in config $srcdir/config" >&2;} + { (exit 1); exit 1; }; } +fi +ac_config_guess="$SHELL $ac_aux_dir/config.guess" +ac_config_sub="$SHELL $ac_aux_dir/config.sub" +ac_configure="$SHELL $ac_aux_dir/configure" # This should be Cygnus configure. + + ac_config_headers="$ac_config_headers config.h" + +# Make sure we can run config.sub. +$ac_config_sub sun4 >/dev/null 2>&1 || + { { echo "$as_me:$LINENO: error: cannot run $ac_config_sub" >&5 +echo "$as_me: error: cannot run $ac_config_sub" >&2;} + { (exit 1); exit 1; }; } + +echo "$as_me:$LINENO: checking build system type" >&5 +echo $ECHO_N "checking build system type... $ECHO_C" >&6 +if test "${ac_cv_build+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_cv_build_alias=$build_alias +test -z "$ac_cv_build_alias" && + ac_cv_build_alias=`$ac_config_guess` +test -z "$ac_cv_build_alias" && + { { echo "$as_me:$LINENO: error: cannot guess build type; you must specify one" >&5 +echo "$as_me: error: cannot guess build type; you must specify one" >&2;} + { (exit 1); exit 1; }; } +ac_cv_build=`$ac_config_sub $ac_cv_build_alias` || + { { echo "$as_me:$LINENO: error: $ac_config_sub $ac_cv_build_alias failed" >&5 +echo "$as_me: error: $ac_config_sub $ac_cv_build_alias failed" >&2;} + { (exit 1); exit 1; }; } + +fi +echo "$as_me:$LINENO: result: $ac_cv_build" >&5 +echo "${ECHO_T}$ac_cv_build" >&6 +build=$ac_cv_build +build_cpu=`echo $ac_cv_build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'` +build_vendor=`echo $ac_cv_build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'` +build_os=`echo $ac_cv_build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'` + + +echo "$as_me:$LINENO: checking host system type" >&5 +echo $ECHO_N "checking host system type... $ECHO_C" >&6 +if test "${ac_cv_host+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_cv_host_alias=$host_alias +test -z "$ac_cv_host_alias" && + ac_cv_host_alias=$ac_cv_build_alias +ac_cv_host=`$ac_config_sub $ac_cv_host_alias` || + { { echo "$as_me:$LINENO: error: $ac_config_sub $ac_cv_host_alias failed" >&5 +echo "$as_me: error: $ac_config_sub $ac_cv_host_alias failed" >&2;} + { (exit 1); exit 1; }; } + +fi +echo "$as_me:$LINENO: result: $ac_cv_host" >&5 +echo "${ECHO_T}$ac_cv_host" >&6 +host=$ac_cv_host +host_cpu=`echo $ac_cv_host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'` +host_vendor=`echo $ac_cv_host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'` +host_os=`echo $ac_cv_host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'` + + +echo "$as_me:$LINENO: checking target system type" >&5 +echo $ECHO_N "checking target system type... $ECHO_C" >&6 +if test "${ac_cv_target+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_cv_target_alias=$target_alias +test "x$ac_cv_target_alias" = "x" && + ac_cv_target_alias=$ac_cv_host_alias +ac_cv_target=`$ac_config_sub $ac_cv_target_alias` || + { { echo "$as_me:$LINENO: error: $ac_config_sub $ac_cv_target_alias failed" >&5 +echo "$as_me: error: $ac_config_sub $ac_cv_target_alias failed" >&2;} + { (exit 1); exit 1; }; } + +fi +echo "$as_me:$LINENO: result: $ac_cv_target" >&5 +echo "${ECHO_T}$ac_cv_target" >&6 +target=$ac_cv_target +target_cpu=`echo $ac_cv_target | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'` +target_vendor=`echo $ac_cv_target | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'` +target_os=`echo $ac_cv_target | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'` + + +# The aliases save the names the user supplied, while $host etc. +# will get canonicalized. +test -n "$target_alias" && + test "$program_prefix$program_suffix$program_transform_name" = \ + NONENONEs,x,x, && + program_prefix=${target_alias}- +am__api_version="1.7" +# Find a good install program. We prefer a C program (faster), +# so one script is as good as another. But avoid the broken or +# incompatible versions: +# SysV /etc/install, /usr/sbin/install +# SunOS /usr/etc/install +# IRIX /sbin/install +# AIX /bin/install +# AmigaOS /C/install, which installs bootblocks on floppy discs +# AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag +# AFS /usr/afsws/bin/install, which mishandles nonexistent args +# SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" +# ./install, which can be erroneously created by make from ./install.sh. +echo "$as_me:$LINENO: checking for a BSD-compatible install" >&5 +echo $ECHO_N "checking for a BSD-compatible install... $ECHO_C" >&6 +if test -z "$INSTALL"; then +if test "${ac_cv_path_install+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + # Account for people who put trailing slashes in PATH elements. +case $as_dir/ in + ./ | .// | /cC/* | \ + /etc/* | /usr/sbin/* | /usr/etc/* | /sbin/* | /usr/afsws/bin/* | \ + /usr/ucb/* ) ;; + *) + # OSF1 and SCO ODT 3.0 have their own names for install. + # Don't use installbsd from OSF since it installs stuff as root + # by default. + for ac_prog in ginstall scoinst install; do + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_prog$ac_exec_ext"; then + if test $ac_prog = install && + grep dspmsg "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then + # AIX install. It has an incompatible calling convention. + : + elif test $ac_prog = install && + grep pwplus "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then + # program-specific install script used by HP pwplus--don't use. + : + else + ac_cv_path_install="$as_dir/$ac_prog$ac_exec_ext -c" + break 3 + fi + fi + done + done + ;; +esac +done + + +fi + if test "${ac_cv_path_install+set}" = set; then + INSTALL=$ac_cv_path_install + else + # As a last resort, use the slow shell script. We don't cache a + # path for INSTALL within a source directory, because that will + # break other packages using the cache if that directory is + # removed, or if the path is relative. + INSTALL=$ac_install_sh + fi +fi +echo "$as_me:$LINENO: result: $INSTALL" >&5 +echo "${ECHO_T}$INSTALL" >&6 + +# Use test -z because SunOS4 sh mishandles braces in ${var-val}. +# It thinks the first close brace ends the variable substitution. +test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}' + +test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL}' + +test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' + +echo "$as_me:$LINENO: checking whether build environment is sane" >&5 +echo $ECHO_N "checking whether build environment is sane... $ECHO_C" >&6 +# Just in case +sleep 1 +echo timestamp > conftest.file +# Do `set' in a subshell so we don't clobber the current shell's +# arguments. Must try -L first in case configure is actually a +# symlink; some systems play weird games with the mod time of symlinks +# (eg FreeBSD returns the mod time of the symlink's containing +# directory). +if ( + set X `ls -Lt $srcdir/configure conftest.file 2> /dev/null` + if test "$*" = "X"; then + # -L didn't work. + set X `ls -t $srcdir/configure conftest.file` + fi + rm -f conftest.file + if test "$*" != "X $srcdir/configure conftest.file" \ + && test "$*" != "X conftest.file $srcdir/configure"; then + + # If neither matched, then we have a broken ls. This can happen + # if, for instance, CONFIG_SHELL is bash and it inherits a + # broken ls alias from the environment. This has actually + # happened. Such a system could not be considered "sane". + { { echo "$as_me:$LINENO: error: ls -t appears to fail. Make sure there is not a broken +alias in your environment" >&5 +echo "$as_me: error: ls -t appears to fail. Make sure there is not a broken +alias in your environment" >&2;} + { (exit 1); exit 1; }; } + fi + + test "$2" = conftest.file + ) +then + # Ok. + : +else + { { echo "$as_me:$LINENO: error: newly created file is older than distributed files! +Check your system clock" >&5 +echo "$as_me: error: newly created file is older than distributed files! +Check your system clock" >&2;} + { (exit 1); exit 1; }; } +fi +echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6 +test "$program_prefix" != NONE && + program_transform_name="s,^,$program_prefix,;$program_transform_name" +# Use a double $ so make ignores it. +test "$program_suffix" != NONE && + program_transform_name="s,\$,$program_suffix,;$program_transform_name" +# Double any \ or $. echo might interpret backslashes. +# By default was `s,x,x', remove it if useless. +cat <<\_ACEOF >conftest.sed +s/[\\$]/&&/g;s/;s,x,x,$// +_ACEOF +program_transform_name=`echo $program_transform_name | sed -f conftest.sed` +rm conftest.sed + + +# expand $ac_aux_dir to an absolute path +am_aux_dir=`cd $ac_aux_dir && pwd` + +test x"${MISSING+set}" = xset || MISSING="\${SHELL} $am_aux_dir/missing" +# Use eval to expand $SHELL +if eval "$MISSING --run true"; then + am_missing_run="$MISSING --run " +else + am_missing_run= + { echo "$as_me:$LINENO: WARNING: \`missing' script is too old or missing" >&5 +echo "$as_me: WARNING: \`missing' script is too old or missing" >&2;} +fi + +for ac_prog in gawk mawk nawk awk +do + # Extract the first word of "$ac_prog", so it can be a program name with args. +set dummy $ac_prog; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_AWK+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$AWK"; then + ac_cv_prog_AWK="$AWK" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_AWK="$ac_prog" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + +fi +fi +AWK=$ac_cv_prog_AWK +if test -n "$AWK"; then + echo "$as_me:$LINENO: result: $AWK" >&5 +echo "${ECHO_T}$AWK" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + test -n "$AWK" && break +done + +echo "$as_me:$LINENO: checking whether ${MAKE-make} sets \$(MAKE)" >&5 +echo $ECHO_N "checking whether ${MAKE-make} sets \$(MAKE)... $ECHO_C" >&6 +set dummy ${MAKE-make}; ac_make=`echo "$2" | sed 'y,./+-,__p_,'` +if eval "test \"\${ac_cv_prog_make_${ac_make}_set+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.make <<\_ACEOF +all: + @echo 'ac_maketemp="$(MAKE)"' +_ACEOF +# GNU make sometimes prints "make[1]: Entering...", which would confuse us. +eval `${MAKE-make} -f conftest.make 2>/dev/null | grep temp=` +if test -n "$ac_maketemp"; then + eval ac_cv_prog_make_${ac_make}_set=yes +else + eval ac_cv_prog_make_${ac_make}_set=no +fi +rm -f conftest.make +fi +if eval "test \"`echo '$ac_cv_prog_make_'${ac_make}_set`\" = yes"; then + echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6 + SET_MAKE= +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 + SET_MAKE="MAKE=${MAKE-make}" +fi + +rm -rf .tst 2>/dev/null +mkdir .tst 2>/dev/null +if test -d .tst; then + am__leading_dot=. +else + am__leading_dot=_ +fi +rmdir .tst 2>/dev/null + + # test to see if srcdir already configured +if test "`cd $srcdir && pwd`" != "`pwd`" && + test -f $srcdir/config.status; then + { { echo "$as_me:$LINENO: error: source directory already configured; run \"make distclean\" there first" >&5 +echo "$as_me: error: source directory already configured; run \"make distclean\" there first" >&2;} + { (exit 1); exit 1; }; } +fi + +# test whether we have cygpath +if test -z "$CYGPATH_W"; then + if (cygpath --version) >/dev/null 2>/dev/null; then + CYGPATH_W='cygpath -w' + else + CYGPATH_W=echo + fi +fi + + +# Define the identity of the package. + PACKAGE=lufs + VERSION=0.9.6 + + +cat >>confdefs.h <<_ACEOF +#define PACKAGE "$PACKAGE" +_ACEOF + + +cat >>confdefs.h <<_ACEOF +#define VERSION "$VERSION" +_ACEOF + +# Some tools Automake needs. + +ACLOCAL=${ACLOCAL-"${am_missing_run}aclocal-${am__api_version}"} + + +AUTOCONF=${AUTOCONF-"${am_missing_run}autoconf"} + + +AUTOMAKE=${AUTOMAKE-"${am_missing_run}automake-${am__api_version}"} + + +AUTOHEADER=${AUTOHEADER-"${am_missing_run}autoheader"} + + +MAKEINFO=${MAKEINFO-"${am_missing_run}makeinfo"} + + +AMTAR=${AMTAR-"${am_missing_run}tar"} + +install_sh=${install_sh-"$am_aux_dir/install-sh"} + +# Installed binaries are usually stripped using `strip' when the user +# run `make install-strip'. However `strip' might not be the right +# tool to use in cross-compilation environments, therefore Automake +# will honor the `STRIP' environment variable to overrule this program. +if test "$cross_compiling" != no; then + if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args. +set dummy ${ac_tool_prefix}strip; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_STRIP+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$STRIP"; then + ac_cv_prog_STRIP="$STRIP" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_STRIP="${ac_tool_prefix}strip" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + +fi +fi +STRIP=$ac_cv_prog_STRIP +if test -n "$STRIP"; then + echo "$as_me:$LINENO: result: $STRIP" >&5 +echo "${ECHO_T}$STRIP" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + +fi +if test -z "$ac_cv_prog_STRIP"; then + ac_ct_STRIP=$STRIP + # Extract the first word of "strip", so it can be a program name with args. +set dummy strip; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_ac_ct_STRIP+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$ac_ct_STRIP"; then + ac_cv_prog_ac_ct_STRIP="$ac_ct_STRIP" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_STRIP="strip" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + + test -z "$ac_cv_prog_ac_ct_STRIP" && ac_cv_prog_ac_ct_STRIP=":" +fi +fi +ac_ct_STRIP=$ac_cv_prog_ac_ct_STRIP +if test -n "$ac_ct_STRIP"; then + echo "$as_me:$LINENO: result: $ac_ct_STRIP" >&5 +echo "${ECHO_T}$ac_ct_STRIP" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + STRIP=$ac_ct_STRIP +else + STRIP="$ac_cv_prog_STRIP" +fi + +fi +INSTALL_STRIP_PROGRAM="\${SHELL} \$(install_sh) -c -s" + +# We need awk for the "check" target. The system "awk" is bad on +# some platforms. + + + + +opt_fs="localfs locasefs ftpfs gnetfs" + +# Check whether --enable-kernel-support or --disable-kernel-support was given. +if test "${enable_kernel_support+set}" = set; then + enableval="$enable_kernel_support" + KERNEL_SUPPORT=$enableval +fi; + +if test "$KERNEL_SUPPORT" != "no" +then + + echo "$as_me:$LINENO: checking OS" >&5 +echo $ECHO_N "checking OS... $ECHO_C" >&6 + OS_DIR=`uname -s` + if test ! -d kernel/$OS_DIR + then + { { echo "$as_me:$LINENO: error: $OS_DIR - not supported!" >&5 +echo "$as_me: error: $OS_DIR - not supported!" >&2;} + { (exit 1); exit 1; }; } + else + echo "$as_me:$LINENO: result: $OS_DIR" >&5 +echo "${ECHO_T}$OS_DIR" >&6 + fi + + if test "$OS_DIR"="Linux" + then + + echo "$as_me:$LINENO: checking kernel" >&5 +echo $ECHO_N "checking kernel... $ECHO_C" >&6 + +# Check whether --with-kernel or --without-kernel was given. +if test "${with_kernel+set}" = set; then + withval="$with_kernel" + KERNEL_VERSION=$withval +else + KERNEL_VERSION=`uname -r` +fi; + MODULES_DIR=/lib/modules/$KERNEL_VERSION + echo "$as_me:$LINENO: result: $KERNEL_VERSION" >&5 +echo "${ECHO_T}$KERNEL_VERSION" >&6 + + echo "$as_me:$LINENO: checking kernel support" >&5 +echo $ECHO_N "checking kernel support... $ECHO_C" >&6 + KERNEL_DIR=`echo $KERNEL_VERSION | cut -d'.' -f1,2` + if test ! -d kernel/$OS_DIR/$KERNEL_DIR + then + { { echo "$as_me:$LINENO: error: $KERNEL_DIR not supported!" >&5 +echo "$as_me: error: $KERNEL_DIR not supported!" >&2;} + { (exit 1); exit 1; }; } + else + echo "$as_me:$LINENO: result: supported in kernel/$OS_DIR/$KERNEL_DIR" >&5 +echo "${ECHO_T}supported in kernel/$OS_DIR/$KERNEL_DIR" >&6 + fi + + echo "$as_me:$LINENO: checking kernel headers" >&5 +echo $ECHO_N "checking kernel headers... $ECHO_C" >&6 + +# Check whether --with-kheaders or --without-kheaders was given. +if test "${with_kheaders+set}" = set; then + withval="$with_kheaders" + KERNEL_HDR=$withval +else + KERNEL_HDR=$MODULES_DIR/build/include +fi; + if test ! -f $KERNEL_HDR/linux/fs.h + then + { { echo "$as_me:$LINENO: error: not found in $KERNEL_HDR. please install them!" >&5 +echo "$as_me: error: not found in $KERNEL_HDR. please install them!" >&2;} + { (exit 1); exit 1; }; } + else + echo "$as_me:$LINENO: result: found in $KERNEL_HDR" >&5 +echo "${ECHO_T}found in $KERNEL_HDR" >&6 + fi + + echo "$as_me:$LINENO: checking kernel configuration" >&5 +echo $ECHO_N "checking kernel configuration... $ECHO_C" >&6 + if test -f $MODULES_DIR/build/.config + then + tmp=`cat $MODULES_DIR/build/.config | grep CONFIG_MODVERSIONS=y` + if test "$tmp" + then + echo "$as_me:$LINENO: result: found, using modversions" >&5 +echo "${ECHO_T}found, using modversions" >&6 + MODV_FLAGS="-DMODVERSIONS -include $KERNEL_HDR/linux/modversions.h" + else + echo "$as_me:$LINENO: result: found, not using modversions" >&5 +echo "${ECHO_T}found, not using modversions" >&6 + fi + else + echo "$as_me:$LINENO: result: not found at $MODULES_DIR/build/.config, assuming modversions support" >&5 +echo "${ECHO_T}not found at $MODULES_DIR/build/.config, assuming modversions support" >&6 + MODV_FLAGS="-DMODVERSIONS -include $KERNEL_HDR/linux/modversions.h" + fi + + # Check whether --enable-modversions or --disable-modversions was given. +if test "${enable_modversions+set}" = set; then + enableval="$enable_modversions" + if test $enableval = "yes"; then MODV_FLAGS="-DMODVERSIONS -include $KERNEL_HDR/linux/modversions.h"; else MODV_FLAGS=""; fi +fi; + + + + + + + fi +fi + + + +# Check whether --enable-debug or --disable-debug was given. +if test "${enable_debug+set}" = set; then + enableval="$enable_debug" + DEBUG_FLAGS="-g -DDEBUG" && CXXFLAGS="-g -O2 -Wall -DDEBUG -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64" && CFLAGS="-g -O2 -Wall -DDEBUG -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64" +else + CXXFLAGS="-O2 -Wall -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64" && CFLAGS="-O2 -Wall -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64" +fi; + + +# Check whether --enable-kdebug or --disable-kdebug was given. +if test "${enable_kdebug+set}" = set; then + enableval="$enable_kdebug" + KDEBUG_FLAGS="-DLUFS_DEBUG -DLUFS_VERBOSE" +fi; + + +# Check whether --enable-autofs-install or --disable-autofs-install was given. +if test "${enable_autofs_install+set}" = set; then + enableval="$enable_autofs_install" + AUTOFS_INSTALL="yes" +fi; + + +# Check whether --enable-suid or --disable-suid was given. +if test "${enable_suid+set}" = set; then + enableval="$enable_suid" + if test $enableval = "no"; then LUFS_SUID=""; else LUFS_SUID="true"; fi +else + LUFS_SUID="true" +fi; + + +# Check whether --enable-static or --disable-static was given. +if test "${enable_static+set}" = set; then + enableval="$enable_static" + p=${PACKAGE-default} +case $enableval in +yes) enable_static=yes ;; +no) enable_static=no ;; +*) + enable_static=no + # Look at the argument we got. We use all the common list separators. + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:," + for pkg in $enableval; do + if test "X$pkg" = "X$p"; then + enable_static=yes + fi + done + IFS="$ac_save_ifs" + ;; +esac +else + enable_static=no +fi; + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu +if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args. +set dummy ${ac_tool_prefix}gcc; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_CC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_CC="${ac_tool_prefix}gcc" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + echo "$as_me:$LINENO: result: $CC" >&5 +echo "${ECHO_T}$CC" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + +fi +if test -z "$ac_cv_prog_CC"; then + ac_ct_CC=$CC + # Extract the first word of "gcc", so it can be a program name with args. +set dummy gcc; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_ac_ct_CC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$ac_ct_CC"; then + ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_CC="gcc" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + +fi +fi +ac_ct_CC=$ac_cv_prog_ac_ct_CC +if test -n "$ac_ct_CC"; then + echo "$as_me:$LINENO: result: $ac_ct_CC" >&5 +echo "${ECHO_T}$ac_ct_CC" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + CC=$ac_ct_CC +else + CC="$ac_cv_prog_CC" +fi + +if test -z "$CC"; then + if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args. +set dummy ${ac_tool_prefix}cc; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_CC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_CC="${ac_tool_prefix}cc" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + echo "$as_me:$LINENO: result: $CC" >&5 +echo "${ECHO_T}$CC" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + +fi +if test -z "$ac_cv_prog_CC"; then + ac_ct_CC=$CC + # Extract the first word of "cc", so it can be a program name with args. +set dummy cc; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_ac_ct_CC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$ac_ct_CC"; then + ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_CC="cc" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + +fi +fi +ac_ct_CC=$ac_cv_prog_ac_ct_CC +if test -n "$ac_ct_CC"; then + echo "$as_me:$LINENO: result: $ac_ct_CC" >&5 +echo "${ECHO_T}$ac_ct_CC" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + CC=$ac_ct_CC +else + CC="$ac_cv_prog_CC" +fi + +fi +if test -z "$CC"; then + # Extract the first word of "cc", so it can be a program name with args. +set dummy cc; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_CC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else + ac_prog_rejected=no +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then + ac_prog_rejected=yes + continue + fi + ac_cv_prog_CC="cc" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + +if test $ac_prog_rejected = yes; then + # We found a bogon in the path, so make sure we never use it. + set dummy $ac_cv_prog_CC + shift + if test $# != 0; then + # We chose a different compiler from the bogus one. + # However, it has the same basename, so the bogon will be chosen + # first if we set CC to just the basename; use the full file name. + shift + ac_cv_prog_CC="$as_dir/$ac_word${1+' '}$@" + fi +fi +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + echo "$as_me:$LINENO: result: $CC" >&5 +echo "${ECHO_T}$CC" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + +fi +if test -z "$CC"; then + if test -n "$ac_tool_prefix"; then + for ac_prog in cl + do + # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. +set dummy $ac_tool_prefix$ac_prog; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_CC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_CC="$ac_tool_prefix$ac_prog" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + echo "$as_me:$LINENO: result: $CC" >&5 +echo "${ECHO_T}$CC" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + test -n "$CC" && break + done +fi +if test -z "$CC"; then + ac_ct_CC=$CC + for ac_prog in cl +do + # Extract the first word of "$ac_prog", so it can be a program name with args. +set dummy $ac_prog; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_ac_ct_CC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$ac_ct_CC"; then + ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_CC="$ac_prog" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + +fi +fi +ac_ct_CC=$ac_cv_prog_ac_ct_CC +if test -n "$ac_ct_CC"; then + echo "$as_me:$LINENO: result: $ac_ct_CC" >&5 +echo "${ECHO_T}$ac_ct_CC" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + test -n "$ac_ct_CC" && break +done + + CC=$ac_ct_CC +fi + +fi + + +test -z "$CC" && { { echo "$as_me:$LINENO: error: no acceptable C compiler found in \$PATH +See \`config.log' for more details." >&5 +echo "$as_me: error: no acceptable C compiler found in \$PATH +See \`config.log' for more details." >&2;} + { (exit 1); exit 1; }; } + +# Provide some information about the compiler. +echo "$as_me:$LINENO:" \ + "checking for C compiler version" >&5 +ac_compiler=`set X $ac_compile; echo $2` +{ (eval echo "$as_me:$LINENO: \"$ac_compiler --version &5\"") >&5 + (eval $ac_compiler --version &5) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } +{ (eval echo "$as_me:$LINENO: \"$ac_compiler -v &5\"") >&5 + (eval $ac_compiler -v &5) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } +{ (eval echo "$as_me:$LINENO: \"$ac_compiler -V &5\"") >&5 + (eval $ac_compiler -V &5) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } + +cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +ac_clean_files_save=$ac_clean_files +ac_clean_files="$ac_clean_files a.out a.exe b.out" +# Try to create an executable without -o first, disregard a.out. +# It will help us diagnose broken compilers, and finding out an intuition +# of exeext. +echo "$as_me:$LINENO: checking for C compiler default output" >&5 +echo $ECHO_N "checking for C compiler default output... $ECHO_C" >&6 +ac_link_default=`echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'` +if { (eval echo "$as_me:$LINENO: \"$ac_link_default\"") >&5 + (eval $ac_link_default) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; then + # Find the output, starting from the most likely. This scheme is +# not robust to junk in `.', hence go to wildcards (a.*) only as a last +# resort. + +# Be careful to initialize this variable, since it used to be cached. +# Otherwise an old cache value of `no' led to `EXEEXT = no' in a Makefile. +ac_cv_exeext= +# b.out is created by i960 compilers. +for ac_file in a_out.exe a.exe conftest.exe a.out conftest a.* conftest.* b.out +do + test -f "$ac_file" || continue + case $ac_file in + *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.o | *.obj ) + ;; + conftest.$ac_ext ) + # This is the source file. + ;; + [ab].out ) + # We found the default executable, but exeext='' is most + # certainly right. + break;; + *.* ) + ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` + # FIXME: I believe we export ac_cv_exeext for Libtool, + # but it would be cool to find out if it's true. Does anybody + # maintain Libtool? --akim. + export ac_cv_exeext + break;; + * ) + break;; + esac +done +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +{ { echo "$as_me:$LINENO: error: C compiler cannot create executables +See \`config.log' for more details." >&5 +echo "$as_me: error: C compiler cannot create executables +See \`config.log' for more details." >&2;} + { (exit 77); exit 77; }; } +fi + +ac_exeext=$ac_cv_exeext +echo "$as_me:$LINENO: result: $ac_file" >&5 +echo "${ECHO_T}$ac_file" >&6 + +# Check the compiler produces executables we can run. If not, either +# the compiler is broken, or we cross compile. +echo "$as_me:$LINENO: checking whether the C compiler works" >&5 +echo $ECHO_N "checking whether the C compiler works... $ECHO_C" >&6 +# FIXME: These cross compiler hacks should be removed for Autoconf 3.0 +# If not cross compiling, check that we can run a simple program. +if test "$cross_compiling" != yes; then + if { ac_try='./$ac_file' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + cross_compiling=no + else + if test "$cross_compiling" = maybe; then + cross_compiling=yes + else + { { echo "$as_me:$LINENO: error: cannot run C compiled programs. +If you meant to cross compile, use \`--host'. +See \`config.log' for more details." >&5 +echo "$as_me: error: cannot run C compiled programs. +If you meant to cross compile, use \`--host'. +See \`config.log' for more details." >&2;} + { (exit 1); exit 1; }; } + fi + fi +fi +echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6 + +rm -f a.out a.exe conftest$ac_cv_exeext b.out +ac_clean_files=$ac_clean_files_save +# Check the compiler produces executables we can run. If not, either +# the compiler is broken, or we cross compile. +echo "$as_me:$LINENO: checking whether we are cross compiling" >&5 +echo $ECHO_N "checking whether we are cross compiling... $ECHO_C" >&6 +echo "$as_me:$LINENO: result: $cross_compiling" >&5 +echo "${ECHO_T}$cross_compiling" >&6 + +echo "$as_me:$LINENO: checking for suffix of executables" >&5 +echo $ECHO_N "checking for suffix of executables... $ECHO_C" >&6 +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; then + # If both `conftest.exe' and `conftest' are `present' (well, observable) +# catch `conftest.exe'. For instance with Cygwin, `ls conftest' will +# work properly (i.e., refer to `conftest.exe'), while it won't with +# `rm'. +for ac_file in conftest.exe conftest conftest.*; do + test -f "$ac_file" || continue + case $ac_file in + *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.o | *.obj ) ;; + *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` + export ac_cv_exeext + break;; + * ) break;; + esac +done +else + { { echo "$as_me:$LINENO: error: cannot compute suffix of executables: cannot compile and link +See \`config.log' for more details." >&5 +echo "$as_me: error: cannot compute suffix of executables: cannot compile and link +See \`config.log' for more details." >&2;} + { (exit 1); exit 1; }; } +fi + +rm -f conftest$ac_cv_exeext +echo "$as_me:$LINENO: result: $ac_cv_exeext" >&5 +echo "${ECHO_T}$ac_cv_exeext" >&6 + +rm -f conftest.$ac_ext +EXEEXT=$ac_cv_exeext +ac_exeext=$EXEEXT +echo "$as_me:$LINENO: checking for suffix of object files" >&5 +echo $ECHO_N "checking for suffix of object files... $ECHO_C" >&6 +if test "${ac_cv_objext+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +rm -f conftest.o conftest.obj +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; then + for ac_file in `(ls conftest.o conftest.obj; ls conftest.*) 2>/dev/null`; do + case $ac_file in + *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg ) ;; + *) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'` + break;; + esac +done +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +{ { echo "$as_me:$LINENO: error: cannot compute suffix of object files: cannot compile +See \`config.log' for more details." >&5 +echo "$as_me: error: cannot compute suffix of object files: cannot compile +See \`config.log' for more details." >&2;} + { (exit 1); exit 1; }; } +fi + +rm -f conftest.$ac_cv_objext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $ac_cv_objext" >&5 +echo "${ECHO_T}$ac_cv_objext" >&6 +OBJEXT=$ac_cv_objext +ac_objext=$OBJEXT +echo "$as_me:$LINENO: checking whether we are using the GNU C compiler" >&5 +echo $ECHO_N "checking whether we are using the GNU C compiler... $ECHO_C" >&6 +if test "${ac_cv_c_compiler_gnu+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +int +main () +{ +#ifndef __GNUC__ + choke me +#endif + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_compiler_gnu=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_compiler_gnu=no +fi +rm -f conftest.$ac_objext conftest.$ac_ext +ac_cv_c_compiler_gnu=$ac_compiler_gnu + +fi +echo "$as_me:$LINENO: result: $ac_cv_c_compiler_gnu" >&5 +echo "${ECHO_T}$ac_cv_c_compiler_gnu" >&6 +GCC=`test $ac_compiler_gnu = yes && echo yes` +ac_test_CFLAGS=${CFLAGS+set} +ac_save_CFLAGS=$CFLAGS +CFLAGS="-g" +echo "$as_me:$LINENO: checking whether $CC accepts -g" >&5 +echo $ECHO_N "checking whether $CC accepts -g... $ECHO_C" >&6 +if test "${ac_cv_prog_cc_g+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_prog_cc_g=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_prog_cc_g=no +fi +rm -f conftest.$ac_objext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $ac_cv_prog_cc_g" >&5 +echo "${ECHO_T}$ac_cv_prog_cc_g" >&6 +if test "$ac_test_CFLAGS" = set; then + CFLAGS=$ac_save_CFLAGS +elif test $ac_cv_prog_cc_g = yes; then + if test "$GCC" = yes; then + CFLAGS="-g -O2" + else + CFLAGS="-g" + fi +else + if test "$GCC" = yes; then + CFLAGS="-O2" + else + CFLAGS= + fi +fi +echo "$as_me:$LINENO: checking for $CC option to accept ANSI C" >&5 +echo $ECHO_N "checking for $CC option to accept ANSI C... $ECHO_C" >&6 +if test "${ac_cv_prog_cc_stdc+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_cv_prog_cc_stdc=no +ac_save_CC=$CC +cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +#include +#include +#include +/* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */ +struct buf { int x; }; +FILE * (*rcsopen) (struct buf *, struct stat *, int); +static char *e (p, i) + char **p; + int i; +{ + return p[i]; +} +static char *f (char * (*g) (char **, int), char **p, ...) +{ + char *s; + va_list v; + va_start (v,p); + s = g (p, va_arg (v,int)); + va_end (v); + return s; +} +int test (int i, double x); +struct s1 {int (*f) (int a);}; +struct s2 {int (*f) (double a);}; +int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int); +int argc; +char **argv; +int +main () +{ +return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1]; + ; + return 0; +} +_ACEOF +# Don't try gcc -ansi; that turns off useful extensions and +# breaks some systems' header files. +# AIX -qlanglvl=ansi +# Ultrix and OSF/1 -std1 +# HP-UX 10.20 and later -Ae +# HP-UX older versions -Aa -D_HPUX_SOURCE +# SVR4 -Xc -D__EXTENSIONS__ +for ac_arg in "" -qlanglvl=ansi -std1 -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" +do + CC="$ac_save_CC $ac_arg" + rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_prog_cc_stdc=$ac_arg +break +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +fi +rm -f conftest.$ac_objext +done +rm -f conftest.$ac_ext conftest.$ac_objext +CC=$ac_save_CC + +fi + +case "x$ac_cv_prog_cc_stdc" in + x|xno) + echo "$as_me:$LINENO: result: none needed" >&5 +echo "${ECHO_T}none needed" >&6 ;; + *) + echo "$as_me:$LINENO: result: $ac_cv_prog_cc_stdc" >&5 +echo "${ECHO_T}$ac_cv_prog_cc_stdc" >&6 + CC="$CC $ac_cv_prog_cc_stdc" ;; +esac + +# Some people use a C++ compiler to compile C. Since we use `exit', +# in C++ we need to declare it. In case someone uses the same compiler +# for both compiling C and C++ we need to have the C++ compiler decide +# the declaration of exit, since it's the most demanding environment. +cat >conftest.$ac_ext <<_ACEOF +#ifndef __cplusplus + choke me +#endif +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + for ac_declaration in \ + ''\ + '#include ' \ + 'extern "C" void std::exit (int) throw (); using std::exit;' \ + 'extern "C" void std::exit (int); using std::exit;' \ + 'extern "C" void exit (int) throw ();' \ + 'extern "C" void exit (int);' \ + 'void exit (int);' +do + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +$ac_declaration +int +main () +{ +exit (42); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + : +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +continue +fi +rm -f conftest.$ac_objext conftest.$ac_ext + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_declaration +int +main () +{ +exit (42); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + break +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +fi +rm -f conftest.$ac_objext conftest.$ac_ext +done +rm -f conftest* +if test -n "$ac_declaration"; then + echo '#ifdef __cplusplus' >>confdefs.h + echo $ac_declaration >>confdefs.h + echo '#endif' >>confdefs.h +fi + +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +fi +rm -f conftest.$ac_objext conftest.$ac_ext +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu +DEPDIR="${am__leading_dot}deps" + + ac_config_commands="$ac_config_commands depfiles" + + +am_make=${MAKE-make} +cat > confinc << 'END' +am__doit: + @echo done +.PHONY: am__doit +END +# If we don't find an include directive, just comment out the code. +echo "$as_me:$LINENO: checking for style of include used by $am_make" >&5 +echo $ECHO_N "checking for style of include used by $am_make... $ECHO_C" >&6 +am__include="#" +am__quote= +_am_result=none +# First try GNU make style include. +echo "include confinc" > confmf +# We grep out `Entering directory' and `Leaving directory' +# messages which can occur if `w' ends up in MAKEFLAGS. +# In particular we don't look at `^make:' because GNU make might +# be invoked under some other name (usually "gmake"), in which +# case it prints its new name instead of `make'. +if test "`$am_make -s -f confmf 2> /dev/null | grep -v 'ing directory'`" = "done"; then + am__include=include + am__quote= + _am_result=GNU +fi +# Now try BSD make style include. +if test "$am__include" = "#"; then + echo '.include "confinc"' > confmf + if test "`$am_make -s -f confmf 2> /dev/null`" = "done"; then + am__include=.include + am__quote="\"" + _am_result=BSD + fi +fi + + +echo "$as_me:$LINENO: result: $_am_result" >&5 +echo "${ECHO_T}$_am_result" >&6 +rm -f confinc confmf + +# Check whether --enable-dependency-tracking or --disable-dependency-tracking was given. +if test "${enable_dependency_tracking+set}" = set; then + enableval="$enable_dependency_tracking" + +fi; +if test "x$enable_dependency_tracking" != xno; then + am_depcomp="$ac_aux_dir/depcomp" + AMDEPBACKSLASH='\' +fi + + +if test "x$enable_dependency_tracking" != xno; then + AMDEP_TRUE= + AMDEP_FALSE='#' +else + AMDEP_TRUE='#' + AMDEP_FALSE= +fi + + + + +depcc="$CC" am_compiler_list= + +echo "$as_me:$LINENO: checking dependency style of $depcc" >&5 +echo $ECHO_N "checking dependency style of $depcc... $ECHO_C" >&6 +if test "${am_cv_CC_dependencies_compiler_type+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then + # We make a subdir and do the tests there. Otherwise we can end up + # making bogus files that we don't know about and never remove. For + # instance it was reported that on HP-UX the gcc test will end up + # making a dummy file named `D' -- because `-MD' means `put the output + # in D'. + mkdir conftest.dir + # Copy depcomp to subdir because otherwise we won't find it if we're + # using a relative directory. + cp "$am_depcomp" conftest.dir + cd conftest.dir + + am_cv_CC_dependencies_compiler_type=none + if test "$am_compiler_list" = ""; then + am_compiler_list=`sed -n 's/^#*\([a-zA-Z0-9]*\))$/\1/p' < ./depcomp` + fi + for depmode in $am_compiler_list; do + # We need to recreate these files for each test, as the compiler may + # overwrite some of them when testing with obscure command lines. + # This happens at least with the AIX C compiler. + echo '#include "conftest.h"' > conftest.c + echo 'int i;' > conftest.h + echo "${am__include} ${am__quote}conftest.Po${am__quote}" > confmf + + case $depmode in + nosideeffect) + # after this tag, mechanisms are not by side-effect, so they'll + # only be used when explicitly requested + if test "x$enable_dependency_tracking" = xyes; then + continue + else + break + fi + ;; + none) break ;; + esac + # We check with `-c' and `-o' for the sake of the "dashmstdout" + # mode. It turns out that the SunPro C++ compiler does not properly + # handle `-M -o', and we need to detect this. + if depmode=$depmode \ + source=conftest.c object=conftest.o \ + depfile=conftest.Po tmpdepfile=conftest.TPo \ + $SHELL ./depcomp $depcc -c -o conftest.o conftest.c \ + >/dev/null 2>conftest.err && + grep conftest.h conftest.Po > /dev/null 2>&1 && + ${MAKE-make} -s -f confmf > /dev/null 2>&1; then + # icc doesn't choke on unknown options, it will just issue warnings + # (even with -Werror). So we grep stderr for any message + # that says an option was ignored. + if grep 'ignoring option' conftest.err >/dev/null 2>&1; then :; else + am_cv_CC_dependencies_compiler_type=$depmode + break + fi + fi + done + + cd .. + rm -rf conftest.dir +else + am_cv_CC_dependencies_compiler_type=none +fi + +fi +echo "$as_me:$LINENO: result: $am_cv_CC_dependencies_compiler_type" >&5 +echo "${ECHO_T}$am_cv_CC_dependencies_compiler_type" >&6 +CCDEPMODE=depmode=$am_cv_CC_dependencies_compiler_type + + + +if + test "x$enable_dependency_tracking" != xno \ + && test "$am_cv_CC_dependencies_compiler_type" = gcc3; then + am__fastdepCC_TRUE= + am__fastdepCC_FALSE='#' +else + am__fastdepCC_TRUE='#' + am__fastdepCC_FALSE= +fi + + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu +echo "$as_me:$LINENO: checking how to run the C preprocessor" >&5 +echo $ECHO_N "checking how to run the C preprocessor... $ECHO_C" >&6 +# On Suns, sometimes $CPP names a directory. +if test -n "$CPP" && test -d "$CPP"; then + CPP= +fi +if test -z "$CPP"; then + if test "${ac_cv_prog_CPP+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + # Double quotes because CPP needs to be expanded + for CPP in "$CC -E" "$CC -E -traditional-cpp" "/lib/cpp" + do + ac_preproc_ok=false +for ac_c_preproc_warn_flag in '' yes +do + # Use a header file that comes with gcc, so configuring glibc + # with a fresh cross-compiler works. + # Prefer to if __STDC__ is defined, since + # exists even on freestanding compilers. + # On the NeXT, cc -E runs the code through the compiler's parser, + # not just through cpp. "Syntax error" is here to catch this case. + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#ifdef __STDC__ +# include +#else +# include +#endif + Syntax error +_ACEOF +if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + : +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + # Broken: fails on valid input. +continue +fi +rm -f conftest.err conftest.$ac_ext + + # OK, works on sane cases. Now check whether non-existent headers + # can be detected and how. + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +_ACEOF +if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + # Broken: success on invalid input. +continue +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + # Passes both tests. +ac_preproc_ok=: +break +fi +rm -f conftest.err conftest.$ac_ext + +done +# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. +rm -f conftest.err conftest.$ac_ext +if $ac_preproc_ok; then + break +fi + + done + ac_cv_prog_CPP=$CPP + +fi + CPP=$ac_cv_prog_CPP +else + ac_cv_prog_CPP=$CPP +fi +echo "$as_me:$LINENO: result: $CPP" >&5 +echo "${ECHO_T}$CPP" >&6 +ac_preproc_ok=false +for ac_c_preproc_warn_flag in '' yes +do + # Use a header file that comes with gcc, so configuring glibc + # with a fresh cross-compiler works. + # Prefer to if __STDC__ is defined, since + # exists even on freestanding compilers. + # On the NeXT, cc -E runs the code through the compiler's parser, + # not just through cpp. "Syntax error" is here to catch this case. + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#ifdef __STDC__ +# include +#else +# include +#endif + Syntax error +_ACEOF +if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + : +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + # Broken: fails on valid input. +continue +fi +rm -f conftest.err conftest.$ac_ext + + # OK, works on sane cases. Now check whether non-existent headers + # can be detected and how. + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +_ACEOF +if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + # Broken: success on invalid input. +continue +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + # Passes both tests. +ac_preproc_ok=: +break +fi +rm -f conftest.err conftest.$ac_ext + +done +# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. +rm -f conftest.err conftest.$ac_ext +if $ac_preproc_ok; then + : +else + { { echo "$as_me:$LINENO: error: C preprocessor \"$CPP\" fails sanity check +See \`config.log' for more details." >&5 +echo "$as_me: error: C preprocessor \"$CPP\" fails sanity check +See \`config.log' for more details." >&2;} + { (exit 1); exit 1; }; } +fi + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + +ac_ext=cc +ac_cpp='$CXXCPP $CPPFLAGS' +ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_cxx_compiler_gnu +if test -n "$ac_tool_prefix"; then + for ac_prog in $CCC g++ c++ gpp aCC CC cxx cc++ cl FCC KCC RCC xlC_r xlC + do + # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. +set dummy $ac_tool_prefix$ac_prog; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_CXX+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$CXX"; then + ac_cv_prog_CXX="$CXX" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_CXX="$ac_tool_prefix$ac_prog" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + +fi +fi +CXX=$ac_cv_prog_CXX +if test -n "$CXX"; then + echo "$as_me:$LINENO: result: $CXX" >&5 +echo "${ECHO_T}$CXX" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + test -n "$CXX" && break + done +fi +if test -z "$CXX"; then + ac_ct_CXX=$CXX + for ac_prog in $CCC g++ c++ gpp aCC CC cxx cc++ cl FCC KCC RCC xlC_r xlC +do + # Extract the first word of "$ac_prog", so it can be a program name with args. +set dummy $ac_prog; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_ac_ct_CXX+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$ac_ct_CXX"; then + ac_cv_prog_ac_ct_CXX="$ac_ct_CXX" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_CXX="$ac_prog" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + +fi +fi +ac_ct_CXX=$ac_cv_prog_ac_ct_CXX +if test -n "$ac_ct_CXX"; then + echo "$as_me:$LINENO: result: $ac_ct_CXX" >&5 +echo "${ECHO_T}$ac_ct_CXX" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + test -n "$ac_ct_CXX" && break +done +test -n "$ac_ct_CXX" || ac_ct_CXX="g++" + + CXX=$ac_ct_CXX +fi + + +# Provide some information about the compiler. +echo "$as_me:$LINENO:" \ + "checking for C++ compiler version" >&5 +ac_compiler=`set X $ac_compile; echo $2` +{ (eval echo "$as_me:$LINENO: \"$ac_compiler --version &5\"") >&5 + (eval $ac_compiler --version &5) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } +{ (eval echo "$as_me:$LINENO: \"$ac_compiler -v &5\"") >&5 + (eval $ac_compiler -v &5) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } +{ (eval echo "$as_me:$LINENO: \"$ac_compiler -V &5\"") >&5 + (eval $ac_compiler -V &5) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } + +echo "$as_me:$LINENO: checking whether we are using the GNU C++ compiler" >&5 +echo $ECHO_N "checking whether we are using the GNU C++ compiler... $ECHO_C" >&6 +if test "${ac_cv_cxx_compiler_gnu+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +int +main () +{ +#ifndef __GNUC__ + choke me +#endif + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_compiler_gnu=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_compiler_gnu=no +fi +rm -f conftest.$ac_objext conftest.$ac_ext +ac_cv_cxx_compiler_gnu=$ac_compiler_gnu + +fi +echo "$as_me:$LINENO: result: $ac_cv_cxx_compiler_gnu" >&5 +echo "${ECHO_T}$ac_cv_cxx_compiler_gnu" >&6 +GXX=`test $ac_compiler_gnu = yes && echo yes` +ac_test_CXXFLAGS=${CXXFLAGS+set} +ac_save_CXXFLAGS=$CXXFLAGS +CXXFLAGS="-g" +echo "$as_me:$LINENO: checking whether $CXX accepts -g" >&5 +echo $ECHO_N "checking whether $CXX accepts -g... $ECHO_C" >&6 +if test "${ac_cv_prog_cxx_g+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_prog_cxx_g=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_prog_cxx_g=no +fi +rm -f conftest.$ac_objext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $ac_cv_prog_cxx_g" >&5 +echo "${ECHO_T}$ac_cv_prog_cxx_g" >&6 +if test "$ac_test_CXXFLAGS" = set; then + CXXFLAGS=$ac_save_CXXFLAGS +elif test $ac_cv_prog_cxx_g = yes; then + if test "$GXX" = yes; then + CXXFLAGS="-g -O2" + else + CXXFLAGS="-g" + fi +else + if test "$GXX" = yes; then + CXXFLAGS="-O2" + else + CXXFLAGS= + fi +fi +for ac_declaration in \ + ''\ + '#include ' \ + 'extern "C" void std::exit (int) throw (); using std::exit;' \ + 'extern "C" void std::exit (int); using std::exit;' \ + 'extern "C" void exit (int) throw ();' \ + 'extern "C" void exit (int);' \ + 'void exit (int);' +do + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +$ac_declaration +int +main () +{ +exit (42); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + : +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +continue +fi +rm -f conftest.$ac_objext conftest.$ac_ext + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_declaration +int +main () +{ +exit (42); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + break +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +fi +rm -f conftest.$ac_objext conftest.$ac_ext +done +rm -f conftest* +if test -n "$ac_declaration"; then + echo '#ifdef __cplusplus' >>confdefs.h + echo $ac_declaration >>confdefs.h + echo '#endif' >>confdefs.h +fi + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + +depcc="$CXX" am_compiler_list= + +echo "$as_me:$LINENO: checking dependency style of $depcc" >&5 +echo $ECHO_N "checking dependency style of $depcc... $ECHO_C" >&6 +if test "${am_cv_CXX_dependencies_compiler_type+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then + # We make a subdir and do the tests there. Otherwise we can end up + # making bogus files that we don't know about and never remove. For + # instance it was reported that on HP-UX the gcc test will end up + # making a dummy file named `D' -- because `-MD' means `put the output + # in D'. + mkdir conftest.dir + # Copy depcomp to subdir because otherwise we won't find it if we're + # using a relative directory. + cp "$am_depcomp" conftest.dir + cd conftest.dir + + am_cv_CXX_dependencies_compiler_type=none + if test "$am_compiler_list" = ""; then + am_compiler_list=`sed -n 's/^#*\([a-zA-Z0-9]*\))$/\1/p' < ./depcomp` + fi + for depmode in $am_compiler_list; do + # We need to recreate these files for each test, as the compiler may + # overwrite some of them when testing with obscure command lines. + # This happens at least with the AIX C compiler. + echo '#include "conftest.h"' > conftest.c + echo 'int i;' > conftest.h + echo "${am__include} ${am__quote}conftest.Po${am__quote}" > confmf + + case $depmode in + nosideeffect) + # after this tag, mechanisms are not by side-effect, so they'll + # only be used when explicitly requested + if test "x$enable_dependency_tracking" = xyes; then + continue + else + break + fi + ;; + none) break ;; + esac + # We check with `-c' and `-o' for the sake of the "dashmstdout" + # mode. It turns out that the SunPro C++ compiler does not properly + # handle `-M -o', and we need to detect this. + if depmode=$depmode \ + source=conftest.c object=conftest.o \ + depfile=conftest.Po tmpdepfile=conftest.TPo \ + $SHELL ./depcomp $depcc -c -o conftest.o conftest.c \ + >/dev/null 2>conftest.err && + grep conftest.h conftest.Po > /dev/null 2>&1 && + ${MAKE-make} -s -f confmf > /dev/null 2>&1; then + # icc doesn't choke on unknown options, it will just issue warnings + # (even with -Werror). So we grep stderr for any message + # that says an option was ignored. + if grep 'ignoring option' conftest.err >/dev/null 2>&1; then :; else + am_cv_CXX_dependencies_compiler_type=$depmode + break + fi + fi + done + + cd .. + rm -rf conftest.dir +else + am_cv_CXX_dependencies_compiler_type=none +fi + +fi +echo "$as_me:$LINENO: result: $am_cv_CXX_dependencies_compiler_type" >&5 +echo "${ECHO_T}$am_cv_CXX_dependencies_compiler_type" >&6 +CXXDEPMODE=depmode=$am_cv_CXX_dependencies_compiler_type + + + +if + test "x$enable_dependency_tracking" != xno \ + && test "$am_cv_CXX_dependencies_compiler_type" = gcc3; then + am__fastdepCXX_TRUE= + am__fastdepCXX_FALSE='#' +else + am__fastdepCXX_TRUE='#' + am__fastdepCXX_FALSE= +fi + + +# Find a good install program. We prefer a C program (faster), +# so one script is as good as another. But avoid the broken or +# incompatible versions: +# SysV /etc/install, /usr/sbin/install +# SunOS /usr/etc/install +# IRIX /sbin/install +# AIX /bin/install +# AmigaOS /C/install, which installs bootblocks on floppy discs +# AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag +# AFS /usr/afsws/bin/install, which mishandles nonexistent args +# SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" +# ./install, which can be erroneously created by make from ./install.sh. +echo "$as_me:$LINENO: checking for a BSD-compatible install" >&5 +echo $ECHO_N "checking for a BSD-compatible install... $ECHO_C" >&6 +if test -z "$INSTALL"; then +if test "${ac_cv_path_install+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + # Account for people who put trailing slashes in PATH elements. +case $as_dir/ in + ./ | .// | /cC/* | \ + /etc/* | /usr/sbin/* | /usr/etc/* | /sbin/* | /usr/afsws/bin/* | \ + /usr/ucb/* ) ;; + *) + # OSF1 and SCO ODT 3.0 have their own names for install. + # Don't use installbsd from OSF since it installs stuff as root + # by default. + for ac_prog in ginstall scoinst install; do + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_prog$ac_exec_ext"; then + if test $ac_prog = install && + grep dspmsg "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then + # AIX install. It has an incompatible calling convention. + : + elif test $ac_prog = install && + grep pwplus "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then + # program-specific install script used by HP pwplus--don't use. + : + else + ac_cv_path_install="$as_dir/$ac_prog$ac_exec_ext -c" + break 3 + fi + fi + done + done + ;; +esac +done + + +fi + if test "${ac_cv_path_install+set}" = set; then + INSTALL=$ac_cv_path_install + else + # As a last resort, use the slow shell script. We don't cache a + # path for INSTALL within a source directory, because that will + # break other packages using the cache if that directory is + # removed, or if the path is relative. + INSTALL=$ac_install_sh + fi +fi +echo "$as_me:$LINENO: result: $INSTALL" >&5 +echo "${ECHO_T}$INSTALL" >&6 + +# Use test -z because SunOS4 sh mishandles braces in ${var-val}. +# It thinks the first close brace ends the variable substitution. +test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}' + +test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL}' + +test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' + +echo "$as_me:$LINENO: checking whether ln -s works" >&5 +echo $ECHO_N "checking whether ln -s works... $ECHO_C" >&6 +LN_S=$as_ln_s +if test "$LN_S" = "ln -s"; then + echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6 +else + echo "$as_me:$LINENO: result: no, using $LN_S" >&5 +echo "${ECHO_T}no, using $LN_S" >&6 +fi + +# Check whether --enable-shared or --disable-shared was given. +if test "${enable_shared+set}" = set; then + enableval="$enable_shared" + p=${PACKAGE-default} +case $enableval in +yes) enable_shared=yes ;; +no) enable_shared=no ;; +*) + enable_shared=no + # Look at the argument we got. We use all the common list separators. + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:," + for pkg in $enableval; do + if test "X$pkg" = "X$p"; then + enable_shared=yes + fi + done + IFS="$ac_save_ifs" + ;; +esac +else + enable_shared=yes +fi; +# Check whether --enable-fast-install or --disable-fast-install was given. +if test "${enable_fast_install+set}" = set; then + enableval="$enable_fast_install" + p=${PACKAGE-default} +case $enableval in +yes) enable_fast_install=yes ;; +no) enable_fast_install=no ;; +*) + enable_fast_install=no + # Look at the argument we got. We use all the common list separators. + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:," + for pkg in $enableval; do + if test "X$pkg" = "X$p"; then + enable_fast_install=yes + fi + done + IFS="$ac_save_ifs" + ;; +esac +else + enable_fast_install=yes +fi; +# Find the correct PATH separator. Usually this is `:', but +# DJGPP uses `;' like DOS. +if test "X${PATH_SEPARATOR+set}" != Xset; then + UNAME=${UNAME-`uname 2>/dev/null`} + case X$UNAME in + *-DOS) lt_cv_sys_path_separator=';' ;; + *) lt_cv_sys_path_separator=':' ;; + esac + PATH_SEPARATOR=$lt_cv_sys_path_separator +fi + + +# Check whether --with-gnu-ld or --without-gnu-ld was given. +if test "${with_gnu_ld+set}" = set; then + withval="$with_gnu_ld" + test "$withval" = no || with_gnu_ld=yes +else + with_gnu_ld=no +fi; +ac_prog=ld +if test "$GCC" = yes; then + # Check if gcc -print-prog-name=ld gives a path. + echo "$as_me:$LINENO: checking for ld used by GCC" >&5 +echo $ECHO_N "checking for ld used by GCC... $ECHO_C" >&6 + case $host in + *-*-mingw*) + # gcc leaves a trailing carriage return which upsets mingw + ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;; + *) + ac_prog=`($CC -print-prog-name=ld) 2>&5` ;; + esac + case $ac_prog in + # Accept absolute paths. + [\\/]* | [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 aren't using GCC. + ac_prog=ld + ;; + *) + # If it is relative, then search for the first ld in PATH. + with_gnu_ld=unknown + ;; + esac +elif test "$with_gnu_ld" = yes; then + echo "$as_me:$LINENO: checking for GNU ld" >&5 +echo $ECHO_N "checking for GNU ld... $ECHO_C" >&6 +else + echo "$as_me:$LINENO: checking for non-GNU ld" >&5 +echo $ECHO_N "checking for non-GNU ld... $ECHO_C" >&6 +fi +if test "${lt_cv_path_LD+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -z "$LD"; then + IFS="${IFS= }"; ac_save_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 + lt_cv_path_LD="$ac_dir/$ac_prog" + # Check to see if the program is GNU ld. I'd rather use --version, + # but apparently some GNU ld's only accept -v. + # Break only if it was the GNU/non-GNU ld that we prefer. + if "$lt_cv_path_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" +else + lt_cv_path_LD="$LD" # Let the user override the test with a path. +fi +fi + +LD="$lt_cv_path_LD" +if test -n "$LD"; then + echo "$as_me:$LINENO: result: $LD" >&5 +echo "${ECHO_T}$LD" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi +test -z "$LD" && { { echo "$as_me:$LINENO: error: no acceptable ld found in \$PATH" >&5 +echo "$as_me: error: no acceptable ld found in \$PATH" >&2;} + { (exit 1); exit 1; }; } +echo "$as_me:$LINENO: checking if the linker ($LD) is GNU ld" >&5 +echo $ECHO_N "checking if the linker ($LD) is GNU ld... $ECHO_C" >&6 +if test "${lt_cv_prog_gnu_ld+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + # I'd rather use --version here, but apparently some GNU ld's only accept -v. +if $LD -v 2>&1 &5; then + lt_cv_prog_gnu_ld=yes +else + lt_cv_prog_gnu_ld=no +fi +fi +echo "$as_me:$LINENO: result: $lt_cv_prog_gnu_ld" >&5 +echo "${ECHO_T}$lt_cv_prog_gnu_ld" >&6 +with_gnu_ld=$lt_cv_prog_gnu_ld + + +echo "$as_me:$LINENO: checking for $LD option to reload object files" >&5 +echo $ECHO_N "checking for $LD option to reload object files... $ECHO_C" >&6 +if test "${lt_cv_ld_reload_flag+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + lt_cv_ld_reload_flag='-r' +fi +echo "$as_me:$LINENO: result: $lt_cv_ld_reload_flag" >&5 +echo "${ECHO_T}$lt_cv_ld_reload_flag" >&6 +reload_flag=$lt_cv_ld_reload_flag +test -n "$reload_flag" && reload_flag=" $reload_flag" + +echo "$as_me:$LINENO: checking for BSD-compatible nm" >&5 +echo $ECHO_N "checking for BSD-compatible nm... $ECHO_C" >&6 +if test "${lt_cv_path_NM+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$NM"; then + # Let the user override the test. + lt_cv_path_NM="$NM" +else + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=$PATH_SEPARATOR + for ac_dir in $PATH /usr/ccs/bin /usr/ucb /bin; do + test -z "$ac_dir" && ac_dir=. + tmp_nm=$ac_dir/${ac_tool_prefix}nm + if test -f $tmp_nm || test -f $tmp_nm$ac_exeext ; then + # Check to see if the nm accepts a BSD-compat flag. + # Adding the `sed 1q' prevents false positives on HP-UX, which says: + # nm: unknown option "B" ignored + # Tru64's nm complains that /dev/null is an invalid object file + if ($tmp_nm -B /dev/null 2>&1 | sed '1q'; exit 0) | egrep '(/dev/null|Invalid file or object type)' >/dev/null; then + lt_cv_path_NM="$tmp_nm -B" + break + elif ($tmp_nm -p /dev/null 2>&1 | sed '1q'; exit 0) | egrep /dev/null >/dev/null; then + lt_cv_path_NM="$tmp_nm -p" + break + else + lt_cv_path_NM=${lt_cv_path_NM="$tmp_nm"} # keep the first match, but + continue # so that we can try to find one that supports BSD flags + fi + fi + done + IFS="$ac_save_ifs" + test -z "$lt_cv_path_NM" && lt_cv_path_NM=nm +fi +fi + +NM="$lt_cv_path_NM" +echo "$as_me:$LINENO: result: $NM" >&5 +echo "${ECHO_T}$NM" >&6 + +echo "$as_me:$LINENO: checking for a sed that does not truncate output" >&5 +echo $ECHO_N "checking for a sed that does not truncate output... $ECHO_C" >&6 +if test "${lt_cv_path_SED+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + # Loop through the user's path and test for sed and gsed. +# Then use that list of sed's as ones to test for truncation. +as_executable_p="test -f" +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_prog in sed gsed; do + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_prog$ac_exec_ext"; then + _sed_list="$_sed_list $as_dir/$ac_prog$ac_exec_ext" + fi + done + done +done + + # Create a temporary directory, and hook for its removal unless debugging. +$debug || +{ + trap 'exit_status=$?; rm -rf $tmp && exit $exit_status' 0 + trap '{ (exit 1); exit 1; }' 1 2 13 15 +} + +# Create a (secure) tmp directory for tmp files. +: ${TMPDIR=/tmp} +{ + tmp=`(umask 077 && mktemp -d -q "$TMPDIR/sedXXXXXX") 2>/dev/null` && + test -n "$tmp" && test -d "$tmp" +} || +{ + tmp=$TMPDIR/sed$$-$RANDOM + (umask 077 && mkdir $tmp) +} || +{ + echo "$me: cannot create a temporary directory in $TMPDIR" >&2 + { (exit 1); exit 1; } +} + _max=0 + _count=0 + # Add /usr/xpg4/bin/sed as it is typically found on Solaris + # along with /bin/sed that truncates output. + for _sed in $_sed_list /usr/xpg4/bin/sed; do + test ! -f ${_sed} && break + cat /dev/null > "$tmp/sed.in" + _count=0 + echo ${ECHO_N-$ac_n} "0123456789${ECHO_C-$ac_c}" >"$tmp/sed.in" + # Check for GNU sed and select it if it is found. + if "${_sed}" --version 2>&1 < /dev/null | egrep '(GNU)' > /dev/null; then + lt_cv_path_SED=${_sed} + break + fi + while true; do + cat "$tmp/sed.in" "$tmp/sed.in" >"$tmp/sed.tmp" + mv "$tmp/sed.tmp" "$tmp/sed.in" + cp "$tmp/sed.in" "$tmp/sed.nl" + echo >>"$tmp/sed.nl" + ${_sed} -e 's/a$//' < "$tmp/sed.nl" >"$tmp/sed.out" || break + cmp -s "$tmp/sed.out" "$tmp/sed.nl" || break + # 40000 chars as input seems more than enough + test $_count -gt 10 && break + _count=`expr $_count + 1` + if test $_count -gt $_max; then + _max=$_count + lt_cv_path_SED=$_sed + fi + done + done + rm -rf "$tmp" + +fi + +if test "X$SED" != "X"; then + lt_cv_path_SED=$SED +else + SED=$lt_cv_path_SED +fi +echo "$as_me:$LINENO: result: $SED" >&5 +echo "${ECHO_T}$SED" >&6 + +echo "$as_me:$LINENO: checking how to recognise dependent libraries" >&5 +echo $ECHO_N "checking how to recognise dependent libraries... $ECHO_C" >&6 +if test "${lt_cv_deplibs_check_method+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + lt_cv_file_magic_cmd='$MAGIC_CMD' +lt_cv_file_magic_test_file= +lt_cv_deplibs_check_method='unknown' +# Need to set the preceding variable on all platforms that support +# interlibrary dependencies. +# 'none' -- dependencies not supported. +# `unknown' -- same as none, but documents that we really don't know. +# 'pass_all' -- all dependencies passed with no checks. +# 'test_compile' -- check by making test program. +# 'file_magic [[regex]]' -- check by looking for files in library path +# which responds to the $file_magic_cmd with a given 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. + +case $host_os in +aix4* | aix5*) + lt_cv_deplibs_check_method=pass_all + ;; + +beos*) + lt_cv_deplibs_check_method=pass_all + ;; + +bsdi4*) + lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (shared object|dynamic lib)' + lt_cv_file_magic_cmd='/usr/bin/file -L' + lt_cv_file_magic_test_file=/shlib/libc.so + ;; + +cygwin* | mingw* | pw32*) + lt_cv_deplibs_check_method='file_magic file format pei*-i386(.*architecture: i386)?' + lt_cv_file_magic_cmd='$OBJDUMP -f' + ;; + +darwin* | rhapsody*) + lt_cv_deplibs_check_method='file_magic Mach-O dynamically linked shared library' + lt_cv_file_magic_cmd='/usr/bin/file -L' + case "$host_os" in + rhapsody* | darwin1.[012]) + lt_cv_file_magic_test_file=`echo /System/Library/Frameworks/System.framework/Versions/*/System | head -1` + ;; + *) # Darwin 1.3 on + lt_cv_file_magic_test_file='/usr/lib/libSystem.dylib' + ;; + esac + ;; + +freebsd*) + if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then + case $host_cpu in + i*86 ) + # Not sure whether the presence of OpenBSD here was a mistake. + # Let's accept both of them until this is cleared up. + lt_cv_deplibs_check_method='file_magic (FreeBSD|OpenBSD)/i[3-9]86 (compact )?demand paged shared library' + lt_cv_file_magic_cmd=/usr/bin/file + lt_cv_file_magic_test_file=`echo /usr/lib/libc.so.*` + ;; + esac + else + lt_cv_deplibs_check_method=pass_all + fi + ;; + +gnu*) + lt_cv_deplibs_check_method=pass_all + ;; + +hpux10.20*|hpux11*) + lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|PA-RISC[0-9].[0-9]) shared library' + lt_cv_file_magic_cmd=/usr/bin/file + lt_cv_file_magic_test_file=/usr/lib/libc.sl + ;; + +irix5* | irix6* | nonstopux*) + case $host_os in + irix5* | nonstopux*) + # this will be overridden with pass_all, but let us keep it just in case + lt_cv_deplibs_check_method="file_magic ELF 32-bit MSB dynamic lib MIPS - version 1" + ;; + *) + case $LD in + *-32|*"-32 ") libmagic=32-bit;; + *-n32|*"-n32 ") libmagic=N32;; + *-64|*"-64 ") libmagic=64-bit;; + *) libmagic=never-match;; + esac + # this will be overridden with pass_all, but let us keep it just in case + lt_cv_deplibs_check_method="file_magic ELF ${libmagic} MSB mips-[1234] dynamic lib MIPS - version 1" + ;; + esac + lt_cv_file_magic_test_file=`echo /lib${libsuff}/libc.so*` + lt_cv_deplibs_check_method=pass_all + ;; + +# This must be Linux ELF. +linux-gnu*) + case $host_cpu in + alpha* | hppa* | i*86 | mips | mipsel | powerpc* | sparc* | ia64* | x86_64*) + lt_cv_deplibs_check_method=pass_all ;; + *) + # glibc up to 2.1.1 does not perform some relocations on ARM + lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [LM]SB (shared object|dynamic lib )' ;; + esac + lt_cv_file_magic_test_file=`echo /lib/libc.so* /lib/libc-*.so` + ;; + +netbsd*) + if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then + lt_cv_deplibs_check_method='match_pattern /lib[^/\.]+\.so\.[0-9]+\.[0-9]+$' + else + lt_cv_deplibs_check_method='match_pattern /lib[^/\.]+\.so$' + fi + ;; + +newos6*) + lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (executable|dynamic lib)' + lt_cv_file_magic_cmd=/usr/bin/file + lt_cv_file_magic_test_file=/usr/lib/libnls.so + ;; + +openbsd*) + lt_cv_file_magic_cmd=/usr/bin/file + lt_cv_file_magic_test_file=`echo /usr/lib/libc.so.*` + if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then + lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [LM]SB shared object' + else + lt_cv_deplibs_check_method='file_magic OpenBSD.* shared library' + fi + ;; + +osf3* | osf4* | osf5*) + # this will be overridden with pass_all, but let us keep it just in case + lt_cv_deplibs_check_method='file_magic COFF format alpha shared library' + lt_cv_file_magic_test_file=/shlib/libc.so + lt_cv_deplibs_check_method=pass_all + ;; + +sco3.2v5*) + lt_cv_deplibs_check_method=pass_all + ;; + +solaris*) + lt_cv_deplibs_check_method=pass_all + lt_cv_file_magic_test_file=/lib/libc.so + ;; + +sysv5uw[78]* | sysv4*uw2*) + lt_cv_deplibs_check_method=pass_all + ;; + +sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) + case $host_vendor in + motorola) + lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (shared object|dynamic lib) M[0-9][0-9]* Version [0-9]' + lt_cv_file_magic_test_file=`echo /usr/lib/libc.so*` + ;; + ncr) + lt_cv_deplibs_check_method=pass_all + ;; + sequent) + lt_cv_file_magic_cmd='/bin/file' + lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [LM]SB (shared object|dynamic lib )' + ;; + sni) + lt_cv_file_magic_cmd='/bin/file' + lt_cv_deplibs_check_method="file_magic ELF [0-9][0-9]*-bit [LM]SB dynamic lib" + lt_cv_file_magic_test_file=/lib/libc.so + ;; + siemens) + lt_cv_deplibs_check_method=pass_all + ;; + esac + ;; +esac + +fi +echo "$as_me:$LINENO: result: $lt_cv_deplibs_check_method" >&5 +echo "${ECHO_T}$lt_cv_deplibs_check_method" >&6 +file_magic_cmd=$lt_cv_file_magic_cmd +deplibs_check_method=$lt_cv_deplibs_check_method + + + + + + + + +# Check for command to grab the raw symbol name followed by C symbol from nm. +echo "$as_me:$LINENO: checking command to parse $NM output" >&5 +echo $ECHO_N "checking command to parse $NM output... $ECHO_C" >&6 +if test "${lt_cv_sys_global_symbol_pipe+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + +# These are sane defaults that work on at least a few old systems. +# [They come from Ultrix. What could be older than Ultrix?!! ;)] + +# Character class describing NM global symbol codes. +symcode='[BCDEGRST]' + +# Regexp to match symbols that can be accessed directly from C. +sympat='\([_A-Za-z][_A-Za-z0-9]*\)' + +# Transform the above into a raw symbol and a C symbol. +symxfrm='\1 \2\3 \3' + +# Transform an extracted symbol line into a proper C declaration +lt_cv_global_symbol_to_cdecl="sed -n -e 's/^. .* \(.*\)$/extern char \1;/p'" + +# Transform an extracted symbol line into symbol name and symbol address +lt_cv_global_symbol_to_c_name_address="sed -n -e 's/^: \([^ ]*\) $/ {\\\"\1\\\", (lt_ptr) 0},/p' -e 's/^$symcode \([^ ]*\) \([^ ]*\)$/ {\"\2\", (lt_ptr) \&\2},/p'" + +# Define system-specific variables. +case $host_os in +aix*) + symcode='[BCDT]' + ;; +cygwin* | mingw* | pw32*) + symcode='[ABCDGISTW]' + ;; +hpux*) # Its linker distinguishes data from code symbols + lt_cv_global_symbol_to_cdecl="sed -n -e 's/^T .* \(.*\)$/extern char \1();/p' -e 's/^$symcode* .* \(.*\)$/extern char \1;/p'" + lt_cv_global_symbol_to_c_name_address="sed -n -e 's/^: \([^ ]*\) $/ {\\\"\1\\\", (lt_ptr) 0},/p' -e 's/^$symcode* \([^ ]*\) \([^ ]*\)$/ {\"\2\", (lt_ptr) \&\2},/p'" + ;; +irix* | nonstopux*) + symcode='[BCDEGRST]' + ;; +osf*) + symcode='[BCDEGQRST]' + ;; +solaris* | sysv5*) + symcode='[BDT]' + ;; +sysv4) + symcode='[DFNSTU]' + ;; +esac + +# Handle CRLF in mingw tool chain +opt_cr= +case $host_os in +mingw*) + opt_cr=`echo 'x\{0,1\}' | tr x '\015'` # option cr in regexp + ;; +esac + +# If we're using GNU nm, then use its standard symbol codes. +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. +lt_cv_sys_global_symbol_pipe="sed -n -e 's/^.*[ ]\($symcode$symcode*\)[ ][ ]*\($ac_symprfx\)$sympat$opt_cr$/$symxfrm/p'" + + # Check to see that the pipe works correctly. + pipe_works=no + rm -f conftest* + cat > conftest.$ac_ext <&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; then + # Now try to grab the symbols. + nlist=conftest.nm + if { (eval echo "$as_me:$LINENO: \"$NM conftest.$ac_objext \| $lt_cv_sys_global_symbol_pipe \> $nlist\"") >&5 + (eval $NM conftest.$ac_objext \| $lt_cv_sys_global_symbol_pipe \> $nlist) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && 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.$ac_ext +#ifdef __cplusplus +extern "C" { +#endif + +EOF + # Now generate the symbol file. + eval "$lt_cv_global_symbol_to_cdecl"' < "$nlist" >> conftest.$ac_ext' + + cat <> conftest.$ac_ext +#if defined (__STDC__) && __STDC__ +# define lt_ptr void * +#else +# define lt_ptr char * +# define const +#endif + +/* The mapping between symbol names and symbols. */ +const struct { + const char *name; + lt_ptr address; +} +lt_preloaded_symbols[] = +{ +EOF + sed "s/^$symcode$symcode* \(.*\) \(.*\)$/ {\"\2\", (lt_ptr) \&\2},/" < "$nlist" >> conftest.$ac_ext + cat <<\EOF >> conftest.$ac_ext + {0, (lt_ptr) 0} +}; + +#ifdef __cplusplus +} +#endif +EOF + # Now try linking the two files. + mv conftest.$ac_objext conftstm.$ac_objext + save_LIBS="$LIBS" + save_CFLAGS="$CFLAGS" + LIBS="conftstm.$ac_objext" + CFLAGS="$CFLAGS$no_builtin_flag" + if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && test -s conftest$ac_exeext; then + pipe_works=yes + fi + LIBS="$save_LIBS" + CFLAGS="$save_CFLAGS" + else + echo "cannot find nm_test_func in $nlist" >&5 + fi + else + echo "cannot find nm_test_var in $nlist" >&5 + fi + else + echo "cannot run $lt_cv_sys_global_symbol_pipe" >&5 + fi + else + echo "$progname: failed program was:" >&5 + cat conftest.$ac_ext >&5 + fi + rm -f conftest* conftst* + + # Do not use the global_symbol_pipe unless it works. + if test "$pipe_works" = yes; then + break + else + lt_cv_sys_global_symbol_pipe= + fi +done + +fi + +global_symbol_pipe="$lt_cv_sys_global_symbol_pipe" +if test -z "$lt_cv_sys_global_symbol_pipe"; then + global_symbol_to_cdecl= + global_symbol_to_c_name_address= +else + global_symbol_to_cdecl="$lt_cv_global_symbol_to_cdecl" + global_symbol_to_c_name_address="$lt_cv_global_symbol_to_c_name_address" +fi +if test -z "$global_symbol_pipe$global_symbol_to_cdec$global_symbol_to_c_name_address"; +then + echo "$as_me:$LINENO: result: failed" >&5 +echo "${ECHO_T}failed" >&6 +else + echo "$as_me:$LINENO: result: ok" >&5 +echo "${ECHO_T}ok" >&6 +fi + + +echo "$as_me:$LINENO: checking for egrep" >&5 +echo $ECHO_N "checking for egrep... $ECHO_C" >&6 +if test "${ac_cv_prog_egrep+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if echo a | (grep -E '(a|b)') >/dev/null 2>&1 + then ac_cv_prog_egrep='grep -E' + else ac_cv_prog_egrep='egrep' + fi +fi +echo "$as_me:$LINENO: result: $ac_cv_prog_egrep" >&5 +echo "${ECHO_T}$ac_cv_prog_egrep" >&6 + EGREP=$ac_cv_prog_egrep + + +echo "$as_me:$LINENO: checking for ANSI C header files" >&5 +echo $ECHO_N "checking for ANSI C header files... $ECHO_C" >&6 +if test "${ac_cv_header_stdc+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +#include +#include +#include + +int +main () +{ + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_header_stdc=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_header_stdc=no +fi +rm -f conftest.$ac_objext conftest.$ac_ext + +if test $ac_cv_header_stdc = yes; then + # SunOS 4.x string.h does not declare mem*, contrary to ANSI. + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "memchr" >/dev/null 2>&1; then + : +else + ac_cv_header_stdc=no +fi +rm -f conftest* + +fi + +if test $ac_cv_header_stdc = yes; then + # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "free" >/dev/null 2>&1; then + : +else + ac_cv_header_stdc=no +fi +rm -f conftest* + +fi + +if test $ac_cv_header_stdc = yes; then + # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi. + if test "$cross_compiling" = yes; then + : +else + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +#if ((' ' & 0x0FF) == 0x020) +# define ISLOWER(c) ('a' <= (c) && (c) <= 'z') +# define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c)) +#else +# define ISLOWER(c) \ + (('a' <= (c) && (c) <= 'i') \ + || ('j' <= (c) && (c) <= 'r') \ + || ('s' <= (c) && (c) <= 'z')) +# define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c)) +#endif + +#define XOR(e, f) (((e) && !(f)) || (!(e) && (f))) +int +main () +{ + int i; + for (i = 0; i < 256; i++) + if (XOR (islower (i), ISLOWER (i)) + || toupper (i) != TOUPPER (i)) + exit(2); + exit (0); +} +_ACEOF +rm -f conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { ac_try='./conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + : +else + echo "$as_me: program exited with status $ac_status" >&5 +echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +( exit $ac_status ) +ac_cv_header_stdc=no +fi +rm -f core core.* *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +fi +fi +fi +echo "$as_me:$LINENO: result: $ac_cv_header_stdc" >&5 +echo "${ECHO_T}$ac_cv_header_stdc" >&6 +if test $ac_cv_header_stdc = yes; then + +cat >>confdefs.h <<\_ACEOF +#define STDC_HEADERS 1 +_ACEOF + +fi + +# On IRIX 5.3, sys/types and inttypes.h are conflicting. + + + + + + + + + +for ac_header in sys/types.h sys/stat.h stdlib.h string.h memory.h strings.h \ + inttypes.h stdint.h unistd.h +do +as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` +echo "$as_me:$LINENO: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default + +#include <$ac_header> +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + eval "$as_ac_Header=yes" +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +eval "$as_ac_Header=no" +fi +rm -f conftest.$ac_objext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 +if test `eval echo '${'$as_ac_Header'}'` = yes; then + cat >>confdefs.h <<_ACEOF +#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 +_ACEOF + +fi + +done + + + +for ac_header in dlfcn.h +do +as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo "$as_me:$LINENO: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 +else + # Is the header compilable? +echo "$as_me:$LINENO: checking $ac_header usability" >&5 +echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +#include <$ac_header> +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_header_compiler=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_header_compiler=no +fi +rm -f conftest.$ac_objext conftest.$ac_ext +echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 +echo "${ECHO_T}$ac_header_compiler" >&6 + +# Is the header present? +echo "$as_me:$LINENO: checking $ac_header presence" >&5 +echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include <$ac_header> +_ACEOF +if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + ac_header_preproc=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_header_preproc=no +fi +rm -f conftest.err conftest.$ac_ext +echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 +echo "${ECHO_T}$ac_header_preproc" >&6 + +# So? What about this header? +case $ac_header_compiler:$ac_header_preproc in + yes:no ) + { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 +echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 +echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} + ( + cat <<\_ASBOX +## ------------------------------------ ## +## Report this to bug-autoconf@gnu.org. ## +## ------------------------------------ ## +_ASBOX + ) | + sed "s/^/$as_me: WARNING: /" >&2 + ;; + no:yes ) + { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 +echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 +echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 +echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} + ( + cat <<\_ASBOX +## ------------------------------------ ## +## Report this to bug-autoconf@gnu.org. ## +## ------------------------------------ ## +_ASBOX + ) | + sed "s/^/$as_me: WARNING: /" >&2 + ;; +esac +echo "$as_me:$LINENO: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + eval "$as_ac_Header=$ac_header_preproc" +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 + +fi +if test `eval echo '${'$as_ac_Header'}'` = yes; then + cat >>confdefs.h <<_ACEOF +#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 +_ACEOF + +fi + +done + + + + + + +# Only perform the check for file, if the check method requires it +case $deplibs_check_method in +file_magic*) + if test "$file_magic_cmd" = '$MAGIC_CMD'; then + echo "$as_me:$LINENO: checking for ${ac_tool_prefix}file" >&5 +echo $ECHO_N "checking for ${ac_tool_prefix}file... $ECHO_C" >&6 +if test "${lt_cv_path_MAGIC_CMD+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + case $MAGIC_CMD in + /*) + lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a path. + ;; + ?:/*) + lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a dos path. + ;; + *) + ac_save_MAGIC_CMD="$MAGIC_CMD" + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" + ac_dummy="/usr/bin:$PATH" + for ac_dir in $ac_dummy; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/${ac_tool_prefix}file; then + lt_cv_path_MAGIC_CMD="$ac_dir/${ac_tool_prefix}file" + if test -n "$file_magic_test_file"; then + case $deplibs_check_method in + "file_magic "*) + file_magic_regex="`expr \"$deplibs_check_method\" : \"file_magic \(.*\)\"`" + MAGIC_CMD="$lt_cv_path_MAGIC_CMD" + if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null | + egrep "$file_magic_regex" > /dev/null; then + : + else + cat <&2 + +*** Warning: the command libtool uses to detect shared libraries, +*** $file_magic_cmd, produces output that libtool cannot recognize. +*** The result is that libtool may fail to recognize shared libraries +*** as such. This will affect the creation of libtool libraries that +*** depend on shared libraries, but programs linked with such libtool +*** libraries will work regardless of this problem. Nevertheless, you +*** may want to report the problem to your system manager and/or to +*** bug-libtool@gnu.org + +EOF + fi ;; + esac + fi + break + fi + done + IFS="$ac_save_ifs" + MAGIC_CMD="$ac_save_MAGIC_CMD" + ;; +esac +fi + +MAGIC_CMD="$lt_cv_path_MAGIC_CMD" +if test -n "$MAGIC_CMD"; then + echo "$as_me:$LINENO: result: $MAGIC_CMD" >&5 +echo "${ECHO_T}$MAGIC_CMD" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + +if test -z "$lt_cv_path_MAGIC_CMD"; then + if test -n "$ac_tool_prefix"; then + echo "$as_me:$LINENO: checking for file" >&5 +echo $ECHO_N "checking for file... $ECHO_C" >&6 +if test "${lt_cv_path_MAGIC_CMD+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + case $MAGIC_CMD in + /*) + lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a path. + ;; + ?:/*) + lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a dos path. + ;; + *) + ac_save_MAGIC_CMD="$MAGIC_CMD" + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" + ac_dummy="/usr/bin:$PATH" + for ac_dir in $ac_dummy; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/file; then + lt_cv_path_MAGIC_CMD="$ac_dir/file" + if test -n "$file_magic_test_file"; then + case $deplibs_check_method in + "file_magic "*) + file_magic_regex="`expr \"$deplibs_check_method\" : \"file_magic \(.*\)\"`" + MAGIC_CMD="$lt_cv_path_MAGIC_CMD" + if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null | + egrep "$file_magic_regex" > /dev/null; then + : + else + cat <&2 + +*** Warning: the command libtool uses to detect shared libraries, +*** $file_magic_cmd, produces output that libtool cannot recognize. +*** The result is that libtool may fail to recognize shared libraries +*** as such. This will affect the creation of libtool libraries that +*** depend on shared libraries, but programs linked with such libtool +*** libraries will work regardless of this problem. Nevertheless, you +*** may want to report the problem to your system manager and/or to +*** bug-libtool@gnu.org + +EOF + fi ;; + esac + fi + break + fi + done + IFS="$ac_save_ifs" + MAGIC_CMD="$ac_save_MAGIC_CMD" + ;; +esac +fi + +MAGIC_CMD="$lt_cv_path_MAGIC_CMD" +if test -n "$MAGIC_CMD"; then + echo "$as_me:$LINENO: result: $MAGIC_CMD" >&5 +echo "${ECHO_T}$MAGIC_CMD" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + else + MAGIC_CMD=: + fi +fi + + fi + ;; +esac + +if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}ranlib", so it can be a program name with args. +set dummy ${ac_tool_prefix}ranlib; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_RANLIB+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$RANLIB"; then + ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_RANLIB="${ac_tool_prefix}ranlib" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + +fi +fi +RANLIB=$ac_cv_prog_RANLIB +if test -n "$RANLIB"; then + echo "$as_me:$LINENO: result: $RANLIB" >&5 +echo "${ECHO_T}$RANLIB" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + +fi +if test -z "$ac_cv_prog_RANLIB"; then + ac_ct_RANLIB=$RANLIB + # Extract the first word of "ranlib", so it can be a program name with args. +set dummy ranlib; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_ac_ct_RANLIB+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$ac_ct_RANLIB"; then + ac_cv_prog_ac_ct_RANLIB="$ac_ct_RANLIB" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_RANLIB="ranlib" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + + test -z "$ac_cv_prog_ac_ct_RANLIB" && ac_cv_prog_ac_ct_RANLIB=":" +fi +fi +ac_ct_RANLIB=$ac_cv_prog_ac_ct_RANLIB +if test -n "$ac_ct_RANLIB"; then + echo "$as_me:$LINENO: result: $ac_ct_RANLIB" >&5 +echo "${ECHO_T}$ac_ct_RANLIB" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + RANLIB=$ac_ct_RANLIB +else + RANLIB="$ac_cv_prog_RANLIB" +fi + +if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args. +set dummy ${ac_tool_prefix}strip; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_STRIP+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$STRIP"; then + ac_cv_prog_STRIP="$STRIP" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_STRIP="${ac_tool_prefix}strip" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + +fi +fi +STRIP=$ac_cv_prog_STRIP +if test -n "$STRIP"; then + echo "$as_me:$LINENO: result: $STRIP" >&5 +echo "${ECHO_T}$STRIP" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + +fi +if test -z "$ac_cv_prog_STRIP"; then + ac_ct_STRIP=$STRIP + # Extract the first word of "strip", so it can be a program name with args. +set dummy strip; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_ac_ct_STRIP+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$ac_ct_STRIP"; then + ac_cv_prog_ac_ct_STRIP="$ac_ct_STRIP" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_STRIP="strip" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + + test -z "$ac_cv_prog_ac_ct_STRIP" && ac_cv_prog_ac_ct_STRIP=":" +fi +fi +ac_ct_STRIP=$ac_cv_prog_ac_ct_STRIP +if test -n "$ac_ct_STRIP"; then + echo "$as_me:$LINENO: result: $ac_ct_STRIP" >&5 +echo "${ECHO_T}$ac_ct_STRIP" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + STRIP=$ac_ct_STRIP +else + STRIP="$ac_cv_prog_STRIP" +fi + + +enable_dlopen=no +enable_win32_dll=no + +# Check whether --enable-libtool-lock or --disable-libtool-lock was given. +if test "${enable_libtool_lock+set}" = set; then + enableval="$enable_libtool_lock" + +fi; +test "x$enable_libtool_lock" != xno && enable_libtool_lock=yes + +# Some flags need to be propagated to the compiler or linker for good +# libtool support. +case $host in +*-*-irix6*) + # Find out which ABI we are using. + echo '#line 5243 "configure"' > conftest.$ac_ext + if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; then + case `/usr/bin/file conftest.$ac_objext` in + *32-bit*) + LD="${LD-ld} -32" + ;; + *N32*) + LD="${LD-ld} -n32" + ;; + *64-bit*) + LD="${LD-ld} -64" + ;; + esac + fi + rm -rf conftest* + ;; + +*-*-linux*) + # Test if the compiler is 64bit + echo 'int i;' > conftest.$ac_ext + lt_cv_cc_64bit_output=no + if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; then + case `/usr/bin/file conftest.$ac_objext` in + *"ELF 64"*) + lt_cv_cc_64bit_output=yes + ;; + esac + fi + rm -rf conftest* + ;; + +*-*-sco3.2v5*) + # On SCO OpenServer 5, we need -belf to get full-featured binaries. + SAVE_CFLAGS="$CFLAGS" + CFLAGS="$CFLAGS -belf" + echo "$as_me:$LINENO: checking whether the C compiler needs -belf" >&5 +echo $ECHO_N "checking whether the C compiler needs -belf... $ECHO_C" >&6 +if test "${lt_cv_cc_needs_belf+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + + + ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + lt_cv_cc_needs_belf=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +lt_cv_cc_needs_belf=no +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext + ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + +fi +echo "$as_me:$LINENO: result: $lt_cv_cc_needs_belf" >&5 +echo "${ECHO_T}$lt_cv_cc_needs_belf" >&6 + if test x"$lt_cv_cc_needs_belf" != x"yes"; then + # this is probably gcc 2.8.0, egcs 1.0 or newer; no need for -belf + CFLAGS="$SAVE_CFLAGS" + fi + ;; + + +esac + +# Sed substitution that helps us do robust quoting. It backslashifies +# metacharacters that are still active within double-quoted strings. +Xsed='sed -e s/^X//' +sed_quote_subst='s/\([\\"\\`$\\\\]\)/\\\1/g' + +# Same as above, but do not quote variable references. +double_quote_subst='s/\([\\"\\`\\\\]\)/\\\1/g' + +# Sed substitution to delay expansion of an escaped shell variable in a +# double_quote_subst'ed string. +delay_variable_subst='s/\\\\\\\\\\\$/\\\\\\$/g' + +# Constants: +rm="rm -f" + +# Global variables: +default_ofile=libtool +can_build_shared=yes + +# All known linkers require a `.a' archive for static linking (except M$VC, +# which needs '.lib'). +libext=a +ltmain="$ac_aux_dir/ltmain.sh" +ofile="$default_ofile" +with_gnu_ld="$lt_cv_prog_gnu_ld" +need_locks="$enable_libtool_lock" + +old_CC="$CC" +old_CFLAGS="$CFLAGS" + +# Set sane defaults for various variables +test -z "$AR" && AR=ar +test -z "$AR_FLAGS" && AR_FLAGS=cru +test -z "$AS" && AS=as +test -z "$CC" && CC=cc +test -z "$DLLTOOL" && DLLTOOL=dlltool +test -z "$LD" && LD=ld +test -z "$LN_S" && LN_S="ln -s" +test -z "$MAGIC_CMD" && MAGIC_CMD=file +test -z "$NM" && NM=nm +test -z "$OBJDUMP" && OBJDUMP=objdump +test -z "$RANLIB" && RANLIB=: +test -z "$STRIP" && STRIP=: +test -z "$ac_objext" && ac_objext=o + +if test x"$host" != x"$build"; then + ac_tool_prefix=${host_alias}- +else + ac_tool_prefix= +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 + +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 $AR_FLAGS $oldlib$oldobjs$old_deplibs' +old_postinstall_cmds='chmod 644 $oldlib' +old_postuninstall_cmds= + +if test -n "$RANLIB"; then + case $host_os in + openbsd*) + old_postinstall_cmds="\$RANLIB -t \$oldlib~$old_postinstall_cmds" + ;; + *) + old_postinstall_cmds="\$RANLIB \$oldlib~$old_postinstall_cmds" + ;; + esac + old_archive_cmds="$old_archive_cmds~\$RANLIB \$oldlib" +fi + +# Allow CC to be a program name with arguments. +set dummy $CC +compiler="$2" + +echo "$as_me:$LINENO: checking for objdir" >&5 +echo $ECHO_N "checking for objdir... $ECHO_C" >&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 "$as_me:$LINENO: result: $objdir" >&5 +echo "${ECHO_T}$objdir" >&6 + + + +# Check whether --with-pic or --without-pic was given. +if test "${with_pic+set}" = set; then + withval="$with_pic" + pic_mode="$withval" +else + pic_mode=default +fi; +test -z "$pic_mode" && pic_mode=default + +# We assume here that the value for lt_cv_prog_cc_pic will not be cached +# in isolation, and that seeing it set (from the cache) indicates that +# the associated values are set (in the cache) correctly too. +echo "$as_me:$LINENO: checking for $compiler option to produce PIC" >&5 +echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6 +if test "${lt_cv_prog_cc_pic+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + lt_cv_prog_cc_pic= + lt_cv_prog_cc_shlib= + lt_cv_prog_cc_wl= + lt_cv_prog_cc_static= + lt_cv_prog_cc_no_builtin= + lt_cv_prog_cc_can_build_shared=$can_build_shared + + if test "$GCC" = yes; then + lt_cv_prog_cc_wl='-Wl,' + lt_cv_prog_cc_static='-static' + + case $host_os in + 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 + # not sure about C++ programs. + lt_cv_prog_cc_static="$lt_cv_prog_cc_static ${lt_cv_prog_cc_wl}-lC" + ;; + amigaos*) + # FIXME: we need at least 68020 code to build shared libraries, but + # adding the `-m68020' flag to GCC prevents building anything better, + # like `-m68040'. + lt_cv_prog_cc_pic='-m68020 -resident32 -malways-restore-a4' + ;; + beos* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*) + # PIC is the default for these OSes. + ;; + darwin* | rhapsody*) + # PIC is the default on this platform + # Common symbols not allowed in MH_DYLIB files + lt_cv_prog_cc_pic='-fno-common' + ;; + cygwin* | mingw* | pw32* | os2*) + # This hack is so that the source file can tell whether it is being + # built for inclusion in a dll (and should export symbols for example). + lt_cv_prog_cc_pic='-DDLL_EXPORT' + ;; + sysv4*MP*) + if test -d /usr/nec; then + lt_cv_prog_cc_pic=-Kconform_pic + fi + ;; + *) + lt_cv_prog_cc_pic='-fPIC' + ;; + esac + else + # PORTME Check for PIC flags for the system compiler. + case $host_os in + aix3* | aix4* | aix5*) + lt_cv_prog_cc_wl='-Wl,' + # All AIX code is PIC. + if test "$host_cpu" = ia64; then + # AIX 5 now supports IA64 processor + lt_cv_prog_cc_static='-Bstatic' + else + lt_cv_prog_cc_static='-bnso -bI:/lib/syscalls.exp' + fi + ;; + + hpux9* | hpux10* | hpux11*) + # Is there a better lt_cv_prog_cc_static that works with the bundled CC? + lt_cv_prog_cc_wl='-Wl,' + lt_cv_prog_cc_static="${lt_cv_prog_cc_wl}-a ${lt_cv_prog_cc_wl}archive" + lt_cv_prog_cc_pic='+Z' + ;; + + irix5* | irix6* | nonstopux*) + lt_cv_prog_cc_wl='-Wl,' + lt_cv_prog_cc_static='-non_shared' + # PIC (with -KPIC) is the default. + ;; + + cygwin* | mingw* | pw32* | os2*) + # This hack is so that the source file can tell whether it is being + # built for inclusion in a dll (and should export symbols for example). + lt_cv_prog_cc_pic='-DDLL_EXPORT' + ;; + + newsos6) + lt_cv_prog_cc_pic='-KPIC' + lt_cv_prog_cc_static='-Bstatic' + ;; + + osf3* | osf4* | osf5*) + # All OSF/1 code is PIC. + lt_cv_prog_cc_wl='-Wl,' + lt_cv_prog_cc_static='-non_shared' + ;; + + sco3.2v5*) + lt_cv_prog_cc_pic='-Kpic' + lt_cv_prog_cc_static='-dn' + lt_cv_prog_cc_shlib='-belf' + ;; + + solaris*) + lt_cv_prog_cc_pic='-KPIC' + lt_cv_prog_cc_static='-Bstatic' + lt_cv_prog_cc_wl='-Wl,' + ;; + + sunos4*) + lt_cv_prog_cc_pic='-PIC' + lt_cv_prog_cc_static='-Bstatic' + lt_cv_prog_cc_wl='-Qoption ld ' + ;; + + sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) + lt_cv_prog_cc_pic='-KPIC' + lt_cv_prog_cc_static='-Bstatic' + lt_cv_prog_cc_wl='-Wl,' + ;; + + uts4*) + lt_cv_prog_cc_pic='-pic' + lt_cv_prog_cc_static='-Bstatic' + ;; + + sysv4*MP*) + if test -d /usr/nec ;then + lt_cv_prog_cc_pic='-Kconform_pic' + lt_cv_prog_cc_static='-Bstatic' + fi + ;; + + *) + lt_cv_prog_cc_can_build_shared=no + ;; + esac + fi + +fi + +if test -z "$lt_cv_prog_cc_pic"; then + echo "$as_me:$LINENO: result: none" >&5 +echo "${ECHO_T}none" >&6 +else + echo "$as_me:$LINENO: result: $lt_cv_prog_cc_pic" >&5 +echo "${ECHO_T}$lt_cv_prog_cc_pic" >&6 + + # Check to make sure the pic_flag actually works. + echo "$as_me:$LINENO: checking if $compiler PIC flag $lt_cv_prog_cc_pic works" >&5 +echo $ECHO_N "checking if $compiler PIC flag $lt_cv_prog_cc_pic works... $ECHO_C" >&6 + if test "${lt_cv_prog_cc_pic_works+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + save_CFLAGS="$CFLAGS" + CFLAGS="$CFLAGS $lt_cv_prog_cc_pic -DPIC" + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + 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 + lt_cv_prog_cc_pic_works=no + else + lt_cv_prog_cc_pic_works=yes + fi + ;; + *) + lt_cv_prog_cc_pic_works=yes + ;; + esac + +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + lt_cv_prog_cc_pic_works=no + +fi +rm -f conftest.$ac_objext conftest.$ac_ext + CFLAGS="$save_CFLAGS" + +fi + + + if test "X$lt_cv_prog_cc_pic_works" = Xno; then + lt_cv_prog_cc_pic= + lt_cv_prog_cc_can_build_shared=no + else + lt_cv_prog_cc_pic=" $lt_cv_prog_cc_pic" + fi + + echo "$as_me:$LINENO: result: $lt_cv_prog_cc_pic_works" >&5 +echo "${ECHO_T}$lt_cv_prog_cc_pic_works" >&6 +fi + +# Check for any special shared library compilation flags. +if test -n "$lt_cv_prog_cc_shlib"; then + { echo "$as_me:$LINENO: WARNING: \`$CC' requires \`$lt_cv_prog_cc_shlib' to build shared libraries" >&5 +echo "$as_me: WARNING: \`$CC' requires \`$lt_cv_prog_cc_shlib' to build shared libraries" >&2;} + if echo "$old_CC $old_CFLAGS " | egrep -e "[ ]$lt_cv_prog_cc_shlib[ ]" >/dev/null; then : + else + { echo "$as_me:$LINENO: WARNING: add \`$lt_cv_prog_cc_shlib' to the CC or CFLAGS env variable and reconfigure" >&5 +echo "$as_me: WARNING: add \`$lt_cv_prog_cc_shlib' to the CC or CFLAGS env variable and reconfigure" >&2;} + lt_cv_prog_cc_can_build_shared=no + fi +fi + +echo "$as_me:$LINENO: checking if $compiler static flag $lt_cv_prog_cc_static works" >&5 +echo $ECHO_N "checking if $compiler static flag $lt_cv_prog_cc_static works... $ECHO_C" >&6 +if test "${lt_cv_prog_cc_static_works+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + lt_cv_prog_cc_static_works=no + save_LDFLAGS="$LDFLAGS" + LDFLAGS="$LDFLAGS $lt_cv_prog_cc_static" + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + lt_cv_prog_cc_static_works=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext + LDFLAGS="$save_LDFLAGS" + +fi + + +# Belt *and* braces to stop my trousers falling down: +test "X$lt_cv_prog_cc_static_works" = Xno && lt_cv_prog_cc_static= +echo "$as_me:$LINENO: result: $lt_cv_prog_cc_static_works" >&5 +echo "${ECHO_T}$lt_cv_prog_cc_static_works" >&6 + +pic_flag="$lt_cv_prog_cc_pic" +special_shlib_compile_flags="$lt_cv_prog_cc_shlib" +wl="$lt_cv_prog_cc_wl" +link_static_flag="$lt_cv_prog_cc_static" +no_builtin_flag="$lt_cv_prog_cc_no_builtin" +can_build_shared="$lt_cv_prog_cc_can_build_shared" + + +# Check to see if options -o and -c are simultaneously supported by compiler +echo "$as_me:$LINENO: checking if $compiler supports -c -o file.$ac_objext" >&5 +echo $ECHO_N "checking if $compiler supports -c -o file.$ac_objext... $ECHO_C" >&6 +if test "${lt_cv_compiler_c_o+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + +$rm -r conftest 2>/dev/null +mkdir conftest +cd conftest +echo "int some_variable = 0;" > conftest.$ac_ext +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.$ac_objext" +compiler_c_o=no +if { (eval echo configure:5790: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>out/conftest.err; } && test -s out/conftest2.$ac_objext; then + # The compiler can only warn and ignore the option if not recognized + # So say no if there are warnings + if test -s out/conftest.err; then + lt_cv_compiler_c_o=no + else + lt_cv_compiler_c_o=yes + fi +else + # Append any errors to the config.log. + cat out/conftest.err 1>&5 + lt_cv_compiler_c_o=no +fi +CFLAGS="$save_CFLAGS" +chmod u+w . +$rm conftest* out/* +rmdir out +cd .. +rmdir conftest +$rm -r conftest 2>/dev/null + +fi + +compiler_c_o=$lt_cv_compiler_c_o +echo "$as_me:$LINENO: result: $compiler_c_o" >&5 +echo "${ECHO_T}$compiler_c_o" >&6 + +if test x"$compiler_c_o" = x"yes"; then + # Check to see if we can write to a .lo + echo "$as_me:$LINENO: checking if $compiler supports -c -o file.lo" >&5 +echo $ECHO_N "checking if $compiler supports -c -o file.lo... $ECHO_C" >&6 + if test "${lt_cv_compiler_o_lo+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + + lt_cv_compiler_o_lo=no + save_CFLAGS="$CFLAGS" + CFLAGS="$CFLAGS -c -o conftest.lo" + save_objext="$ac_objext" + ac_objext=lo + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +int +main () +{ +int some_variable = 0; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + # 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 + lt_cv_compiler_o_lo=no + else + lt_cv_compiler_o_lo=yes + fi + +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +fi +rm -f conftest.$ac_objext conftest.$ac_ext + ac_objext="$save_objext" + CFLAGS="$save_CFLAGS" + +fi + + compiler_o_lo=$lt_cv_compiler_o_lo + echo "$as_me:$LINENO: result: $compiler_o_lo" >&5 +echo "${ECHO_T}$compiler_o_lo" >&6 +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 "$as_me:$LINENO: checking if we can lock with hard links" >&5 +echo $ECHO_N "checking if we can lock with hard links... $ECHO_C" >&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 "$as_me:$LINENO: result: $hard_links" >&5 +echo "${ECHO_T}$hard_links" >&6 + if test "$hard_links" = no; then + { echo "$as_me:$LINENO: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&5 +echo "$as_me: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&2;} + need_locks=warn + fi +else + need_locks=no +fi + +if test "$GCC" = yes; then + # Check to see if options -fno-rtti -fno-exceptions are supported by compiler + echo "$as_me:$LINENO: checking if $compiler supports -fno-rtti -fno-exceptions" >&5 +echo $ECHO_N "checking if $compiler supports -fno-rtti -fno-exceptions... $ECHO_C" >&6 + echo "int some_variable = 0;" > conftest.$ac_ext + save_CFLAGS="$CFLAGS" + CFLAGS="$CFLAGS -fno-rtti -fno-exceptions -c conftest.$ac_ext" + compiler_rtti_exceptions=no + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +int +main () +{ +int some_variable = 0; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + # 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 + compiler_rtti_exceptions=no + else + compiler_rtti_exceptions=yes + fi + +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +fi +rm -f conftest.$ac_objext conftest.$ac_ext + CFLAGS="$save_CFLAGS" + echo "$as_me:$LINENO: result: $compiler_rtti_exceptions" >&5 +echo "${ECHO_T}$compiler_rtti_exceptions" >&6 + + if test "$compiler_rtti_exceptions" = "yes"; then + no_builtin_flag=' -fno-builtin -fno-rtti -fno-exceptions' + else + no_builtin_flag=' -fno-builtin' + fi +fi + +# See if the linker supports building shared libraries. +echo "$as_me:$LINENO: checking whether the linker ($LD) supports shared libraries" >&5 +echo $ECHO_N "checking whether the linker ($LD) supports shared libraries... $ECHO_C" >&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= +old_archive_from_expsyms_cmds= +export_dynamic_flag_spec= +whole_archive_flag_spec= +thread_safe_flag_spec= +hardcode_into_libs=no +hardcode_libdir_flag_spec= +hardcode_libdir_separator= +hardcode_direct=no +hardcode_minus_L=no +hardcode_shlibpath_var=unsupported +runpath_var= +link_all_deplibs=unknown +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. +extract_expsyms_cmds= + +case $host_os in +cygwin* | mingw* | pw32*) + # FIXME: the MSVC++ port hasn't been tested in a loooong time + # When not using gcc, we currently assume that we are using + # Microsoft Visual C++. + if test "$GCC" != yes; then + with_gnu_ld=no + fi + ;; +openbsd*) + with_gnu_ld=no + ;; +esac + +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* | aix5*) + # On AIX, the GNU linker is very broken + # Note:Check GNU linker on AIX 5-IA64 when/if it becomes available. + 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 $output_objdir/a2ixlibrary.data~$echo "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$echo "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$echo "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$echo "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' + hardcode_libdir_flag_spec='-L$libdir' + hardcode_minus_L=yes + + # 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 $compiler_flags ${wl}-soname $wl$soname -o $lib' + else + ld_shlibs=no + fi + ;; + + cygwin* | mingw* | pw32*) + # 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_expsyms_cmds='test -f $output_objdir/impgen.c || \ + sed -e "/^# \/\* impgen\.c starts here \*\//,/^# \/\* impgen.c ends here \*\// { s/^# //;s/^# *$//; p; }" -e d < $''0 > $output_objdir/impgen.c~ + test -f $output_objdir/impgen.exe || (cd $output_objdir && \ + if test "x$HOST_CC" != "x" ; then $HOST_CC -o impgen impgen.c ; \ + else $CC -o impgen impgen.c ; fi)~ + $output_objdir/impgen $dir/$soroot > $output_objdir/$soname-def' + + old_archive_from_expsyms_cmds='$DLLTOOL --as=$AS --dllname $soname --def $output_objdir/$soname-def --output-lib $output_objdir/$newlib' + + # cygwin and mingw dlls have different entry points and sets of symbols + # to exclude. + # FIXME: what about values for MSVC? + dll_entry=__cygwin_dll_entry@12 + dll_exclude_symbols=DllMain@12,_cygwin_dll_entry@12,_cygwin_noncygwin_dll_entry@12~ + case $host_os in + mingw*) + # mingw values + dll_entry=_DllMainCRTStartup@12 + dll_exclude_symbols=DllMain@12,DllMainCRTStartup@12,DllEntryPoint@12~ + ;; + esac + + # mingw and cygwin differ, and it's simplest to just exclude the union + # of the two symbol sets. + dll_exclude_symbols=DllMain@12,_cygwin_dll_entry@12,_cygwin_noncygwin_dll_entry@12,DllMainCRTStartup@12,DllEntryPoint@12 + + # recent cygwin and mingw systems supply a stub DllMain which the user + # can override, but on older systems we have to supply one (in ltdll.c) + if test "x$lt_cv_need_dllmain" = "xyes"; then + ltdll_obj='$output_objdir/$soname-ltdll.'"$ac_objext " + ltdll_cmds='test -f $output_objdir/$soname-ltdll.c || sed -e "/^# \/\* ltdll\.c starts here \*\//,/^# \/\* ltdll.c ends here \*\// { s/^# //; p; }" -e d < $''0 > $output_objdir/$soname-ltdll.c~ + test -f $output_objdir/$soname-ltdll.$ac_objext || (cd $output_objdir && $CC -c $soname-ltdll.c)~' + else + ltdll_obj= + ltdll_cmds= + fi + + # 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 be newer dlltools. + export_symbols_cmds="$ltdll_cmds"' + $DLLTOOL --export-all --exclude-symbols '$dll_exclude_symbols' --output-def $output_objdir/$soname-def '$ltdll_obj'$libobjs $convenience~ + sed -e "1,/EXPORTS/d" -e "s/ @ [0-9]*//" -e "s/ *;.*$//" < $output_objdir/$soname-def > $export_symbols' + + # If the export-symbols file already is a .def file (1st line + # is EXPORTS), use it as is. + # If DATA tags from a recent dlltool are present, honour them! + archive_expsym_cmds='if test "x`sed 1q $export_symbols`" = xEXPORTS; then + cp $export_symbols $output_objdir/$soname-def; + else + echo EXPORTS > $output_objdir/$soname-def; + _lt_hint=1; + cat $export_symbols | while read symbol; do + set dummy \$symbol; + case \$# in + 2) echo " \$2 @ \$_lt_hint ; " >> $output_objdir/$soname-def;; + 4) echo " \$2 \$3 \$4 ; " >> $output_objdir/$soname-def; _lt_hint=`expr \$_lt_hint - 1`;; + *) echo " \$2 @ \$_lt_hint \$3 ; " >> $output_objdir/$soname-def;; + esac; + _lt_hint=`expr 1 + \$_lt_hint`; + done; + fi~ + '"$ltdll_cmds"' + $CC -Wl,--base-file,$output_objdir/$soname-base '$lt_cv_cc_dll_switch' -Wl,-e,'$dll_entry' -o $output_objdir/$soname '$ltdll_obj'$libobjs $deplibs $compiler_flags~ + $DLLTOOL --as=$AS --dllname $soname --exclude-symbols '$dll_exclude_symbols' --def $output_objdir/$soname-def --base-file $output_objdir/$soname-base --output-exp $output_objdir/$soname-exp~ + $CC -Wl,--base-file,$output_objdir/$soname-base $output_objdir/$soname-exp '$lt_cv_cc_dll_switch' -Wl,-e,'$dll_entry' -o $output_objdir/$soname '$ltdll_obj'$libobjs $deplibs $compiler_flags~ + $DLLTOOL --as=$AS --dllname $soname --exclude-symbols '$dll_exclude_symbols' --def $output_objdir/$soname-def --base-file $output_objdir/$soname-base --output-exp $output_objdir/$soname-exp --output-lib $output_objdir/$libname.dll.a~ + $CC $output_objdir/$soname-exp '$lt_cv_cc_dll_switch' -Wl,-e,'$dll_entry' -o $output_objdir/$soname '$ltdll_obj'$libobjs $deplibs $compiler_flags' + ;; + + netbsd*) + if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then + archive_cmds='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib' + wlarc= + else + archive_cmds='$CC -shared -nodefaultlibs $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + archive_expsym_cmds='$CC -shared -nodefaultlibs $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + 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 $compiler_flags ${wl}-soname $wl$soname -o $lib' + archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + else + ld_shlibs=no + fi + ;; + + sunos4*) + archive_cmds='$LD -assert pure-text -Bshareable -o $lib $libobjs $deplibs $linker_flags' + wlarc= + hardcode_direct=yes + hardcode_shlibpath_var=no + ;; + + *) + if $LD --help 2>&1 | egrep ': supported targets:.* elf' > /dev/null; then + archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + else + ld_shlibs=no + fi + ;; + esac + + 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* | pw32*) + # 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 $output_objdir/$soname $libobjs $deplibs $linker_flags -bE:$export_symbols -T512 -H512 -bM:SRE~$AR $AR_FLAGS $lib $output_objdir/$soname' + # Note: this linker hardcodes the directories in LIBPATH if there + # are no directories specified by -L. + hardcode_minus_L=yes + if test "$GCC" = yes && test -z "$link_static_flag"; then + # Neither direct hardcoding nor static linking is supported with a + # broken collect2. + hardcode_direct=unsupported + fi + ;; + + aix4* | aix5*) + if test "$host_cpu" = ia64; then + # On IA64, the linker does run time linking by default, so we don't + # have to do anything special. + aix_use_runtimelinking=no + exp_sym_flag='-Bexport' + no_entry_flag="" + else + aix_use_runtimelinking=no + + # Test if we are trying to use run time linking or normal + # AIX style linking. If -brtl is somewhere in LDFLAGS, we + # need to do runtime linking. + case $host_os in aix4.[23]|aix4.[23].*|aix5*) + for ld_flag in $LDFLAGS; do + case $ld_flag in + *-brtl*) + aix_use_runtimelinking=yes + break + ;; + esac + done + esac + + exp_sym_flag='-bexport' + no_entry_flag='-bnoentry' + fi + + # When large executables or shared objects are built, AIX ld can + # have problems creating the table of contents. If linking a library + # or program results in "error TOC overflow" add -mminimal-toc to + # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not + # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS. + + hardcode_direct=yes + archive_cmds='' + hardcode_libdir_separator=':' + if test "$GCC" = yes; then + case $host_os in aix4.[012]|aix4.[012].*) + 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 + esac + + shared_flag='-shared' + else + # not using gcc + if test "$host_cpu" = ia64; then + shared_flag='${wl}-G' + else + if test "$aix_use_runtimelinking" = yes; then + shared_flag='${wl}-G' + else + shared_flag='${wl}-bM:SRE' + fi + fi + fi + + # It seems that -bexpall can do strange things, so it is better to + # generate a list of symbols to export. + always_export_symbols=yes + if test "$aix_use_runtimelinking" = yes; then + # Warning - without using the other runtime loading flags (-brtl), + # -berok will link without error, but may produce a broken library. + allow_undefined_flag='-berok' + hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:/usr/lib:/lib' + archive_expsym_cmds="\$CC"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then echo "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$no_entry_flag \${wl}$exp_sym_flag:\$export_symbols $shared_flag" + else + if test "$host_cpu" = ia64; then + hardcode_libdir_flag_spec='${wl}-R $libdir:/usr/lib:/lib' + allow_undefined_flag="-z nodefs" + archive_expsym_cmds="\$CC $shared_flag"' -o $output_objdir/$soname ${wl}-h$soname $libobjs $deplibs $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$no_entry_flag \${wl}$exp_sym_flag:\$export_symbols" + else + hardcode_libdir_flag_spec='${wl}-bnolibpath ${wl}-blibpath:$libdir:/usr/lib:/lib' + # Warning - without using the other run time loading flags, + # -berok will link without error, but may produce a broken library. + allow_undefined_flag='${wl}-berok' + # This is a bit strange, but is similar to how AIX traditionally builds + # it's shared libraries. + archive_expsym_cmds="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags ${allow_undefined_flag} '"\${wl}$no_entry_flag \${wl}$exp_sym_flag:\$export_symbols"' ~$AR -crlo $objdir/$libname$release.a $objdir/$soname' + fi + fi + ;; + + amigaos*) + archive_cmds='$rm $output_objdir/a2ixlibrary.data~$echo "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$echo "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$echo "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$echo "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' + hardcode_libdir_flag_spec='-L$libdir' + hardcode_minus_L=yes + # see comment about different semantics on the GNU ld section + ld_shlibs=no + ;; + + cygwin* | mingw* | pw32*) + # When not using gcc, we currently assume that we are using + # Microsoft Visual C++. + # hardcode_libdir_flag_spec is actually meaningless, as there is + # no search path for DLLs. + 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 $compiler_flags `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$old_deplibs' + fix_srcfile_path='`cygpath -w "$srcfile"`' + ;; + + darwin* | rhapsody*) + case "$host_os" in + rhapsody* | darwin1.[012]) + allow_undefined_flag='-undefined suppress' + ;; + *) # Darwin 1.3 on + allow_undefined_flag='-flat_namespace -undefined suppress' + ;; + esac + # FIXME: Relying on posixy $() will cause problems for + # cross-compilation, but unfortunately the echo tests do not + # yet detect zsh echo's removal of \ escapes. Also zsh mangles + # `"' quotes if we put them in here... so don't! + archive_cmds='$CC -r -keep_private_externs -nostdlib -o ${lib}-master.o $libobjs && $CC $(test .$module = .yes && echo -bundle || echo -dynamiclib) $allow_undefined_flag -o $lib ${lib}-master.o $deplibs$linker_flags $(test .$module != .yes && echo -install_name $rpath/$soname $verstring)' + # We need to add '_' to the symbols in $export_symbols first + #archive_expsym_cmds="$archive_cmds"' && strip -s $export_symbols' + hardcode_direct=yes + hardcode_shlibpath_var=no + whole_archive_flag_spec='-all_load $convenience' + ;; + + 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 $linker_flags /usr/lib/c++rt0.o' + hardcode_libdir_flag_spec='-R$libdir' + hardcode_direct=yes + hardcode_shlibpath_var=no + ;; + + # Unfortunately, older versions of FreeBSD 2 do not have this feature. + freebsd2*) + archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' + hardcode_direct=yes + hardcode_minus_L=yes + hardcode_shlibpath_var=no + ;; + + # FreeBSD 3 and greater uses gcc -shared to do shared libraries. + freebsd*) + archive_cmds='$CC -shared -o $lib $libobjs $deplibs $compiler_flags' + hardcode_libdir_flag_spec='-R$libdir' + hardcode_direct=yes + hardcode_shlibpath_var=no + ;; + + hpux9* | hpux10* | hpux11*) + case $host_os in + hpux9*) archive_cmds='$rm $output_objdir/$soname~$LD -b +b $install_libdir -o $output_objdir/$soname $libobjs $deplibs $linker_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' ;; + *) archive_cmds='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags' ;; + 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* | nonstopux*) + if test "$GCC" = yes; then + archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' + hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' + else + archive_cmds='$LD -shared $libobjs $deplibs $linker_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' + hardcode_libdir_flag_spec='-rpath $libdir' + fi + hardcode_libdir_separator=: + link_all_deplibs=yes + ;; + + netbsd*) + if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then + archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' # a.out + else + archive_cmds='$LD -shared -o $lib $libobjs $deplibs $linker_flags' # ELF + fi + hardcode_libdir_flag_spec='-R$libdir' + hardcode_direct=yes + hardcode_shlibpath_var=no + ;; + + newsos6) + archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_direct=yes + hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' + hardcode_libdir_separator=: + hardcode_shlibpath_var=no + ;; + + openbsd*) + hardcode_direct=yes + hardcode_shlibpath_var=no + if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then + archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' + hardcode_libdir_flag_spec='${wl}-rpath,$libdir' + export_dynamic_flag_spec='${wl}-E' + else + case "$host_os" in + openbsd[01].* | openbsd2.[0-7] | openbsd2.[0-7].*) + archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' + hardcode_libdir_flag_spec='-R$libdir' + ;; + *) + archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' + hardcode_libdir_flag_spec='${wl}-rpath,$libdir' + ;; + esac + fi + ;; + + os2*) + hardcode_libdir_flag_spec='-L$libdir' + hardcode_minus_L=yes + allow_undefined_flag=unsupported + archive_cmds='$echo "LIBRARY $libname INITINSTANCE" > $output_objdir/$libname.def~$echo "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~$echo DATA >> $output_objdir/$libname.def~$echo " SINGLE NONSHARED" >> $output_objdir/$libname.def~$echo EXPORTS >> $output_objdir/$libname.def~emxexp $libobjs >> $output_objdir/$libname.def~$CC -Zdll -Zcrtdll -o $lib $libobjs $deplibs $compiler_flags $output_objdir/$libname.def' + old_archive_from_new_cmds='emximp -o $output_objdir/$libname.a $output_objdir/$libname.def' + ;; + + osf3*) + if test "$GCC" = yes; then + allow_undefined_flag=' ${wl}-expect_unresolved ${wl}\*' + archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' + else + allow_undefined_flag=' -expect_unresolved \*' + archive_cmds='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' + fi + hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' + hardcode_libdir_separator=: + ;; + + osf4* | osf5*) # as osf3* with the addition of -msym flag + if test "$GCC" = yes; then + allow_undefined_flag=' ${wl}-expect_unresolved ${wl}\*' + archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' + hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' + else + allow_undefined_flag=' -expect_unresolved \*' + archive_cmds='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -msym -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' + archive_expsym_cmds='for i in `cat $export_symbols`; do printf "-exported_symbol " >> $lib.exp; echo "\$i" >> $lib.exp; done; echo "-hidden">> $lib.exp~ + $LD -shared${allow_undefined_flag} -input $lib.exp $linker_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${objdir}/so_locations -o $lib~$rm $lib.exp' + + #Both c and cxx compiler support -rpath directly + hardcode_libdir_flag_spec='-rpath $libdir' + fi + hardcode_libdir_separator=: + ;; + + sco3.2v5*) + archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_shlibpath_var=no + runpath_var=LD_RUN_PATH + hardcode_runpath_var=yes + export_dynamic_flag_spec='${wl}-Bexport' + ;; + + solaris*) + # gcc --version < 3.0 without binutils cannot create self contained + # shared libraries reliably, requiring libgcc.a to resolve some of + # the object symbols generated in some cases. Libraries that use + # assert need libgcc.a to resolve __eprintf, for example. Linking + # a copy of libgcc.a into every shared library to guarantee resolving + # such symbols causes other problems: According to Tim Van Holder + # , C++ libraries end up with a separate + # (to the application) exception stack for one thing. + no_undefined_flag=' -z defs' + if test "$GCC" = yes; then + case `$CC --version 2>/dev/null` in + [12].*) + cat <&2 + +*** Warning: Releases of GCC earlier than version 3.0 cannot reliably +*** create self contained shared libraries on Solaris systems, without +*** introducing a dependency on libgcc.a. Therefore, libtool is disabling +*** -no-undefined support, which will at least allow you to build shared +*** libraries. However, you may find that when you link such libraries +*** into an application without using GCC, you have to manually add +*** \`gcc --print-libgcc-file-name\` to the link command. We urge you to +*** upgrade to a newer version of GCC. Another option is to rebuild your +*** current GCC to use the GNU linker from GNU binutils 2.9.1 or newer. + +EOF + no_undefined_flag= + ;; + esac + fi + # $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 $linker_flags' + archive_expsym_cmds='$echo "{ global:" > $lib.exp~cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ + $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$rm $lib.exp' + 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 + link_all_deplibs=yes + ;; + + sunos4*) + if test "x$host_vendor" = xsequent; then + # Use $CC to link under sequent, because it throws in some extra .o + # files that make .init and .fini sections work. + archive_cmds='$CC -G ${wl}-h $soname -o $lib $libobjs $deplibs $compiler_flags' + else + archive_cmds='$LD -assert pure-text -Bstatic -o $lib $libobjs $deplibs $linker_flags' + fi + hardcode_libdir_flag_spec='-L$libdir' + hardcode_direct=yes + hardcode_minus_L=yes + hardcode_shlibpath_var=no + ;; + + sysv4) + case $host_vendor in + sni) + archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_direct=yes # is this really true??? + ;; + siemens) + ## LD is ld it makes a PLAMLIB + ## CC just makes a GrossModule. + archive_cmds='$LD -G -o $lib $libobjs $deplibs $linker_flags' + reload_cmds='$CC -r -o $output$reload_objs' + hardcode_direct=no + ;; + motorola) + archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_direct=no #Motorola manual says yes, but my tests say they lie + ;; + esac + runpath_var='LD_RUN_PATH' + hardcode_shlibpath_var=no + ;; + + sysv4.3*) + archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_shlibpath_var=no + export_dynamic_flag_spec='-Bexport' + ;; + + 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 $linker_flags' + archive_expsym_cmds='$echo "{ global:" > $lib.exp~cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ + $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$rm $lib.exp' + hardcode_libdir_flag_spec= + hardcode_shlibpath_var=no + runpath_var='LD_RUN_PATH' + ;; + + uts4*) + archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_libdir_flag_spec='-L$libdir' + hardcode_shlibpath_var=no + ;; + + dgux*) + archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + 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 $linker_flags' + 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 $linker_flags' + hardcode_direct=yes + hardcode_minus_L=no + hardcode_shlibpath_var=no + hardcode_runpath_var=yes + runpath_var=LD_RUN_PATH + ;; + + sysv5uw7* | unixware7*) + no_undefined_flag='${wl}-z ${wl}text' + if test "$GCC" = yes; then + archive_cmds='$CC -shared ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' + else + archive_cmds='$CC -G ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' + fi + runpath_var='LD_RUN_PATH' + hardcode_shlibpath_var=no + ;; + + *) + ld_shlibs=no + ;; + esac +fi +echo "$as_me:$LINENO: result: $ld_shlibs" >&5 +echo "${ECHO_T}$ld_shlibs" >&6 +test "$ld_shlibs" = no && can_build_shared=no + +# Check hardcoding attributes. +echo "$as_me:$LINENO: checking how to hardcode library paths into programs" >&5 +echo $ECHO_N "checking how to hardcode library paths into programs... $ECHO_C" >&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 "$as_me:$LINENO: result: $hardcode_action" >&5 +echo "${ECHO_T}$hardcode_action" >&6 + +striplib= +old_striplib= +echo "$as_me:$LINENO: checking whether stripping libraries is possible" >&5 +echo $ECHO_N "checking whether stripping libraries is possible... $ECHO_C" >&6 +if test -n "$STRIP" && $STRIP -V 2>&1 | grep "GNU strip" >/dev/null; then + test -z "$old_striplib" && old_striplib="$STRIP --strip-debug" + test -z "$striplib" && striplib="$STRIP --strip-unneeded" + echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + +reload_cmds='$LD$reload_flag -o $output$reload_objs' +test -z "$deplibs_check_method" && deplibs_check_method=unknown + +# PORTME Fill in your ld.so characteristics +echo "$as_me:$LINENO: checking dynamic linker characteristics" >&5 +echo $ECHO_N "checking dynamic linker characteristics... $ECHO_C" >&6 +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 /usr/X11R6/lib" +sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib /usr/X11R6/lib" + +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* | aix5*) + version_type=linux + need_lib_prefix=no + need_version=no + hardcode_into_libs=yes + if test "$host_cpu" = ia64; then + # AIX 5 supports IA64 + library_names_spec='${libname}${release}.so$major ${libname}${release}.so$versuffix $libname.so' + shlibpath_var=LD_LIBRARY_PATH + else + # With GCC up to 2.95.x, collect2 would create an import file + # for dependence libraries. The import file would start with + # the line `#! .'. This would cause the generated library to + # depend on `.', always an invalid library. This was fixed in + # development snapshots of GCC prior to 3.0. + case $host_os in + aix4 | aix4.[01] | aix4.[01].*) + if { echo '#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 97)' + echo ' yes ' + echo '#endif'; } | ${CC} -E - | grep yes > /dev/null; then + : + else + can_build_shared=no + fi + ;; + esac + # AIX (on Power*) has no versioning support, so currently we can + # not hardcode correct soname into executable. Probably we can + # add versioning support to collect2, so additional links can + # be useful in future. + if test "$aix_use_runtimelinking" = yes; then + # If using run time linking (on AIX 4.2 or later) use lib.so + # instead of lib.a to let people know that these are not + # typical AIX shared libraries. + library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so' + else + # We preserve .a as extension for shared libraries through AIX4.2 + # and later when we are not doing run time linking. + library_names_spec='${libname}${release}.a $libname.a' + soname_spec='${libname}${release}.so$major' + fi + shlibpath_var=LIBPATH + fi + hardcode_into_libs=yes + ;; + +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 + ;; + +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 + 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* | pw32*) + version_type=windows + need_version=no + need_lib_prefix=no + case $GCC,$host_os in + yes,cygwin*) + library_names_spec='$libname.dll.a' + soname_spec='`echo ${libname} | sed -e 's/^lib/cyg/'``echo ${release} | sed -e 's/[.]/-/g'`${versuffix}.dll' + postinstall_cmds='dlpath=`bash 2>&1 -c '\''. $dir/${file}i;echo \$dlname'\''`~ + dldir=$destdir/`dirname \$dlpath`~ + test -d \$dldir || mkdir -p \$dldir~ + $install_prog .libs/$dlname \$dldir/$dlname' + postuninstall_cmds='dldll=`bash 2>&1 -c '\''. $file; echo \$dlname'\''`~ + dlpath=$dir/\$dldll~ + $rm \$dlpath' + ;; + yes,mingw*) + library_names_spec='${libname}`echo ${release} | sed -e 's/[.]/-/g'`${versuffix}.dll' + sys_lib_search_path_spec=`$CC -print-search-dirs | grep "^libraries:" | sed -e "s/^libraries://" -e "s/;/ /g" -e "s,=/,/,g"` + ;; + yes,pw32*) + library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | sed -e 's/./-/g'`${versuffix}.dll' + ;; + *) + library_names_spec='${libname}`echo ${release} | sed -e 's/[.]/-/g'`${versuffix}.dll $libname.lib' + ;; + esac + dynamic_linker='Win32 ld.exe' + # FIXME: first we should search . and the directory the executable is in + shlibpath_var=PATH + ;; + +darwin* | rhapsody*) + dynamic_linker="$host_os dyld" + version_type=darwin + need_lib_prefix=no + need_version=no + # FIXME: Relying on posixy $() will cause problems for + # cross-compilation, but unfortunately the echo tests do not + # yet detect zsh echo's removal of \ escapes. + library_names_spec='${libname}${release}${versuffix}.$(test .$module = .yes && echo so || echo dylib) ${libname}${release}${major}.$(test .$module = .yes && echo so || echo dylib) ${libname}.$(test .$module = .yes && echo so || echo dylib)' + soname_spec='${libname}${release}${major}.$(test .$module = .yes && echo so || echo dylib)' + shlibpath_overrides_runpath=yes + shlibpath_var=DYLD_LIBRARY_PATH + ;; + +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*) + library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so $libname.so' + need_version=no + need_lib_prefix=no + ;; + freebsd-*) + library_names_spec='${libname}${release}.so$versuffix $libname.so$versuffix' + need_version=yes + ;; + esac + shlibpath_var=LD_LIBRARY_PATH + case $host_os in + freebsd2*) + shlibpath_overrides_runpath=yes + ;; + *) + shlibpath_overrides_runpath=no + hardcode_into_libs=yes + ;; + esac + ;; + +gnu*) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so${major} ${libname}.so' + soname_spec='${libname}${release}.so$major' + shlibpath_var=LD_LIBRARY_PATH + hardcode_into_libs=yes + ;; + +hpux9* | hpux10* | hpux11*) + # Give a soname corresponding to the major version so that dld.sl refuses to + # link against other versions. + 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' + ;; + +irix5* | irix6* | nonstopux*) + case $host_os in + nonstopux*) version_type=nonstopux ;; + *) version_type=irix ;; + esac + 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* | nonstopux*) + libsuff= shlibsuff= + ;; + *) + 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}" + ;; + +# 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 + # This implies no fast_install, which is unacceptable. + # Some rework will be needed to allow for fast_install + # before this can be enabled. + hardcode_into_libs=yes + + case $host_cpu:$lt_cv_cc_64bit_output in + powerpc64:yes | s390x:yes | sparc64:yes | x86_64:yes) + sys_lib_dlsearch_path_spec="/lib64 /usr/lib64 /usr/X11R6/lib64" + sys_lib_search_path_spec="/lib64 /usr/lib64 /usr/local/lib64 /usr/X11R6/lib64" + ;; + esac + + # We used to test for /lib/ld.so.1 and disable shared libraries on + # powerpc, because MkLinux only supported shared libraries with the + # GNU dynamic linker. Since this was broken with cross compilers, + # most powerpc-linux boxes support dynamic linking these days and + # people can always --disable-shared, the test was removed, and we + # assume the GNU/Linux dynamic linker is in use. + dynamic_linker='GNU/Linux ld.so' + ;; + +netbsd*) + version_type=sunos + need_lib_prefix=no + need_version=no + if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then + library_names_spec='${libname}${release}.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 + shlibpath_overrides_runpath=yes + hardcode_into_libs=yes + ;; + +newsos6) + version_type=linux + library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + ;; + +openbsd*) + version_type=sunos + need_lib_prefix=no + need_version=no + if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then + case "$host_os" in + openbsd2.[89] | openbsd2.[89].*) + shlibpath_overrides_runpath=no + ;; + *) + shlibpath_overrides_runpath=yes + ;; + esac + else + shlibpath_overrides_runpath=yes + fi + 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$major' + library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so' + shlibpath_var=LD_LIBRARY_PATH + sys_lib_search_path_spec="/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /usr/local/lib /var/shlib" + sys_lib_dlsearch_path_spec="$sys_lib_search_path_spec" + hardcode_into_libs=yes + ;; + +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 + hardcode_into_libs=yes + # ldd complains unless libraries are executable + postinstall_cmds='chmod +x $lib' + ;; + +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 + sni) + shlibpath_overrides_runpath=no + need_lib_prefix=no + export_dynamic_flag_spec='${wl}-Blargedynsym' + runpath_var=LD_RUN_PATH + ;; + siemens) + need_lib_prefix=no + ;; + motorola) + need_lib_prefix=no + need_version=no + shlibpath_overrides_runpath=no + sys_lib_search_path_spec='/lib /usr/lib /usr/ccs/lib' + ;; + esac + ;; + +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 "$as_me:$LINENO: result: $dynamic_linker" >&5 +echo "${ECHO_T}$dynamic_linker" >&6 +test "$dynamic_linker" = no && can_build_shared=no + +# Report the final consequences. +echo "$as_me:$LINENO: checking if libtool supports shared libraries" >&5 +echo $ECHO_N "checking if libtool supports shared libraries... $ECHO_C" >&6 +echo "$as_me:$LINENO: result: $can_build_shared" >&5 +echo "${ECHO_T}$can_build_shared" >&6 + +echo "$as_me:$LINENO: checking whether to build shared libraries" >&5 +echo $ECHO_N "checking whether to build shared libraries... $ECHO_C" >&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*) + if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then + test "$enable_shared" = yes && enable_static=no + fi + ;; +esac +echo "$as_me:$LINENO: result: $enable_shared" >&5 +echo "${ECHO_T}$enable_shared" >&6 + +echo "$as_me:$LINENO: checking whether to build static libraries" >&5 +echo $ECHO_N "checking whether to build static libraries... $ECHO_C" >&6 +# Make sure either enable_shared or enable_static is yes. +test "$enable_shared" = yes || enable_static=yes +echo "$as_me:$LINENO: result: $enable_static" >&5 +echo "${ECHO_T}$enable_static" >&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 + +variables_saved_for_relink="PATH $shlibpath_var $runpath_var" +if test "$GCC" = yes; then + variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH" +fi + +if test "x$enable_dlopen" != xyes; then + enable_dlopen=unknown + enable_dlopen_self=unknown + enable_dlopen_self_static=unknown +else + lt_cv_dlopen=no + lt_cv_dlopen_libs= + + case $host_os in + beos*) + lt_cv_dlopen="load_add_on" + lt_cv_dlopen_libs= + lt_cv_dlopen_self=yes + ;; + + cygwin* | mingw* | pw32*) + lt_cv_dlopen="LoadLibrary" + lt_cv_dlopen_libs= + ;; + + *) + echo "$as_me:$LINENO: checking for shl_load" >&5 +echo $ECHO_N "checking for shl_load... $ECHO_C" >&6 +if test "${ac_cv_func_shl_load+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char shl_load (); below. + Prefer to if __STDC__ is defined, since + exists even on freestanding compilers. */ +#ifdef __STDC__ +# include +#else +# include +#endif +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +{ +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char shl_load (); +/* 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 +char (*f) () = shl_load; +#endif +#ifdef __cplusplus +} +#endif + +int +main () +{ +return f != shl_load; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_func_shl_load=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_func_shl_load=no +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $ac_cv_func_shl_load" >&5 +echo "${ECHO_T}$ac_cv_func_shl_load" >&6 +if test $ac_cv_func_shl_load = yes; then + lt_cv_dlopen="shl_load" +else + echo "$as_me:$LINENO: checking for shl_load in -ldld" >&5 +echo $ECHO_N "checking for shl_load in -ldld... $ECHO_C" >&6 +if test "${ac_cv_lib_dld_shl_load+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-ldld $LIBS" +cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char shl_load (); +int +main () +{ +shl_load (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_lib_dld_shl_load=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_lib_dld_shl_load=no +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +echo "$as_me:$LINENO: result: $ac_cv_lib_dld_shl_load" >&5 +echo "${ECHO_T}$ac_cv_lib_dld_shl_load" >&6 +if test $ac_cv_lib_dld_shl_load = yes; then + lt_cv_dlopen="shl_load" lt_cv_dlopen_libs="-dld" +else + echo "$as_me:$LINENO: checking for dlopen" >&5 +echo $ECHO_N "checking for dlopen... $ECHO_C" >&6 +if test "${ac_cv_func_dlopen+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char dlopen (); below. + Prefer to if __STDC__ is defined, since + exists even on freestanding compilers. */ +#ifdef __STDC__ +# include +#else +# include +#endif +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +{ +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char dlopen (); +/* 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 +char (*f) () = dlopen; +#endif +#ifdef __cplusplus +} +#endif + +int +main () +{ +return f != dlopen; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_func_dlopen=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_func_dlopen=no +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $ac_cv_func_dlopen" >&5 +echo "${ECHO_T}$ac_cv_func_dlopen" >&6 +if test $ac_cv_func_dlopen = yes; then + lt_cv_dlopen="dlopen" +else + echo "$as_me:$LINENO: checking for dlopen in -ldl" >&5 +echo $ECHO_N "checking for dlopen in -ldl... $ECHO_C" >&6 +if test "${ac_cv_lib_dl_dlopen+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-ldl $LIBS" +cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char dlopen (); +int +main () +{ +dlopen (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_lib_dl_dlopen=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_lib_dl_dlopen=no +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +echo "$as_me:$LINENO: result: $ac_cv_lib_dl_dlopen" >&5 +echo "${ECHO_T}$ac_cv_lib_dl_dlopen" >&6 +if test $ac_cv_lib_dl_dlopen = yes; then + lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl" +else + echo "$as_me:$LINENO: checking for dlopen in -lsvld" >&5 +echo $ECHO_N "checking for dlopen in -lsvld... $ECHO_C" >&6 +if test "${ac_cv_lib_svld_dlopen+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lsvld $LIBS" +cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char dlopen (); +int +main () +{ +dlopen (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_lib_svld_dlopen=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_lib_svld_dlopen=no +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +echo "$as_me:$LINENO: result: $ac_cv_lib_svld_dlopen" >&5 +echo "${ECHO_T}$ac_cv_lib_svld_dlopen" >&6 +if test $ac_cv_lib_svld_dlopen = yes; then + lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-lsvld" +else + echo "$as_me:$LINENO: checking for dld_link in -ldld" >&5 +echo $ECHO_N "checking for dld_link in -ldld... $ECHO_C" >&6 +if test "${ac_cv_lib_dld_dld_link+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-ldld $LIBS" +cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char dld_link (); +int +main () +{ +dld_link (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_lib_dld_dld_link=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_lib_dld_dld_link=no +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +echo "$as_me:$LINENO: result: $ac_cv_lib_dld_dld_link" >&5 +echo "${ECHO_T}$ac_cv_lib_dld_dld_link" >&6 +if test $ac_cv_lib_dld_dld_link = yes; then + lt_cv_dlopen="dld_link" lt_cv_dlopen_libs="-dld" +fi + + +fi + + +fi + + +fi + + +fi + + +fi + + ;; + esac + + if test "x$lt_cv_dlopen" != xno; then + enable_dlopen=yes + else + enable_dlopen=no + fi + + case $lt_cv_dlopen in + dlopen) + save_CPPFLAGS="$CPPFLAGS" + test "x$ac_cv_header_dlfcn_h" = xyes && CPPFLAGS="$CPPFLAGS -DHAVE_DLFCN_H" + + save_LDFLAGS="$LDFLAGS" + eval LDFLAGS=\"\$LDFLAGS $export_dynamic_flag_spec\" + + save_LIBS="$LIBS" + LIBS="$lt_cv_dlopen_libs $LIBS" + + echo "$as_me:$LINENO: checking whether a program can dlopen itself" >&5 +echo $ECHO_N "checking whether a program can dlopen itself... $ECHO_C" >&6 +if test "${lt_cv_dlopen_self+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test "$cross_compiling" = yes; then : + lt_cv_dlopen_self=cross +else + lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 + lt_status=$lt_dlunknown + cat > conftest.$ac_ext < +#endif + +#include + +#ifdef RTLD_GLOBAL +# define LT_DLGLOBAL RTLD_GLOBAL +#else +# ifdef DL_GLOBAL +# define LT_DLGLOBAL DL_GLOBAL +# else +# define LT_DLGLOBAL 0 +# endif +#endif + +/* We may have to define LT_DLLAZY_OR_NOW in the command line if we + find out it does not work in some platform. */ +#ifndef LT_DLLAZY_OR_NOW +# ifdef RTLD_LAZY +# define LT_DLLAZY_OR_NOW RTLD_LAZY +# else +# ifdef DL_LAZY +# define LT_DLLAZY_OR_NOW DL_LAZY +# else +# ifdef RTLD_NOW +# define LT_DLLAZY_OR_NOW RTLD_NOW +# else +# ifdef DL_NOW +# define LT_DLLAZY_OR_NOW DL_NOW +# else +# define LT_DLLAZY_OR_NOW 0 +# endif +# endif +# endif +# endif +#endif + +#ifdef __cplusplus +extern "C" void exit (int); +#endif + +void fnord() { int i=42;} +int main () +{ + void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW); + int status = $lt_dlunknown; + + if (self) + { + if (dlsym (self,"fnord")) status = $lt_dlno_uscore; + else if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore; + /* dlclose (self); */ + } + + exit (status); +} +EOF + if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && test -s conftest${ac_exeext} 2>/dev/null; then + (./conftest; exit; ) 2>/dev/null + lt_status=$? + case x$lt_status in + x$lt_dlno_uscore) lt_cv_dlopen_self=yes ;; + x$lt_dlneed_uscore) lt_cv_dlopen_self=yes ;; + x$lt_unknown|x*) lt_cv_dlopen_self=no ;; + esac + else : + # compilation failed + lt_cv_dlopen_self=no + fi +fi +rm -fr conftest* + + +fi +echo "$as_me:$LINENO: result: $lt_cv_dlopen_self" >&5 +echo "${ECHO_T}$lt_cv_dlopen_self" >&6 + + if test "x$lt_cv_dlopen_self" = xyes; then + LDFLAGS="$LDFLAGS $link_static_flag" + echo "$as_me:$LINENO: checking whether a statically linked program can dlopen itself" >&5 +echo $ECHO_N "checking whether a statically linked program can dlopen itself... $ECHO_C" >&6 +if test "${lt_cv_dlopen_self_static+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test "$cross_compiling" = yes; then : + lt_cv_dlopen_self_static=cross +else + lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 + lt_status=$lt_dlunknown + cat > conftest.$ac_ext < +#endif + +#include + +#ifdef RTLD_GLOBAL +# define LT_DLGLOBAL RTLD_GLOBAL +#else +# ifdef DL_GLOBAL +# define LT_DLGLOBAL DL_GLOBAL +# else +# define LT_DLGLOBAL 0 +# endif +#endif + +/* We may have to define LT_DLLAZY_OR_NOW in the command line if we + find out it does not work in some platform. */ +#ifndef LT_DLLAZY_OR_NOW +# ifdef RTLD_LAZY +# define LT_DLLAZY_OR_NOW RTLD_LAZY +# else +# ifdef DL_LAZY +# define LT_DLLAZY_OR_NOW DL_LAZY +# else +# ifdef RTLD_NOW +# define LT_DLLAZY_OR_NOW RTLD_NOW +# else +# ifdef DL_NOW +# define LT_DLLAZY_OR_NOW DL_NOW +# else +# define LT_DLLAZY_OR_NOW 0 +# endif +# endif +# endif +# endif +#endif + +#ifdef __cplusplus +extern "C" void exit (int); +#endif + +void fnord() { int i=42;} +int main () +{ + void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW); + int status = $lt_dlunknown; + + if (self) + { + if (dlsym (self,"fnord")) status = $lt_dlno_uscore; + else if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore; + /* dlclose (self); */ + } + + exit (status); +} +EOF + if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && test -s conftest${ac_exeext} 2>/dev/null; then + (./conftest; exit; ) 2>/dev/null + lt_status=$? + case x$lt_status in + x$lt_dlno_uscore) lt_cv_dlopen_self_static=yes ;; + x$lt_dlneed_uscore) lt_cv_dlopen_self_static=yes ;; + x$lt_unknown|x*) lt_cv_dlopen_self_static=no ;; + esac + else : + # compilation failed + lt_cv_dlopen_self_static=no + fi +fi +rm -fr conftest* + + +fi +echo "$as_me:$LINENO: result: $lt_cv_dlopen_self_static" >&5 +echo "${ECHO_T}$lt_cv_dlopen_self_static" >&6 + fi + + CPPFLAGS="$save_CPPFLAGS" + LDFLAGS="$save_LDFLAGS" + LIBS="$save_LIBS" + ;; + esac + + case $lt_cv_dlopen_self in + yes|no) enable_dlopen_self=$lt_cv_dlopen_self ;; + *) enable_dlopen_self=unknown ;; + esac + + case $lt_cv_dlopen_self_static in + yes|no) enable_dlopen_self_static=$lt_cv_dlopen_self_static ;; + *) enable_dlopen_self_static=unknown ;; + esac +fi + + +if test "$enable_shared" = yes && test "$GCC" = yes; then + case $archive_cmds in + *'~'*) + # FIXME: we may have to deal with multi-command sequences. + ;; + '$CC '*) + # Test whether the compiler implicitly links with -lc since on some + # systems, -lgcc has to come before -lc. If gcc already passes -lc + # to ld, don't add -lc before -lgcc. + echo "$as_me:$LINENO: checking whether -lc should be explicitly linked in" >&5 +echo $ECHO_N "checking whether -lc should be explicitly linked in... $ECHO_C" >&6 + if test "${lt_cv_archive_cmds_need_lc+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + $rm conftest* + echo 'static int dummy;' > conftest.$ac_ext + + if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; then + soname=conftest + lib=conftest + libobjs=conftest.$ac_objext + deplibs= + wl=$lt_cv_prog_cc_wl + compiler_flags=-v + linker_flags=-v + verstring= + output_objdir=. + libname=conftest + save_allow_undefined_flag=$allow_undefined_flag + allow_undefined_flag= + if { (eval echo "$as_me:$LINENO: \"$archive_cmds 2\>\&1 \| grep \" -lc \" \>/dev/null 2\>\&1\"") >&5 + (eval $archive_cmds 2\>\&1 \| grep \" -lc \" \>/dev/null 2\>\&1) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } + then + lt_cv_archive_cmds_need_lc=no + else + lt_cv_archive_cmds_need_lc=yes + fi + allow_undefined_flag=$save_allow_undefined_flag + else + cat conftest.err 1>&5 + fi +fi + + echo "$as_me:$LINENO: result: $lt_cv_archive_cmds_need_lc" >&5 +echo "${ECHO_T}$lt_cv_archive_cmds_need_lc" >&6 + ;; + esac +fi +need_lc=${lt_cv_archive_cmds_need_lc-yes} + +# The second clause should only fire when bootstrapping the +# libtool distribution, otherwise you forgot to ship ltmain.sh +# with your package, and you will get complaints that there are +# no rules to generate ltmain.sh. +if test -f "$ltmain"; then + : +else + # If there is no Makefile yet, we rely on a make rule to execute + # `config.status --recheck' to rerun these tests and create the + # libtool script then. + test -f Makefile && make "$ltmain" +fi + +if test -f "$ltmain"; then + trap "$rm \"${ofile}T\"; exit 1" 1 2 15 + $rm -f "${ofile}T" + + echo creating $ofile + + # Now quote all the things that may contain metacharacters while being + # careful not to overquote the AC_SUBSTed values. We take copies of the + # variables and quote the copies for generation of the libtool script. + for var in echo old_CC old_CFLAGS SED \ + AR AR_FLAGS CC LD LN_S NM SHELL \ + 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 extract_expsyms_cmds old_archive_from_expsyms_cmds \ + old_striplib striplib 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 \ + global_symbol_to_c_name_address \ + 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 | \ + extract_expsyms_cmds | old_archive_from_expsyms_cmds | \ + postinstall_cmds | postuninstall_cmds | \ + finish_cmds | sys_lib_search_path_spec | sys_lib_dlsearch_path_spec) + # Double-quote double-evaled strings. + eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$double_quote_subst\" -e \"\$sed_quote_subst\" -e \"\$delay_variable_subst\"\`\\\"" + ;; + *) + eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$sed_quote_subst\"\`\\\"" + ;; + esac + done + + cat <<__EOF__ > "${ofile}T" +#! $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 ltmain.sh. +# +# Copyright (C) 1996-2000 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. + +# A sed that does not truncate output. +SED=$lt_SED + +# Sed that helps us avoid accidentally triggering echo(1) options like -n. +Xsed="${SED} -e s/^X//" + +# The HP-UX ksh and POSIX shell print the target directory to stdout +# if CDPATH is set. +if test "X\${CDPATH+set}" = Xset; then CDPATH=:; export CDPATH; fi + +# ### BEGIN LIBTOOL CONFIG + +# Libtool was configured on host `(hostname || uname -n) 2>/dev/null | sed 1q`: + +# Shell to use when invoking shell scripts. +SHELL=$lt_SHELL + +# Whether or not to build shared libraries. +build_libtool_libs=$enable_shared + +# Whether or not to build static libraries. +build_old_libs=$enable_static + +# Whether or not to add -lc for building shared libraries. +build_libtool_need_lc=$need_lc + +# Whether or not to optimize for fast installation. +fast_install=$enable_fast_install + +# The host system. +host_alias=$host_alias +host=$host + +# An echo program that does not interpret backslashes. +echo=$lt_echo + +# The archiver. +AR=$lt_AR +AR_FLAGS=$lt_AR_FLAGS + +# The default C compiler. +CC=$lt_CC + +# Is the compiler the GNU C compiler? +with_gcc=$GCC + +# The linker used to build libraries. +LD=$lt_LD + +# Whether we need hard or soft links. +LN_S=$lt_LN_S + +# A BSD-compatible nm program. +NM=$lt_NM + +# A symbol stripping program +STRIP=$STRIP + +# Used to examine libraries when file_magic_cmd begins "file" +MAGIC_CMD=$MAGIC_CMD + +# Used on cygwin: DLL creation program. +DLLTOOL="$DLLTOOL" + +# Used on cygwin: object dumper. +OBJDUMP="$OBJDUMP" + +# Used on cygwin: assembler. +AS="$AS" + +# The name of the directory that contains temporary libtool files. +objdir=$objdir + +# How to create reloadable object files. +reload_flag=$lt_reload_flag +reload_cmds=$lt_reload_cmds + +# How to pass a linker flag through the compiler. +wl=$lt_wl + +# Object file suffix (normally "o"). +objext="$ac_objext" + +# Old archive suffix (normally "a"). +libext="$libext" + +# Executable file suffix (normally ""). +exeext="$exeext" + +# Additional compiler flags for building library objects. +pic_flag=$lt_pic_flag +pic_mode=$pic_mode + +# Does compiler simultaneously support -c and -o options? +compiler_c_o=$lt_compiler_c_o + +# Can we write directly to a .lo ? +compiler_o_lo=$lt_compiler_o_lo + +# Must we lock files when doing compilation ? +need_locks=$lt_need_locks + +# Do we need the lib prefix for modules? +need_lib_prefix=$need_lib_prefix + +# Do we need a version for libraries? +need_version=$need_version + +# Whether dlopen is supported. +dlopen_support=$enable_dlopen + +# Whether dlopen of programs is supported. +dlopen_self=$enable_dlopen_self + +# Whether dlopen of statically linked programs is supported. +dlopen_self_static=$enable_dlopen_self_static + +# Compiler flag to prevent dynamic linking. +link_static_flag=$lt_link_static_flag + +# Compiler flag to turn off builtin functions. +no_builtin_flag=$lt_no_builtin_flag + +# Compiler flag to allow reflexive dlopens. +export_dynamic_flag_spec=$lt_export_dynamic_flag_spec + +# Compiler flag to generate shared objects directly from archives. +whole_archive_flag_spec=$lt_whole_archive_flag_spec + +# Compiler flag to generate thread-safe objects. +thread_safe_flag_spec=$lt_thread_safe_flag_spec + +# Library versioning type. +version_type=$version_type + +# Format of library name prefix. +libname_spec=$lt_libname_spec + +# List of archive names. First name is the real one, the rest are links. +# The last name is the one that the linker finds with -lNAME. +library_names_spec=$lt_library_names_spec + +# The coded name of the library, if different from the real name. +soname_spec=$lt_soname_spec + +# Commands used to build and install an old-style archive. +RANLIB=$lt_RANLIB +old_archive_cmds=$lt_old_archive_cmds +old_postinstall_cmds=$lt_old_postinstall_cmds +old_postuninstall_cmds=$lt_old_postuninstall_cmds + +# Create an old-style archive from a shared archive. +old_archive_from_new_cmds=$lt_old_archive_from_new_cmds + +# Create a temporary old-style archive to link instead of a shared archive. +old_archive_from_expsyms_cmds=$lt_old_archive_from_expsyms_cmds + +# Commands used to build and install a shared archive. +archive_cmds=$lt_archive_cmds +archive_expsym_cmds=$lt_archive_expsym_cmds +postinstall_cmds=$lt_postinstall_cmds +postuninstall_cmds=$lt_postuninstall_cmds + +# Commands to strip libraries. +old_striplib=$lt_old_striplib +striplib=$lt_striplib + +# Method to check whether dependent libraries are shared objects. +deplibs_check_method=$lt_deplibs_check_method + +# Command to use when deplibs_check_method == file_magic. +file_magic_cmd=$lt_file_magic_cmd + +# Flag that allows shared libraries with undefined symbols to be built. +allow_undefined_flag=$lt_allow_undefined_flag + +# Flag that forces no undefined symbols. +no_undefined_flag=$lt_no_undefined_flag + +# Commands used to finish a libtool library installation in a directory. +finish_cmds=$lt_finish_cmds + +# Same as above, but a single script fragment to be evaled but not shown. +finish_eval=$lt_finish_eval + +# Take the output of nm and produce a listing of raw symbols and C names. +global_symbol_pipe=$lt_global_symbol_pipe + +# Transform the output of nm in a proper C declaration +global_symbol_to_cdecl=$lt_global_symbol_to_cdecl + +# Transform the output of nm in a C name address pair +global_symbol_to_c_name_address=$lt_global_symbol_to_c_name_address + +# This is the shared library runtime path variable. +runpath_var=$runpath_var + +# This is the shared library path variable. +shlibpath_var=$shlibpath_var + +# Is shlibpath searched before the hard-coded library search path? +shlibpath_overrides_runpath=$shlibpath_overrides_runpath + +# How to hardcode a shared library path into an executable. +hardcode_action=$hardcode_action + +# Whether we should hardcode library paths into libraries. +hardcode_into_libs=$hardcode_into_libs + +# Flag to hardcode \$libdir into a binary during linking. +# This must work even if \$libdir does not exist. +hardcode_libdir_flag_spec=$lt_hardcode_libdir_flag_spec + +# Whether we need a single -rpath flag with a separated argument. +hardcode_libdir_separator=$lt_hardcode_libdir_separator + +# Set to yes if using DIR/libNAME.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 + +# Variables whose values should be saved in libtool wrapper scripts and +# restored at relink time. +variables_saved_for_relink="$variables_saved_for_relink" + +# Whether libtool must link a program against all its dependency libraries. +link_all_deplibs=$link_all_deplibs + +# Compile-time system search path for libraries +sys_lib_search_path_spec=$lt_sys_lib_search_path_spec + +# Run-time system search path for libraries +sys_lib_dlsearch_path_spec=$lt_sys_lib_dlsearch_path_spec + +# Fix the shell variable \$srcfile for the compiler. +fix_srcfile_path="$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=$lt_export_symbols_cmds + +# The commands to extract the exported symbol list from a shared archive. +extract_expsyms_cmds=$lt_extract_expsyms_cmds + +# Symbols that should not be listed in the preloaded symbols. +exclude_expsyms=$lt_exclude_expsyms + +# Symbols that must always be exported. +include_expsyms=$lt_include_expsyms + +# ### END LIBTOOL CONFIG + +__EOF__ + + case $host_os in + aix3*) + cat <<\EOF >> "${ofile}T" + +# 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 + + case $host_os in + cygwin* | mingw* | pw32* | os2*) + cat <<'EOF' >> "${ofile}T" + # 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-2000 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() */ +# +# /* O_BINARY isn't required (or even defined sometimes) under Unix */ +# #ifndef O_BINARY +# #define O_BINARY 0 +# #endif +# +# 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 < 1) +# 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> "${ofile}T" || (rm -f "${ofile}T"; exit 1) + + mv -f "${ofile}T" "$ofile" || \ + (rm -f "$ofile" && cp "${ofile}T" "$ofile" && rm -f "${ofile}T") + chmod +x "$ofile" +fi + + + + + +# This can be used to rebuild libtool when needed +LIBTOOL_DEPS="$ac_aux_dir/ltmain.sh" + +# Always use our own libtool. +LIBTOOL='$(SHELL) $(top_builddir)/libtool' + +# Prevent multiple expansion + + +echo "$as_me:$LINENO: checking whether ${MAKE-make} sets \$(MAKE)" >&5 +echo $ECHO_N "checking whether ${MAKE-make} sets \$(MAKE)... $ECHO_C" >&6 +set dummy ${MAKE-make}; ac_make=`echo "$2" | sed 'y,./+-,__p_,'` +if eval "test \"\${ac_cv_prog_make_${ac_make}_set+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.make <<\_ACEOF +all: + @echo 'ac_maketemp="$(MAKE)"' +_ACEOF +# GNU make sometimes prints "make[1]: Entering...", which would confuse us. +eval `${MAKE-make} -f conftest.make 2>/dev/null | grep temp=` +if test -n "$ac_maketemp"; then + eval ac_cv_prog_make_${ac_make}_set=yes +else + eval ac_cv_prog_make_${ac_make}_set=no +fi +rm -f conftest.make +fi +if eval "test \"`echo '$ac_cv_prog_make_'${ac_make}_set`\" = yes"; then + echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6 + SET_MAKE= +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 + SET_MAKE="MAKE=${MAKE-make}" +fi + + + +echo "$as_me:$LINENO: checking for ssh" >&5 +echo $ECHO_N "checking for ssh... $ECHO_C" >&6 + +# Check whether --with-ssh or --without-ssh was given. +if test "${with_ssh+set}" = set; then + withval="$with_ssh" + SSHPROG=$withval +else + SSHPROG=`which ssh 2>/dev/null` +fi; +if test ! -x "$SSHPROG" +then + echo "$as_me:$LINENO: result: not found (sshfs support disabled)" >&5 +echo "${ECHO_T}not found (sshfs support disabled)" >&6 +else + echo "$as_me:$LINENO: result: found ($SSHPROG)" >&5 +echo "${ECHO_T}found ($SSHPROG)" >&6 + +cat >>confdefs.h <<\_ACEOF +#define HAS_SSH 1 +_ACEOF + + opt_fs="$opt_fs sshfs" +fi + + + +# Extract the first word of "gnome-config", so it can be a program name with args. +set dummy gnome-config; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_GCONF+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$GCONF"; then + ac_cv_prog_GCONF="$GCONF" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_GCONF="gnome-config" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + +fi +fi +GCONF=$ac_cv_prog_GCONF +if test -n "$GCONF"; then + echo "$as_me:$LINENO: result: $GCONF" >&5 +echo "${ECHO_T}$GCONF" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + +# Extract the first word of "gnome-vfs-config", so it can be a program name with args. +set dummy gnome-vfs-config; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_GVFSCONF+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$GVFSCONF"; then + ac_cv_prog_GVFSCONF="$GVFSCONF" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_GVFSCONF="gnome-vfs-config" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + +fi +fi +GVFSCONF=$ac_cv_prog_GVFSCONF +if test -n "$GVFSCONF"; then + echo "$as_me:$LINENO: result: $GVFSCONF" >&5 +echo "${ECHO_T}$GVFSCONF" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + +echo "$as_me:$LINENO: checking for gnome_vfs_init in -lgnomevfs" >&5 +echo $ECHO_N "checking for gnome_vfs_init in -lgnomevfs... $ECHO_C" >&6 +if test "${ac_cv_lib_gnomevfs_gnome_vfs_init+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lgnomevfs $LIBS" +cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char gnome_vfs_init (); +int +main () +{ +gnome_vfs_init (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_lib_gnomevfs_gnome_vfs_init=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_lib_gnomevfs_gnome_vfs_init=no +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +echo "$as_me:$LINENO: result: $ac_cv_lib_gnomevfs_gnome_vfs_init" >&5 +echo "${ECHO_T}$ac_cv_lib_gnomevfs_gnome_vfs_init" >&6 +if test $ac_cv_lib_gnomevfs_gnome_vfs_init = yes; then + HAS_GNOMEVFS=1 +fi + +if test "$GCONF" -a "$GVFSCONF" -a "$HAS_GNOMEVFS" +then + +cat >>confdefs.h <<\_ACEOF +#define HAS_GVFS 1 +_ACEOF + + + GVFS_LDADD="`$GCONF --libs gnome` `$GVFSCONF --libs`" + GVFS_CFLAGS="`$GCONF --cflags gnome` `$GVFSCONF --cflags`" + opt_fs="$opt_fs gvfs" +fi + + + +# Check whether --enable-wavfs or --disable-wavfs was given. +if test "${enable_wavfs+set}" = set; then + enableval="$enable_wavfs" + opt_fs="$opt_fs wavfs" +fi; + + +# Check whether --enable-cefs or --disable-cefs was given. +if test "${enable_cefs+set}" = set; then + enableval="$enable_cefs" + opt_fs="$opt_fs cefs" +fi; + +if test -n "$cefs_dir"; then + +cat >>confdefs.h <<\_ACEOF +#define HAS_CEFS 1 +_ACEOF + + +cat >>confdefs.h <<\_ACEOF +#define INFOFILE "/tmp/cedevices" +_ACEOF + +fi + +# Check whether --enable-cardfs or --disable-cardfs was given. +if test "${enable_cardfs+set}" = set; then + enableval="$enable_cardfs" + WITH_CARDFS=true +fi; + + +echo "$as_me:$LINENO: checking for pthread_detach in -lpthread" >&5 +echo $ECHO_N "checking for pthread_detach in -lpthread... $ECHO_C" >&6 +if test "${ac_cv_lib_pthread_pthread_detach+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lpthread $LIBS" +cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char pthread_detach (); +int +main () +{ +pthread_detach (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_lib_pthread_pthread_detach=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_lib_pthread_pthread_detach=no +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +echo "$as_me:$LINENO: result: $ac_cv_lib_pthread_pthread_detach" >&5 +echo "${ECHO_T}$ac_cv_lib_pthread_pthread_detach" >&6 +if test $ac_cv_lib_pthread_pthread_detach = yes; then + cat >>confdefs.h <<_ACEOF +#define HAVE_LIBPTHREAD 1 +_ACEOF + + LIBS="-lpthread $LIBS" + +else + { { echo "$as_me:$LINENO: error: libpthread is needed by lufs" >&5 +echo "$as_me: error: libpthread is needed by lufs" >&2;} + { (exit 1); exit 1; }; } +fi + + + +echo "$as_me:$LINENO: checking for ANSI C header files" >&5 +echo $ECHO_N "checking for ANSI C header files... $ECHO_C" >&6 +if test "${ac_cv_header_stdc+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +#include +#include +#include + +int +main () +{ + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_header_stdc=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_header_stdc=no +fi +rm -f conftest.$ac_objext conftest.$ac_ext + +if test $ac_cv_header_stdc = yes; then + # SunOS 4.x string.h does not declare mem*, contrary to ANSI. + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "memchr" >/dev/null 2>&1; then + : +else + ac_cv_header_stdc=no +fi +rm -f conftest* + +fi + +if test $ac_cv_header_stdc = yes; then + # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "free" >/dev/null 2>&1; then + : +else + ac_cv_header_stdc=no +fi +rm -f conftest* + +fi + +if test $ac_cv_header_stdc = yes; then + # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi. + if test "$cross_compiling" = yes; then + : +else + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +#if ((' ' & 0x0FF) == 0x020) +# define ISLOWER(c) ('a' <= (c) && (c) <= 'z') +# define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c)) +#else +# define ISLOWER(c) \ + (('a' <= (c) && (c) <= 'i') \ + || ('j' <= (c) && (c) <= 'r') \ + || ('s' <= (c) && (c) <= 'z')) +# define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c)) +#endif + +#define XOR(e, f) (((e) && !(f)) || (!(e) && (f))) +int +main () +{ + int i; + for (i = 0; i < 256; i++) + if (XOR (islower (i), ISLOWER (i)) + || toupper (i) != TOUPPER (i)) + exit(2); + exit (0); +} +_ACEOF +rm -f conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { ac_try='./conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + : +else + echo "$as_me: program exited with status $ac_status" >&5 +echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +( exit $ac_status ) +ac_cv_header_stdc=no +fi +rm -f core core.* *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +fi +fi +fi +echo "$as_me:$LINENO: result: $ac_cv_header_stdc" >&5 +echo "${ECHO_T}$ac_cv_header_stdc" >&6 +if test $ac_cv_header_stdc = yes; then + +cat >>confdefs.h <<\_ACEOF +#define STDC_HEADERS 1 +_ACEOF + +fi + + +for ac_header in unistd.h +do +as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo "$as_me:$LINENO: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 +else + # Is the header compilable? +echo "$as_me:$LINENO: checking $ac_header usability" >&5 +echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +#include <$ac_header> +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_header_compiler=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_header_compiler=no +fi +rm -f conftest.$ac_objext conftest.$ac_ext +echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 +echo "${ECHO_T}$ac_header_compiler" >&6 + +# Is the header present? +echo "$as_me:$LINENO: checking $ac_header presence" >&5 +echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include <$ac_header> +_ACEOF +if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + ac_header_preproc=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_header_preproc=no +fi +rm -f conftest.err conftest.$ac_ext +echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 +echo "${ECHO_T}$ac_header_preproc" >&6 + +# So? What about this header? +case $ac_header_compiler:$ac_header_preproc in + yes:no ) + { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 +echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 +echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} + ( + cat <<\_ASBOX +## ------------------------------------ ## +## Report this to bug-autoconf@gnu.org. ## +## ------------------------------------ ## +_ASBOX + ) | + sed "s/^/$as_me: WARNING: /" >&2 + ;; + no:yes ) + { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 +echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 +echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 +echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} + ( + cat <<\_ASBOX +## ------------------------------------ ## +## Report this to bug-autoconf@gnu.org. ## +## ------------------------------------ ## +_ASBOX + ) | + sed "s/^/$as_me: WARNING: /" >&2 + ;; +esac +echo "$as_me:$LINENO: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + eval "$as_ac_Header=$ac_header_preproc" +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 + +fi +if test `eval echo '${'$as_ac_Header'}'` = yes; then + cat >>confdefs.h <<_ACEOF +#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 +_ACEOF + +fi + +done + + + + + + + + +for ac_header in byteswap.h sys/byteswap.h endian.h machine/endian.h sys/types.h +do +as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo "$as_me:$LINENO: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 +else + # Is the header compilable? +echo "$as_me:$LINENO: checking $ac_header usability" >&5 +echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +#include <$ac_header> +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_header_compiler=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_header_compiler=no +fi +rm -f conftest.$ac_objext conftest.$ac_ext +echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 +echo "${ECHO_T}$ac_header_compiler" >&6 + +# Is the header present? +echo "$as_me:$LINENO: checking $ac_header presence" >&5 +echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include <$ac_header> +_ACEOF +if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + ac_header_preproc=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_header_preproc=no +fi +rm -f conftest.err conftest.$ac_ext +echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 +echo "${ECHO_T}$ac_header_preproc" >&6 + +# So? What about this header? +case $ac_header_compiler:$ac_header_preproc in + yes:no ) + { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 +echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 +echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} + ( + cat <<\_ASBOX +## ------------------------------------ ## +## Report this to bug-autoconf@gnu.org. ## +## ------------------------------------ ## +_ASBOX + ) | + sed "s/^/$as_me: WARNING: /" >&2 + ;; + no:yes ) + { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 +echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 +echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 +echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} + ( + cat <<\_ASBOX +## ------------------------------------ ## +## Report this to bug-autoconf@gnu.org. ## +## ------------------------------------ ## +_ASBOX + ) | + sed "s/^/$as_me: WARNING: /" >&2 + ;; +esac +echo "$as_me:$LINENO: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + eval "$as_ac_Header=$ac_header_preproc" +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 + +fi +if test `eval echo '${'$as_ac_Header'}'` = yes; then + cat >>confdefs.h <<_ACEOF +#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 +_ACEOF + +fi + +done + + + +echo "$as_me:$LINENO: checking for an ANSI C-conforming const" >&5 +echo $ECHO_N "checking for an ANSI C-conforming const... $ECHO_C" >&6 +if test "${ac_cv_c_const+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +int +main () +{ +/* FIXME: Include the comments suggested by Paul. */ +#ifndef __cplusplus + /* Ultrix mips cc rejects this. */ + typedef int charset[2]; + const charset x; + /* SunOS 4.1.1 cc rejects this. */ + char const *const *ccp; + char **p; + /* NEC SVR4.0.2 mips cc rejects this. */ + struct point {int x, y;}; + static struct point const zero = {0,0}; + /* AIX XL C 1.02.0.0 rejects this. + It does not let you subtract one const X* pointer from another in + an arm of an if-expression whose if-part is not a constant + expression */ + const char *g = "string"; + ccp = &g + (g ? g-g : 0); + /* HPUX 7.0 cc rejects these. */ + ++ccp; + p = (char**) ccp; + ccp = (char const *const *) p; + { /* SCO 3.2v4 cc rejects this. */ + char *t; + char const *s = 0 ? (char *) 0 : (char const *) 0; + + *t++ = 0; + } + { /* Someone thinks the Sun supposedly-ANSI compiler will reject this. */ + int x[] = {25, 17}; + const int *foo = &x[0]; + ++foo; + } + { /* Sun SC1.0 ANSI compiler rejects this -- but not the above. */ + typedef const int *iptr; + iptr p = 0; + ++p; + } + { /* AIX XL C 1.02.0.0 rejects this saying + "k.c", line 2.27: 1506-025 (S) Operand must be a modifiable lvalue. */ + struct s { int j; const int *ap[3]; }; + struct s *b; b->j = 5; + } + { /* ULTRIX-32 V3.1 (Rev 9) vcc rejects this */ + const int foo = 10; + } +#endif + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_c_const=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_c_const=no +fi +rm -f conftest.$ac_objext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $ac_cv_c_const" >&5 +echo "${ECHO_T}$ac_cv_c_const" >&6 +if test $ac_cv_c_const = no; then + +cat >>confdefs.h <<\_ACEOF +#define const +_ACEOF + +fi + +echo "$as_me:$LINENO: checking for pid_t" >&5 +echo $ECHO_N "checking for pid_t... $ECHO_C" >&6 +if test "${ac_cv_type_pid_t+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +int +main () +{ +if ((pid_t *) 0) + return 0; +if (sizeof (pid_t)) + return 0; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_type_pid_t=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_type_pid_t=no +fi +rm -f conftest.$ac_objext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $ac_cv_type_pid_t" >&5 +echo "${ECHO_T}$ac_cv_type_pid_t" >&6 +if test $ac_cv_type_pid_t = yes; then + : +else + +cat >>confdefs.h <<_ACEOF +#define pid_t int +_ACEOF + +fi + + + + +for ac_func in mkdir rmdir +do +as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` +echo "$as_me:$LINENO: checking for $ac_func" >&5 +echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6 +if eval "test \"\${$as_ac_var+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char $ac_func (); below. + Prefer to if __STDC__ is defined, since + exists even on freestanding compilers. */ +#ifdef __STDC__ +# include +#else +# include +#endif +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +{ +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char $ac_func (); +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined (__stub_$ac_func) || defined (__stub___$ac_func) +choke me +#else +char (*f) () = $ac_func; +#endif +#ifdef __cplusplus +} +#endif + +int +main () +{ +return f != $ac_func; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + eval "$as_ac_var=yes" +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +eval "$as_ac_var=no" +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_var'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6 +if test `eval echo '${'$as_ac_var'}'` = yes; then + cat >>confdefs.h <<_ACEOF +#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1 +_ACEOF + +fi +done + + +if test -n "$WITH_CARDFS"; then + echo checking for cardfs + echo "$as_me:$LINENO: checking for libchipcard" >&5 +echo $ECHO_N "checking for libchipcard... $ECHO_C" >&6 + +# Check whether --with-chipcard-dir or --without-chipcard-dir was given. +if test "${with_chipcard_dir+set}" = set; then + withval="$with_chipcard_dir" + cc_dir="$withval" +else + cc_dir="/usr/local/libchipcard \ + /usr/local \ + /usr/libchipcard \ + /usr \ + /" +fi; + for li in $cc_dir; do + if test -x "$li/bin/libchipcard-config"; then + chipcard_dir="$li" + fi + done + if test -z "$chipcard_dir"; then + echo "$as_me:$LINENO: result: not found (chipcard support disabled)" >&5 +echo "${ECHO_T}not found (chipcard support disabled)" >&6 + else + all_libraries="$all_libraries `$chipcard_dir/bin/libchipcard-config --libraries`" + all_includes="$all_includes `$chipcard_dir/bin/libchipcard-config --includes`" + +cat >>confdefs.h <<\_ACEOF +#define HAS_LIBCHIPCARD 1 +_ACEOF + + define_has_libchipcard="#define HAS_LIBCHIPCARD" + + LIBCHIPCARD_LIB="`$chipcard_dir/bin/libchipcard-config --libraries` -lcardfs" + LIBCHIPCARD_INCLUDES="`$chipcard_dir/bin/libchipcard-config --includes`" + echo "$as_me:$LINENO: result: $chipcard_dir" >&5 +echo "${ECHO_T}$chipcard_dir" >&6 + all_libraries="$all_libraries $libchipcard_libs" + all_includes="$all_includes $libchipcard_includes" + opt_fs="$opt_fs cardfs" + fi +fi + + + +all_includes="$all_includes -I`pwd`/include" + + + + + + ac_config_files="$ac_config_files Makefile lufsd/Makefile filesystems/Makefile filesystems/localfs/Makefile filesystems/locasefs/Makefile filesystems/sshfs/Makefile filesystems/ftpfs/Makefile filesystems/cardfs/Makefile filesystems/cefs/Makefile filesystems/cefs/asyncd/Makefile filesystems/gvfs/Makefile filesystems/gnetfs/Makefile filesystems/wavfs/Makefile util/Makefile kernel/Makefile kernel/Linux/Makefile kernel/Linux/2.4/Makefile kernel/Linux/2.5/Makefile include/Makefile config/Makefile docs/Makefile man/Makefile" +cat >confcache <<\_ACEOF +# This file is a shell script that caches the results of configure +# tests run on this system so they can be shared between configure +# scripts and configure runs, see configure's option --config-cache. +# It is not useful on other systems. If it contains results you don't +# want to keep, you may remove or edit it. +# +# config.status only pays attention to the cache file if you give it +# the --recheck option to rerun configure. +# +# `ac_cv_env_foo' variables (set or unset) will be overridden when +# loading this file, other *unset* `ac_cv_foo' will be assigned the +# following values. + +_ACEOF + +# The following way of writing the cache mishandles newlines in values, +# but we know of no workaround that is simple, portable, and efficient. +# So, don't put newlines in cache variables' values. +# Ultrix sh set writes to stderr and can't be redirected directly, +# and sets the high bit in the cache file unless we assign to the vars. +{ + (set) 2>&1 | + case `(ac_space=' '; set | grep ac_space) 2>&1` in + *ac_space=\ *) + # `set' does not quote correctly, so add quotes (double-quote + # substitution turns \\\\ into \\, and sed turns \\ into \). + sed -n \ + "s/'/'\\\\''/g; + s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p" + ;; + *) + # `set' quotes correctly as required by POSIX, so do not add quotes. + sed -n \ + "s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1=\\2/p" + ;; + esac; +} | + sed ' + t clear + : clear + s/^\([^=]*\)=\(.*[{}].*\)$/test "${\1+set}" = set || &/ + t end + /^ac_cv_env/!s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/ + : end' >>confcache +if diff $cache_file confcache >/dev/null 2>&1; then :; else + if test -w $cache_file; then + test "x$cache_file" != "x/dev/null" && echo "updating cache $cache_file" + cat confcache >$cache_file + else + echo "not updating unwritable cache $cache_file" + fi +fi +rm -f confcache + +test "x$prefix" = xNONE && prefix=$ac_default_prefix +# Let make expand exec_prefix. +test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' + +# VPATH may cause trouble with some makes, so we remove $(srcdir), +# ${srcdir} and @srcdir@ from VPATH if srcdir is ".", strip leading and +# trailing colons and then remove the whole line if VPATH becomes empty +# (actually we leave an empty line to preserve line numbers). +if test "x$srcdir" = x.; then + ac_vpsub='/^[ ]*VPATH[ ]*=/{ +s/:*\$(srcdir):*/:/; +s/:*\${srcdir}:*/:/; +s/:*@srcdir@:*/:/; +s/^\([^=]*=[ ]*\):*/\1/; +s/:*$//; +s/^[^=]*=[ ]*$//; +}' +fi + +DEFS=-DHAVE_CONFIG_H + +ac_libobjs= +ac_ltlibobjs= +for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue + # 1. Remove the extension, and $U if already installed. + ac_i=`echo "$ac_i" | + sed 's/\$U\././;s/\.o$//;s/\.obj$//'` + # 2. Add them. + ac_libobjs="$ac_libobjs $ac_i\$U.$ac_objext" + ac_ltlibobjs="$ac_ltlibobjs $ac_i"'$U.lo' +done +LIBOBJS=$ac_libobjs + +LTLIBOBJS=$ac_ltlibobjs + + +if test -z "${AMDEP_TRUE}" && test -z "${AMDEP_FALSE}"; then + { { echo "$as_me:$LINENO: error: conditional \"AMDEP\" was never defined. +Usually this means the macro was only invoked conditionally." >&5 +echo "$as_me: error: conditional \"AMDEP\" was never defined. +Usually this means the macro was only invoked conditionally." >&2;} + { (exit 1); exit 1; }; } +fi +if test -z "${am__fastdepCC_TRUE}" && test -z "${am__fastdepCC_FALSE}"; then + { { echo "$as_me:$LINENO: error: conditional \"am__fastdepCC\" was never defined. +Usually this means the macro was only invoked conditionally." >&5 +echo "$as_me: error: conditional \"am__fastdepCC\" was never defined. +Usually this means the macro was only invoked conditionally." >&2;} + { (exit 1); exit 1; }; } +fi +if test -z "${am__fastdepCXX_TRUE}" && test -z "${am__fastdepCXX_FALSE}"; then + { { echo "$as_me:$LINENO: error: conditional \"am__fastdepCXX\" was never defined. +Usually this means the macro was only invoked conditionally." >&5 +echo "$as_me: error: conditional \"am__fastdepCXX\" was never defined. +Usually this means the macro was only invoked conditionally." >&2;} + { (exit 1); exit 1; }; } +fi + +: ${CONFIG_STATUS=./config.status} +ac_clean_files_save=$ac_clean_files +ac_clean_files="$ac_clean_files $CONFIG_STATUS" +{ echo "$as_me:$LINENO: creating $CONFIG_STATUS" >&5 +echo "$as_me: creating $CONFIG_STATUS" >&6;} +cat >$CONFIG_STATUS <<_ACEOF +#! $SHELL +# Generated by $as_me. +# Run this file to recreate the current configuration. +# Compiler output produced by configure, useful for debugging +# configure, is in config.log if it exists. + +debug=false +ac_cs_recheck=false +ac_cs_silent=false +SHELL=\${CONFIG_SHELL-$SHELL} +_ACEOF + +cat >>$CONFIG_STATUS <<\_ACEOF +## --------------------- ## +## M4sh Initialization. ## +## --------------------- ## + +# Be Bourne compatible +if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then + emulate sh + NULLCMD=: + # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which + # is contrary to our usage. Disable this feature. + alias -g '${1+"$@"}'='"$@"' +elif test -n "${BASH_VERSION+set}" && (set -o posix) >/dev/null 2>&1; then + set -o posix +fi + +# Support unset when possible. +if (FOO=FOO; unset FOO) >/dev/null 2>&1; then + as_unset=unset +else + as_unset=false +fi + + +# Work around bugs in pre-3.0 UWIN ksh. +$as_unset ENV MAIL MAILPATH +PS1='$ ' +PS2='> ' +PS4='+ ' + +# NLS nuisances. +for as_var in \ + LANG LANGUAGE LC_ADDRESS LC_ALL LC_COLLATE LC_CTYPE LC_IDENTIFICATION \ + LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER \ + LC_TELEPHONE LC_TIME +do + if (set +x; test -n "`(eval $as_var=C; export $as_var) 2>&1`"); then + eval $as_var=C; export $as_var + else + $as_unset $as_var + fi +done + +# Required to use basename. +if expr a : '\(a\)' >/dev/null 2>&1; then + as_expr=expr +else + as_expr=false +fi + +if (basename /) >/dev/null 2>&1 && test "X`basename / 2>&1`" = "X/"; then + as_basename=basename +else + as_basename=false +fi + + +# Name of the executable. +as_me=`$as_basename "$0" || +$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ + X"$0" : 'X\(//\)$' \| \ + X"$0" : 'X\(/\)$' \| \ + . : '\(.\)' 2>/dev/null || +echo X/"$0" | + sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/; q; } + /^X\/\(\/\/\)$/{ s//\1/; q; } + /^X\/\(\/\).*/{ s//\1/; q; } + s/.*/./; q'` + + +# PATH needs CR, and LINENO needs CR and PATH. +# Avoid depending upon Character Ranges. +as_cr_letters='abcdefghijklmnopqrstuvwxyz' +as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' +as_cr_Letters=$as_cr_letters$as_cr_LETTERS +as_cr_digits='0123456789' +as_cr_alnum=$as_cr_Letters$as_cr_digits + +# The user is always right. +if test "${PATH_SEPARATOR+set}" != set; then + echo "#! /bin/sh" >conf$$.sh + echo "exit 0" >>conf$$.sh + chmod +x conf$$.sh + if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then + PATH_SEPARATOR=';' + else + PATH_SEPARATOR=: + fi + rm -f conf$$.sh +fi + + + as_lineno_1=$LINENO + as_lineno_2=$LINENO + as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null` + test "x$as_lineno_1" != "x$as_lineno_2" && + test "x$as_lineno_3" = "x$as_lineno_2" || { + # Find who we are. Look in the path if we contain no path at all + # relative or not. + case $0 in + *[\\/]* ) as_myself=$0 ;; + *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break +done + + ;; + esac + # We did not find ourselves, most probably we were run as `sh COMMAND' + # in which case we are not to be found in the path. + if test "x$as_myself" = x; then + as_myself=$0 + fi + if test ! -f "$as_myself"; then + { { echo "$as_me:$LINENO: error: cannot find myself; rerun with an absolute path" >&5 +echo "$as_me: error: cannot find myself; rerun with an absolute path" >&2;} + { (exit 1); exit 1; }; } + fi + case $CONFIG_SHELL in + '') + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for as_base in sh bash ksh sh5; do + case $as_dir in + /*) + if ("$as_dir/$as_base" -c ' + as_lineno_1=$LINENO + as_lineno_2=$LINENO + as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null` + test "x$as_lineno_1" != "x$as_lineno_2" && + test "x$as_lineno_3" = "x$as_lineno_2" ') 2>/dev/null; then + $as_unset BASH_ENV || test "${BASH_ENV+set}" != set || { BASH_ENV=; export BASH_ENV; } + $as_unset ENV || test "${ENV+set}" != set || { ENV=; export ENV; } + CONFIG_SHELL=$as_dir/$as_base + export CONFIG_SHELL + exec "$CONFIG_SHELL" "$0" ${1+"$@"} + fi;; + esac + done +done +;; + esac + + # Create $as_me.lineno as a copy of $as_myself, but with $LINENO + # uniformly replaced by the line number. The first 'sed' inserts a + # line-number line before each line; the second 'sed' does the real + # work. The second script uses 'N' to pair each line-number line + # with the numbered line, and appends trailing '-' during + # substitution so that $LINENO is not a special case at line end. + # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the + # second 'sed' script. Blame Lee E. McMahon for sed's syntax. :-) + sed '=' <$as_myself | + sed ' + N + s,$,-, + : loop + s,^\(['$as_cr_digits']*\)\(.*\)[$]LINENO\([^'$as_cr_alnum'_]\),\1\2\1\3, + t loop + s,-$,, + s,^['$as_cr_digits']*\n,, + ' >$as_me.lineno && + chmod +x $as_me.lineno || + { { echo "$as_me:$LINENO: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&5 +echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2;} + { (exit 1); exit 1; }; } + + # Don't try to exec as it changes $[0], causing all sort of problems + # (the dirname of $[0] is not the place where we might find the + # original and so on. Autoconf is especially sensible to this). + . ./$as_me.lineno + # Exit status is that of the last command. + exit +} + + +case `echo "testing\c"; echo 1,2,3`,`echo -n testing; echo 1,2,3` in + *c*,-n*) ECHO_N= ECHO_C=' +' ECHO_T=' ' ;; + *c*,* ) ECHO_N=-n ECHO_C= ECHO_T= ;; + *) ECHO_N= ECHO_C='\c' ECHO_T= ;; +esac + +if expr a : '\(a\)' >/dev/null 2>&1; then + as_expr=expr +else + as_expr=false +fi + +rm -f conf$$ conf$$.exe conf$$.file +echo >conf$$.file +if ln -s conf$$.file conf$$ 2>/dev/null; then + # We could just check for DJGPP; but this test a) works b) is more generic + # and c) will remain valid once DJGPP supports symlinks (DJGPP 2.04). + if test -f conf$$.exe; then + # Don't use ln at all; we don't have any links + as_ln_s='cp -p' + else + as_ln_s='ln -s' + fi +elif ln conf$$.file conf$$ 2>/dev/null; then + as_ln_s=ln +else + as_ln_s='cp -p' +fi +rm -f conf$$ conf$$.exe conf$$.file + +if mkdir -p . 2>/dev/null; then + as_mkdir_p=: +else + as_mkdir_p=false +fi + +as_executable_p="test -f" + +# Sed expression to map a string onto a valid CPP name. +as_tr_cpp="sed y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g" + +# Sed expression to map a string onto a valid variable name. +as_tr_sh="sed y%*+%pp%;s%[^_$as_cr_alnum]%_%g" + + +# IFS +# We need space, tab and new line, in precisely that order. +as_nl=' +' +IFS=" $as_nl" + +# CDPATH. +$as_unset CDPATH + +exec 6>&1 + +# Open the log real soon, to keep \$[0] and so on meaningful, and to +# report actual input values of CONFIG_FILES etc. instead of their +# values after options handling. Logging --version etc. is OK. +exec 5>>config.log +{ + echo + sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX +## Running $as_me. ## +_ASBOX +} >&5 +cat >&5 <<_CSEOF + +This file was extended by $as_me, which was +generated by GNU Autoconf 2.57. Invocation command line was + + CONFIG_FILES = $CONFIG_FILES + CONFIG_HEADERS = $CONFIG_HEADERS + CONFIG_LINKS = $CONFIG_LINKS + CONFIG_COMMANDS = $CONFIG_COMMANDS + $ $0 $@ + +_CSEOF +echo "on `(hostname || uname -n) 2>/dev/null | sed 1q`" >&5 +echo >&5 +_ACEOF + +# Files that config.status was made for. +if test -n "$ac_config_files"; then + echo "config_files=\"$ac_config_files\"" >>$CONFIG_STATUS +fi + +if test -n "$ac_config_headers"; then + echo "config_headers=\"$ac_config_headers\"" >>$CONFIG_STATUS +fi + +if test -n "$ac_config_links"; then + echo "config_links=\"$ac_config_links\"" >>$CONFIG_STATUS +fi + +if test -n "$ac_config_commands"; then + echo "config_commands=\"$ac_config_commands\"" >>$CONFIG_STATUS +fi + +cat >>$CONFIG_STATUS <<\_ACEOF + +ac_cs_usage="\ +\`$as_me' instantiates files from templates according to the +current configuration. + +Usage: $0 [OPTIONS] [FILE]... + + -h, --help print this help, then exit + -V, --version print version number, then exit + -q, --quiet do not print progress messages + -d, --debug don't remove temporary files + --recheck update $as_me by reconfiguring in the same conditions + --file=FILE[:TEMPLATE] + instantiate the configuration file FILE + --header=FILE[:TEMPLATE] + instantiate the configuration header FILE + +Configuration files: +$config_files + +Configuration headers: +$config_headers + +Configuration commands: +$config_commands + +Report bugs to ." +_ACEOF + +cat >>$CONFIG_STATUS <<_ACEOF +ac_cs_version="\\ +config.status +configured by $0, generated by GNU Autoconf 2.57, + with options \\"`echo "$ac_configure_args" | sed 's/[\\""\`\$]/\\\\&/g'`\\" + +Copyright 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001 +Free Software Foundation, Inc. +This config.status script is free software; the Free Software Foundation +gives unlimited permission to copy, distribute and modify it." +srcdir=$srcdir +INSTALL="$INSTALL" +_ACEOF + +cat >>$CONFIG_STATUS <<\_ACEOF +# If no file are specified by the user, then we need to provide default +# value. By we need to know if files were specified by the user. +ac_need_defaults=: +while test $# != 0 +do + case $1 in + --*=*) + ac_option=`expr "x$1" : 'x\([^=]*\)='` + ac_optarg=`expr "x$1" : 'x[^=]*=\(.*\)'` + ac_shift=: + ;; + -*) + ac_option=$1 + ac_optarg=$2 + ac_shift=shift + ;; + *) # This is not an option, so the user has probably given explicit + # arguments. + ac_option=$1 + ac_need_defaults=false;; + esac + + case $ac_option in + # Handling of the options. +_ACEOF +cat >>$CONFIG_STATUS <<\_ACEOF + -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) + ac_cs_recheck=: ;; + --version | --vers* | -V ) + echo "$ac_cs_version"; exit 0 ;; + --he | --h) + # Conflict between --help and --header + { { echo "$as_me:$LINENO: error: ambiguous option: $1 +Try \`$0 --help' for more information." >&5 +echo "$as_me: error: ambiguous option: $1 +Try \`$0 --help' for more information." >&2;} + { (exit 1); exit 1; }; };; + --help | --hel | -h ) + echo "$ac_cs_usage"; exit 0 ;; + --debug | --d* | -d ) + debug=: ;; + --file | --fil | --fi | --f ) + $ac_shift + CONFIG_FILES="$CONFIG_FILES $ac_optarg" + ac_need_defaults=false;; + --header | --heade | --head | --hea ) + $ac_shift + CONFIG_HEADERS="$CONFIG_HEADERS $ac_optarg" + ac_need_defaults=false;; + -q | -quiet | --quiet | --quie | --qui | --qu | --q \ + | -silent | --silent | --silen | --sile | --sil | --si | --s) + ac_cs_silent=: ;; + + # This is an error. + -*) { { echo "$as_me:$LINENO: error: unrecognized option: $1 +Try \`$0 --help' for more information." >&5 +echo "$as_me: error: unrecognized option: $1 +Try \`$0 --help' for more information." >&2;} + { (exit 1); exit 1; }; } ;; + + *) ac_config_targets="$ac_config_targets $1" ;; + + esac + shift +done + +ac_configure_extra_args= + +if $ac_cs_silent; then + exec 6>/dev/null + ac_configure_extra_args="$ac_configure_extra_args --silent" +fi + +_ACEOF +cat >>$CONFIG_STATUS <<_ACEOF +if \$ac_cs_recheck; then + echo "running $SHELL $0 " $ac_configure_args \$ac_configure_extra_args " --no-create --no-recursion" >&6 + exec $SHELL $0 $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion +fi + +_ACEOF + +cat >>$CONFIG_STATUS <<_ACEOF +# +# INIT-COMMANDS section. +# + +AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir" + +_ACEOF + + + +cat >>$CONFIG_STATUS <<\_ACEOF +for ac_config_target in $ac_config_targets +do + case "$ac_config_target" in + # Handling of arguments. + "Makefile" ) CONFIG_FILES="$CONFIG_FILES Makefile" ;; + "lufsd/Makefile" ) CONFIG_FILES="$CONFIG_FILES lufsd/Makefile" ;; + "filesystems/Makefile" ) CONFIG_FILES="$CONFIG_FILES filesystems/Makefile" ;; + "filesystems/localfs/Makefile" ) CONFIG_FILES="$CONFIG_FILES filesystems/localfs/Makefile" ;; + "filesystems/locasefs/Makefile" ) CONFIG_FILES="$CONFIG_FILES filesystems/locasefs/Makefile" ;; + "filesystems/sshfs/Makefile" ) CONFIG_FILES="$CONFIG_FILES filesystems/sshfs/Makefile" ;; + "filesystems/ftpfs/Makefile" ) CONFIG_FILES="$CONFIG_FILES filesystems/ftpfs/Makefile" ;; + "filesystems/cardfs/Makefile" ) CONFIG_FILES="$CONFIG_FILES filesystems/cardfs/Makefile" ;; + "filesystems/cefs/Makefile" ) CONFIG_FILES="$CONFIG_FILES filesystems/cefs/Makefile" ;; + "filesystems/cefs/asyncd/Makefile" ) CONFIG_FILES="$CONFIG_FILES filesystems/cefs/asyncd/Makefile" ;; + "filesystems/gvfs/Makefile" ) CONFIG_FILES="$CONFIG_FILES filesystems/gvfs/Makefile" ;; + "filesystems/gnetfs/Makefile" ) CONFIG_FILES="$CONFIG_FILES filesystems/gnetfs/Makefile" ;; + "filesystems/wavfs/Makefile" ) CONFIG_FILES="$CONFIG_FILES filesystems/wavfs/Makefile" ;; + "util/Makefile" ) CONFIG_FILES="$CONFIG_FILES util/Makefile" ;; + "kernel/Makefile" ) CONFIG_FILES="$CONFIG_FILES kernel/Makefile" ;; + "kernel/Linux/Makefile" ) CONFIG_FILES="$CONFIG_FILES kernel/Linux/Makefile" ;; + "kernel/Linux/2.4/Makefile" ) CONFIG_FILES="$CONFIG_FILES kernel/Linux/2.4/Makefile" ;; + "kernel/Linux/2.5/Makefile" ) CONFIG_FILES="$CONFIG_FILES kernel/Linux/2.5/Makefile" ;; + "include/Makefile" ) CONFIG_FILES="$CONFIG_FILES include/Makefile" ;; + "config/Makefile" ) CONFIG_FILES="$CONFIG_FILES config/Makefile" ;; + "docs/Makefile" ) CONFIG_FILES="$CONFIG_FILES docs/Makefile" ;; + "man/Makefile" ) CONFIG_FILES="$CONFIG_FILES man/Makefile" ;; + "depfiles" ) CONFIG_COMMANDS="$CONFIG_COMMANDS depfiles" ;; + "config.h" ) CONFIG_HEADERS="$CONFIG_HEADERS config.h" ;; + *) { { echo "$as_me:$LINENO: error: invalid argument: $ac_config_target" >&5 +echo "$as_me: error: invalid argument: $ac_config_target" >&2;} + { (exit 1); exit 1; }; };; + esac +done + +# If the user did not use the arguments to specify the items to instantiate, +# then the envvar interface is used. Set only those that are not. +# We use the long form for the default assignment because of an extremely +# bizarre bug on SunOS 4.1.3. +if $ac_need_defaults; then + test "${CONFIG_FILES+set}" = set || CONFIG_FILES=$config_files + test "${CONFIG_HEADERS+set}" = set || CONFIG_HEADERS=$config_headers + test "${CONFIG_COMMANDS+set}" = set || CONFIG_COMMANDS=$config_commands +fi + +# Have a temporary directory for convenience. Make it in the build tree +# simply because there is no reason to put it here, and in addition, +# creating and moving files from /tmp can sometimes cause problems. +# Create a temporary directory, and hook for its removal unless debugging. +$debug || +{ + trap 'exit_status=$?; rm -rf $tmp && exit $exit_status' 0 + trap '{ (exit 1); exit 1; }' 1 2 13 15 +} + +# Create a (secure) tmp directory for tmp files. + +{ + tmp=`(umask 077 && mktemp -d -q "./confstatXXXXXX") 2>/dev/null` && + test -n "$tmp" && test -d "$tmp" +} || +{ + tmp=./confstat$$-$RANDOM + (umask 077 && mkdir $tmp) +} || +{ + echo "$me: cannot create a temporary directory in ." >&2 + { (exit 1); exit 1; } +} + +_ACEOF + +cat >>$CONFIG_STATUS <<_ACEOF + +# +# CONFIG_FILES section. +# + +# No need to generate the scripts if there are no CONFIG_FILES. +# This happens for instance when ./config.status config.h +if test -n "\$CONFIG_FILES"; then + # Protect against being on the right side of a sed subst in config.status. + sed 's/,@/@@/; s/@,/@@/; s/,;t t\$/@;t t/; /@;t t\$/s/[\\\\&,]/\\\\&/g; + s/@@/,@/; s/@@/@,/; s/@;t t\$/,;t t/' >\$tmp/subs.sed <<\\CEOF +s,@SHELL@,$SHELL,;t t +s,@PATH_SEPARATOR@,$PATH_SEPARATOR,;t t +s,@PACKAGE_NAME@,$PACKAGE_NAME,;t t +s,@PACKAGE_TARNAME@,$PACKAGE_TARNAME,;t t +s,@PACKAGE_VERSION@,$PACKAGE_VERSION,;t t +s,@PACKAGE_STRING@,$PACKAGE_STRING,;t t +s,@PACKAGE_BUGREPORT@,$PACKAGE_BUGREPORT,;t t +s,@exec_prefix@,$exec_prefix,;t t +s,@prefix@,$prefix,;t t +s,@program_transform_name@,$program_transform_name,;t t +s,@bindir@,$bindir,;t t +s,@sbindir@,$sbindir,;t t +s,@libexecdir@,$libexecdir,;t t +s,@datadir@,$datadir,;t t +s,@sysconfdir@,$sysconfdir,;t t +s,@sharedstatedir@,$sharedstatedir,;t t +s,@localstatedir@,$localstatedir,;t t +s,@libdir@,$libdir,;t t +s,@includedir@,$includedir,;t t +s,@oldincludedir@,$oldincludedir,;t t +s,@infodir@,$infodir,;t t +s,@mandir@,$mandir,;t t +s,@build_alias@,$build_alias,;t t +s,@host_alias@,$host_alias,;t t +s,@target_alias@,$target_alias,;t t +s,@DEFS@,$DEFS,;t t +s,@ECHO_C@,$ECHO_C,;t t +s,@ECHO_N@,$ECHO_N,;t t +s,@ECHO_T@,$ECHO_T,;t t +s,@LIBS@,$LIBS,;t t +s,@build@,$build,;t t +s,@build_cpu@,$build_cpu,;t t +s,@build_vendor@,$build_vendor,;t t +s,@build_os@,$build_os,;t t +s,@host@,$host,;t t +s,@host_cpu@,$host_cpu,;t t +s,@host_vendor@,$host_vendor,;t t +s,@host_os@,$host_os,;t t +s,@target@,$target,;t t +s,@target_cpu@,$target_cpu,;t t +s,@target_vendor@,$target_vendor,;t t +s,@target_os@,$target_os,;t t +s,@INSTALL_PROGRAM@,$INSTALL_PROGRAM,;t t +s,@INSTALL_SCRIPT@,$INSTALL_SCRIPT,;t t +s,@INSTALL_DATA@,$INSTALL_DATA,;t t +s,@CYGPATH_W@,$CYGPATH_W,;t t +s,@PACKAGE@,$PACKAGE,;t t +s,@VERSION@,$VERSION,;t t +s,@ACLOCAL@,$ACLOCAL,;t t +s,@AUTOCONF@,$AUTOCONF,;t t +s,@AUTOMAKE@,$AUTOMAKE,;t t +s,@AUTOHEADER@,$AUTOHEADER,;t t +s,@MAKEINFO@,$MAKEINFO,;t t +s,@AMTAR@,$AMTAR,;t t +s,@install_sh@,$install_sh,;t t +s,@STRIP@,$STRIP,;t t +s,@ac_ct_STRIP@,$ac_ct_STRIP,;t t +s,@INSTALL_STRIP_PROGRAM@,$INSTALL_STRIP_PROGRAM,;t t +s,@AWK@,$AWK,;t t +s,@SET_MAKE@,$SET_MAKE,;t t +s,@am__leading_dot@,$am__leading_dot,;t t +s,@MODV_FLAGS@,$MODV_FLAGS,;t t +s,@KERNEL_DIR@,$KERNEL_DIR,;t t +s,@MODULES_DIR@,$MODULES_DIR,;t t +s,@KERNEL_HDR@,$KERNEL_HDR,;t t +s,@OS_DIR@,$OS_DIR,;t t +s,@DEBUG_FLAGS@,$DEBUG_FLAGS,;t t +s,@KDEBUG_FLAGS@,$KDEBUG_FLAGS,;t t +s,@AUTOFS_INSTALL@,$AUTOFS_INSTALL,;t t +s,@LUFS_SUID@,$LUFS_SUID,;t t +s,@CC@,$CC,;t t +s,@CFLAGS@,$CFLAGS,;t t +s,@LDFLAGS@,$LDFLAGS,;t t +s,@CPPFLAGS@,$CPPFLAGS,;t t +s,@ac_ct_CC@,$ac_ct_CC,;t t +s,@EXEEXT@,$EXEEXT,;t t +s,@OBJEXT@,$OBJEXT,;t t +s,@DEPDIR@,$DEPDIR,;t t +s,@am__include@,$am__include,;t t +s,@am__quote@,$am__quote,;t t +s,@AMDEP_TRUE@,$AMDEP_TRUE,;t t +s,@AMDEP_FALSE@,$AMDEP_FALSE,;t t +s,@AMDEPBACKSLASH@,$AMDEPBACKSLASH,;t t +s,@CCDEPMODE@,$CCDEPMODE,;t t +s,@am__fastdepCC_TRUE@,$am__fastdepCC_TRUE,;t t +s,@am__fastdepCC_FALSE@,$am__fastdepCC_FALSE,;t t +s,@CPP@,$CPP,;t t +s,@CXX@,$CXX,;t t +s,@CXXFLAGS@,$CXXFLAGS,;t t +s,@ac_ct_CXX@,$ac_ct_CXX,;t t +s,@CXXDEPMODE@,$CXXDEPMODE,;t t +s,@am__fastdepCXX_TRUE@,$am__fastdepCXX_TRUE,;t t +s,@am__fastdepCXX_FALSE@,$am__fastdepCXX_FALSE,;t t +s,@LN_S@,$LN_S,;t t +s,@ECHO@,$ECHO,;t t +s,@RANLIB@,$RANLIB,;t t +s,@ac_ct_RANLIB@,$ac_ct_RANLIB,;t t +s,@EGREP@,$EGREP,;t t +s,@LIBTOOL@,$LIBTOOL,;t t +s,@SSHPROG@,$SSHPROG,;t t +s,@GCONF@,$GCONF,;t t +s,@GVFSCONF@,$GVFSCONF,;t t +s,@GVFS_LDADD@,$GVFS_LDADD,;t t +s,@GVFS_CFLAGS@,$GVFS_CFLAGS,;t t +s,@define_has_libchipcard@,$define_has_libchipcard,;t t +s,@LIBCHIPCARD_LIB@,$LIBCHIPCARD_LIB,;t t +s,@LIBCHIPCARD_INCLUDES@,$LIBCHIPCARD_INCLUDES,;t t +s,@opt_fs@,$opt_fs,;t t +s,@all_includes@,$all_includes,;t t +s,@all_libraries@,$all_libraries,;t t +s,@LIBOBJS@,$LIBOBJS,;t t +s,@LTLIBOBJS@,$LTLIBOBJS,;t t +CEOF + +_ACEOF + + cat >>$CONFIG_STATUS <<\_ACEOF + # Split the substitutions into bite-sized pieces for seds with + # small command number limits, like on Digital OSF/1 and HP-UX. + ac_max_sed_lines=48 + ac_sed_frag=1 # Number of current file. + ac_beg=1 # First line for current file. + ac_end=$ac_max_sed_lines # Line after last line for current file. + ac_more_lines=: + ac_sed_cmds= + while $ac_more_lines; do + if test $ac_beg -gt 1; then + sed "1,${ac_beg}d; ${ac_end}q" $tmp/subs.sed >$tmp/subs.frag + else + sed "${ac_end}q" $tmp/subs.sed >$tmp/subs.frag + fi + if test ! -s $tmp/subs.frag; then + ac_more_lines=false + else + # The purpose of the label and of the branching condition is to + # speed up the sed processing (if there are no `@' at all, there + # is no need to browse any of the substitutions). + # These are the two extra sed commands mentioned above. + (echo ':t + /@[a-zA-Z_][a-zA-Z_0-9]*@/!b' && cat $tmp/subs.frag) >$tmp/subs-$ac_sed_frag.sed + if test -z "$ac_sed_cmds"; then + ac_sed_cmds="sed -f $tmp/subs-$ac_sed_frag.sed" + else + ac_sed_cmds="$ac_sed_cmds | sed -f $tmp/subs-$ac_sed_frag.sed" + fi + ac_sed_frag=`expr $ac_sed_frag + 1` + ac_beg=$ac_end + ac_end=`expr $ac_end + $ac_max_sed_lines` + fi + done + if test -z "$ac_sed_cmds"; then + ac_sed_cmds=cat + fi +fi # test -n "$CONFIG_FILES" + +_ACEOF +cat >>$CONFIG_STATUS <<\_ACEOF +for ac_file in : $CONFIG_FILES; do test "x$ac_file" = x: && continue + # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in". + case $ac_file in + - | *:- | *:-:* ) # input from stdin + cat >$tmp/stdin + ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'` + ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; + *:* ) ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'` + ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; + * ) ac_file_in=$ac_file.in ;; + esac + + # Compute @srcdir@, @top_srcdir@, and @INSTALL@ for subdirectories. + ac_dir=`(dirname "$ac_file") 2>/dev/null || +$as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$ac_file" : 'X\(//\)[^/]' \| \ + X"$ac_file" : 'X\(//\)$' \| \ + X"$ac_file" : 'X\(/\)' \| \ + . : '\(.\)' 2>/dev/null || +echo X"$ac_file" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } + /^X\(\/\/\)[^/].*/{ s//\1/; q; } + /^X\(\/\/\)$/{ s//\1/; q; } + /^X\(\/\).*/{ s//\1/; q; } + s/.*/./; q'` + { if $as_mkdir_p; then + mkdir -p "$ac_dir" + else + as_dir="$ac_dir" + as_dirs= + while test ! -d "$as_dir"; do + as_dirs="$as_dir $as_dirs" + as_dir=`(dirname "$as_dir") 2>/dev/null || +$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$as_dir" : 'X\(//\)[^/]' \| \ + X"$as_dir" : 'X\(//\)$' \| \ + X"$as_dir" : 'X\(/\)' \| \ + . : '\(.\)' 2>/dev/null || +echo X"$as_dir" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } + /^X\(\/\/\)[^/].*/{ s//\1/; q; } + /^X\(\/\/\)$/{ s//\1/; q; } + /^X\(\/\).*/{ s//\1/; q; } + s/.*/./; q'` + done + test ! -n "$as_dirs" || mkdir $as_dirs + fi || { { echo "$as_me:$LINENO: error: cannot create directory \"$ac_dir\"" >&5 +echo "$as_me: error: cannot create directory \"$ac_dir\"" >&2;} + { (exit 1); exit 1; }; }; } + + ac_builddir=. + +if test "$ac_dir" != .; then + ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'` + # A "../" for each directory in $ac_dir_suffix. + ac_top_builddir=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,../,g'` +else + ac_dir_suffix= ac_top_builddir= +fi + +case $srcdir in + .) # No --srcdir option. We are building in place. + ac_srcdir=. + if test -z "$ac_top_builddir"; then + ac_top_srcdir=. + else + ac_top_srcdir=`echo $ac_top_builddir | sed 's,/$,,'` + fi ;; + [\\/]* | ?:[\\/]* ) # Absolute path. + ac_srcdir=$srcdir$ac_dir_suffix; + ac_top_srcdir=$srcdir ;; + *) # Relative path. + ac_srcdir=$ac_top_builddir$srcdir$ac_dir_suffix + ac_top_srcdir=$ac_top_builddir$srcdir ;; +esac +# Don't blindly perform a `cd "$ac_dir"/$ac_foo && pwd` since $ac_foo can be +# absolute. +ac_abs_builddir=`cd "$ac_dir" && cd $ac_builddir && pwd` +ac_abs_top_builddir=`cd "$ac_dir" && cd ${ac_top_builddir}. && pwd` +ac_abs_srcdir=`cd "$ac_dir" && cd $ac_srcdir && pwd` +ac_abs_top_srcdir=`cd "$ac_dir" && cd $ac_top_srcdir && pwd` + + + case $INSTALL in + [\\/$]* | ?:[\\/]* ) ac_INSTALL=$INSTALL ;; + *) ac_INSTALL=$ac_top_builddir$INSTALL ;; + esac + + if test x"$ac_file" != x-; then + { echo "$as_me:$LINENO: creating $ac_file" >&5 +echo "$as_me: creating $ac_file" >&6;} + rm -f "$ac_file" + fi + # Let's still pretend it is `configure' which instantiates (i.e., don't + # use $as_me), people would be surprised to read: + # /* config.h. Generated by config.status. */ + if test x"$ac_file" = x-; then + configure_input= + else + configure_input="$ac_file. " + fi + configure_input=$configure_input"Generated from `echo $ac_file_in | + sed 's,.*/,,'` by configure." + + # First look for the input files in the build tree, otherwise in the + # src tree. + ac_file_inputs=`IFS=: + for f in $ac_file_in; do + case $f in + -) echo $tmp/stdin ;; + [\\/$]*) + # Absolute (can't be DOS-style, as IFS=:) + test -f "$f" || { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5 +echo "$as_me: error: cannot find input file: $f" >&2;} + { (exit 1); exit 1; }; } + echo $f;; + *) # Relative + if test -f "$f"; then + # Build tree + echo $f + elif test -f "$srcdir/$f"; then + # Source tree + echo $srcdir/$f + else + # /dev/null tree + { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5 +echo "$as_me: error: cannot find input file: $f" >&2;} + { (exit 1); exit 1; }; } + fi;; + esac + done` || { (exit 1); exit 1; } +_ACEOF +cat >>$CONFIG_STATUS <<_ACEOF + sed "$ac_vpsub +$extrasub +_ACEOF +cat >>$CONFIG_STATUS <<\_ACEOF +:t +/@[a-zA-Z_][a-zA-Z_0-9]*@/!b +s,@configure_input@,$configure_input,;t t +s,@srcdir@,$ac_srcdir,;t t +s,@abs_srcdir@,$ac_abs_srcdir,;t t +s,@top_srcdir@,$ac_top_srcdir,;t t +s,@abs_top_srcdir@,$ac_abs_top_srcdir,;t t +s,@builddir@,$ac_builddir,;t t +s,@abs_builddir@,$ac_abs_builddir,;t t +s,@top_builddir@,$ac_top_builddir,;t t +s,@abs_top_builddir@,$ac_abs_top_builddir,;t t +s,@INSTALL@,$ac_INSTALL,;t t +" $ac_file_inputs | (eval "$ac_sed_cmds") >$tmp/out + rm -f $tmp/stdin + if test x"$ac_file" != x-; then + mv $tmp/out $ac_file + else + cat $tmp/out + rm -f $tmp/out + fi + +done +_ACEOF +cat >>$CONFIG_STATUS <<\_ACEOF + +# +# CONFIG_HEADER section. +# + +# These sed commands are passed to sed as "A NAME B NAME C VALUE D", where +# NAME is the cpp macro being defined and VALUE is the value it is being given. +# +# ac_d sets the value in "#define NAME VALUE" lines. +ac_dA='s,^\([ ]*\)#\([ ]*define[ ][ ]*\)' +ac_dB='[ ].*$,\1#\2' +ac_dC=' ' +ac_dD=',;t' +# ac_u turns "#undef NAME" without trailing blanks into "#define NAME VALUE". +ac_uA='s,^\([ ]*\)#\([ ]*\)undef\([ ][ ]*\)' +ac_uB='$,\1#\2define\3' +ac_uC=' ' +ac_uD=',;t' + +for ac_file in : $CONFIG_HEADERS; do test "x$ac_file" = x: && continue + # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in". + case $ac_file in + - | *:- | *:-:* ) # input from stdin + cat >$tmp/stdin + ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'` + ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; + *:* ) ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'` + ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; + * ) ac_file_in=$ac_file.in ;; + esac + + test x"$ac_file" != x- && { echo "$as_me:$LINENO: creating $ac_file" >&5 +echo "$as_me: creating $ac_file" >&6;} + + # First look for the input files in the build tree, otherwise in the + # src tree. + ac_file_inputs=`IFS=: + for f in $ac_file_in; do + case $f in + -) echo $tmp/stdin ;; + [\\/$]*) + # Absolute (can't be DOS-style, as IFS=:) + test -f "$f" || { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5 +echo "$as_me: error: cannot find input file: $f" >&2;} + { (exit 1); exit 1; }; } + echo $f;; + *) # Relative + if test -f "$f"; then + # Build tree + echo $f + elif test -f "$srcdir/$f"; then + # Source tree + echo $srcdir/$f + else + # /dev/null tree + { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5 +echo "$as_me: error: cannot find input file: $f" >&2;} + { (exit 1); exit 1; }; } + fi;; + esac + done` || { (exit 1); exit 1; } + # Remove the trailing spaces. + sed 's/[ ]*$//' $ac_file_inputs >$tmp/in + +_ACEOF + +# Transform confdefs.h into two sed scripts, `conftest.defines' and +# `conftest.undefs', that substitutes the proper values into +# config.h.in to produce config.h. The first handles `#define' +# templates, and the second `#undef' templates. +# And first: Protect against being on the right side of a sed subst in +# config.status. Protect against being in an unquoted here document +# in config.status. +rm -f conftest.defines conftest.undefs +# Using a here document instead of a string reduces the quoting nightmare. +# Putting comments in sed scripts is not portable. +# +# `end' is used to avoid that the second main sed command (meant for +# 0-ary CPP macros) applies to n-ary macro definitions. +# See the Autoconf documentation for `clear'. +cat >confdef2sed.sed <<\_ACEOF +s/[\\&,]/\\&/g +s,[\\$`],\\&,g +t clear +: clear +s,^[ ]*#[ ]*define[ ][ ]*\([^ (][^ (]*\)\(([^)]*)\)[ ]*\(.*\)$,${ac_dA}\1${ac_dB}\1\2${ac_dC}\3${ac_dD},gp +t end +s,^[ ]*#[ ]*define[ ][ ]*\([^ ][^ ]*\)[ ]*\(.*\)$,${ac_dA}\1${ac_dB}\1${ac_dC}\2${ac_dD},gp +: end +_ACEOF +# If some macros were called several times there might be several times +# the same #defines, which is useless. Nevertheless, we may not want to +# sort them, since we want the *last* AC-DEFINE to be honored. +uniq confdefs.h | sed -n -f confdef2sed.sed >conftest.defines +sed 's/ac_d/ac_u/g' conftest.defines >conftest.undefs +rm -f confdef2sed.sed + +# This sed command replaces #undef with comments. This is necessary, for +# example, in the case of _POSIX_SOURCE, which is predefined and required +# on some systems where configure will not decide to define it. +cat >>conftest.undefs <<\_ACEOF +s,^[ ]*#[ ]*undef[ ][ ]*[a-zA-Z_][a-zA-Z_0-9]*,/* & */, +_ACEOF + +# Break up conftest.defines because some shells have a limit on the size +# of here documents, and old seds have small limits too (100 cmds). +echo ' # Handle all the #define templates only if necessary.' >>$CONFIG_STATUS +echo ' if grep "^[ ]*#[ ]*define" $tmp/in >/dev/null; then' >>$CONFIG_STATUS +echo ' # If there are no defines, we may have an empty if/fi' >>$CONFIG_STATUS +echo ' :' >>$CONFIG_STATUS +rm -f conftest.tail +while grep . conftest.defines >/dev/null +do + # Write a limited-size here document to $tmp/defines.sed. + echo ' cat >$tmp/defines.sed <>$CONFIG_STATUS + # Speed up: don't consider the non `#define' lines. + echo '/^[ ]*#[ ]*define/!b' >>$CONFIG_STATUS + # Work around the forget-to-reset-the-flag bug. + echo 't clr' >>$CONFIG_STATUS + echo ': clr' >>$CONFIG_STATUS + sed ${ac_max_here_lines}q conftest.defines >>$CONFIG_STATUS + echo 'CEOF + sed -f $tmp/defines.sed $tmp/in >$tmp/out + rm -f $tmp/in + mv $tmp/out $tmp/in +' >>$CONFIG_STATUS + sed 1,${ac_max_here_lines}d conftest.defines >conftest.tail + rm -f conftest.defines + mv conftest.tail conftest.defines +done +rm -f conftest.defines +echo ' fi # grep' >>$CONFIG_STATUS +echo >>$CONFIG_STATUS + +# Break up conftest.undefs because some shells have a limit on the size +# of here documents, and old seds have small limits too (100 cmds). +echo ' # Handle all the #undef templates' >>$CONFIG_STATUS +rm -f conftest.tail +while grep . conftest.undefs >/dev/null +do + # Write a limited-size here document to $tmp/undefs.sed. + echo ' cat >$tmp/undefs.sed <>$CONFIG_STATUS + # Speed up: don't consider the non `#undef' + echo '/^[ ]*#[ ]*undef/!b' >>$CONFIG_STATUS + # Work around the forget-to-reset-the-flag bug. + echo 't clr' >>$CONFIG_STATUS + echo ': clr' >>$CONFIG_STATUS + sed ${ac_max_here_lines}q conftest.undefs >>$CONFIG_STATUS + echo 'CEOF + sed -f $tmp/undefs.sed $tmp/in >$tmp/out + rm -f $tmp/in + mv $tmp/out $tmp/in +' >>$CONFIG_STATUS + sed 1,${ac_max_here_lines}d conftest.undefs >conftest.tail + rm -f conftest.undefs + mv conftest.tail conftest.undefs +done +rm -f conftest.undefs + +cat >>$CONFIG_STATUS <<\_ACEOF + # Let's still pretend it is `configure' which instantiates (i.e., don't + # use $as_me), people would be surprised to read: + # /* config.h. Generated by config.status. */ + if test x"$ac_file" = x-; then + echo "/* Generated by configure. */" >$tmp/config.h + else + echo "/* $ac_file. Generated by configure. */" >$tmp/config.h + fi + cat $tmp/in >>$tmp/config.h + rm -f $tmp/in + if test x"$ac_file" != x-; then + if diff $ac_file $tmp/config.h >/dev/null 2>&1; then + { echo "$as_me:$LINENO: $ac_file is unchanged" >&5 +echo "$as_me: $ac_file is unchanged" >&6;} + else + ac_dir=`(dirname "$ac_file") 2>/dev/null || +$as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$ac_file" : 'X\(//\)[^/]' \| \ + X"$ac_file" : 'X\(//\)$' \| \ + X"$ac_file" : 'X\(/\)' \| \ + . : '\(.\)' 2>/dev/null || +echo X"$ac_file" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } + /^X\(\/\/\)[^/].*/{ s//\1/; q; } + /^X\(\/\/\)$/{ s//\1/; q; } + /^X\(\/\).*/{ s//\1/; q; } + s/.*/./; q'` + { if $as_mkdir_p; then + mkdir -p "$ac_dir" + else + as_dir="$ac_dir" + as_dirs= + while test ! -d "$as_dir"; do + as_dirs="$as_dir $as_dirs" + as_dir=`(dirname "$as_dir") 2>/dev/null || +$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$as_dir" : 'X\(//\)[^/]' \| \ + X"$as_dir" : 'X\(//\)$' \| \ + X"$as_dir" : 'X\(/\)' \| \ + . : '\(.\)' 2>/dev/null || +echo X"$as_dir" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } + /^X\(\/\/\)[^/].*/{ s//\1/; q; } + /^X\(\/\/\)$/{ s//\1/; q; } + /^X\(\/\).*/{ s//\1/; q; } + s/.*/./; q'` + done + test ! -n "$as_dirs" || mkdir $as_dirs + fi || { { echo "$as_me:$LINENO: error: cannot create directory \"$ac_dir\"" >&5 +echo "$as_me: error: cannot create directory \"$ac_dir\"" >&2;} + { (exit 1); exit 1; }; }; } + + rm -f $ac_file + mv $tmp/config.h $ac_file + fi + else + cat $tmp/config.h + rm -f $tmp/config.h + fi +# Compute $ac_file's index in $config_headers. +_am_stamp_count=1 +for _am_header in $config_headers :; do + case $_am_header in + $ac_file | $ac_file:* ) + break ;; + * ) + _am_stamp_count=`expr $_am_stamp_count + 1` ;; + esac +done +echo "timestamp for $ac_file" >`(dirname $ac_file) 2>/dev/null || +$as_expr X$ac_file : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X$ac_file : 'X\(//\)[^/]' \| \ + X$ac_file : 'X\(//\)$' \| \ + X$ac_file : 'X\(/\)' \| \ + . : '\(.\)' 2>/dev/null || +echo X$ac_file | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } + /^X\(\/\/\)[^/].*/{ s//\1/; q; } + /^X\(\/\/\)$/{ s//\1/; q; } + /^X\(\/\).*/{ s//\1/; q; } + s/.*/./; q'`/stamp-h$_am_stamp_count +done +_ACEOF +cat >>$CONFIG_STATUS <<\_ACEOF + +# +# CONFIG_COMMANDS section. +# +for ac_file in : $CONFIG_COMMANDS; do test "x$ac_file" = x: && continue + ac_dest=`echo "$ac_file" | sed 's,:.*,,'` + ac_source=`echo "$ac_file" | sed 's,[^:]*:,,'` + ac_dir=`(dirname "$ac_dest") 2>/dev/null || +$as_expr X"$ac_dest" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$ac_dest" : 'X\(//\)[^/]' \| \ + X"$ac_dest" : 'X\(//\)$' \| \ + X"$ac_dest" : 'X\(/\)' \| \ + . : '\(.\)' 2>/dev/null || +echo X"$ac_dest" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } + /^X\(\/\/\)[^/].*/{ s//\1/; q; } + /^X\(\/\/\)$/{ s//\1/; q; } + /^X\(\/\).*/{ s//\1/; q; } + s/.*/./; q'` + ac_builddir=. + +if test "$ac_dir" != .; then + ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'` + # A "../" for each directory in $ac_dir_suffix. + ac_top_builddir=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,../,g'` +else + ac_dir_suffix= ac_top_builddir= +fi + +case $srcdir in + .) # No --srcdir option. We are building in place. + ac_srcdir=. + if test -z "$ac_top_builddir"; then + ac_top_srcdir=. + else + ac_top_srcdir=`echo $ac_top_builddir | sed 's,/$,,'` + fi ;; + [\\/]* | ?:[\\/]* ) # Absolute path. + ac_srcdir=$srcdir$ac_dir_suffix; + ac_top_srcdir=$srcdir ;; + *) # Relative path. + ac_srcdir=$ac_top_builddir$srcdir$ac_dir_suffix + ac_top_srcdir=$ac_top_builddir$srcdir ;; +esac +# Don't blindly perform a `cd "$ac_dir"/$ac_foo && pwd` since $ac_foo can be +# absolute. +ac_abs_builddir=`cd "$ac_dir" && cd $ac_builddir && pwd` +ac_abs_top_builddir=`cd "$ac_dir" && cd ${ac_top_builddir}. && pwd` +ac_abs_srcdir=`cd "$ac_dir" && cd $ac_srcdir && pwd` +ac_abs_top_srcdir=`cd "$ac_dir" && cd $ac_top_srcdir && pwd` + + + { echo "$as_me:$LINENO: executing $ac_dest commands" >&5 +echo "$as_me: executing $ac_dest commands" >&6;} + case $ac_dest in + depfiles ) test x"$AMDEP_TRUE" != x"" || for mf in $CONFIG_FILES; do + # Strip MF so we end up with the name of the file. + mf=`echo "$mf" | sed -e 's/:.*$//'` + # Check whether this is an Automake generated Makefile or not. + # We used to match only the files named `Makefile.in', but + # some people rename them; so instead we look at the file content. + # Grep'ing the first line is not enough: some people post-process + # each Makefile.in and add a new line on top of each file to say so. + # So let's grep whole file. + if grep '^#.*generated by automake' $mf > /dev/null 2>&1; then + dirpart=`(dirname "$mf") 2>/dev/null || +$as_expr X"$mf" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$mf" : 'X\(//\)[^/]' \| \ + X"$mf" : 'X\(//\)$' \| \ + X"$mf" : 'X\(/\)' \| \ + . : '\(.\)' 2>/dev/null || +echo X"$mf" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } + /^X\(\/\/\)[^/].*/{ s//\1/; q; } + /^X\(\/\/\)$/{ s//\1/; q; } + /^X\(\/\).*/{ s//\1/; q; } + s/.*/./; q'` + else + continue + fi + grep '^DEP_FILES *= *[^ #]' < "$mf" > /dev/null || continue + # Extract the definition of DEP_FILES from the Makefile without + # running `make'. + DEPDIR=`sed -n -e '/^DEPDIR = / s///p' < "$mf"` + test -z "$DEPDIR" && continue + # When using ansi2knr, U may be empty or an underscore; expand it + U=`sed -n -e '/^U = / s///p' < "$mf"` + test -d "$dirpart/$DEPDIR" || mkdir "$dirpart/$DEPDIR" + # We invoke sed twice because it is the simplest approach to + # changing $(DEPDIR) to its actual value in the expansion. + for file in `sed -n -e ' + /^DEP_FILES = .*\\\\$/ { + s/^DEP_FILES = // + :loop + s/\\\\$// + p + n + /\\\\$/ b loop + p + } + /^DEP_FILES = / s/^DEP_FILES = //p' < "$mf" | \ + sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g' -e 's/\$U/'"$U"'/g'`; do + # Make sure the directory exists. + test -f "$dirpart/$file" && continue + fdir=`(dirname "$file") 2>/dev/null || +$as_expr X"$file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$file" : 'X\(//\)[^/]' \| \ + X"$file" : 'X\(//\)$' \| \ + X"$file" : 'X\(/\)' \| \ + . : '\(.\)' 2>/dev/null || +echo X"$file" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } + /^X\(\/\/\)[^/].*/{ s//\1/; q; } + /^X\(\/\/\)$/{ s//\1/; q; } + /^X\(\/\).*/{ s//\1/; q; } + s/.*/./; q'` + { if $as_mkdir_p; then + mkdir -p $dirpart/$fdir + else + as_dir=$dirpart/$fdir + as_dirs= + while test ! -d "$as_dir"; do + as_dirs="$as_dir $as_dirs" + as_dir=`(dirname "$as_dir") 2>/dev/null || +$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$as_dir" : 'X\(//\)[^/]' \| \ + X"$as_dir" : 'X\(//\)$' \| \ + X"$as_dir" : 'X\(/\)' \| \ + . : '\(.\)' 2>/dev/null || +echo X"$as_dir" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } + /^X\(\/\/\)[^/].*/{ s//\1/; q; } + /^X\(\/\/\)$/{ s//\1/; q; } + /^X\(\/\).*/{ s//\1/; q; } + s/.*/./; q'` + done + test ! -n "$as_dirs" || mkdir $as_dirs + fi || { { echo "$as_me:$LINENO: error: cannot create directory $dirpart/$fdir" >&5 +echo "$as_me: error: cannot create directory $dirpart/$fdir" >&2;} + { (exit 1); exit 1; }; }; } + + # echo "creating $dirpart/$file" + echo '# dummy' > "$dirpart/$file" + done +done + ;; + esac +done +_ACEOF + +cat >>$CONFIG_STATUS <<\_ACEOF + +{ (exit 0); exit 0; } +_ACEOF +chmod +x $CONFIG_STATUS +ac_clean_files=$ac_clean_files_save + + +# configure is writing to config.log, and then calls config.status. +# config.status does its own redirection, appending to config.log. +# Unfortunately, on DOS this fails, as config.log is still kept open +# by configure, so config.status won't be able to write to it; its +# output is simply discarded. So we exec the FD to /dev/null, +# effectively closing config.log, so it can be properly (re)opened and +# appended to by config.status. When coming back to configure, we +# need to make the FD available again. +if test "$no_create" != yes; then + ac_cs_success=: + ac_config_status_args= + test "$silent" = yes && + ac_config_status_args="$ac_config_status_args --quiet" + exec 5>/dev/null + $SHELL $CONFIG_STATUS $ac_config_status_args || ac_cs_success=false + exec 5>>config.log + # Use ||, not &&, to avoid exiting from the if with $? = 1, which + # would make configure fail if this is the last instruction. + $ac_cs_success || { (exit 1); exit 1; } +fi + + +echo "###############################################################################" +echo " supported filesystems: $opt_fs" +echo -n " suid files: " +if test $LUFS_SUID; then echo "lufsmnt & lufsumount."; else echo "none."; fi +echo "###############################################################################" diff --git a/configure.in b/configure.in new file mode 100644 index 0000000..88854a7 --- /dev/null +++ b/configure.in @@ -0,0 +1,267 @@ +dnl Process this file with autoconf to produce a configure script. +AC_PREREQ(2.50) +AC_INIT(AUTHORS) +AC_CONFIG_AUX_DIR(config) +AM_CONFIG_HEADER(config.h) +AC_CANONICAL_SYSTEM +AM_INIT_AUTOMAKE(lufs,0.9.6) + +dnl "static" FSs +opt_fs="localfs locasefs ftpfs gnetfs" + +AC_ARG_ENABLE(kernel-support, + [ --enable-kernel-support enable building of the kernel module (default=yes)], + [ KERNEL_SUPPORT=$enableval ],) + +if test "$KERNEL_SUPPORT" != "no" +then + + dnl Checking os + AC_MSG_CHECKING(OS) + OS_DIR=`uname -s` + if test ! -d kernel/$OS_DIR + then + AC_MSG_ERROR($OS_DIR - not supported!) + else + AC_MSG_RESULT($OS_DIR) + fi + + dnl LINUX kernel configuration + if test "$OS_DIR"="Linux" + then + + dnl Checking kernel & headers + AC_MSG_CHECKING(kernel) + AC_ARG_WITH(kernel, + [ --with-kernel=VERSION specify a kernel version to compile for], + [KERNEL_VERSION=$withval], + [KERNEL_VERSION=`uname -r`]) + MODULES_DIR=/lib/modules/$KERNEL_VERSION + AC_MSG_RESULT($KERNEL_VERSION) + + AC_MSG_CHECKING(kernel support) + KERNEL_DIR=`echo $KERNEL_VERSION | cut -d'.' -f1,2` + if test ! -d kernel/$OS_DIR/$KERNEL_DIR + then + AC_MSG_ERROR([$KERNEL_DIR not supported!]) + else + AC_MSG_RESULT([supported in kernel/$OS_DIR/$KERNEL_DIR]) + fi + + AC_MSG_CHECKING(kernel headers) + AC_ARG_WITH(kheaders, + [ --with-kheaders=DIR specify the location of the kernel headers], + [KERNEL_HDR=$withval], + [KERNEL_HDR=$MODULES_DIR/build/include]) + if test ! -f $KERNEL_HDR/linux/fs.h + then + AC_MSG_ERROR([not found in $KERNEL_HDR. please install them!]) + else + AC_MSG_RESULT([found in $KERNEL_HDR]) + fi + + AC_MSG_CHECKING(kernel configuration) + if test -f $MODULES_DIR/build/.config + then + tmp=`cat $MODULES_DIR/build/.config | grep CONFIG_MODVERSIONS=y` + if test "$tmp" + then + AC_MSG_RESULT([found, using modversions]) + MODV_FLAGS="-DMODVERSIONS -include $KERNEL_HDR/linux/modversions.h" + else + AC_MSG_RESULT([found, not using modversions]) + fi + else + AC_MSG_RESULT([not found at $MODULES_DIR/build/.config, assuming modversions support]) + MODV_FLAGS="-DMODVERSIONS -include $KERNEL_HDR/linux/modversions.h" + fi + + AC_ARG_ENABLE(modversions, + [ --enable-modversions enable modeversions support (default=auto-detect)], + [ if test $enableval = "yes"; then MODV_FLAGS="-DMODVERSIONS -include $KERNEL_HDR/linux/modversions.h"; else MODV_FLAGS=""; fi ],) + + AC_SUBST(MODV_FLAGS) + AC_SUBST(KERNEL_DIR) + AC_SUBST(MODULES_DIR) + AC_SUBST(KERNEL_HDR) + + fi +fi +AC_SUBST(OS_DIR) + + +dnl options +AC_ARG_ENABLE(debug, + [ --enable-debug enable debug messages to stdout (default=no)], + [ DEBUG_FLAGS="-g -DDEBUG" && CXXFLAGS="-g -O2 -Wall -DDEBUG -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64" && CFLAGS="-g -O2 -Wall -DDEBUG -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64"], + [ CXXFLAGS="-O2 -Wall -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64" && CFLAGS="-O2 -Wall -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64"]) +AC_SUBST(DEBUG_FLAGS) + +AC_ARG_ENABLE(kdebug, + [ --enable-kdebug enable kernel module debug messages (default=no)], + [ KDEBUG_FLAGS="-DLUFS_DEBUG -DLUFS_VERBOSE" ], ) +AC_SUBST(KDEBUG_FLAGS) + +AC_ARG_ENABLE(autofs-install, + [ --enable-autofs-install enable installing of autofs configuration (default=no)], + [ AUTOFS_INSTALL="yes"],) +AC_SUBST(AUTOFS_INSTALL) + +AC_ARG_ENABLE(suid, + [ --enable-suid make lufsmnt and lufsumount suid root (default=yes)], + [ if test $enableval = "no"; then LUFS_SUID=""; else LUFS_SUID="true"; fi ] , LUFS_SUID="true" ) +AC_SUBST(LUFS_SUID) + +AC_DISABLE_STATIC + +dnl Checks for programs. +AC_PROG_CC +AC_PROG_CPP +AC_PROG_CXX +AC_PROG_INSTALL +AC_PROG_LN_S +AM_PROG_LIBTOOL +AC_PROG_MAKE_SET + + +dnl Checking ssh +AC_MSG_CHECKING(for ssh) +AC_ARG_WITH(ssh, + [ --with-ssh=PATH specify the path to the ssh executable], + [SSHPROG=$withval], + [SSHPROG=`which ssh 2>/dev/null`]) +if test ! -x "$SSHPROG" +then + AC_MSG_RESULT([not found (sshfs support disabled)]) +else + AC_MSG_RESULT([found ($SSHPROG)]) + AC_DEFINE([HAS_SSH], 1 , [Define if ssh is found.]) + opt_fs="$opt_fs sshfs" +fi +AC_SUBST(SSHPROG) + + +dnl Checking gnome +AC_CHECK_PROG(GCONF, gnome-config, gnome-config) +AC_CHECK_PROG(GVFSCONF, gnome-vfs-config, gnome-vfs-config) +AC_CHECK_LIB(gnomevfs, gnome_vfs_init, HAS_GNOMEVFS=1,) +if test "$GCONF" -a "$GVFSCONF" -a "$HAS_GNOMEVFS" +then + AC_DEFINE([HAS_GVFS], 1, [Define if gvfs is to be built.]) + + GVFS_LDADD="`$GCONF --libs gnome` `$GVFSCONF --libs`" + GVFS_CFLAGS="`$GCONF --cflags gnome` `$GVFSCONF --cflags`" + opt_fs="$opt_fs gvfs" +fi +AC_SUBST(GVFS_LDADD) +AC_SUBST(GVFS_CFLAGS) + +AC_ARG_ENABLE(wavfs, + [ --enable-wavfs build wavfs support (default=no)], + [ opt_fs="$opt_fs wavfs"],) + + +AC_ARG_ENABLE(cefs, + [ --enable-cefs build cefs support (default=no)], + [ opt_fs="$opt_fs cefs"],) + +if test -n "$cefs_dir"; then + AC_DEFINE([HAS_CEFS], 1, [Define if cefs is to be built.]) + AC_DEFINE([INFOFILE], ["/tmp/cedevices"], [Path to the information file for the RAPI library]) +fi + +AC_ARG_ENABLE(cardfs, + [ --enable-cardfs build cardfs support (default=no)], + [ WITH_CARDFS=true ],) + +dnl Checks for libraries. +AC_CHECK_LIB(pthread, pthread_detach,,AC_MSG_ERROR(libpthread is needed by lufs)) + + +dnl Checks for header files. +AC_HEADER_STDC +AC_CHECK_HEADERS(unistd.h) + + +dnl This will test for endian-swapping headers +AC_CHECK_HEADERS(byteswap.h sys/byteswap.h endian.h machine/endian.h sys/types.h) + + +dnl Checks for typedefs, structures, and compiler characteristics. +AC_C_CONST +AC_TYPE_PID_T + +dnl Checks for library functions. +AC_CHECK_FUNCS(mkdir rmdir) + +if test -n "$WITH_CARDFS"; then + echo checking for cardfs + AC_MSG_CHECKING(for libchipcard) + AC_ARG_WITH(chipcard-dir, + [ --with-chipcard-dir=DIR uses libchipcard from given dir], + [cc_dir="$withval"], + [cc_dir="/usr/local/libchipcard \ + /usr/local \ + /usr/libchipcard \ + /usr \ + /"]) + for li in $cc_dir; do + if test -x "$li/bin/libchipcard-config"; then + chipcard_dir="$li" + fi + done + if test -z "$chipcard_dir"; then + AC_MSG_RESULT([not found (chipcard support disabled)]) + else + all_libraries="$all_libraries `$chipcard_dir/bin/libchipcard-config --libraries`" + all_includes="$all_includes `$chipcard_dir/bin/libchipcard-config --includes`" + AC_DEFINE([HAS_LIBCHIPCARD], 1, [Define if libchipcard is present.]) + define_has_libchipcard="#define HAS_LIBCHIPCARD" + AC_SUBST(define_has_libchipcard) + LIBCHIPCARD_LIB="`$chipcard_dir/bin/libchipcard-config --libraries` -lcardfs" + LIBCHIPCARD_INCLUDES="`$chipcard_dir/bin/libchipcard-config --includes`" + AC_MSG_RESULT($chipcard_dir) + all_libraries="$all_libraries $libchipcard_libs" + all_includes="$all_includes $libchipcard_includes" + opt_fs="$opt_fs cardfs" + fi +fi +AC_SUBST(LIBCHIPCARD_LIB) +AC_SUBST(LIBCHIPCARD_INCLUDES) + +all_includes="$all_includes -I`pwd`/include" + +AC_SUBST(opt_fs) +AC_SUBST(all_includes) +AC_SUBST(all_libraries) + +AC_OUTPUT(\ + Makefile \ + lufsd/Makefile \ + filesystems/Makefile \ + filesystems/localfs/Makefile \ + filesystems/locasefs/Makefile \ + filesystems/sshfs/Makefile \ + filesystems/ftpfs/Makefile \ + filesystems/cardfs/Makefile \ + filesystems/cefs/Makefile \ + filesystems/cefs/asyncd/Makefile \ + filesystems/gvfs/Makefile \ + filesystems/gnetfs/Makefile \ + filesystems/wavfs/Makefile \ + util/Makefile \ + kernel/Makefile \ + kernel/Linux/Makefile \ + kernel/Linux/2.4/Makefile \ + kernel/Linux/2.5/Makefile \ + include/Makefile \ + config/Makefile \ + docs/Makefile \ + man/Makefile \ + ) + +echo "###############################################################################" +echo " supported filesystems: $opt_fs" +echo -n " suid files: " +if test $LUFS_SUID; then echo "lufsmnt & lufsumount."; else echo "none."; fi +echo "###############################################################################" diff --git a/docs/Makefile.am b/docs/Makefile.am new file mode 100644 index 0000000..04654fc --- /dev/null +++ b/docs/Makefile.am @@ -0,0 +1 @@ +EXTRA_DIST=lufs.html lufs.sxw lufs.txt cefs.txt diff --git a/docs/Makefile.in b/docs/Makefile.in new file mode 100644 index 0000000..5d9f14a --- /dev/null +++ b/docs/Makefile.in @@ -0,0 +1,301 @@ +# Makefile.in generated by automake 1.7.5 from Makefile.am. +# @configure_input@ + +# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003 +# Free Software Foundation, Inc. +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ + +srcdir = @srcdir@ +top_srcdir = @top_srcdir@ +VPATH = @srcdir@ +pkgdatadir = $(datadir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +top_builddir = .. + +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +INSTALL = @INSTALL@ +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = @build@ +host_triplet = @host@ +target_triplet = @target@ +ACLOCAL = @ACLOCAL@ +AMDEP_FALSE = @AMDEP_FALSE@ +AMDEP_TRUE = @AMDEP_TRUE@ +AMTAR = @AMTAR@ +AUTOCONF = @AUTOCONF@ +AUTOFS_INSTALL = @AUTOFS_INSTALL@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CXX = @CXX@ +CXXDEPMODE = @CXXDEPMODE@ +CXXFLAGS = @CXXFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DEBUG_FLAGS = @DEBUG_FLAGS@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +ECHO = @ECHO@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +EXEEXT = @EXEEXT@ +GCONF = @GCONF@ +GVFSCONF = @GVFSCONF@ +GVFS_CFLAGS = @GVFS_CFLAGS@ +GVFS_LDADD = @GVFS_LDADD@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +KDEBUG_FLAGS = @KDEBUG_FLAGS@ +KERNEL_DIR = @KERNEL_DIR@ +KERNEL_HDR = @KERNEL_HDR@ +LDFLAGS = @LDFLAGS@ +LIBCHIPCARD_INCLUDES = @LIBCHIPCARD_INCLUDES@ +LIBCHIPCARD_LIB = @LIBCHIPCARD_LIB@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LIBTOOL = @LIBTOOL@ +LN_S = @LN_S@ +LTLIBOBJS = @LTLIBOBJS@ +LUFS_SUID = @LUFS_SUID@ +MAKEINFO = @MAKEINFO@ +MODULES_DIR = @MODULES_DIR@ +MODV_FLAGS = @MODV_FLAGS@ +OBJEXT = @OBJEXT@ +OS_DIR = @OS_DIR@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +RANLIB = @RANLIB@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +SSHPROG = @SSHPROG@ +STRIP = @STRIP@ +VERSION = @VERSION@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_CXX = @ac_ct_CXX@ +ac_ct_RANLIB = @ac_ct_RANLIB@ +ac_ct_STRIP = @ac_ct_STRIP@ +all_includes = @all_includes@ +all_libraries = @all_libraries@ +am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ +am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ +am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@ +am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +datadir = @datadir@ +define_has_libchipcard = @define_has_libchipcard@ +exec_prefix = @exec_prefix@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localstatedir = @localstatedir@ +mandir = @mandir@ +oldincludedir = @oldincludedir@ +opt_fs = @opt_fs@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +sysconfdir = @sysconfdir@ +target = @target@ +target_alias = @target_alias@ +target_cpu = @target_cpu@ +target_os = @target_os@ +target_vendor = @target_vendor@ +EXTRA_DIST = lufs.html lufs.sxw lufs.txt cefs.txt +subdir = docs +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +mkinstalldirs = $(SHELL) $(top_srcdir)/config/mkinstalldirs +CONFIG_HEADER = $(top_builddir)/config.h +CONFIG_CLEAN_FILES = +DIST_SOURCES = +DIST_COMMON = Makefile.am Makefile.in +all: all-am + +.SUFFIXES: +$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4) + cd $(top_srcdir) && \ + $(AUTOMAKE) --gnu docs/Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe) + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs + +distclean-libtool: + -rm -f libtool +uninstall-info-am: +tags: TAGS +TAGS: + +ctags: CTAGS +CTAGS: + +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) + +top_distdir = .. +distdir = $(top_distdir)/$(PACKAGE)-$(VERSION) + +distdir: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \ + list='$(DISTFILES)'; for file in $$list; do \ + case $$file in \ + $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ + $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ + esac; \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test "$$dir" != "$$file" && test "$$dir" != "."; then \ + dir="/$$dir"; \ + $(mkinstalldirs) "$(distdir)$$dir"; \ + else \ + dir=''; \ + fi; \ + if test -d $$d/$$file; then \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ + fi; \ + cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ + else \ + test -f $(distdir)/$$file \ + || cp -p $$d/$$file $(distdir)/$$file \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-am +all-am: Makefile + +installdirs: +install: install-am +install-exec: install-exec-am +install-data: install-data-am +uninstall: uninstall-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-am +install-strip: + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + INSTALL_STRIP_FLAG=-s \ + `test -z '$(STRIP)' || \ + echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -rm -f Makefile $(CONFIG_CLEAN_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +clean: clean-am + +clean-am: clean-generic clean-libtool mostlyclean-am + +distclean: distclean-am + +distclean-am: clean-am distclean-generic distclean-libtool + +dvi: dvi-am + +dvi-am: + +info: info-am + +info-am: + +install-data-am: + +install-exec-am: + +install-info: install-info-am + +install-man: + +installcheck-am: + +maintainer-clean: maintainer-clean-am + +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-generic mostlyclean-libtool + +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + +uninstall-am: uninstall-info-am + +.PHONY: all all-am check check-am clean clean-generic clean-libtool \ + distclean distclean-generic distclean-libtool distdir dvi \ + dvi-am info info-am install install-am install-data \ + install-data-am install-exec install-exec-am install-info \ + install-info-am install-man install-strip installcheck \ + installcheck-am installdirs maintainer-clean \ + maintainer-clean-generic mostlyclean mostlyclean-generic \ + mostlyclean-libtool pdf pdf-am ps ps-am uninstall uninstall-am \ + uninstall-info-am + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/docs/cefs.txt b/docs/cefs.txt new file mode 100644 index 0000000..bb5bb71 --- /dev/null +++ b/docs/cefs.txt @@ -0,0 +1,241 @@ +This is a LUFS filesystem module allowing to access the filesystem of +a Windows CE device (HP (Compaq) Ipaq, HP Jornada, etc...) + +Because of limitations of the current version of librapi not all +filesystem operations are supported. Specifically, file read and +write are performed only at file open and file close. Opening files +in read-write mode is not supported. + +This code uses librapi library from the SynCE project. For +convenience asyncd source code from that project is also included in +this distribution. + + http://synce.sourceforge.org + +SOURCES OF ADDITIONAL INFORMATION + + http://synce.sourceforge.org + http://www.handhelds.org + +REQUIREMENS + +A Windows CE device :) + +INSTALLATION + +To use the CEFS module you should be able to connect your Windows CE +device to the Linux box using serial cable, USB, or IRDA. + +Here I give some explanations of how to setup the connection between +the Linux box and PDA. It is described in many places, so you may +find it interesting to compare the description here with bits of +information you can read on http://synce.sourceforge.org +http://www.handhelds.org and in Documentation/usb/usb-serial.txt in +the kernel source. + + +I. Asyncd setup + +In any case you should setup asyncd -- a daemon to keep the connection +up. Notice, that if you protected you Windows CE device with a +password (which is generally quite a good idea), you should change it +from the default value "1234" in asyncd.c recompile and reinstall +asyncd. Long passwords are not supported now. + +1) add the following line to /etc/services : + +dccm 5679/tcp # ActiveSync KeepAlive + +2) configure your Inetd super-daemon (either inetd, or xinetd), so that client/asyncd is + fired whenever someone initiates a TCP connect on port 5679 on your + computer (insert the prefix you used in ./configure instead of the default /usr/local): + +* inetd : add the following line to /etc/inetd.conf +------------------------------------------------------------- +asyncd stream tcp nowait lufs /usr/local/bin/asyncd asyncd +------------------------------------------------------------- + +* xinetd : add the following file (asyncd) to /etc/xinetd.d : +------------------------------------------------------------- +# default: on +service asyncd +{ + flags = REUSE NOLIBWRAP + socket_type = stream + wait = no + user = lufs + server = /usr/local/bin/asyncd + log_on_failure += USERID + only_from = 127.0.0.1 192.168.131.0/24 + disable = no +} +------------------------------------------------------------- + +(xinetd : replace the line 'only_from' with your local network mask (the one where your +CE device will be calling from, or disable it completly) + + +II. Physical link setup + +II.A Serial link setup. + +Here you have a lot of variants. The simplest is: + +Variant 1. + +Create the following file (cedevice) in /etc/ppp/peers : +------------------------------------------------------------- +/dev/ttyS1 115200 modem +connect '/usr/sbin/chat -v CLIENT "CLIENT\c" "" "SERVER\c"' +noauth +local +192.168.131.102:192.168.131.201 +ms-dns 192.168.131.102 +lcp-echo-failure 2 +lcp-echo-interval 2 +linkname cedevice +------------------------------------------------------------- + +To start the communications you'll have to run (as root): + +$ pppd call cedevice + +This should start your Windows CE device, and start a PPP link. +Check that your PPP configuration shows the link, and check that 'asyncd' has +created a file '/tmp/cedevice' which contains the informations on your device ( +IP address, brand, etc...) + + +Variant 2. + +As an alternative method you can use mgetty to automatically start the +link on connection of your PDA to the computer. It is a very simple +setup, assuming that you don't have dialin connections. + +Add the following lines to /etc/mgetty+sendfax/mgetty.config: +------------------------------------------------------------------------ +# WinCE connection: port ttyS1 + speed 115200 + direct y + toggle-dtr n + issue-file /etc/ppp/wince.issue +------------------------------------------------------------------------ +Add this to /etc/mgetty+sendfax/login.config: +------------------------------------------------------------------------ +# This is for WinCE +/AutoPPP/ - a_ppp /usr/sbin/pppd file /etc/ppp/wince +------------------------------------------------------------------------ +Create the file /etc/ppp/wince.issue: +------------------------------------------------------------------------ +CLIENTSERVER +CLIENTSERVER +CLIENTSERVER +------------------------------------------------------------------------ +and the file /etc/ppp/wince: +------------------------------------------------------------------------ +modem +noauth +local +192.168.131.102:192.168.131.201 +ms-dns 192.168.131.102 +lcp-echo-failure 2 +lcp-echo-interval 2 +linkname cedevice +------------------------------------------------------------------------ + + +II.B. USB Setup. + +If you have an old kernel, you can try to use ipaqd from SynCE +project. Here I'll describe usage if ipaq module present in kernel +(starting at least from 2.4.18 ar maybe earlier). Generally, you +should first look at the file Documentation/usb/usb-serial.txt in your +kernel source. BUT: Don't believe the words written there abut uhci.o +and usb-uhci.o modules. In my case it works _only_ with usb-uhci and +does not work at all with uhci. Maybe in some cases opposite is +better, I don't know. + +Also you shold make a special version of chat. To get it, recompile +the ppp distribution after applying the patch ppp-chat.patch in the +'other' directory. This will make the chat program which does not +make intercharacter delay. For some reason In my case it is crucially +needed to make things work. Maybe it is not always the case, so you +may try first without this, and do this only if your PDA freezes +during establishing connection with the computer. Another patch that +was needed in my case is ppp-pppd.patch, which _adds_ some delay +between ppp control packets. It is really a patch that I don't +understand, but it helped in my case. + +You should install hotplug, to use USB. Here I give an example setup. +Create the file /etc/hotplug/usb/ipaq: +------------------------------------------------------------------------ +#!/bin/bash echo $REMOVER created >>/tmp/ipaqlog cat >$REMOVER +<<-'EOF' + #!/bin/sh + if [ -f /var/lock/LCK..ttyUSB0 ] + then + kill -9 `cat /var/lock/LCK..ttyUSB0` + fi +EOF +chmod a+x $REMOVER +MYIP=192.168.131.102 +REMOTEIP=192.168.131.201 +MYDNS=192.168.131.102 + +if [ -f /var/lock/LCK..ttyUSB0 ] +then + kill -9 `cat /var/lock/LCK..ttyUSB0` +fi +/usr/sbin/pppd.ipaq /dev/ttyUSB0 \ + connect "/usr/sbin/chat.nopause -v TIMEOUT 60 CLIENT 'CLIENTSERVER\c'" \ + nocrtscts local passive $MYIP:$REMOTEIP ms-dns $MYDNS noauth +----------------------------------------------------------------------- +And apply the following patch to /etc/hotplug/usb.agent +------------------------------------------------------------------------ +--- /home/fedor/usb.agent Mon Sep 23 00:28:48 2002 ++++ /etc/hotplug/usb.agent Thu Apr 11 10:38:36 2002 +@@ -298,6 +298,15 @@ + rm -f "$REMOVER" + fi + ++ if [ "$PRODUCT" = "49f/3/0" ]; then # Compaq Ipaq 3760 ++ /etc/hotplug/usb/ipaq ++ exit 0 ++ fi ++ if [ "$PRODUCT" = "3f0/1116/0" ]; then # HP Jornada 568 ++ /etc/hotplug/usb/ipaq ++ exit 0 ++ fi ++ + # on 2.4 systems, modutils 2.4.2+ maintains MAP_CURRENT + # ... otherwise we can't rely on it (sigh) + case "$KERNEL" in +________________________________________________________________________ + + +II.C IRDA Setup + +To be written. But it works, it was checked. Ask, if you are interested. + + +III lufs setup + +Nothing additional to general lufs setup! + + +USAGE + +Simply mount the filesystem after connecting your PDA with a command +like + + mount -t lufs -o fs=cefs none /mnt/lufs + +No additional options, instead of general LuFS options uid, gid, fmask +and dmask are present. + +And umount it before disconnecting. It may be a good idea to setup +automounter to do this. + + +Fedor Bezrukov + diff --git a/docs/lufs.html b/docs/lufs.html new file mode 100644 index 0000000..595215f --- /dev/null +++ b/docs/lufs.html @@ -0,0 +1,1262 @@ + + + + + + + + + + + +

LUFS +– Linux Userland File +System

+

(sshfs, +ftpfs, localfs, locasefs, gnutellafs, gvfs, cardfs, cefs)

+


+

+

1. +INTRODUCTION

+


+

+

+For those not interested +in technicalities: +

+

+
+

+

+LUFS +is enabling you to mount into your file hierarchy a remote computer's +file system, which is accessible by various means (ftp, ssh, etc.). +Then, the access to the remote files will be completely network +transparent. In other words, you'll be able to read/modify remote +files as if they were local, watch movies/listen to MP3s from +FTP/SSH/Gnutella servers without +copying them locally. Sheer magic. Now skip +to the next section.

+

+
+

+

+LUFS is a hybrid +userspace file system +framework supporting an indefinite number of file +systems transparently for any application. It consists of a +kernel module and an userspace daemon. Basically it delegates most of +the VFS calls to a specialized daemon which handles them.

+

+
+

+

+The reason for the +userspace stuff: there are operations only suited for userspace +(cryptography for example) and implementing them in kernel would be +bloat.

+

+
+

+

+The reason for the kernel +stuff: I think it's important to keep the file system access point at +the lowest level in order to allow all the applications to use it. +Consider KDE: it implements its own virtual file system, a great one, +but only KDE applications can take advantage of it. So does GNOME, MC +and others. Suddenly we have lots of overlapping userspace file +system implementations, a real waste...

+

+
+

+

+Communication between the +kernel module and the daemon is done through UNIX domain sockets. +This makes LUFS best suited for networked file systems, where this +indirection overhead (userspace <-> kernel <-> userspace) +is small compared to the speed penalty due to the network itself.

+

+
+

+

+LUFS can be regarded as +doing the same job as the VFS (virtual file system switch) in the +kernel: it is a switch, distributing the file system calls to its +supported file systems. With a big difference: LUFS file systems are +implemented in userspace. This would be a drawback for local file +systems where the access speed is important, but proves to be a huge +advantage for networked file systems where the userland +flexibility is most important.

+

+
+

+

+This flexibility allowed +for implementation of SSHFS for example, in a pretty straightforward +manner, using the already existing openssh +infrastructure. Lots of other “exotic” file systems are in the +planning phase: socketfs, httpfs, webdavfs, freenetfs, etc. Just +imagine mounting a freenet file system and accessing all the goodies +as they were local...

+

+
+

+

+Everything is a file and +if not, it should be!

+

+
+

+

+2. +FILE SYSTEMS

+


+

+

+This section describes +the file systems distributed with LUFS and provides some real mount +examples. Other file systems might also be available.

+

+
+

+

+The options presented +here are file system specific, for a list of the global options +please consult the USAGE section and the lufsmount(1) +man page.

+


+

+


+

+


+

+

2.1 +LOCALFS

+


+

+

+LocalFS is a proof of +concept and didactic file system, meant to demonstrate the +framework's power. All it does is mirror the local tree on the +mountpoint. Consider it a tutorial ;)

+

+
+

+

+It is a complete (and +inefficient for simplicity's sake) implementation.

+

+
+

+

Specific +mount options: none.

+


+

+

Mount +example:

+

+
+

+

[user@localhost]$ +lufsmount localfs:// ~/mnt/lufs -–uid=505

+

+
+

+

+or, using mount:

+

+[root@localhost]# mount +-t lufs none /mnt/lufs -o fs=localfs,uid=505

+

+
+

+

+
+

+

+
+

+

+
+

+

2.2 +LOCASEFS

+

Contributed +by: Timothee Besset +<ttimo@idsoftware.com>

+

+
+

+

+LoCaseFS provides a +lowercase mapping of the local file system. It comes in handy when +importing win32 source trees on *nix systems.

+

+
+

+

+It is a complete +implementation (based on localfs, it could use some optimizations). +

+


+

+

Specific +mount options: none

+

+
+

+

Mount +example:

+

+
+

+

[user@localhost]$ +lufsmount locasefs:// ~/mnt/lufs -–uid=505

+

+
+

+

+or, using mount:

+

+[root@localhost]# mount +-t lufs none /mnt/lufs -o fs=locasefs,uid=505

+

+
+

+

+
+

+

+
+

+

+
+

+

2.3 +SSHFS

+

Requires: +ssh ( http://www.openssh.org +).

+


+

+

+SshFS is probably the +most advanced LUFS file system because of its security, usefulness +and completeness. It is based on the SFTP protocol and requires +openssh. You can mount remote file systems accessible through sftp +(scp utility).

+

+
+

+

+It is a complete +implementation. +

+


+

+


+

+

Specific +mount options:

+

+
+

+
    +
  • + host=server : the + sftp server to mount (authentication should be properly configured, + see below)

    +
  • port=port : + the port the sftp server is listening on

    +
  • + username=user : + the user to authenticate on the server (see INSTALLATION)

    +
+

+
+

+

+I recommend setting up +public key authentication (DSA or RSA based) on the remote system for +the mounting user when using sshfs. This will allow the daemon to +open several channels without any user interaction. Consult the +ssh(1) manual page or try the lussh script for ssh +setup.

+

+
+

+

lussh +is a helper script which tries to automatically setup public key +authentication for ssh. You will be prompted for the ssh server and +the remote username by the script and for the remote user's password +by openssh. If you are prompted for the password more that twice, +then public key authentication setup failed for the given +server/user.

+

+
+

+

It +is possible to use sshfs without a public key authentication setup +(provided you have openssh-askpass-gnome or some other ssh +authentication helper) but you will be asked for passwords +interactively. If this is annoying, you can reduce the number of +communication channels (channels=1 +option).

+

+
+

+

Mount +example:

+

+
+

+

+[user@localhost]$ +lufsmount sshfs://mali@lufs.sourceforge.net ~/mnt/lufs –-fmask=444 +-–dmask=555

+

+
+

+

+or, using mount:

+

[root@localhost]# +mount -t lufs none /mnt/lufs -o +nosuid,fs=sshfs,host=lufs.sourceforge.net,username=mali,fmode=444,dmode=555

+


+

+


+

+


+

+

2.4 +FTPFS

+

+
+

+

+FtpFS is a port of an old +kernel implementation ( http://ftpfs.sourceforge.net +). Based on FTP, this file system allows you to mount ftp sites +locally.

+

+
+

+

+Because of FTP's nature, +there are some limitations: +

+
    +
  • + the communication is in + clear

    +
  • + some operations are not + supported by the protocol

    +
  • + some operations are not + supported by specific server implementations

    +
+

+
+

+

Specific +mount options:

+

+
+

+
    +
  • host=server : + the ftp server to mount

    +
  • port=port : + the port the ftp server is listening on

    +
  • username=user : + the user to authenticate on the server

    +
  • password=pass : + the user's password

    +
  • ftpactive : + will use active data connection (the server initiates the data + connection) instead of passive data connection (the client opens the + connection)

    +
+


+

+

If +no username is supplied, LUFS will try anonymous +access.

+

If +the ftp server only allows a limited number of logins from a certain +IP (1 per IP), you should limit the number of channels with the +channels +option ( channels=1 +).

+


+

+

Mount +example:

+


+

+

[user@localhost]$ +lufsmount ftpfs://mali:mypass@ftp.sourceforge.net +~/mnt/lufs -o ftpactive

+

+
+

+

+or, using mount:

+

[root@localhost]# +mount -t lufs none /mnt/lufs -o +nosuid,fs=ftpfs,host=ftp.sourceforge.net,username=mali,password=mypass,ftpactive

+


+

+

+
+

+


+

+

2.5 +GNUTELLAFS (GNETFS)

+

+
+

+

OK, +it's time to fasten your seatbelt and hold your breath: Kansas is +going bye-bye 'cause you're about to swallow the red pill.

+

+
+

+

+Forget everything you +knew about file sharing clients. This is a glimpse of the future...

+

+
+

+

+You mount a gnetfs in +~/gnet. You wait a couple of minutes so it can establish its peer +connections. You start a search by creating a subdirectory of SEARCH: +mkdir “~/gnet/SEARCH/metallica mp3”. You wait a few seconds for +the results to accumulate. The you chdir to “SEARCH/metallica mp3” +and try a ls: surprise – the files are there! You shoot up mpg123 +and enjoy... You are happy.

+

+
+

+

+Sounds too good to be +true? Well, it's here... +

+

+
+

+

+GnetFS is a Gnutella +network interface. You can perform searches and access resources +without downloading them locally.

+

+
+

+

Specific +options:

+
    +
  • + known_peers=MAX : + maximum number of known peers (see below)

    +
  • hostX=IP:port : + known peer – specify initial peers (X < MAX)

    +
+

+
+

+

+All these have sane +defaults in /etc/lufsd.conf so +you can just ignore them. Just make sure you specify a small +dir_cache_ttl so that the directory cache won't get in your way (the +gnutella results are cached anyway).

+

+
+

+

+In order to start a +search you create a subdirectory of SEARCH. A search for the +text in subdirectory's name will be started in background and results +added to that dir gradually. Once you have some results, you can +start accessing (read-only) them. When you are no longer interested +in that search, you simply erase the directory.

+

+
+

+

Note: +You need some serious bandwidth in order to enjoy gnetfs. LAN is +great, DSL will do. Maybe cable too.

+

+
+

+

IMPORTANT: +gnetfs is EXPERIMENTAL! At least the searches seem to be working OK +while for transfers you need to be lucky (but this is no news to +gnutella users, is it?:) . The gnutella back-end is incomplete and +only implements the bare basics needed for file searching/download – +no uploads/sharing (the gnutella guys are probably out to get me as I +write :). Hope this will change soon, I'm stuck with a dialup +connection for now so I'm counting a LOT on your feedback.

+

+
+

+

Mount +examples:

+

+
+

+

+[user@localhost]$ +lufsmount gnetfs:// ~/gnet -o dir_cache_ttl=1

+

+
+

+

+or, using mount:

+


+

+

+[user@localhost]# mount +-t lufs none /mnt/gnet -o fs=gnetfs,dir_cache_ttl=1

+

+
+

+

+
+

+

+
+

+

2.6 +GVFS (GnomeVFS)

+

Requires: +Gnome, libnomevfs +(http://www.gnome.org)

+

+
+

+

+GVFS is an adapter file +system linking lufs to Gnome's vfs. Thus, you gain access to the vfs +functionality implemented in Gnome from all the applications. While +not a very bright idea in itself (I think Gnome should use lufs or a +similar concept) this might add some value to lufs considering the +number of existing Gnome vfs modules.

+

+
+

+

+The functionality is +dependent on that of the used Gnome VFS module, which (for gnomevfs-1 +at least) isn't exactly impressive. The ftp and ssh modules +especially, don't even come close to their lufs native corespondents.

+

+
+

+

Specific +mount options:

+

+
+

+

No +specific options, but the root +option is mandatory and has a special meaning: it specifies the Gnome +VFS URI to mount (thus it includes the protocol, host and all the +other meaningful components) preceded by a “/” (example: +root=/smb://station2).

+

+
+

+

Mount +examples:

+

[user@localhost]$ +lufsmount gvfs:///ssh://mali@ssh.sf.net +~/mnt/lufs

+

+
+

+

+[user@localhost]$ +lufsmount gvfs:///file:/ ~/mnt/lufs

+

+
+

+

+or, using mount:

+

[root@localhost]# +mount -t lufs none /mnt/lufs -o +fs=gvfs,root=/ftp://mali:xxxxx@ftp.sf.net

+


+

+

[root@localhost]# +mount -t lufs none /mnt/lufs -o fs=gvfs,root=/start-here:/

+

+
+

+


+

+


+

+

2.7 +CARDFS

+

Contributed +by: Martin Preuss < +m_preuss@hamburg.de + >.

+

Requires: +libchipcard ( +http://www.libchipcard.de +).

+

+
+

+

+This module allows you to +mount memory card file systems. It requires the latest CVS +libchipcard version.

+

+
+

+

+You must enable cefs +support at configure time, using --enable-cardfs +if you want this file system to be built.

+

+
+

+

Specific +mount options:

+

+
+

+
    +
  • host=teminal@address : + terminal is the short name of your terminal (tow1,

    +
+

pcsc0 +or whatever name you assigned +to your terminal). If omitted the default terminal will be used.

+

+address is the address +the cardfs daemon listens on (cardfsd's -a option)

+
    +
  • + port=port : the + port that cardfsd is listening on (-p option)

    +
  • + username=user : + the name used to authorize yourself to the card (only needed if + encryption is enabled on the card)

    +
  • + password=pass : + the password used for encryption/decryption

    +
+

+
+

+

+You must start +libchipcard's cardfs daemon before mounting the file system:

+

+[root@localhost]# +cardfsd -a ADDRESS_TO_BIND_TO -p PORT_TO_BIND_TO

+

+
+

+

Mount +example:

+


+

+

[root@localhost]# +lufsmount cardfs://myusr:password@ttyS0@127.0.0.1:9770 +/mnt/lufs

+

+
+

+

+or, using mount:

+

[root@localhost]# +mount -t lufs none /mnt/lufs -o +nosuid,fs=cardfs,username=myusr,password=mypass,host=ttyS0@127.0.0.1,port=9770

+

+
+

+

+
+

+

+
+

+

2.8 +CEFS

+

Contributed +by: Fedor Bezrukov < +fedor@ms2.inr.ac.ru +>

+

+
+

+

+This lufs module allows +access to a CE device's (HP (Compaq) IPAQ, HP Jornada, etc...) file +system.

+

+
+

+

You +must enable cefs support at configure time, using --enable-cefs +if you want this file system to be built.

+

+
+

+

Specific +mount options:

+

+
+

+

+No specific options here. +Simply mount the file system after connecting your PDA.

+

+Check out cefs.txt +for detailed information.

+

+
+

+

Mount +example:

+

+
+

+

+[user@localhost]$ +lufsmount cefs:// ~/mnt/lufs

+

+
+

+

+or, using mount:

+

+[root@localhost]# mount +-t lufs none /mnt/lufs -o nosuid,fs=cefs

+

+
+

+

+3. +BUILD & INSTALLATION

+
    +

    +
+

3.1 +SOURCE DISTRIBUTION

+


+

+

+In order to build LUFS +you need to have the running kernel's headers installed. Check +whether /lib/modules/`uname +-r`/build/include is pointing to the running kernel's include +dir.

+

+
+

+

IMPORTANT:

+

+The kernel module +requires the same compiler that was used for your running kernel's +build. +

+

+
+

+

+Executing +

+

+
+

+

[root@localhost]# +./configure [options]

+

[root@localhost]# +make

+

+[root@localhost]# make +install

+

+
+

+

+as root in the top lufs +directory should build and install the application. +

+


+

+

The +non-standard configure options are:

+


+

+
    +
  • --with-kernel=VERSION configure + for the specified kernel version (skip

    +
+

+auto-detection)

+
    +
  • --with-kheaders=DIR specify + the location of the kernel headers (skip

    +
+

+auto-detection)

+
    +
  • --with-ssh=SSH specify + the location of the ssh executable

    +
  • --enable-debug enable + debug messages from the daemon

    +
  • --enable-kdebug enable + debug messages from the kernel module

    +
  • --enable-cardfs enable + cardfs support

    +
  • --enable-cefs enable + cefs support

    +
  • --enable-autofs-install enable + installing of autofs config file

    +
  • --enable-modversions force + modversions kernel support

    +
  • --disable-suid lufsmnt + and lufsumount will not be made suid (regular +

    +
+

+users won't be able to mount lufs).

+
    +
  • --disable-kernel-support do + not build & install the required kernel module

    +

    + (useful when your kernel + is already patched for lufs support) +

    +
+

+
+

+

+
+

+

+
+

+

+3.2 PATCHED KERNEL

+

+
+

+

+If for some reason (read +modversions:) the kernel module fails to compile and install +properly, you can try to patch the kernel manually.

+

+
+

+

+Download the patch for +your kernel version (if available) into your kernel's source top +directory. Apply it by

+

+
+

+

[user@localhost +~/linux-2.4.19]$ zcat lufs-x.x.x-x.x.x.patch.gz +| patch -Np1

+

+
+

+

+Then proceed with +building and installing your kernel, not forgetting to reconfigure +it, enabling LUFS under FILE SYSTEMS section first (it requires +development/incomplete drivers and UNIX domain sockets).

+

+
+

+

+The rest of the package +can then be easily installed as described above, specifying +–disable-kernel-support when running ./configure.

+

+
+

+

+
+

+

+
+

+

+3.3 DEBUG BUILD

+

+
+

+

+So you've got lufs +installed but bumped right into that nasty buggy... The cruel +realization of lufs' imperfection overwhelms +you... But wait, maybe you can do something about it!

+

+
+

+

+Don't worry, I'm not +gonna tell you to shoot gdb up and start hacking. Just make a debug +build of lufs, try to replicate the problem and send me a bug report +along with some log files. I will (try to) take care of the rest. +

+

+
+

+

+[root@localhost]# +./configure -–enable-debug -–enable-kdebug

+

+[root@localhost]# make +clean

+

+[root@localhost]# make +

+

+[root@localhost]# make +install

+

+
+

+

+When mounting, redirect +stdout and stderr to some files :

+

+
+

+

+[root@localhost]# +lufsmount ftpfs://mali@ftp.sourceforge.net ~/mnt >lufsd.log +2>lufsd.err

+

+
+

+

Now +try to replicate the problem and send me a bug report along with +lufsd.err and +lufsd.log plus a tail +of your /var/log/messages +(or whatever holds your kernel's logs). The bug report should contain +information about you system (distro, kernel version, gcc version, +etc.) and a description of what you did to bring up the bug.

+

+
+

+

+Your help will be +appreciated!

+

+
+

+


+

+


+

+

+4. +USAGE

+

+
+

+

+4.1 MOUNTING:

+


+

+

NOTE: +Regular users can mount/unmount +lufs file systems using lufsmount/lufsumount +if suid is set on these mount wrappers (see INSTALLATION).

+

+
+

+

For +your convenience, a mounting utility is provided (lufsmount) +which allows a more natural interface. +

+

+
+

+

+Lufsmount +<file_system>://[<user>[:<pass>]@][<host>][:<port>][/<remote_root>] +<mountpoint> [OPTIONS]

+

+
+

+

+The -h flag +provides a complete description of the available options.

+


+

+

Notes: + +

+
    +
  • + “/”, + ”:”, “@” are treated as separators by lufsmount. If one of + the parameters contains such characters, you shouldn't use + lufsmount. +

    +
  • + lufsmount + is just a parameter parser actually, which in turn calls lufsd + with formated parameters, so you could use lufsd if you run into + lufsmount's limitations.

    +
+

+
+

+

+Another way to mount a +LUFS is by calling lufsd directly:

+

+
+

+

lufsd +none mountpoint -o +options[...]

+

+
+

+

+where the options have +exactly the same syntax as when using mount (see below).

+

+
+

+

+Besides lufsmount & +lufsd, you can always count on good ol' mount. You'll probably not be +able to use mount as a regular user though... The general syntax for +mounting a LUFS file system is

+

+
+

+

mount +-t lufs none mountpoint -o +nosuid,fs=file_system[,uid=id][,gid=id][,fmask=mode][,dmask=mode][,channels=nr_chan][,root=remote_root][,own_fs][,quiet][,...]

+

+
+

+
    +
  • fs=file_system : + the file system type to mount (localfs, sshfs, ftpfs)

    +
  • + uid=id : the uid + to own the mounted fs

    +
  • + gid=id : the gid + to own the mounted fs

    +
  • + fmask=mode : the + minimal permissions to be set on each file

    +
  • + dmask=mode : the + minimal permissions to be set on each directory

    +
  • channels=nr_chan : + the number of communication channels to open for a mounted fs

    +
  • root=remote_root : + the remote directory to be mapped on the file system's root

    +
  • own_fs : + the whole file system will be owned by the mounting user

    +
  • quiet : + disable all logging (close all file descriptors)

    +
  • + dir_cache_ttl=secs : number of + seconds a directory cache entry is valid

    +
+


+

+

+The nosuid option +is automatically appended, so that all the remote file systems are +treated as untrusted.

+

+
+

+

+Sensitive information +(passwords) will not be written in /etc/mtab.

+

+
+

+

+The number of +communication channels represents the number of independent channels +that will be used for a mounted file system. More of these insure +better performance when multiple processes access the file system. +Ideally, one channel per accessing process would allow optimum +performance. There is a channel setup and resource overhead though, +so a number of ~7 channels should not be exceeded. In some cases, +multiple channels may cause problems (ftp servers only allowing a +limited number of logins from a certain IP), so the channels +option allows you to specify a reduced number (possibly 1).

+

+
+

+

+For file system specific +options and examples check out the FILE SYSTEMS section.

+

+
+

+

+
+

+


+

+

+4.2 UNMOUNTING:

+


+

+

As +root, you can simply use umount +in order to unmount a lufs file system. That is:

+

+
+

+

+#umount /mnt/lufs

+


+

+

A +regular user will have to use the suid-ed lufsumount:

+


+

+

$lufsumount +~/mnt/lufs

+


+

+

+Of course, a regular user +will only be able to unmount file systems mounted by himself.

+

+
+

+


+

+

+4.3 AUTOFS SUPPORT:

+


+

+

+LUFS provides autofs +executable maps for ftpfs and sshfs (auto.ftpfs and auto.sshfs). +These can be used in /etc/auto.master as follows:

+

+
+

+

+# Sample auto.master +file

+

+# Format of this file:

+

+# mountpoint map options

+

+# For details of the +format look at autofs(8).

+

+/mnt/net/ssh +/etc/auto.sshfs --timeout=60

+

+/mnt/net/ftp +/etc/auto.ftpfs --timeout=60

+

+
+

+

+
+

+

+Then, after restarting +automount (/etc/init.d/autofs restart), you can access ssh and ftp +servers more easily:

+

+
+

+

+$ cd +/mnt/net/ftp/ftp.kernel.org/pub

+

+$ ls -al +/mnt/net/ssh/mali@lufs.sourceforge.net

+

+
+

+

+
+

+

+Mounting and unmounting +is taken care of by autofs.

+

+
+

+

Notes:

+
    +
  • + the + --enable-autofs-install + configure parameter will configure autofs for /mnt/net/ssh + and /mnt/net/ftp automatically.

    +
  • + for sshfs to function + properly under autofs, public key authentication must be configured + for root (or whoever is running automount - see the SSHFS section).

    +
+

+
+

+

+
+

+

+4.4 PERMISSIONS MAPPING

+
    +
      +

      +

      +
    +
+

Two +methods are available for mapping remote permissions locally:

+

+
+

+
    +
  • normal + mapping: the + file/dir permissions are preserved and the owner changed accordingly + (either the mounting user, or some neutral – uid=gid=2 – if the + file is not owned remotely). This mode is active by default.

    +
  • forced + ownership: all the files/dirs + are owned by the mounting user and the permissions are changed to + reflect real access rights (if the file is not owned remotely, then + the local “user” and “group” permissions will be the same as + remote “other”). This mode is activated + by the own_fs + option.

    +
+ + \ No newline at end of file diff --git a/docs/lufs.sxw b/docs/lufs.sxw new file mode 100644 index 0000000000000000000000000000000000000000..8dec4bbefbc5b4b25e606455d442d9328447ac81 GIT binary patch literal 17872 zcma%j1ymhNvo7u)+}&m4?jAg7fM6SUcXxN!;DO-o?(XhRAh_!z=l{=n@4xHbyWXss zUe(oKRexQ3q-SQ=D9V6Cpo9EbzId844okA!+J4A?HiVDOQs2$S$&mr54>UCb{iC=1 zC=_8qKp?RH7R3J+O#cXoARyQ=AHtWvwKabW>wgPJe+%dz9{=(M_*+o_Tk!uQ{KX6g z1m-VhA4dNy@E;P;#@f-y+L6)K%JR3@iT$ob{Mox#IBq#mgr_?~N+~6oLGEYkyj9e^ zxs@{iE^J6IJeW8d8OqicDF*=+H_rwDSzl(Moh zrdpQTj>p-KNv6Z_BzxCsQ;r{Fc$doq!=KW4FRf06oUPz%qr_FWxrNd+0^W>3? zjBwOs(D^(?K%ui#a@}-p_w834c5Ym*%mqMWu8DX{l+Vz?^x@~RqyjlQca=T0y1+I1dd3)?o3JqUZJEQ>PJMPOxI z9tzkxuJ06m%JdNxlkd>qskMmot!&BNb}7!!K0K}Jpd$Q*N4A<~>?2d}H;2eIw(G!; z(#fHIf4LIjnelv0&?i{1f!R3^y|&+BmHj)CFXGwyAg-Dqz3Q{qGi&43Q^$o>uYQg; zo*1IZdFyq+Lq7AJf2B#zr%lFRcip~{c7yvjFTZ*3Hk`+E2P=Me0}Oq17H-!9PVO0C zS7|f$#GgCy+&e6An(9rUW1r0WQ9Nx7%heloD8Y;72hleW5roxx;fE7x6%4{!1HIw9^hC+^>V@q)Rc6&>ZoiwA zt#qo%Iws(o{`K3ʖjvz;t6+cnu3yO}r=0B+Q|!FK1wIPiI0h75@IO zWuzap7SWFJ8ig}w7h$H0I`X`W4v&1|+JP<;YNqxo9CCVNWW7X7*6Z6|sWPqAn>+wX z-V!2D=25SgyXAO*_iS**+NrHl+8nFkulU!8QIcl|^7G-M;Z|L{8-!t9m2flAb`Js0 zvlD)#J4(rT1V^cr6(4Uni*M=HO7->GFhh+zEm|HHFh6cpwsf^ttYXLu@eo$A9gmH> z#@rcdj5%21#(`IE#WL>EljzBfp9lB*kFPSvlhls89*)dZvdOTMYf~e|2r!ldbzwvz5{%*_`TuUgTHRABwKtAB^P2XsFf^nD<#X$Vt zv&9B%PoN&F7$TSMB5PE zLSnqhs_aI( z_sX1&vZ3CdyfBO8`6t+WcKOwkiga|)EhskQw05g&MnRrGWZ0cpG}36u99Vt7Z^(Sud>6tmxs^=UWu*J#U+>=~@wIiYPL z?h2r#&khv#fMHE^_^GRRuJts0AyaTMT+Z8==axur$1V+D&Bye= zM_C;_!qvqXB@H6yR@Kq-K#Z@m=(66TzEla|z>UsF)ogffD}6IKa=dfx)=XzF8KsX& zDOWHC*&N53*AD1yOu}{H)E&3C`eISowmzN`vX)86P;%M;rAIG!HG7VeVVH%;p<7|+ zrL+Emlu`MsiSp-jt(k`48VMLc6sV~tF)PyJuZD=uJc<(!OQ){Lw$a&tI zZ=Maau{L2)$E01gS-L)tJ`o3E$k9`N1~+=-pH_P^Fz)fPu$V9<^a>gA`rInh!v^?P zSJO-Y9I}L)9o3s$YsJ2uhr$5?#oxPG(|r!558m5cw=QT*r@RHO1>NHx1(^uByy0;1 z+3s>aAmE&Q0yJBp1vJ&3*8%L+jx{eyw8TJJe8`a1-vNC>qa}YReZv4;C+*S+}(V_ z#ZMLp0rSuAyCg~yd@HZ)wmWv94mJLq**gq%peO~K#1(>7IGIbFPHl%Iz1@LEr8FaA zO8b&9qNKtdPAjRjPhE;Ho|ON?9$hs$?=L0X)&SQ3Ojs%fRlTbkEE>bM%ohlWPq(E3 zIta(5_D9v+Ro(I{|G#Yt@&!6AO8zJO-yYyW2lrFF_~ckD4@(mCZz)q*u`UaZpn-#_ z;S=Deh17|bPDt5Sq`!BX85E4Ov$US~j+QBx8M9aIH!`!dieGn@DK|fA`gYd`508`w zAEMHBGeIL#j#bauPBQ^k_UiEVWv$%aH@?OMleDtRgtb;z9VWPpxYgu$P3g`ED#>n} zeq;4`sHq^nd47zf%Cf5@)sC7Gb+yM4THUYvbU!_fk}74v28*D3IUh?2_%^xxTberUE%J0yJ;Bpe%;qSU2)EzJjLs$K6}}9xp*k{ zeU9GNETwY2;JYtu3UNYT;?h51Sf;53d|O}hdbv25J!$=k%n6x(T4s5L61wB} zmFosi*egN#DHG#hlVRLSJnE^h9TpcJf3-4` zLGGZ0&fd%e-^+lBm-blhxK}S{h_W#tC#Efybrvs5pWsCh7s&L$gE9$Ocf`(tvvPo< z#VMNr?T6?Qa$9uTePP7}w-kzJ-Q}zwW`U60I^b%`aff?qJ+zLi7&dxu%l9Dd9QF;u z(tsD~Bn;GdXnP{DnJ?4zjXz-gtS8dzEV#;-@p{WBr&|FN06iuVsoEC(jI(;*tj{i) zZFFC}>>cU5>~-orLRqEe|4H9m0!A6n4Y}%zT%yBTzwyQ`-4B&2_2aZ@Z{FAlq$)e7Ajv?<#u1plaT_IL<; z$v9x$^%LgWDzILUkq`cwL+OTt&8SOyL;g#qMb&oQ;i_5%U$`Em6qdPkHM*$D#>w*q zOtltD)F9!J)^~0;gI3J*)e1xe@^&E|-Qon|S()%8zi#0GQLL)x0U-1qL|oFhpsGD< z5PEDqb*R?Ej!}XwIXZteVe{Rponh8dkh|b}9UMQovF_8@uWQ@jWDwp&Zo;9zx1L@h zsUu^ikRXr<9cH19Z&*X=ro-2^MUNov;cB$=yH*Gf%6}95b|&*Bd?E+9nS%+#NFAYf z2L6UA(1&pe#TEj=I`|~U@ma-_)y-n@rg(P>?_mIYFGV}{fLowX5RY2)E>w-c;2lShNfv z@*XFv$kX~I<#$tTVc1MGDbX9no)(^qPjBi{Yk~Eq^M1ZlP66!_n7y1G9u98d_@8EB zp#n2G?Un<6hs13gI{9`(0R;7EQWiCs;QG;o>6R;G*Kh~;5xU%cOK`xWWkdO0_>JAV zw9l;t+B(as?<>vHq>7*~EDXQmYi0Vnvk=;58xZx;o$?bq{(qF5&8lI zW52K|)-jJAFn_S+1$6K}A(^s-taxUFNq_0bE;G!zGXQP@=P!FgnOj9M-pMpmcg3Vg2|LLehrc-0)?19kLy-QRqv zg~q(A?0hi+y@%0(dY*Bre!oOHEm5YCopQ$w?%7Mf$To`oHh(Xy7Dj}cTPrA8hv54t z#1fY)v?R%&qACs}2=O#%Qjm<}>RSidlr6kK5w3yNS)pL_!%Fv<{#o_Y{0ty2_cmyUj>D!_P2ye{ca{k8)iB-mO?u-wT0^M}&ad0I{kN+kvda_ml}&O<$B-{U_Qf%YoR3`O zD_R%tFRiffBBpL$R@b=vb*eT%1Ml%y&`9FuLs{eIv(xverz z1LE4inXkC8sURJ>jm8*+>ax!mkEeT6U{jUVNgQpCB5w zn{`cuV$wzqg$tJcaQU;xkZYOSa}azB$P&q|d z&+sVgu7NlEBi1~`tI-!aG8YM_0w@wr!riZN?_@PzJOrcL9)R@aGqA)2rh;iOsDo5l zN<=d+PClQhF|4TwUBj68X%C8B1~LC`#Vu!)X@0;_5gJc`s`v!{r@fW3QCI|_S)pc$ z4UHNJG9p_B7PfQA=m=}Fz^>0aJ6Po7xj7mt27>F2E{#hLM`_ujl@Im|X{4CX8CY>A z@)vHu@EPs&$*ICdsBmw3nO70Vm?K24wok1@QPI(UmG92u5g#66i0GR5$H`21Th9;s zXM5c6XyFY*iB#fZNGYRBnz$WQb6sR^`sPmmgwEx(&dz~zp|8ks<>GeRU?+VTM@$;z zb6xa)j!k7ggTBVDV#VYZpS?0#V%EIzuR`MST9oRYB8&)(j0yzxz2S6A<$ zzqHVbQSYXnLlA~&>7i(<#@Iw%Q75u!EW!Th6%>)~Ne<0rCYoa4~!Xjw?{RSJGsAOn?B*bI}UjwBfg=UPY?j}VK!MBUVC5V}YQKxUu44cxSrH3q-Gc7~fA|J*u zp?lBUL#VF@umxwM1AB_+MoXxGRB5OX*fah%{ZH4W3YWY`QdxLHFFix~WH@|S*-Mng zQg|-?FMTi1dd)?ecuUBA{#?0~(K1*SdkiMoCMQy6ro&Q2=v?k8o1`KjbE(@;O~0JK`%R)maIxXQ`I z)o>tpaobBwmnXrtOkH0PUBP2&zTA><3P8av~vRIZ4E`|P9n;-;j ze-+(Mf`sR_u=$m`2x+Oj2;W6s?iWTY!V4KZhrON$IfDaa7yvYF)V~eYa#a|O=XJ(A z(OcS;hnzWhQ|>ke*aZef?rKAM;6?8$<3Yq>(;cuN3)LeWr#d+@%Xy@UIGJGmz|rc5 z_fd=O0`b5in+a^DR)Gz8q>_m8o$&#ux#y1IZ=m$9< z|1R#2Wwd2e4|Gz*Ulm>Ut++Z3zWWt>>1;v}@LJH+?ft!kpjf1`!u8*Vd&^EeeZpN8dDZG-Gr(I8dyDffnx$6OQ%$zetv z5IkP76rwHzRQQ^VD=9sdMmgb`9^6U3FeU#khTtF`Fsiyb_Ssx6P!^Wd*bO@}ity5; zi#$AkH?s#dB;USpaCL0vBN5?^Sz3mOv1ZOn*y_E?PP$ve(Y^ zqL2+slRc1rI+>3t={k}o6>}fH4G0}myntSHGm(Mq**wFl6|*C=_WBvDvV04mBMRH}o2( zSngnQKF@S-E$qCX$d1)<)9Cx7GNyV-?csxd)%bH{ufNtZ62`HA4r#AesZ|p(IH(p7 zn`iulPnNWZWIZr1^X~t(NZ8r{T|Td+cT2O=Z4QDU7%=TVw6X5l(%RP1(be_j!kOY? z(;9TetUf4&kAKh#A?T?tV>A+Y7rN%}6>xP;9ml*Sv9ud~QHeDDQdsGcTEN0*w25P_ z7fWO<^a$2YQ`!5@I$Zz&+eH^)dvZTA3KZ~{-uW>&7Q$@We=~#5EP4$ymHRRcdg_qf z$C+>5?D8mvB#u2I8Zhz;_D62?r=dF{-!~k1nPl{DVkCP(c@^*o$ltaMOoSECS)+@N z1T!8Q9b@s(lg->whb-~?hXxR&BNdB;a5cUX2Bt>hA{_U*MGl9;iouDosvx2`0Jta% z@=#58;KGG&h<}ASVj?TTO8nN<@$`KCO@p`IyNFH11T}}g$tlSfSPyI;rN}OLB31j8tQ`aD1Vl#70`r2GLU}@4)P2N0JE;PuT(|e`V|{!8;WhW?~M0-$r<~N7&=jdoRACQ)VjUb%YKwgR=_Q?%h&m0rX z!hOtB+}&FKa0!~G&+F3z2z|^}Zj$HFRF5Krs+aegCg9j`-mP8`y;#!vk76ppa&y0P)74j z+s8P8zfMqQ(-mk8DK@U4(a1)Y0G3n>!!*wFGYi$3>)qidF~YfMg{FS0=$u6clWBer z--Sol-pIz%qz0E<3Nrs{#{Pmzm1E6!=?EVG?We z(u(T>k&YB+RG^7cVM5c$0IfX*-)&@gFbvq5%C0V{?5SYir5ge^Egb_0wRQO}LKq*8 zyVRaqRM$Pt&S$hX_<=P=%F%yBw=jq$c5omt#q#p zU|w$#ixWaV?vwec+`VR5_&)oR2Qd5=U?>i+u(-hpX#RQMNF=cFZEY=UV2e>NWph)< zyUpFl&B4X)724U4=0JkDS2mFYihw!(2$Y?x;wa=C@T&)PIbY@Ad(4%6DK%NPGwC&< zGfDQ3pVxL87DBBM9XnCd+*Ry64>0eJErSr45k3-(?HIxuW^cH3I1dx?LE>~MT1L@6ozJbH6caE&h$W1S z2MvxL$I9-G+W{8VjAX1VM({PdY%QR=fpT<}h_4%ywgeQQW*dY}mK%?T0gKMwb(qdL zzTE9~8;PJluLXV#Elg#Ga_GSbF3W3={mI}~xMNEKbt=jyA2cWKy}HqSpV+=lG)t0O z;7axYQd#RPOEKXD+QeX@{;IfnV{#9a%ix^4 z8lG6t6Zw2kmO>s$a&=X^5A%cn7*SVI83Kbd8fwxOF<1v-;hJWBsiDaaG4uuW^~mr7Fb5lLiXP6LF_tGCkC+5 z*rWb0?4r5rp7MuEA`CmrP^AKqdI_wC+6#AfMeOukXqS9+(@^q+I*r+JExe&R8?qKOGH!qUaAM`&Ve7PE%*$i0SM@O*X~=tdi$GATqQ z7f+?m!fi?_jT`bC2^bDE6Yy&LEIt=fRaxR3X2BCjL8Nwx%g#~2hXQeBzZ%XZxvU_F zrut3jQ#b9o{;v+{p&ucbiy!y4tzkOl-<&Y>?TQLy@-U~4%5WmxiG9IQx2G3aQtJIK z%~M=W-cfyvkHYry>KfV3+)}wkG}l*PHP(dcEH9kTKvaCmC9t7i(}0w6n$Gs}L|3*O z;JIy-v~{xwFMx%_sTd)btUI#nn;(W09j?J~cJTwnIhXH!!#aXa28pcxNvB_XK>Fu- zkGA=(lB1%Dna!sv*f7$<@`Un`dw{9PeQOx)2mu0r&Ne5g{dhRbI?UQKsTZHdXsj6}EB4FpZLK zVjDw9N-=RRTKEIx1*(jmb&O6yYS2Z*Zo=hxPf|*eb*!rKc`#XpXauc0STfu=zk)}I zXZW%BXI9XSf?$~R4#*9$#WPYjEV}@!_6@OJcHc{>`_v z)CsDb$Qw}DLb+^*V?t=uv2V0hbPVbw<-2P>p80H~N06izpGYPW$VC)O23^hNB7O?W zpcDKAClIzEUs27BD4c6rQCVK6V)T%Tk2Il$!ep`3j5vkrKdA~~+Gu-pUH<*%c)wk& zuFh$*r3-}+11(lk$)Tr%h5M2|TxjSrDJM`Z3W?*$a6Zij7hbF$dt9D+X@o7``pl&D zdv`$KrPAqX=fO3He*tb%I>XbjKb;TJ^$J^*4YoJ2k(XR4PHMclN{T-<0GOR?x$VN7 zAA1AODBcVod+p#INvSbJb?Q`YZyIXmG@9GKk2%z@{$e87a!kJ(oWaMiZTk(|?|GiRRZ7*3BG28{;g15Lf?=Ggs|vuw)qqSRxf`V|EE=xuuxjecgv=EJp*us z;7lasYYw|l^l3$W0oHFeVs|F%@0*l}#WcvYtUL?Ji|MhdyXDv!?#nf=w{##|2MYe1 zaO{$Uugk6cEIMCX0>Knigw-B<;sDJ4eMjWO&93HRSt4AxK|{ot9$KGmZdEX60T0*5Wkg!}bV~xu!+N$(9FMi5Qo&Qc=_Sxt4}3vj7@wJ64APsG z*RXu@cAfbkdgf2C6Tf1$-kma~5VcZws$ccAP4cB_YKzDQyY*pc?V%#A_RB1C>@EsG z6olgnU5+9mrU zGJ>U~tb(Mh|S6w8y>ZHb>rO*vTk| z@7a$MBn92^C;YU4lr9bPs3>RSlVX;L>LXHZgH1|6k}09nT0pWG{&u}*6RCY8Ty!oU z$+UB_Dq!mWjTd9ebo;e`1N%BEy+lQRwDH*934h6-*B*Y~1d9a5n0Anc2iV&-ICEU* z6Q}Y0NGNk@=y`cx=j%F(drz)KRV<4AUm?-(zEB-AiJ9@2b(_&55Dh<+NN9w-BeF<>k*k4;Ok-FJOA98SPkO3!W;J{vhoNiQT?D1 zWxQ|O`>itUc7yRuT0pbiC=RwnGXPHVr@kM(2z-}Pa#J-}8vKp#4^Ls70u|7bP&&@a z=OE?G@?I*3%;beRAa*SYZ4$9yLqZJT=oUH+FD|$+$fl}osYR>wfq5iXh~^jv)AeV7 zIFCL|%n>xq&&A25FaQPGKe9Jx;6+5PVivK(A~fduS^$7Fbq?gA|WjXQ}kH zHw9}Y&_J$gj;d<45v^fU#jLh z_Q7Xgg02mp2S*1Nr|SwuzW!gckNJFyM4=HG$Sx_%vh{1qXva^eNa+vR^~QUY)@i3! z7A!wXkBX!=!`5ZBmHIi8LVu7-Vyt^I*6vjIBs!Wuc8S|9GiUiRgrd{15x;sos5!{Q zMOban=HnOig1cCq?XdGp{Fu5wIqw^3gBJtel7=EEwe- zx$2{1Ozm|Av_NNcJ$rCEX~Y}32KqeU=#1#XqLdmb$A_z50UI$g$J_If>^0myM_@EZ z7%C!0?uD9B;|W$D%uD8#JSBYBDM?-D8e}J(5U3i?;<-YH>#=Q zLJy%MJc?RXJu>#KyQW95Dcj`=aV|KwgjF_A{TjaY>A`a1&8MZ)Bq+QnwKmaw)%$wv z4Px_3R^tZqE+C;tWta81rEo&~Yqu>HxR#77nG3`g58HXxewCHRM~P z=NY;+hw}?nEYJIrp?!RxWGVuCRt`h7UK!?-+uiteRJY#_^i_B%F$&p@>jiB#r0X>EOsXMf zY7@m@elL44MO(ofNfC-7yYrFTWHnt6be*6N1u%zaP7P=!QJd1ixW+%{B*h^*8`*7d zi}q?FMOo9yR%pjYRl#x}_U)?;ak*m1mRi`8J!oss=WBxfW)zi}+vi2c4xr(jc^9HL zE-<~F+zk}FvQ%MYe7F3PM1oyUX8exN3EfY-^zVylpMFG?5&ZOPd@!YsAEPyK?| zZ{x6*;6ZBANx;+*sr0+alB9EQ01X8yE-ey>rJ|viuUo7d{eE1Y!T=_avZ|miJ$zL! zB%c(R!>b$1bUf5PmT82po0|}l$yz%vc&KgWvetdQ%<=4)?;zsQ7XPFFL`oNiI=*E^ z3|&!(a^5c|U9vm2)Q0_Pge+SZi!R*M}_Mk(|lJ zzKRwtD}GF(j=gW)XRko1{`ztR*0UkbQ-1 zs^KmF4DksO0zppKnc=ti2m1N#NIH_k*T%px2%)%s8#o5o_DuU}@Sr5xnPaU5ci5d# z`hHvd$<{$MVFL;m1-N5H%fvfe9fYuwa{H3L{DWmAcjknBR0PFJ;3dgaqKV{lix)BD z*YyxR`f-7)CVrxe7WS`$&;e#8O}9czussgayS*}JxN6F07>`>zzsO~_LTI!^vgyR4u`*QqU72;=8SUv!qCpFObxh|CP+SjK*b3sbshHV;4VLi6f_au z7%a9ElB9{gBvaF4Kf82C!g-6tVxF>3R6Y}va6f{wsjGjvZ>I9&J#4D1?Qg@RYCB*{ zC`FI!;|*=C-ytIB%r8*5PdNx$vo;ph#j?6Dv@t2W%=1GGD)Fl6bdYzmA#b_RG<3s} z%Z#RUu!A5lN4Sdu=jh?5ngHuYp`A^EtKBwo2zTxYEi@+~rC!KS)zJHrloT%&%cBD= zdDXJ|dS{jSJ0W={BYI;9`QtC|tD`aJl`R_0`J)@UYa9OSfLgq(yPocv_9{Kh{!+!P zI<`_p1`-3MLuEg%{?@QTKtO+OASZPgPd*nIkZ&L;(M;zGM;xTu~2f%W1SrpYpi|8O(1b1<9BP z_V<$c1~cnBmKnQQ=IwT%Ky|xcdddBjQL%DeW_C4vH3q{fb%Nai`=0&oqbLIn^GRzA z|C|{F#Jm;sf5{Vp`^Xb@%n1t=28XM1liERY;hDYH^p%8-L8u_YTK4bP=-RVkIuZU>eCtib6c-WrvV~N84#7d!$CtOipDhM& zJ>P+T$C6R$%pG^H86kLsFC8U`__n*xHUdr27GvWEIIZd_WDOq=SQ#U2_lv$@Vs%V* z!CSNk3Zpz6G-}b9{+4c&n6nLYu}3QhLB!@Ks47Qg=Q}Xv4O0Uda*a~Z2-vW0to@xP zF_AJ__SZ316O%Wy3XDK6DaQy>puh|PfWs#PjvN4M@8*GNaIK9pVj)Tk0O}sAEtX}XFPx4 z8~{>kJqtS7+3s)#6ZPd_E#8SXYjaQ=*|+$)0*&{5hDLDVU37#iDz2sB8Prki6Nznd zegf&#A@_|AgMurj7HJ>JWXFE8s!Wm0Tz5a0u#wtr^ol9QXnH;=MVzgLZTEJIgY@^| zA8-go-^JV%nX9Sb(1peCh~4&Bxx|-85RJEY=>12Sp*E<2(^8c@na=I{7bJ{KWD#ETn@vBmKvV$hW8 zi%XMzC54UZUiHVug?pIeZ-)~m`1NTJ#=Sna%X4`O#TasnjxLb&Nq{w@kgzr;*Tau% zCT`{7O)#VbE`*rk*dfj!oSd9SIPHjuw#7D+OvEYWzAh~Z4@pRzW(GVKp?^xkoZCoI z(w?*vEGA1Jsy$W6s$fK#3qHVs`s*88MC++l5xE{=%({~NqT6IF3Y|Lg;agKXbS$p| zy|;iV3TAp^hzWAh$*gz1eIJPlAvySnvue%HdMZkaQ787CkoGxzsbL1g`DUnS5!W4f zYqBIaj`k=7Dxn{4K1AB<>&`CeI)MYJ3lRg~4Kf!$rOVjfG;Fd^(j+V`<3;|ABI0>K zei{aUDZhbE<2BrJN;A@sH`j{i{889Yy@@_+q-6kAXul^sRUW5yTLdSEV=6S#H+^_X z2s1=u*vCg7BQvPe_!XkPR0WK+sgzDpX{&(6GQ~X!_L}m`yMVwi!BAqfLHSRwzkMRS zr%#e}>7F>*1a{zlbTVnsj6ayt-z~7Tb$?~2HTBc+&G@EOV01?DwA(X6pn*S&q%b4E zEB)Lry>dup*2yRRe3(#&MPbRpb3$}SOCtX`(=!W%#Yl4c|cA1(^ZuP z$9IXMJ8&6Dl%^k!r4SHXz-i4=XsdJBUSoD0{e$i`f8nsaTtxq!P8pK%-1K~o6Z|uu ztjBAj)fD;jWmBKp^dxk$TheL4m$NgTh&NyCkY+S*pf(OkcoKzkaOOa?%^Aq+G>al^ zY2FeOQr2hgN9@z4tCg#5B9>ZpXDhWHYw6X9>Bjf-lAk`Hf36Yv2_vbekRTwUcz@>- z{z)MGljZn(s%pyu0tDpG2J@k_GIG@abA{j&{3wW>jqDxFY^?c7nHd43#75RY8$&Z| z6Mj-v6$u6|Qb7SYJ`ynnQI)TX;>0$_#%4ex9zz?TlhsEuBEug?#EPmSveKf&qzp_< z3bsbp3V&f3ZR|~$n8Z}Xi2qd=`?m@4M<+~7;_{@#r2lfpXy|B2D!}*Odj4Q%?ZES| zCVo;=M@L&8CMKJYKK^a`rw?c_?s$Mj#od?XAE%3nk|*qC*-I5{|2zv;?K z%d2YWO3SN=%j)VnINF=p+WwgV7#cYnSu)xi8Jg-lG6HR^boCu|xtW*&OaK;LE*^FO z4}hJ4;on?<_D1@SANv4JA zzkt^IR!01!($>Z{#LT2j|BlE13S;^IgR%bq!Px$R{c}_~IDU-E!O;x(FNTi#29`z) zKpQ7(M}E?eBlIuYW>z2J{I5zI19KzbNA~i6LT&#aBs0su?QQk#^-b*cZB741vvRZj zyUE4I-tccN3pWS*ztup~4-=r{NBsWnpP8GDll>3-e;$cH_ukaqzT!#p9U$LT*-;7bryTg<3fopcB}^&DxyqJzebR`> z#LC=~p<1${f)nKM&@o#)S>F8I5o&7|t%3H%zA}-Cy)ZCT@--IXe#F#N$5XXq@xAG} z_R$)UGBJ?5x!j91~;fqay%Zh|_v*P?AcHE)%d3=qKDqgRInbW$4 zpcB=cBg%PCdv4d{OCV?21TKwMXXV1zpu9(geS`5A$ECumdHYca@G9rzw*fy)% zTKd+p3j1~Yay4a#V~P3vJ$8gQ(AKgFmBc9I4L2)`=YhSa_0L|2o~ZWd!?%eGjj)k@ zpASez8h)zW@n7rs(BFWH+DZY9$hJo{q(pj>o>cc6+`qLe3-)*twgl)r3RwPTTarGy zUKUszNpf~@z;%WX>b9($-Zy`Iy5q9-kf;T{5|1PXLP`6^6Zq2IDmczPtyH5`UmWbA+(yr@rSgf^l&T+zgAPH{ zRZE)H&Q+c;tJ|F1$18WnZ;~-%Lsx9w=E#>NB|!E4Zl(=V|1Y<@|}79D^|5EtevI`&;@Opz2iw^!fG@OJ1G2)_xu5h{jWJul&% z3Sc&%%#Vw5ZPEHMF+fUZfsDx_zW3l(h6%#xk{*yat4fYx*e)#2|GkO&khsCcM&IAM z)Ln{Li}sf7$Ww`(NFo0cO+MRS>4YRZ9`p|EqVomMtb@C+h5yZE9u`Dl=VzAgk6-Ep zzG)2J9A1}`(dOG-EbN0&@Bv2#zZcV=XDSeBcjvs^LbD1t?nyJB7F^B5*hz>YHjALB z>gzZc4heDSvtSn@fAHSZN4DprcOAdkQo^s{`41lVX}4fxwj@8MywA)RT|EXTJK++$ zvDC;4aMqj4EaIAUV9aHE-w?H{aoXu>^I^Dm4%6Arj5A9XZJer`&lH(kdkCKKej^~X$ohdr!o0#(Z>y@`iVD^6QX9m&=Nj3({3N2fy&rG38eR}hMs0i?>-WQ*(Jgw#@3POL`@Qzxziq`q$%7eluM>Ba3zm}s2 z211f}7|^wC>}r?;W*3=~4^a)ZckzNThJbn(QP#zgnSc4qXn>U&AUEM){VZjm&lBW& zjV2XMCC+y1d=-ifDh(seL_w%<{f)^NW(z=^cfOK2z@HunIgL#N?D@vhWH=bV$sw0^ zPZFvwsdhWdU;S)Xu!--%Acg|pKBIXZ*v7iO1DG_i8jo>EGUewIU-HUaL2BQ7yzMoFGEI_F@zWZW)qT^Y-`Mre9~ZOskt|13E3VuirJYhl0YWb#wqTlq~1G4=IHurfZT z*wZ|9v&`)O%SyuY9^4DqVZBXp+V^tRXFm+}wt4TV+_gF$6sjjpWFHCxPwxm~28Ajk zlL!Ou(?x(miv*C*8iDDAo&JG5-UB-Q0|90MnMh}Wpld|#1b~Kv5a5sz^576mA4ncs z7XhK~nFXT50Mi9?CUTMj)#C_IZi`y0qw7QtHc*m705)eF2{6E$l?|kf4G80aAs*ub G;sF3g`u~ss literal 0 HcmV?d00001 diff --git a/docs/lufs.txt b/docs/lufs.txt new file mode 100644 index 0000000..455375a --- /dev/null +++ b/docs/lufs.txt @@ -0,0 +1,394 @@ +LUFS – Linux Userland File System +(sshfs, ftpfs, localfs, locasefs, gnutellafs, gvfs, cardfs, cefs) + +1. INTRODUCTION + +For those not interested in technicalities: + +LUFS is enabling you to mount into your file hierarchy a remote computer's file system, which is accessible by various means (ftp, ssh, etc.). Then, the access to the remote files will be completely network transparent. In other words, you'll be able to read/modify remote files as if they were local, watch movies/listen to MP3s from FTP/SSH/Gnutella servers without copying them locally. Sheer magic. Now skip to the next section. + +LUFS is a hybrid userspace file system framework supporting an indefinite number of file systems transparently for any application. It consists of a kernel module and an userspace daemon. Basically it delegates most of the VFS calls to a specialized daemon which handles them. + +The reason for the userspace stuff: there are operations only suited for userspace (cryptography for example) and implementing them in kernel would be bloat. + +The reason for the kernel stuff: I think it's important to keep the file system access point at the lowest level in order to allow all the applications to use it. Consider KDE: it implements its own virtual file system, a great one, but only KDE applications can take advantage of it. So does GNOME, MC and others. Suddenly we have lots of overlapping userspace file system implementations, a real waste... + +Communication between the kernel module and the daemon is done through UNIX domain sockets. This makes LUFS best suited for networked file systems, where this indirection overhead (userspace <-> kernel <-> userspace) is small compared to the speed penalty due to the network itself. + +LUFS can be regarded as doing the same job as the VFS (virtual file system switch) in the kernel: it is a switch, distributing the file system calls to its supported file systems. With a big difference: LUFS file systems are implemented in userspace. This would be a drawback for local file systems where the access speed is important, but proves to be a huge advantage for networked file systems where the userland flexibility is most important. + +This flexibility allowed for implementation of SSHFS for example, in a pretty straightforward manner, using the already existing openssh infrastructure. Lots of other “exotic” file systems are in the planning phase: socketfs, httpfs, webdavfs, freenetfs, etc. Just imagine mounting a freenet file system and accessing all the goodies as they were local... + +Everything is a file and if not, it should be! + +2. FILE SYSTEMS + +This section describes the file systems distributed with LUFS and provides some real mount examples. Other file systems might also be available. + +The options presented here are file system specific, for a list of the global options please consult the USAGE section and the lufsmount(1) man page. + + + +2.1 LOCALFS + +LocalFS is a proof of concept and didactic file system, meant to demonstrate the framework's power. All it does is mirror the local tree on the mountpoint. Consider it a tutorial ;) + +It is a complete (and inefficient for simplicity's sake) implementation. + +Specific mount options: none. + +Mount example: + +[user@localhost]$ lufsmount localfs:// ~/mnt/lufs -–uid=505 + +or, using mount: +[root@localhost]# mount -t lufs none /mnt/lufs -o fs=localfs,uid=505 + + + + +2.2 LOCASEFS +Contributed by: Timothee Besset + +LoCaseFS provides a lowercase mapping of the local file system. It comes in handy when importing win32 source trees on *nix systems. + +It is a complete implementation (based on localfs, it could use some optimizations). + +Specific mount options: none + +Mount example: + +[user@localhost]$ lufsmount locasefs:// ~/mnt/lufs -–uid=505 + +or, using mount: +[root@localhost]# mount -t lufs none /mnt/lufs -o fs=locasefs,uid=505 + + + + +2.3 SSHFS +Requires: ssh ( http://www.openssh.org ). + +SshFS is probably the most advanced LUFS file system because of its security, usefulness and completeness. It is based on the SFTP protocol and requires openssh. You can mount remote file systems accessible through sftp (scp utility). + +It is a complete implementation. + + +Specific mount options: + +host=server : the sftp server to mount (authentication should be properly configured, see below) +port=port : the port the sftp server is listening on +username=user : the user to authenticate on the server (see INSTALLATION) + +I recommend setting up public key authentication (DSA or RSA based) on the remote system for the mounting user when using sshfs. This will allow the daemon to open several channels without any user interaction. Consult the ssh(1) manual page or try the lussh script for ssh setup. + +lussh is a helper script which tries to automatically setup public key authentication for ssh. You will be prompted for the ssh server and the remote username by the script and for the remote user's password by openssh. If you are prompted for the password more that twice, then public key authentication setup failed for the given server/user. + +It is possible to use sshfs without a public key authentication setup (provided you have openssh-askpass-gnome or some other ssh authentication helper) but you will be asked for passwords interactively. If this is annoying, you can reduce the number of communication channels (channels=1 option). + +Mount example: + +[user@localhost]$ lufsmount sshfs://mali@lufs.sourceforge.net ~/mnt/lufs –-fmask=444 -–dmask=555 + +or, using mount: +[root@localhost]# mount -t lufs none /mnt/lufs -o nosuid,fs=sshfs,host=lufs.sourceforge.net,username=mali,fmode=444,dmode=555 + + + +2.4 FTPFS + +FtpFS is a port of an old kernel implementation ( http://ftpfs.sourceforge.net ). Based on FTP, this file system allows you to mount ftp sites locally. + +Because of FTP's nature, there are some limitations: +the communication is in clear +some operations are not supported by the protocol +some operations are not supported by specific server implementations + +Specific mount options: + +host=server : the ftp server to mount +port=port : the port the ftp server is listening on +username=user : the user to authenticate on the server +password=pass : the user's password +ftpactive : will use active data connection (the server initiates the data connection) instead of passive data connection (the client opens the connection) + +If no username is supplied, LUFS will try anonymous access. +If the ftp server only allows a limited number of logins from a certain IP (1 per IP), you should limit the number of channels with the channels option ( channels=1 ). + +Mount example: + +[user@localhost]$ lufsmount ftpfs://mali:mypass@ftp.sourceforge.net ~/mnt/lufs -o ftpactive + +or, using mount: +[root@localhost]# mount -t lufs none /mnt/lufs -o nosuid,fs=ftpfs,host=ftp.sourceforge.net,username=mali,password=mypass,ftpactive + + + +2.5 GNUTELLAFS (GNETFS) + +OK, it's time to fasten your seatbelt and hold your breath: Kansas is going bye-bye 'cause you're about to swallow the red pill. + +Forget everything you knew about file sharing clients. This is a glimpse of the future... + +You mount a gnetfs in ~/gnet. You wait a couple of minutes so it can establish its peer connections. You start a search by creating a subdirectory of SEARCH: mkdir “~/gnet/SEARCH/metallica mp3”. You wait a few seconds for the results to accumulate. The you chdir to “SEARCH/metallica mp3” and try a ls: surprise – the files are there! You shoot up mpg123 and enjoy... You are happy. + +Sounds too good to be true? Well, it's here... + +GnetFS is a Gnutella network interface. You can perform searches and access resources without downloading them locally. + +Specific options: +known_peers=MAX : maximum number of known peers (see below) +hostX=IP:port : known peer – specify initial peers (X < MAX) + +All these have sane defaults in /etc/lufsd.conf so you can just ignore them. Just make sure you specify a small dir_cache_ttl so that the directory cache won't get in your way (the gnutella results are cached anyway). + +In order to start a search you create a subdirectory of SEARCH. A search for the text in subdirectory's name will be started in background and results added to that dir gradually. Once you have some results, you can start accessing (read-only) them. When you are no longer interested in that search, you simply erase the directory. + +Note: You need some serious bandwidth in order to enjoy gnetfs. LAN is great, DSL will do. Maybe cable too. + +IMPORTANT: gnetfs is EXPERIMENTAL! At least the searches seem to be working OK while for transfers you need to be lucky (but this is no news to gnutella users, is it?:) . The gnutella back-end is incomplete and only implements the bare basics needed for file searching/download – no uploads/sharing (the gnutella guys are probably out to get me as I write :). Hope this will change soon, I'm stuck with a dialup connection for now so I'm counting a LOT on your feedback. + +Mount examples: + +[user@localhost]$ lufsmount gnetfs:// ~/gnet -o dir_cache_ttl=1 + +or, using mount: + +[user@localhost]# mount -t lufs none /mnt/gnet -o fs=gnetfs,dir_cache_ttl=1 + + + +2.6 GVFS (GnomeVFS) +Requires: Gnome, libnomevfs (http://www.gnome.org) + +GVFS is an adapter file system linking lufs to Gnome's vfs. Thus, you gain access to the vfs functionality implemented in Gnome from all the applications. While not a very bright idea in itself (I think Gnome should use lufs or a similar concept) this might add some value to lufs considering the number of existing Gnome vfs modules. + +The functionality is dependent on that of the used Gnome VFS module, which (for gnomevfs-1 at least) isn't exactly impressive. The ftp and ssh modules especially, don't even come close to their lufs native corespondents. + +Specific mount options: + +No specific options, but the root option is mandatory and has a special meaning: it specifies the Gnome VFS URI to mount (thus it includes the protocol, host and all the other meaningful components) preceded by a “/” (example: root=/smb://station2). + +Mount examples: +[user@localhost]$ lufsmount gvfs:///ssh://mali@ssh.sf.net ~/mnt/lufs + +[user@localhost]$ lufsmount gvfs:///file:/ ~/mnt/lufs + +or, using mount: +[root@localhost]# mount -t lufs none /mnt/lufs -o fs=gvfs,root=/ftp://mali:xxxxx@ftp.sf.net + +[root@localhost]# mount -t lufs none /mnt/lufs -o fs=gvfs,root=/start-here:/ + + + +2.7 CARDFS +Contributed by: Martin Preuss < m_preuss@hamburg.de >. +Requires: libchipcard ( http://www.libchipcard.de ). + +This module allows you to mount memory card file systems. It requires the latest CVS libchipcard version. + +You must enable cefs support at configure time, using --enable-cardfs if you want this file system to be built. + +Specific mount options: + +host=teminal@address : terminal is the short name of your terminal (tow1, +pcsc0 or whatever name you assigned to your terminal). If omitted the default terminal will be used. +address is the address the cardfs daemon listens on (cardfsd's -a option) +port=port : the port that cardfsd is listening on (-p option) +username=user : the name used to authorize yourself to the card (only needed if encryption is enabled on the card) +password=pass : the password used for encryption/decryption + +You must start libchipcard's cardfs daemon before mounting the file system: +[root@localhost]# cardfsd -a ADDRESS_TO_BIND_TO -p PORT_TO_BIND_TO + +Mount example: + +[root@localhost]# lufsmount cardfs://myusr:password@ttyS0@127.0.0.1:9770 /mnt/lufs + +or, using mount: +[root@localhost]# mount -t lufs none /mnt/lufs -o nosuid,fs=cardfs,username=myusr,password=mypass,host=ttyS0@127.0.0.1,port=9770 + + + +2.8 CEFS +Contributed by: Fedor Bezrukov < fedor@ms2.inr.ac.ru > + +This lufs module allows access to a CE device's (HP (Compaq) IPAQ, HP Jornada, etc...) file system. + +You must enable cefs support at configure time, using --enable-cefs if you want this file system to be built. + +Specific mount options: + +No specific options here. Simply mount the file system after connecting your PDA. +Check out cefs.txt for detailed information. + +Mount example: + +[user@localhost]$ lufsmount cefs:// ~/mnt/lufs + +or, using mount: +[root@localhost]# mount -t lufs none /mnt/lufs -o nosuid,fs=cefs + +3. BUILD & INSTALLATION + +3.1 SOURCE DISTRIBUTION + +In order to build LUFS you need to have the running kernel's headers installed. Check whether /lib/modules/`uname -r`/build/include is pointing to the running kernel's include dir. + +IMPORTANT: +The kernel module requires the same compiler that was used for your running kernel's build. + +Executing + +[root@localhost]# ./configure [options] +[root@localhost]# make +[root@localhost]# make install + +as root in the top lufs directory should build and install the application. + +The non-standard configure options are: + +--with-kernel=VERSION configure for the specified kernel version (skip +auto-detection) +--with-kheaders=DIR specify the location of the kernel headers (skip +auto-detection) +--with-ssh=SSH specify the location of the ssh executable +--enable-debug enable debug messages from the daemon +--enable-kdebug enable debug messages from the kernel module +--enable-cardfs enable cardfs support +--enable-cefs enable cefs support +--enable-autofs-install enable installing of autofs config file +--enable-modversions force modversions kernel support +--disable-suid lufsmnt and lufsumount will not be made suid (regular +users won't be able to mount lufs). +--disable-kernel-support do not build & install the required kernel module +(useful when your kernel is already patched for lufs support) + + + +3.2 PATCHED KERNEL + +If for some reason (read modversions:) the kernel module fails to compile and install properly, you can try to patch the kernel manually. + +Download the patch for your kernel version (if available) into your kernel's source top directory. Apply it by + +[user@localhost ~/linux-2.4.19]$ zcat lufs-x.x.x-x.x.x.patch.gz | patch -Np1 + +Then proceed with building and installing your kernel, not forgetting to reconfigure it, enabling LUFS under FILE SYSTEMS section first (it requires development/incomplete drivers and UNIX domain sockets). + +The rest of the package can then be easily installed as described above, specifying –disable-kernel-support when running ./configure. + + + +3.3 DEBUG BUILD + +So you've got lufs installed but bumped right into that nasty buggy... The cruel realization of lufs' imperfection overwhelms you... But wait, maybe you can do something about it! + +Don't worry, I'm not gonna tell you to shoot gdb up and start hacking. Just make a debug build of lufs, try to replicate the problem and send me a bug report along with some log files. I will (try to) take care of the rest. + +[root@localhost]# ./configure -–enable-debug -–enable-kdebug +[root@localhost]# make clean +[root@localhost]# make +[root@localhost]# make install + +When mounting, redirect stdout and stderr to some files : + +[root@localhost]# lufsmount ftpfs://mali@ftp.sourceforge.net ~/mnt >lufsd.log 2>lufsd.err + +Now try to replicate the problem and send me a bug report along with lufsd.err and lufsd.log plus a tail of your /var/log/messages (or whatever holds your kernel's logs). The bug report should contain information about you system (distro, kernel version, gcc version, etc.) and a description of what you did to bring up the bug. + +Your help will be appreciated! + + + +4. USAGE + +4.1 MOUNTING: + +NOTE: Regular users can mount/unmount lufs file systems using lufsmount/lufsumount if suid is set on these mount wrappers (see INSTALLATION). + +For your convenience, a mounting utility is provided (lufsmount) which allows a more natural interface. + +Lufsmount ://[[:]@][][:][/] [OPTIONS] + +The -h flag provides a complete description of the available options. + +Notes: +“/”, ”:”, “@” are treated as separators by lufsmount. If one of the parameters contains such characters, you shouldn't use lufsmount. +lufsmount is just a parameter parser actually, which in turn calls lufsd with formated parameters, so you could use lufsd if you run into lufsmount's limitations. + +Another way to mount a LUFS is by calling lufsd directly: + +lufsd none mountpoint -o options[...] + +where the options have exactly the same syntax as when using mount (see below). + +Besides lufsmount & lufsd, you can always count on good ol' mount. You'll probably not be able to use mount as a regular user though... The general syntax for mounting a LUFS file system is + +mount -t lufs none mountpoint -o nosuid,fs=file_system[,uid=id][,gid=id][,fmask=mode][,dmask=mode][,channels=nr_chan][,root=remote_root][,own_fs][,quiet][,...] + +fs=file_system : the file system type to mount (localfs, sshfs, ftpfs) +uid=id : the uid to own the mounted fs +gid=id : the gid to own the mounted fs +fmask=mode : the minimal permissions to be set on each file +dmask=mode : the minimal permissions to be set on each directory +channels=nr_chan : the number of communication channels to open for a mounted fs +root=remote_root : the remote directory to be mapped on the file system's root +own_fs : the whole file system will be owned by the mounting user +quiet : disable all logging (close all file descriptors) +dir_cache_ttl=secs : number of seconds a directory cache entry is valid + +The nosuid option is automatically appended, so that all the remote file systems are treated as untrusted. + +Sensitive information (passwords) will not be written in /etc/mtab. + +The number of communication channels represents the number of independent channels that will be used for a mounted file system. More of these insure better performance when multiple processes access the file system. Ideally, one channel per accessing process would allow optimum performance. There is a channel setup and resource overhead though, so a number of ~7 channels should not be exceeded. In some cases, multiple channels may cause problems (ftp servers only allowing a limited number of logins from a certain IP), so the channels option allows you to specify a reduced number (possibly 1). + +For file system specific options and examples check out the FILE SYSTEMS section. + + + +4.2 UNMOUNTING: + +As root, you can simply use umount in order to unmount a lufs file system. That is: + +#umount /mnt/lufs + +A regular user will have to use the suid-ed lufsumount: + +$lufsumount ~/mnt/lufs + +Of course, a regular user will only be able to unmount file systems mounted by himself. + + +4.3 AUTOFS SUPPORT: + +LUFS provides autofs executable maps for ftpfs and sshfs (auto.ftpfs and auto.sshfs). These can be used in /etc/auto.master as follows: + +# Sample auto.master file +# Format of this file: +# mountpoint map options +# For details of the format look at autofs(8). +/mnt/net/ssh /etc/auto.sshfs --timeout=60 +/mnt/net/ftp /etc/auto.ftpfs --timeout=60 + + +Then, after restarting automount (/etc/init.d/autofs restart), you can access ssh and ftp servers more easily: + +$ cd /mnt/net/ftp/ftp.kernel.org/pub +$ ls -al /mnt/net/ssh/mali@lufs.sourceforge.net + + +Mounting and unmounting is taken care of by autofs. + +Notes: +the --enable-autofs-install configure parameter will configure autofs for /mnt/net/ssh and /mnt/net/ftp automatically. +for sshfs to function properly under autofs, public key authentication must be configured for root (or whoever is running automount - see the SSHFS section). + + +4.4 PERMISSIONS MAPPING + +Two methods are available for mapping remote permissions locally: + +normal mapping: the file/dir permissions are preserved and the owner changed accordingly (either the mounting user, or some neutral – uid=gid=2 – if the file is not owned remotely). This mode is active by default. +forced ownership: all the files/dirs are owned by the mounting user and the permissions are changed to reflect real access rights (if the file is not owned remotely, then the local “user” and “group” permissions will be the same as remote “other”). This mode is activated by the own_fs option. \ No newline at end of file diff --git a/filesystems/Makefile.am b/filesystems/Makefile.am new file mode 100644 index 0000000..f16c9a8 --- /dev/null +++ b/filesystems/Makefile.am @@ -0,0 +1,8 @@ +INCLUDES=-I../ @all_includes@ + +SUBDIRS=@opt_fs@ +DIST_SUBDIRS=localfs locasefs ftpfs sshfs cardfs cefs gvfs gnetfs wavfs + +install-exec-hook: + @echo "filesystems post install configuration..." + ldconfig diff --git a/filesystems/Makefile.in b/filesystems/Makefile.in new file mode 100644 index 0000000..181043a --- /dev/null +++ b/filesystems/Makefile.in @@ -0,0 +1,458 @@ +# Makefile.in generated by automake 1.7.5 from Makefile.am. +# @configure_input@ + +# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003 +# Free Software Foundation, Inc. +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ + +srcdir = @srcdir@ +top_srcdir = @top_srcdir@ +VPATH = @srcdir@ +pkgdatadir = $(datadir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +top_builddir = .. + +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +INSTALL = @INSTALL@ +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = @build@ +host_triplet = @host@ +target_triplet = @target@ +ACLOCAL = @ACLOCAL@ +AMDEP_FALSE = @AMDEP_FALSE@ +AMDEP_TRUE = @AMDEP_TRUE@ +AMTAR = @AMTAR@ +AUTOCONF = @AUTOCONF@ +AUTOFS_INSTALL = @AUTOFS_INSTALL@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CXX = @CXX@ +CXXDEPMODE = @CXXDEPMODE@ +CXXFLAGS = @CXXFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DEBUG_FLAGS = @DEBUG_FLAGS@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +ECHO = @ECHO@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +EXEEXT = @EXEEXT@ +GCONF = @GCONF@ +GVFSCONF = @GVFSCONF@ +GVFS_CFLAGS = @GVFS_CFLAGS@ +GVFS_LDADD = @GVFS_LDADD@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +KDEBUG_FLAGS = @KDEBUG_FLAGS@ +KERNEL_DIR = @KERNEL_DIR@ +KERNEL_HDR = @KERNEL_HDR@ +LDFLAGS = @LDFLAGS@ +LIBCHIPCARD_INCLUDES = @LIBCHIPCARD_INCLUDES@ +LIBCHIPCARD_LIB = @LIBCHIPCARD_LIB@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LIBTOOL = @LIBTOOL@ +LN_S = @LN_S@ +LTLIBOBJS = @LTLIBOBJS@ +LUFS_SUID = @LUFS_SUID@ +MAKEINFO = @MAKEINFO@ +MODULES_DIR = @MODULES_DIR@ +MODV_FLAGS = @MODV_FLAGS@ +OBJEXT = @OBJEXT@ +OS_DIR = @OS_DIR@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +RANLIB = @RANLIB@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +SSHPROG = @SSHPROG@ +STRIP = @STRIP@ +VERSION = @VERSION@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_CXX = @ac_ct_CXX@ +ac_ct_RANLIB = @ac_ct_RANLIB@ +ac_ct_STRIP = @ac_ct_STRIP@ +all_includes = @all_includes@ +all_libraries = @all_libraries@ +am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ +am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ +am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@ +am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +datadir = @datadir@ +define_has_libchipcard = @define_has_libchipcard@ +exec_prefix = @exec_prefix@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localstatedir = @localstatedir@ +mandir = @mandir@ +oldincludedir = @oldincludedir@ +opt_fs = @opt_fs@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +sysconfdir = @sysconfdir@ +target = @target@ +target_alias = @target_alias@ +target_cpu = @target_cpu@ +target_os = @target_os@ +target_vendor = @target_vendor@ +INCLUDES = -I../ @all_includes@ + +SUBDIRS = @opt_fs@ +DIST_SUBDIRS = localfs locasefs ftpfs sshfs cardfs cefs gvfs gnetfs wavfs +subdir = filesystems +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +mkinstalldirs = $(SHELL) $(top_srcdir)/config/mkinstalldirs +CONFIG_HEADER = $(top_builddir)/config.h +CONFIG_CLEAN_FILES = +DIST_SOURCES = + +RECURSIVE_TARGETS = info-recursive dvi-recursive pdf-recursive \ + ps-recursive install-info-recursive uninstall-info-recursive \ + all-recursive install-data-recursive install-exec-recursive \ + installdirs-recursive install-recursive uninstall-recursive \ + check-recursive installcheck-recursive +DIST_COMMON = Makefile.am Makefile.in +all: all-recursive + +.SUFFIXES: +$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4) + cd $(top_srcdir) && \ + $(AUTOMAKE) --gnu filesystems/Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe) + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs + +distclean-libtool: + -rm -f libtool +uninstall-info-am: + +# This directory's subdirectories are mostly independent; you can cd +# into them and run `make' without going through this Makefile. +# To change the values of `make' variables: instead of editing Makefiles, +# (1) if the variable is set in `config.status', edit `config.status' +# (which will cause the Makefiles to be regenerated when you run `make'); +# (2) otherwise, pass the desired values on the `make' command line. +$(RECURSIVE_TARGETS): + @set fnord $$MAKEFLAGS; amf=$$2; \ + dot_seen=no; \ + target=`echo $@ | sed s/-recursive//`; \ + list='$(SUBDIRS)'; for subdir in $$list; do \ + echo "Making $$target in $$subdir"; \ + if test "$$subdir" = "."; then \ + dot_seen=yes; \ + local_target="$$target-am"; \ + else \ + local_target="$$target"; \ + fi; \ + (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ + || case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \ + done; \ + if test "$$dot_seen" = "no"; then \ + $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \ + fi; test -z "$$fail" + +mostlyclean-recursive clean-recursive distclean-recursive \ +maintainer-clean-recursive: + @set fnord $$MAKEFLAGS; amf=$$2; \ + dot_seen=no; \ + case "$@" in \ + distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ + *) list='$(SUBDIRS)' ;; \ + esac; \ + rev=''; for subdir in $$list; do \ + if test "$$subdir" = "."; then :; else \ + rev="$$subdir $$rev"; \ + fi; \ + done; \ + rev="$$rev ."; \ + target=`echo $@ | sed s/-recursive//`; \ + for subdir in $$rev; do \ + echo "Making $$target in $$subdir"; \ + if test "$$subdir" = "."; then \ + local_target="$$target-am"; \ + else \ + local_target="$$target"; \ + fi; \ + (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ + || case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \ + done && test -z "$$fail" +tags-recursive: + list='$(SUBDIRS)'; for subdir in $$list; do \ + test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \ + done +ctags-recursive: + list='$(SUBDIRS)'; for subdir in $$list; do \ + test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \ + done + +ETAGS = etags +ETAGSFLAGS = + +CTAGS = ctags +CTAGSFLAGS = + +tags: TAGS + +ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + mkid -fID $$unique + +TAGS: tags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + tags=; \ + here=`pwd`; \ + if (etags --etags-include --version) >/dev/null 2>&1; then \ + include_option=--etags-include; \ + else \ + include_option=--include; \ + fi; \ + list='$(SUBDIRS)'; for subdir in $$list; do \ + if test "$$subdir" = .; then :; else \ + test -f $$subdir/TAGS && \ + tags="$$tags $$include_option=$$here/$$subdir/TAGS"; \ + fi; \ + done; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + test -z "$(ETAGS_ARGS)$$tags$$unique" \ + || $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$tags $$unique + +ctags: CTAGS +CTAGS: ctags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + tags=; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + test -z "$(CTAGS_ARGS)$$tags$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$tags $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && cd $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) $$here + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) + +top_distdir = .. +distdir = $(top_distdir)/$(PACKAGE)-$(VERSION) + +distdir: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \ + list='$(DISTFILES)'; for file in $$list; do \ + case $$file in \ + $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ + $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ + esac; \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test "$$dir" != "$$file" && test "$$dir" != "."; then \ + dir="/$$dir"; \ + $(mkinstalldirs) "$(distdir)$$dir"; \ + else \ + dir=''; \ + fi; \ + if test -d $$d/$$file; then \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ + fi; \ + cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ + else \ + test -f $(distdir)/$$file \ + || cp -p $$d/$$file $(distdir)/$$file \ + || exit 1; \ + fi; \ + done + list='$(DIST_SUBDIRS)'; for subdir in $$list; do \ + if test "$$subdir" = .; then :; else \ + test -d $(distdir)/$$subdir \ + || mkdir $(distdir)/$$subdir \ + || exit 1; \ + (cd $$subdir && \ + $(MAKE) $(AM_MAKEFLAGS) \ + top_distdir="$(top_distdir)" \ + distdir=../$(distdir)/$$subdir \ + distdir) \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-recursive +all-am: Makefile +installdirs: installdirs-recursive +installdirs-am: + +install: install-recursive +install-exec: install-exec-recursive +install-data: install-data-recursive +uninstall: uninstall-recursive + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-recursive +install-strip: + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + INSTALL_STRIP_FLAG=-s \ + `test -z '$(STRIP)' || \ + echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -rm -f Makefile $(CONFIG_CLEAN_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +clean: clean-recursive + +clean-am: clean-generic clean-libtool mostlyclean-am + +distclean: distclean-recursive + +distclean-am: clean-am distclean-generic distclean-libtool \ + distclean-tags + +dvi: dvi-recursive + +dvi-am: + +info: info-recursive + +info-am: + +install-data-am: + +install-exec-am: + @$(NORMAL_INSTALL) + $(MAKE) $(AM_MAKEFLAGS) install-exec-hook + +install-info: install-info-recursive + +install-man: + +installcheck-am: + +maintainer-clean: maintainer-clean-recursive + +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-recursive + +mostlyclean-am: mostlyclean-generic mostlyclean-libtool + +pdf: pdf-recursive + +pdf-am: + +ps: ps-recursive + +ps-am: + +uninstall-am: uninstall-info-am + +uninstall-info: uninstall-info-recursive + +.PHONY: $(RECURSIVE_TARGETS) CTAGS GTAGS all all-am check check-am clean \ + clean-generic clean-libtool clean-recursive ctags \ + ctags-recursive distclean distclean-generic distclean-libtool \ + distclean-recursive distclean-tags distdir dvi dvi-am \ + dvi-recursive info info-am info-recursive install install-am \ + install-data install-data-am install-data-recursive \ + install-exec install-exec-am install-exec-recursive \ + install-info install-info-am install-info-recursive install-man \ + install-recursive install-strip installcheck installcheck-am \ + installdirs installdirs-am installdirs-recursive \ + maintainer-clean maintainer-clean-generic \ + maintainer-clean-recursive mostlyclean mostlyclean-generic \ + mostlyclean-libtool mostlyclean-recursive pdf pdf-am \ + pdf-recursive ps ps-am ps-recursive tags tags-recursive \ + uninstall uninstall-am uninstall-info-am \ + uninstall-info-recursive uninstall-recursive + + +install-exec-hook: + @echo "filesystems post install configuration..." + ldconfig +# 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/filesystems/cardfs/Makefile.am b/filesystems/cardfs/Makefile.am new file mode 100644 index 0000000..cfbca44 --- /dev/null +++ b/filesystems/cardfs/Makefile.am @@ -0,0 +1,9 @@ + +INCLUDES=-I../ @all_includes@ @LIBCHIPCARD_INCLUDES@ +lib_LTLIBRARIES=liblufs-cardfs.la + +liblufs_cardfs_la_SOURCES=cardfs.cpp +liblufs_cardfs_la_LDFLAGS=-version-info 2:0:0 + +#libcardfsm_la_LIBADD=-L/usr/local/libchipcard/lib -lcardfs -lchipcard +noinst_HEADERS=cardfs.h diff --git a/filesystems/cardfs/Makefile.in b/filesystems/cardfs/Makefile.in new file mode 100644 index 0000000..cde8376 --- /dev/null +++ b/filesystems/cardfs/Makefile.in @@ -0,0 +1,461 @@ +# Makefile.in generated by automake 1.7.5 from Makefile.am. +# @configure_input@ + +# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003 +# Free Software Foundation, Inc. +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ + +srcdir = @srcdir@ +top_srcdir = @top_srcdir@ +VPATH = @srcdir@ +pkgdatadir = $(datadir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +top_builddir = ../.. + +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +INSTALL = @INSTALL@ +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = @build@ +host_triplet = @host@ +target_triplet = @target@ +ACLOCAL = @ACLOCAL@ +AMDEP_FALSE = @AMDEP_FALSE@ +AMDEP_TRUE = @AMDEP_TRUE@ +AMTAR = @AMTAR@ +AUTOCONF = @AUTOCONF@ +AUTOFS_INSTALL = @AUTOFS_INSTALL@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CXX = @CXX@ +CXXDEPMODE = @CXXDEPMODE@ +CXXFLAGS = @CXXFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DEBUG_FLAGS = @DEBUG_FLAGS@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +ECHO = @ECHO@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +EXEEXT = @EXEEXT@ +GCONF = @GCONF@ +GVFSCONF = @GVFSCONF@ +GVFS_CFLAGS = @GVFS_CFLAGS@ +GVFS_LDADD = @GVFS_LDADD@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +KDEBUG_FLAGS = @KDEBUG_FLAGS@ +KERNEL_DIR = @KERNEL_DIR@ +KERNEL_HDR = @KERNEL_HDR@ +LDFLAGS = @LDFLAGS@ +LIBCHIPCARD_INCLUDES = @LIBCHIPCARD_INCLUDES@ +LIBCHIPCARD_LIB = @LIBCHIPCARD_LIB@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LIBTOOL = @LIBTOOL@ +LN_S = @LN_S@ +LTLIBOBJS = @LTLIBOBJS@ +LUFS_SUID = @LUFS_SUID@ +MAKEINFO = @MAKEINFO@ +MODULES_DIR = @MODULES_DIR@ +MODV_FLAGS = @MODV_FLAGS@ +OBJEXT = @OBJEXT@ +OS_DIR = @OS_DIR@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +RANLIB = @RANLIB@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +SSHPROG = @SSHPROG@ +STRIP = @STRIP@ +VERSION = @VERSION@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_CXX = @ac_ct_CXX@ +ac_ct_RANLIB = @ac_ct_RANLIB@ +ac_ct_STRIP = @ac_ct_STRIP@ +all_includes = @all_includes@ +all_libraries = @all_libraries@ +am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ +am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ +am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@ +am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +datadir = @datadir@ +define_has_libchipcard = @define_has_libchipcard@ +exec_prefix = @exec_prefix@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localstatedir = @localstatedir@ +mandir = @mandir@ +oldincludedir = @oldincludedir@ +opt_fs = @opt_fs@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +sysconfdir = @sysconfdir@ +target = @target@ +target_alias = @target_alias@ +target_cpu = @target_cpu@ +target_os = @target_os@ +target_vendor = @target_vendor@ + +INCLUDES = -I../ @all_includes@ @LIBCHIPCARD_INCLUDES@ +lib_LTLIBRARIES = liblufs-cardfs.la + +liblufs_cardfs_la_SOURCES = cardfs.cpp +liblufs_cardfs_la_LDFLAGS = -version-info 2:0:0 + +#libcardfsm_la_LIBADD=-L/usr/local/libchipcard/lib -lcardfs -lchipcard +noinst_HEADERS = cardfs.h +subdir = filesystems/cardfs +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +mkinstalldirs = $(SHELL) $(top_srcdir)/config/mkinstalldirs +CONFIG_HEADER = $(top_builddir)/config.h +CONFIG_CLEAN_FILES = +LTLIBRARIES = $(lib_LTLIBRARIES) + +liblufs_cardfs_la_LIBADD = +am_liblufs_cardfs_la_OBJECTS = cardfs.lo +liblufs_cardfs_la_OBJECTS = $(am_liblufs_cardfs_la_OBJECTS) + +DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir) +depcomp = $(SHELL) $(top_srcdir)/config/depcomp +am__depfiles_maybe = depfiles +@AMDEP_TRUE@DEP_FILES = ./$(DEPDIR)/cardfs.Plo +CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ + $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) +LTCXXCOMPILE = $(LIBTOOL) --mode=compile $(CXX) $(DEFS) \ + $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ + $(AM_CXXFLAGS) $(CXXFLAGS) +CXXLD = $(CXX) +CXXLINK = $(LIBTOOL) --mode=link $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) \ + $(AM_LDFLAGS) $(LDFLAGS) -o $@ +DIST_SOURCES = $(liblufs_cardfs_la_SOURCES) +HEADERS = $(noinst_HEADERS) + +DIST_COMMON = $(noinst_HEADERS) Makefile.am Makefile.in +SOURCES = $(liblufs_cardfs_la_SOURCES) + +all: all-am + +.SUFFIXES: +.SUFFIXES: .cpp .lo .o .obj +$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4) + cd $(top_srcdir) && \ + $(AUTOMAKE) --gnu filesystems/cardfs/Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe) +libLTLIBRARIES_INSTALL = $(INSTALL) +install-libLTLIBRARIES: $(lib_LTLIBRARIES) + @$(NORMAL_INSTALL) + $(mkinstalldirs) $(DESTDIR)$(libdir) + @list='$(lib_LTLIBRARIES)'; for p in $$list; do \ + if test -f $$p; then \ + f="`echo $$p | sed -e 's|^.*/||'`"; \ + echo " $(LIBTOOL) --mode=install $(libLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) $$p $(DESTDIR)$(libdir)/$$f"; \ + $(LIBTOOL) --mode=install $(libLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) $$p $(DESTDIR)$(libdir)/$$f; \ + else :; fi; \ + done + +uninstall-libLTLIBRARIES: + @$(NORMAL_UNINSTALL) + @list='$(lib_LTLIBRARIES)'; for p in $$list; do \ + p="`echo $$p | sed -e 's|^.*/||'`"; \ + echo " $(LIBTOOL) --mode=uninstall rm -f $(DESTDIR)$(libdir)/$$p"; \ + $(LIBTOOL) --mode=uninstall rm -f $(DESTDIR)$(libdir)/$$p; \ + done + +clean-libLTLIBRARIES: + -test -z "$(lib_LTLIBRARIES)" || rm -f $(lib_LTLIBRARIES) + @list='$(lib_LTLIBRARIES)'; for p in $$list; do \ + dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \ + test "$$dir" = "$$p" && dir=.; \ + echo "rm -f \"$${dir}/so_locations\""; \ + rm -f "$${dir}/so_locations"; \ + done +liblufs-cardfs.la: $(liblufs_cardfs_la_OBJECTS) $(liblufs_cardfs_la_DEPENDENCIES) + $(CXXLINK) -rpath $(libdir) $(liblufs_cardfs_la_LDFLAGS) $(liblufs_cardfs_la_OBJECTS) $(liblufs_cardfs_la_LIBADD) $(LIBS) + +mostlyclean-compile: + -rm -f *.$(OBJEXT) core *.core + +distclean-compile: + -rm -f *.tab.c + +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cardfs.Plo@am__quote@ + +distclean-depend: + -rm -rf ./$(DEPDIR) + +.cpp.o: +@am__fastdepCXX_TRUE@ if $(CXXCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" \ +@am__fastdepCXX_TRUE@ -c -o $@ `test -f '$<' || echo '$(srcdir)/'`$<; \ +@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; \ +@am__fastdepCXX_TRUE@ else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; \ +@am__fastdepCXX_TRUE@ fi +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ `test -f '$<' || echo '$(srcdir)/'`$< + +.cpp.obj: +@am__fastdepCXX_TRUE@ if $(CXXCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" \ +@am__fastdepCXX_TRUE@ -c -o $@ `if test -f '$<'; then $(CYGPATH_W) '$<'; else $(CYGPATH_W) '$(srcdir)/$<'; fi`; \ +@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; \ +@am__fastdepCXX_TRUE@ else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; \ +@am__fastdepCXX_TRUE@ fi +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ `if test -f '$<'; then $(CYGPATH_W) '$<'; else $(CYGPATH_W) '$(srcdir)/$<'; fi` + +.cpp.lo: +@am__fastdepCXX_TRUE@ if $(LTCXXCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" \ +@am__fastdepCXX_TRUE@ -c -o $@ `test -f '$<' || echo '$(srcdir)/'`$<; \ +@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Plo"; \ +@am__fastdepCXX_TRUE@ else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; \ +@am__fastdepCXX_TRUE@ fi +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ depfile='$(DEPDIR)/$*.Plo' tmpdepfile='$(DEPDIR)/$*.TPlo' @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(LTCXXCOMPILE) -c -o $@ `test -f '$<' || echo '$(srcdir)/'`$< + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs + +distclean-libtool: + -rm -f libtool +uninstall-info-am: + +ETAGS = etags +ETAGSFLAGS = + +CTAGS = ctags +CTAGSFLAGS = + +tags: TAGS + +ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + mkid -fID $$unique + +TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + tags=; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + test -z "$(ETAGS_ARGS)$$tags$$unique" \ + || $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$tags $$unique + +ctags: CTAGS +CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + tags=; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + test -z "$(CTAGS_ARGS)$$tags$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$tags $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && cd $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) $$here + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) + +top_distdir = ../.. +distdir = $(top_distdir)/$(PACKAGE)-$(VERSION) + +distdir: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \ + list='$(DISTFILES)'; for file in $$list; do \ + case $$file in \ + $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ + $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ + esac; \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test "$$dir" != "$$file" && test "$$dir" != "."; then \ + dir="/$$dir"; \ + $(mkinstalldirs) "$(distdir)$$dir"; \ + else \ + dir=''; \ + fi; \ + if test -d $$d/$$file; then \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ + fi; \ + cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ + else \ + test -f $(distdir)/$$file \ + || cp -p $$d/$$file $(distdir)/$$file \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-am +all-am: Makefile $(LTLIBRARIES) $(HEADERS) + +installdirs: + $(mkinstalldirs) $(DESTDIR)$(libdir) +install: install-am +install-exec: install-exec-am +install-data: install-data-am +uninstall: uninstall-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-am +install-strip: + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + INSTALL_STRIP_FLAG=-s \ + `test -z '$(STRIP)' || \ + echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -rm -f Makefile $(CONFIG_CLEAN_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +clean: clean-am + +clean-am: clean-generic clean-libLTLIBRARIES clean-libtool \ + mostlyclean-am + +distclean: distclean-am + +distclean-am: clean-am distclean-compile distclean-depend \ + distclean-generic distclean-libtool distclean-tags + +dvi: dvi-am + +dvi-am: + +info: info-am + +info-am: + +install-data-am: + +install-exec-am: install-libLTLIBRARIES + +install-info: install-info-am + +install-man: + +installcheck-am: + +maintainer-clean: maintainer-clean-am + +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-compile mostlyclean-generic \ + mostlyclean-libtool + +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + +uninstall-am: uninstall-info-am uninstall-libLTLIBRARIES + +.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ + clean-libLTLIBRARIES clean-libtool ctags distclean \ + distclean-compile distclean-depend distclean-generic \ + distclean-libtool distclean-tags distdir dvi dvi-am info \ + info-am install install-am install-data install-data-am \ + install-exec install-exec-am install-info install-info-am \ + install-libLTLIBRARIES install-man install-strip installcheck \ + installcheck-am installdirs maintainer-clean \ + maintainer-clean-generic mostlyclean mostlyclean-compile \ + mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ + tags uninstall uninstall-am uninstall-info-am \ + uninstall-libLTLIBRARIES + +# 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/filesystems/cardfs/cardfs.cpp b/filesystems/cardfs/cardfs.cpp new file mode 100644 index 0000000..751997e --- /dev/null +++ b/filesystems/cardfs/cardfs.cpp @@ -0,0 +1,453 @@ +/*************************************************************************** + $RCSfile$ + ------------------- + cvs : $Id$ + begin : Thu Aug 15 2002 + copyright : (C) 2002 by Martin Preuss + email : martin@libchipcard.de + + *************************************************************************** + * * + * This library is free software; you can redistribute it and/or * + * modify it under the terms of the GNU Lesser General Public * + * License as published by the Free Software Foundation; either * + * version 2.1 of the License, or (at your option) any later version. * + * * + * This library is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * + * Lesser General Public License for more details. * + * * + * You should have received a copy of the GNU Lesser General Public * + * License along with this library; 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 "cardfs.h" + +extern "C" { + +void* +cardfs_init(struct list_head *cfg, struct dir_cache *cache, struct credentials *cred, void **global_fs){ + return (void*)new CardFS(cfg, cache); +} + +void +cardfs_free(void *ctx){ + CardFS *p = (CardFS*)ctx; + + delete p; +} + +int +cardfs_mount(void *ctx){ + return ((CardFS*)ctx)->do_mount(); +} + +void +cardfs_umount(void *ctx){ +// return ((CardFS*)ctx)->do_umount(); +} + +int +cardfs_readdir(void *ctx, char *dir_name, struct directory *dir){ + return ((CardFS*)ctx)->do_readdir(dir_name, dir); +} + +int +cardfs_stat(void *ctx, char *name, struct lufs_fattr *fattr){ + return ((CardFS*)ctx)->do_stat(name, fattr); +} + +int +cardfs_mkdir(void *ctx, char *dir, int mode){ + return ((CardFS*)ctx)->do_mkdir(dir, mode); +} + +int +cardfs_rmdir(void *ctx, char *dir){ + return ((CardFS*)ctx)->do_rmdir(dir); +} + +int +cardfs_create(void *ctx, char *file, int mode){ + return ((CardFS*)ctx)->do_create(file, mode); +} + +int +cardfs_unlink(void *ctx, char *file){ + return ((CardFS*)ctx)->do_unlink(file); +} + +int +cardfs_rename(void *ctx, char *old_name, char *new_name){ + return ((CardFS*)ctx)->do_rename(old_name, new_name); +} + +int +cardfs_open(void *ctx, char *file, unsigned mode){ + return ((CardFS*)ctx)->do_open(file, mode); +} + +int +cardfs_release(void *ctx, char *file){ + return ((CardFS*)ctx)->do_release(file); +} + +int +cardfs_read(void *ctx, char *file, unsigned long offset, unsigned long count, char *buf){ + return ((CardFS*)ctx)->do_read(file, offset, count, buf); +} + +int +cardfs_write(void *ctx, char *file, unsigned long offset, unsigned long count, char *buf){ + return ((CardFS*)ctx)->do_write(file, offset, count, buf); +} + +int +cardfs_readlink(void *ctx, char *link, char *buf, int buflen){ + return ((CardFS*)ctx)->do_readlink(link, buf, buflen); +} + +int +cardfs_link(void *ctx, char *target, char *link){ + return ((CardFS*)ctx)->do_link(target, link); +} + +int +cardfs_symlink(void *ctx, char *target, char *link){ + return ((CardFS*)ctx)->do_symlink(target, link); +} + +int +cardfs_setattr(void *ctx, char *file, struct lufs_fattr *fattr){ + return ((CardFS*)ctx)->do_setattr(file, fattr); +} + +} /* extern "C" */ + +CardFS::CardFS(struct list_head *c, struct dir_cache *cache, struct credentials *cred) +{ + cfg = c; + this->cache = cache; + this->cred = cred; + + _cid="LUFS:CardFS:"+CTMisc::num2string(getpid()); +} + +CardFS::~CardFS(){ +} + +int +CardFS::do_mount(){ + unsigned int pos; + string tmp; + + try { + tmp=options.o_host; + pos=tmp.find("@"); + if (pos!=string::npos) { + _terminal=tmp.substr(0,pos); + if (pos+1=0) { + if (entry.attributes() & CTDirEntry::Attr_USED) { + fattr=_entry2fattr(entry); + lu_cache_add2dir(dir, (char*)entry.name().c_str(), NULL, &fattr); + } + } // while + + return 0; +} + + +int +CardFS::do_stat(char *nm, struct lufs_fattr *fattr){ + int result; + CTDirEntry entry; + + INFO("do_stat "<"<"<"< +#include + +#include +#include + +using namespace std; + +struct directory; + +#define TIMEOUT1 (10*1000) +#define TIMEOUT2 (60*1000) + +/* Main filesystem class, extending FileSystem */ +class CardFS{ +private: + struct credentials *cred; + struct dir_cache *cache; + struct list_head *cfg; + + string _host; + string _terminal; + string _cid; + + struct lufs_fattr _entry2fattr(const CTDirEntry &e); + unsigned int _mode2attribs(int mode); + +public: + CardFS(struct list_head*, struct dir_cache*, struct credentials*); + ~CardFS(); + + int do_mount(); + void do_umount(); + int do_readdir(char*, struct directory*); + int do_stat(char*, struct lufs_fattr*); + int do_mkdir(char*, int); + int do_rmdir(char*); + int do_create(char*, int); + int do_unlink(char*); + int do_rename(char*, char*); + int do_open(char*, unsigned); + int do_release(char*); + int do_read(char*, unsigned long, unsigned long, char*); + int do_write(char*, unsigned long, unsigned long, char*); + int do_readlink(char*, char*, int); + int do_link(char*, char*); + int do_symlink(char*, char*); + int do_setattr(char*, struct lufs_fattr*); +}; + +#endif + diff --git a/filesystems/cefs/Makefile.am b/filesystems/cefs/Makefile.am new file mode 100644 index 0000000..bed86a4 --- /dev/null +++ b/filesystems/cefs/Makefile.am @@ -0,0 +1,12 @@ +INCLUDES=-I../ @all_includes@ +lib_LTLIBRARIES=liblufs-cefs.la + +SUBDIRS=asyncd +DIST_SUBDIRS=asyncd + +liblufs_cefs_la_SOURCES=cefs.cpp chunk.c rapi.c wine.c +liblufs_cefs_la_LDFLAGS=-version-info 2:0:0 + +noinst_HEADERS=cefs.h chunk.h rapi.h windows.h little_endian.h + +EXTRA_DIST=README diff --git a/filesystems/cefs/Makefile.in b/filesystems/cefs/Makefile.in new file mode 100644 index 0000000..00c4993 --- /dev/null +++ b/filesystems/cefs/Makefile.in @@ -0,0 +1,606 @@ +# Makefile.in generated by automake 1.7.5 from Makefile.am. +# @configure_input@ + +# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003 +# Free Software Foundation, Inc. +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ + +srcdir = @srcdir@ +top_srcdir = @top_srcdir@ +VPATH = @srcdir@ +pkgdatadir = $(datadir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +top_builddir = ../.. + +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +INSTALL = @INSTALL@ +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = @build@ +host_triplet = @host@ +target_triplet = @target@ +ACLOCAL = @ACLOCAL@ +AMDEP_FALSE = @AMDEP_FALSE@ +AMDEP_TRUE = @AMDEP_TRUE@ +AMTAR = @AMTAR@ +AUTOCONF = @AUTOCONF@ +AUTOFS_INSTALL = @AUTOFS_INSTALL@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CXX = @CXX@ +CXXDEPMODE = @CXXDEPMODE@ +CXXFLAGS = @CXXFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DEBUG_FLAGS = @DEBUG_FLAGS@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +ECHO = @ECHO@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +EXEEXT = @EXEEXT@ +GCONF = @GCONF@ +GVFSCONF = @GVFSCONF@ +GVFS_CFLAGS = @GVFS_CFLAGS@ +GVFS_LDADD = @GVFS_LDADD@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +KDEBUG_FLAGS = @KDEBUG_FLAGS@ +KERNEL_DIR = @KERNEL_DIR@ +KERNEL_HDR = @KERNEL_HDR@ +LDFLAGS = @LDFLAGS@ +LIBCHIPCARD_INCLUDES = @LIBCHIPCARD_INCLUDES@ +LIBCHIPCARD_LIB = @LIBCHIPCARD_LIB@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LIBTOOL = @LIBTOOL@ +LN_S = @LN_S@ +LTLIBOBJS = @LTLIBOBJS@ +LUFS_SUID = @LUFS_SUID@ +MAKEINFO = @MAKEINFO@ +MODULES_DIR = @MODULES_DIR@ +MODV_FLAGS = @MODV_FLAGS@ +OBJEXT = @OBJEXT@ +OS_DIR = @OS_DIR@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +RANLIB = @RANLIB@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +SSHPROG = @SSHPROG@ +STRIP = @STRIP@ +VERSION = @VERSION@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_CXX = @ac_ct_CXX@ +ac_ct_RANLIB = @ac_ct_RANLIB@ +ac_ct_STRIP = @ac_ct_STRIP@ +all_includes = @all_includes@ +all_libraries = @all_libraries@ +am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ +am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ +am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@ +am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +datadir = @datadir@ +define_has_libchipcard = @define_has_libchipcard@ +exec_prefix = @exec_prefix@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localstatedir = @localstatedir@ +mandir = @mandir@ +oldincludedir = @oldincludedir@ +opt_fs = @opt_fs@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +sysconfdir = @sysconfdir@ +target = @target@ +target_alias = @target_alias@ +target_cpu = @target_cpu@ +target_os = @target_os@ +target_vendor = @target_vendor@ +INCLUDES = -I../ @all_includes@ +lib_LTLIBRARIES = liblufs-cefs.la + +SUBDIRS = asyncd +DIST_SUBDIRS = asyncd + +liblufs_cefs_la_SOURCES = cefs.cpp chunk.c rapi.c wine.c +liblufs_cefs_la_LDFLAGS = -version-info 2:0:0 + +noinst_HEADERS = cefs.h chunk.h rapi.h windows.h little_endian.h + +EXTRA_DIST = README +subdir = filesystems/cefs +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +mkinstalldirs = $(SHELL) $(top_srcdir)/config/mkinstalldirs +CONFIG_HEADER = $(top_builddir)/config.h +CONFIG_CLEAN_FILES = +LTLIBRARIES = $(lib_LTLIBRARIES) + +liblufs_cefs_la_LIBADD = +am_liblufs_cefs_la_OBJECTS = cefs.lo chunk.lo rapi.lo wine.lo +liblufs_cefs_la_OBJECTS = $(am_liblufs_cefs_la_OBJECTS) + +DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir) +depcomp = $(SHELL) $(top_srcdir)/config/depcomp +am__depfiles_maybe = depfiles +@AMDEP_TRUE@DEP_FILES = ./$(DEPDIR)/cefs.Plo ./$(DEPDIR)/chunk.Plo \ +@AMDEP_TRUE@ ./$(DEPDIR)/rapi.Plo ./$(DEPDIR)/wine.Plo +COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ + $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +LTCOMPILE = $(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) \ + $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +CCLD = $(CC) +LINK = $(LIBTOOL) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ + $(AM_LDFLAGS) $(LDFLAGS) -o $@ +CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ + $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) +LTCXXCOMPILE = $(LIBTOOL) --mode=compile $(CXX) $(DEFS) \ + $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ + $(AM_CXXFLAGS) $(CXXFLAGS) +CXXLD = $(CXX) +CXXLINK = $(LIBTOOL) --mode=link $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) \ + $(AM_LDFLAGS) $(LDFLAGS) -o $@ +DIST_SOURCES = $(liblufs_cefs_la_SOURCES) +HEADERS = $(noinst_HEADERS) + + +RECURSIVE_TARGETS = info-recursive dvi-recursive pdf-recursive \ + ps-recursive install-info-recursive uninstall-info-recursive \ + all-recursive install-data-recursive install-exec-recursive \ + installdirs-recursive install-recursive uninstall-recursive \ + check-recursive installcheck-recursive +DIST_COMMON = README $(noinst_HEADERS) Makefile.am Makefile.in +SOURCES = $(liblufs_cefs_la_SOURCES) + +all: all-recursive + +.SUFFIXES: +.SUFFIXES: .c .cpp .lo .o .obj +$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4) + cd $(top_srcdir) && \ + $(AUTOMAKE) --gnu filesystems/cefs/Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe) +libLTLIBRARIES_INSTALL = $(INSTALL) +install-libLTLIBRARIES: $(lib_LTLIBRARIES) + @$(NORMAL_INSTALL) + $(mkinstalldirs) $(DESTDIR)$(libdir) + @list='$(lib_LTLIBRARIES)'; for p in $$list; do \ + if test -f $$p; then \ + f="`echo $$p | sed -e 's|^.*/||'`"; \ + echo " $(LIBTOOL) --mode=install $(libLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) $$p $(DESTDIR)$(libdir)/$$f"; \ + $(LIBTOOL) --mode=install $(libLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) $$p $(DESTDIR)$(libdir)/$$f; \ + else :; fi; \ + done + +uninstall-libLTLIBRARIES: + @$(NORMAL_UNINSTALL) + @list='$(lib_LTLIBRARIES)'; for p in $$list; do \ + p="`echo $$p | sed -e 's|^.*/||'`"; \ + echo " $(LIBTOOL) --mode=uninstall rm -f $(DESTDIR)$(libdir)/$$p"; \ + $(LIBTOOL) --mode=uninstall rm -f $(DESTDIR)$(libdir)/$$p; \ + done + +clean-libLTLIBRARIES: + -test -z "$(lib_LTLIBRARIES)" || rm -f $(lib_LTLIBRARIES) + @list='$(lib_LTLIBRARIES)'; for p in $$list; do \ + dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \ + test "$$dir" = "$$p" && dir=.; \ + echo "rm -f \"$${dir}/so_locations\""; \ + rm -f "$${dir}/so_locations"; \ + done +liblufs-cefs.la: $(liblufs_cefs_la_OBJECTS) $(liblufs_cefs_la_DEPENDENCIES) + $(CXXLINK) -rpath $(libdir) $(liblufs_cefs_la_LDFLAGS) $(liblufs_cefs_la_OBJECTS) $(liblufs_cefs_la_LIBADD) $(LIBS) + +mostlyclean-compile: + -rm -f *.$(OBJEXT) core *.core + +distclean-compile: + -rm -f *.tab.c + +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cefs.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/chunk.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/rapi.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/wine.Plo@am__quote@ + +distclean-depend: + -rm -rf ./$(DEPDIR) + +.c.o: +@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" \ +@am__fastdepCC_TRUE@ -c -o $@ `test -f '$<' || echo '$(srcdir)/'`$<; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; \ +@am__fastdepCC_TRUE@ else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; \ +@am__fastdepCC_TRUE@ fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(COMPILE) -c `test -f '$<' || echo '$(srcdir)/'`$< + +.c.obj: +@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" \ +@am__fastdepCC_TRUE@ -c -o $@ `if test -f '$<'; then $(CYGPATH_W) '$<'; else $(CYGPATH_W) '$(srcdir)/$<'; fi`; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; \ +@am__fastdepCC_TRUE@ else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; \ +@am__fastdepCC_TRUE@ fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(COMPILE) -c `if test -f '$<'; then $(CYGPATH_W) '$<'; else $(CYGPATH_W) '$(srcdir)/$<'; fi` + +.c.lo: +@am__fastdepCC_TRUE@ if $(LTCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" \ +@am__fastdepCC_TRUE@ -c -o $@ `test -f '$<' || echo '$(srcdir)/'`$<; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Plo"; \ +@am__fastdepCC_TRUE@ else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; \ +@am__fastdepCC_TRUE@ fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/$*.Plo' tmpdepfile='$(DEPDIR)/$*.TPlo' @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ `test -f '$<' || echo '$(srcdir)/'`$< + +.cpp.o: +@am__fastdepCXX_TRUE@ if $(CXXCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" \ +@am__fastdepCXX_TRUE@ -c -o $@ `test -f '$<' || echo '$(srcdir)/'`$<; \ +@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; \ +@am__fastdepCXX_TRUE@ else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; \ +@am__fastdepCXX_TRUE@ fi +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ `test -f '$<' || echo '$(srcdir)/'`$< + +.cpp.obj: +@am__fastdepCXX_TRUE@ if $(CXXCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" \ +@am__fastdepCXX_TRUE@ -c -o $@ `if test -f '$<'; then $(CYGPATH_W) '$<'; else $(CYGPATH_W) '$(srcdir)/$<'; fi`; \ +@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; \ +@am__fastdepCXX_TRUE@ else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; \ +@am__fastdepCXX_TRUE@ fi +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ `if test -f '$<'; then $(CYGPATH_W) '$<'; else $(CYGPATH_W) '$(srcdir)/$<'; fi` + +.cpp.lo: +@am__fastdepCXX_TRUE@ if $(LTCXXCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" \ +@am__fastdepCXX_TRUE@ -c -o $@ `test -f '$<' || echo '$(srcdir)/'`$<; \ +@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Plo"; \ +@am__fastdepCXX_TRUE@ else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; \ +@am__fastdepCXX_TRUE@ fi +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ depfile='$(DEPDIR)/$*.Plo' tmpdepfile='$(DEPDIR)/$*.TPlo' @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(LTCXXCOMPILE) -c -o $@ `test -f '$<' || echo '$(srcdir)/'`$< + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs + +distclean-libtool: + -rm -f libtool +uninstall-info-am: + +# This directory's subdirectories are mostly independent; you can cd +# into them and run `make' without going through this Makefile. +# To change the values of `make' variables: instead of editing Makefiles, +# (1) if the variable is set in `config.status', edit `config.status' +# (which will cause the Makefiles to be regenerated when you run `make'); +# (2) otherwise, pass the desired values on the `make' command line. +$(RECURSIVE_TARGETS): + @set fnord $$MAKEFLAGS; amf=$$2; \ + dot_seen=no; \ + target=`echo $@ | sed s/-recursive//`; \ + list='$(SUBDIRS)'; for subdir in $$list; do \ + echo "Making $$target in $$subdir"; \ + if test "$$subdir" = "."; then \ + dot_seen=yes; \ + local_target="$$target-am"; \ + else \ + local_target="$$target"; \ + fi; \ + (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ + || case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \ + done; \ + if test "$$dot_seen" = "no"; then \ + $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \ + fi; test -z "$$fail" + +mostlyclean-recursive clean-recursive distclean-recursive \ +maintainer-clean-recursive: + @set fnord $$MAKEFLAGS; amf=$$2; \ + dot_seen=no; \ + case "$@" in \ + distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ + *) list='$(SUBDIRS)' ;; \ + esac; \ + rev=''; for subdir in $$list; do \ + if test "$$subdir" = "."; then :; else \ + rev="$$subdir $$rev"; \ + fi; \ + done; \ + rev="$$rev ."; \ + target=`echo $@ | sed s/-recursive//`; \ + for subdir in $$rev; do \ + echo "Making $$target in $$subdir"; \ + if test "$$subdir" = "."; then \ + local_target="$$target-am"; \ + else \ + local_target="$$target"; \ + fi; \ + (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ + || case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \ + done && test -z "$$fail" +tags-recursive: + list='$(SUBDIRS)'; for subdir in $$list; do \ + test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \ + done +ctags-recursive: + list='$(SUBDIRS)'; for subdir in $$list; do \ + test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \ + done + +ETAGS = etags +ETAGSFLAGS = + +CTAGS = ctags +CTAGSFLAGS = + +tags: TAGS + +ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + mkid -fID $$unique + +TAGS: tags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + tags=; \ + here=`pwd`; \ + if (etags --etags-include --version) >/dev/null 2>&1; then \ + include_option=--etags-include; \ + else \ + include_option=--include; \ + fi; \ + list='$(SUBDIRS)'; for subdir in $$list; do \ + if test "$$subdir" = .; then :; else \ + test -f $$subdir/TAGS && \ + tags="$$tags $$include_option=$$here/$$subdir/TAGS"; \ + fi; \ + done; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + test -z "$(ETAGS_ARGS)$$tags$$unique" \ + || $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$tags $$unique + +ctags: CTAGS +CTAGS: ctags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + tags=; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + test -z "$(CTAGS_ARGS)$$tags$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$tags $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && cd $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) $$here + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) + +top_distdir = ../.. +distdir = $(top_distdir)/$(PACKAGE)-$(VERSION) + +distdir: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \ + list='$(DISTFILES)'; for file in $$list; do \ + case $$file in \ + $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ + $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ + esac; \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test "$$dir" != "$$file" && test "$$dir" != "."; then \ + dir="/$$dir"; \ + $(mkinstalldirs) "$(distdir)$$dir"; \ + else \ + dir=''; \ + fi; \ + if test -d $$d/$$file; then \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ + fi; \ + cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ + else \ + test -f $(distdir)/$$file \ + || cp -p $$d/$$file $(distdir)/$$file \ + || exit 1; \ + fi; \ + done + list='$(DIST_SUBDIRS)'; for subdir in $$list; do \ + if test "$$subdir" = .; then :; else \ + test -d $(distdir)/$$subdir \ + || mkdir $(distdir)/$$subdir \ + || exit 1; \ + (cd $$subdir && \ + $(MAKE) $(AM_MAKEFLAGS) \ + top_distdir="$(top_distdir)" \ + distdir=../$(distdir)/$$subdir \ + distdir) \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-recursive +all-am: Makefile $(LTLIBRARIES) $(HEADERS) +installdirs: installdirs-recursive +installdirs-am: + $(mkinstalldirs) $(DESTDIR)$(libdir) + +install: install-recursive +install-exec: install-exec-recursive +install-data: install-data-recursive +uninstall: uninstall-recursive + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-recursive +install-strip: + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + INSTALL_STRIP_FLAG=-s \ + `test -z '$(STRIP)' || \ + echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -rm -f Makefile $(CONFIG_CLEAN_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +clean: clean-recursive + +clean-am: clean-generic clean-libLTLIBRARIES clean-libtool \ + mostlyclean-am + +distclean: distclean-recursive + +distclean-am: clean-am distclean-compile distclean-depend \ + distclean-generic distclean-libtool distclean-tags + +dvi: dvi-recursive + +dvi-am: + +info: info-recursive + +info-am: + +install-data-am: + +install-exec-am: install-libLTLIBRARIES + +install-info: install-info-recursive + +install-man: + +installcheck-am: + +maintainer-clean: maintainer-clean-recursive + +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-recursive + +mostlyclean-am: mostlyclean-compile mostlyclean-generic \ + mostlyclean-libtool + +pdf: pdf-recursive + +pdf-am: + +ps: ps-recursive + +ps-am: + +uninstall-am: uninstall-info-am uninstall-libLTLIBRARIES + +uninstall-info: uninstall-info-recursive + +.PHONY: $(RECURSIVE_TARGETS) CTAGS GTAGS all all-am check check-am clean \ + clean-generic clean-libLTLIBRARIES clean-libtool \ + clean-recursive ctags ctags-recursive distclean \ + distclean-compile distclean-depend distclean-generic \ + distclean-libtool distclean-recursive distclean-tags distdir \ + dvi dvi-am dvi-recursive info info-am info-recursive install \ + install-am install-data install-data-am install-data-recursive \ + install-exec install-exec-am install-exec-recursive \ + install-info install-info-am install-info-recursive \ + install-libLTLIBRARIES install-man install-recursive \ + install-strip installcheck installcheck-am installdirs \ + installdirs-am installdirs-recursive maintainer-clean \ + maintainer-clean-generic maintainer-clean-recursive mostlyclean \ + mostlyclean-compile mostlyclean-generic mostlyclean-libtool \ + mostlyclean-recursive pdf pdf-am pdf-recursive ps ps-am \ + ps-recursive tags tags-recursive uninstall uninstall-am \ + uninstall-info-am uninstall-info-recursive \ + uninstall-libLTLIBRARIES uninstall-recursive + +# 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/filesystems/cefs/README b/filesystems/cefs/README new file mode 100644 index 0000000..bb5bb71 --- /dev/null +++ b/filesystems/cefs/README @@ -0,0 +1,241 @@ +This is a LUFS filesystem module allowing to access the filesystem of +a Windows CE device (HP (Compaq) Ipaq, HP Jornada, etc...) + +Because of limitations of the current version of librapi not all +filesystem operations are supported. Specifically, file read and +write are performed only at file open and file close. Opening files +in read-write mode is not supported. + +This code uses librapi library from the SynCE project. For +convenience asyncd source code from that project is also included in +this distribution. + + http://synce.sourceforge.org + +SOURCES OF ADDITIONAL INFORMATION + + http://synce.sourceforge.org + http://www.handhelds.org + +REQUIREMENS + +A Windows CE device :) + +INSTALLATION + +To use the CEFS module you should be able to connect your Windows CE +device to the Linux box using serial cable, USB, or IRDA. + +Here I give some explanations of how to setup the connection between +the Linux box and PDA. It is described in many places, so you may +find it interesting to compare the description here with bits of +information you can read on http://synce.sourceforge.org +http://www.handhelds.org and in Documentation/usb/usb-serial.txt in +the kernel source. + + +I. Asyncd setup + +In any case you should setup asyncd -- a daemon to keep the connection +up. Notice, that if you protected you Windows CE device with a +password (which is generally quite a good idea), you should change it +from the default value "1234" in asyncd.c recompile and reinstall +asyncd. Long passwords are not supported now. + +1) add the following line to /etc/services : + +dccm 5679/tcp # ActiveSync KeepAlive + +2) configure your Inetd super-daemon (either inetd, or xinetd), so that client/asyncd is + fired whenever someone initiates a TCP connect on port 5679 on your + computer (insert the prefix you used in ./configure instead of the default /usr/local): + +* inetd : add the following line to /etc/inetd.conf +------------------------------------------------------------- +asyncd stream tcp nowait lufs /usr/local/bin/asyncd asyncd +------------------------------------------------------------- + +* xinetd : add the following file (asyncd) to /etc/xinetd.d : +------------------------------------------------------------- +# default: on +service asyncd +{ + flags = REUSE NOLIBWRAP + socket_type = stream + wait = no + user = lufs + server = /usr/local/bin/asyncd + log_on_failure += USERID + only_from = 127.0.0.1 192.168.131.0/24 + disable = no +} +------------------------------------------------------------- + +(xinetd : replace the line 'only_from' with your local network mask (the one where your +CE device will be calling from, or disable it completly) + + +II. Physical link setup + +II.A Serial link setup. + +Here you have a lot of variants. The simplest is: + +Variant 1. + +Create the following file (cedevice) in /etc/ppp/peers : +------------------------------------------------------------- +/dev/ttyS1 115200 modem +connect '/usr/sbin/chat -v CLIENT "CLIENT\c" "" "SERVER\c"' +noauth +local +192.168.131.102:192.168.131.201 +ms-dns 192.168.131.102 +lcp-echo-failure 2 +lcp-echo-interval 2 +linkname cedevice +------------------------------------------------------------- + +To start the communications you'll have to run (as root): + +$ pppd call cedevice + +This should start your Windows CE device, and start a PPP link. +Check that your PPP configuration shows the link, and check that 'asyncd' has +created a file '/tmp/cedevice' which contains the informations on your device ( +IP address, brand, etc...) + + +Variant 2. + +As an alternative method you can use mgetty to automatically start the +link on connection of your PDA to the computer. It is a very simple +setup, assuming that you don't have dialin connections. + +Add the following lines to /etc/mgetty+sendfax/mgetty.config: +------------------------------------------------------------------------ +# WinCE connection: port ttyS1 + speed 115200 + direct y + toggle-dtr n + issue-file /etc/ppp/wince.issue +------------------------------------------------------------------------ +Add this to /etc/mgetty+sendfax/login.config: +------------------------------------------------------------------------ +# This is for WinCE +/AutoPPP/ - a_ppp /usr/sbin/pppd file /etc/ppp/wince +------------------------------------------------------------------------ +Create the file /etc/ppp/wince.issue: +------------------------------------------------------------------------ +CLIENTSERVER +CLIENTSERVER +CLIENTSERVER +------------------------------------------------------------------------ +and the file /etc/ppp/wince: +------------------------------------------------------------------------ +modem +noauth +local +192.168.131.102:192.168.131.201 +ms-dns 192.168.131.102 +lcp-echo-failure 2 +lcp-echo-interval 2 +linkname cedevice +------------------------------------------------------------------------ + + +II.B. USB Setup. + +If you have an old kernel, you can try to use ipaqd from SynCE +project. Here I'll describe usage if ipaq module present in kernel +(starting at least from 2.4.18 ar maybe earlier). Generally, you +should first look at the file Documentation/usb/usb-serial.txt in your +kernel source. BUT: Don't believe the words written there abut uhci.o +and usb-uhci.o modules. In my case it works _only_ with usb-uhci and +does not work at all with uhci. Maybe in some cases opposite is +better, I don't know. + +Also you shold make a special version of chat. To get it, recompile +the ppp distribution after applying the patch ppp-chat.patch in the +'other' directory. This will make the chat program which does not +make intercharacter delay. For some reason In my case it is crucially +needed to make things work. Maybe it is not always the case, so you +may try first without this, and do this only if your PDA freezes +during establishing connection with the computer. Another patch that +was needed in my case is ppp-pppd.patch, which _adds_ some delay +between ppp control packets. It is really a patch that I don't +understand, but it helped in my case. + +You should install hotplug, to use USB. Here I give an example setup. +Create the file /etc/hotplug/usb/ipaq: +------------------------------------------------------------------------ +#!/bin/bash echo $REMOVER created >>/tmp/ipaqlog cat >$REMOVER +<<-'EOF' + #!/bin/sh + if [ -f /var/lock/LCK..ttyUSB0 ] + then + kill -9 `cat /var/lock/LCK..ttyUSB0` + fi +EOF +chmod a+x $REMOVER +MYIP=192.168.131.102 +REMOTEIP=192.168.131.201 +MYDNS=192.168.131.102 + +if [ -f /var/lock/LCK..ttyUSB0 ] +then + kill -9 `cat /var/lock/LCK..ttyUSB0` +fi +/usr/sbin/pppd.ipaq /dev/ttyUSB0 \ + connect "/usr/sbin/chat.nopause -v TIMEOUT 60 CLIENT 'CLIENTSERVER\c'" \ + nocrtscts local passive $MYIP:$REMOTEIP ms-dns $MYDNS noauth +----------------------------------------------------------------------- +And apply the following patch to /etc/hotplug/usb.agent +------------------------------------------------------------------------ +--- /home/fedor/usb.agent Mon Sep 23 00:28:48 2002 ++++ /etc/hotplug/usb.agent Thu Apr 11 10:38:36 2002 +@@ -298,6 +298,15 @@ + rm -f "$REMOVER" + fi + ++ if [ "$PRODUCT" = "49f/3/0" ]; then # Compaq Ipaq 3760 ++ /etc/hotplug/usb/ipaq ++ exit 0 ++ fi ++ if [ "$PRODUCT" = "3f0/1116/0" ]; then # HP Jornada 568 ++ /etc/hotplug/usb/ipaq ++ exit 0 ++ fi ++ + # on 2.4 systems, modutils 2.4.2+ maintains MAP_CURRENT + # ... otherwise we can't rely on it (sigh) + case "$KERNEL" in +________________________________________________________________________ + + +II.C IRDA Setup + +To be written. But it works, it was checked. Ask, if you are interested. + + +III lufs setup + +Nothing additional to general lufs setup! + + +USAGE + +Simply mount the filesystem after connecting your PDA with a command +like + + mount -t lufs -o fs=cefs none /mnt/lufs + +No additional options, instead of general LuFS options uid, gid, fmask +and dmask are present. + +And umount it before disconnecting. It may be a good idea to setup +automounter to do this. + + +Fedor Bezrukov + diff --git a/filesystems/cefs/asyncd/Makefile.am b/filesystems/cefs/asyncd/Makefile.am new file mode 100644 index 0000000..819ad4b --- /dev/null +++ b/filesystems/cefs/asyncd/Makefile.am @@ -0,0 +1,8 @@ +INCLUDES=-I.. +bin_PROGRAMS=asyncd + +noinst_HEADERS=asyncd.h debug.h socket.h + +asyncd_SOURCES=asyncd.c debug.c socket.c + +CPPFLAGS=-DUSE_SYSLOG diff --git a/filesystems/cefs/asyncd/Makefile.in b/filesystems/cefs/asyncd/Makefile.in new file mode 100644 index 0000000..191a07b --- /dev/null +++ b/filesystems/cefs/asyncd/Makefile.in @@ -0,0 +1,464 @@ +# Makefile.in generated by automake 1.7.5 from Makefile.am. +# @configure_input@ + +# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003 +# Free Software Foundation, Inc. +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ + +srcdir = @srcdir@ +top_srcdir = @top_srcdir@ +VPATH = @srcdir@ +pkgdatadir = $(datadir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +top_builddir = ../../.. + +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +INSTALL = @INSTALL@ +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = @build@ +host_triplet = @host@ +target_triplet = @target@ +ACLOCAL = @ACLOCAL@ +AMDEP_FALSE = @AMDEP_FALSE@ +AMDEP_TRUE = @AMDEP_TRUE@ +AMTAR = @AMTAR@ +AUTOCONF = @AUTOCONF@ +AUTOFS_INSTALL = @AUTOFS_INSTALL@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +CPP = @CPP@ + +CPPFLAGS = -DUSE_SYSLOG +CXX = @CXX@ +CXXDEPMODE = @CXXDEPMODE@ +CXXFLAGS = @CXXFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DEBUG_FLAGS = @DEBUG_FLAGS@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +ECHO = @ECHO@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +EXEEXT = @EXEEXT@ +GCONF = @GCONF@ +GVFSCONF = @GVFSCONF@ +GVFS_CFLAGS = @GVFS_CFLAGS@ +GVFS_LDADD = @GVFS_LDADD@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +KDEBUG_FLAGS = @KDEBUG_FLAGS@ +KERNEL_DIR = @KERNEL_DIR@ +KERNEL_HDR = @KERNEL_HDR@ +LDFLAGS = @LDFLAGS@ +LIBCHIPCARD_INCLUDES = @LIBCHIPCARD_INCLUDES@ +LIBCHIPCARD_LIB = @LIBCHIPCARD_LIB@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LIBTOOL = @LIBTOOL@ +LN_S = @LN_S@ +LTLIBOBJS = @LTLIBOBJS@ +LUFS_SUID = @LUFS_SUID@ +MAKEINFO = @MAKEINFO@ +MODULES_DIR = @MODULES_DIR@ +MODV_FLAGS = @MODV_FLAGS@ +OBJEXT = @OBJEXT@ +OS_DIR = @OS_DIR@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +RANLIB = @RANLIB@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +SSHPROG = @SSHPROG@ +STRIP = @STRIP@ +VERSION = @VERSION@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_CXX = @ac_ct_CXX@ +ac_ct_RANLIB = @ac_ct_RANLIB@ +ac_ct_STRIP = @ac_ct_STRIP@ +all_includes = @all_includes@ +all_libraries = @all_libraries@ +am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ +am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ +am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@ +am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +datadir = @datadir@ +define_has_libchipcard = @define_has_libchipcard@ +exec_prefix = @exec_prefix@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localstatedir = @localstatedir@ +mandir = @mandir@ +oldincludedir = @oldincludedir@ +opt_fs = @opt_fs@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +sysconfdir = @sysconfdir@ +target = @target@ +target_alias = @target_alias@ +target_cpu = @target_cpu@ +target_os = @target_os@ +target_vendor = @target_vendor@ +INCLUDES = -I.. +bin_PROGRAMS = asyncd + +noinst_HEADERS = asyncd.h debug.h socket.h + +asyncd_SOURCES = asyncd.c debug.c socket.c +subdir = filesystems/cefs/asyncd +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +mkinstalldirs = $(SHELL) $(top_srcdir)/config/mkinstalldirs +CONFIG_HEADER = $(top_builddir)/config.h +CONFIG_CLEAN_FILES = +bin_PROGRAMS = asyncd$(EXEEXT) +PROGRAMS = $(bin_PROGRAMS) + +am_asyncd_OBJECTS = asyncd.$(OBJEXT) debug.$(OBJEXT) socket.$(OBJEXT) +asyncd_OBJECTS = $(am_asyncd_OBJECTS) +asyncd_LDADD = $(LDADD) +asyncd_DEPENDENCIES = +asyncd_LDFLAGS = + +DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir) +depcomp = $(SHELL) $(top_srcdir)/config/depcomp +am__depfiles_maybe = depfiles +@AMDEP_TRUE@DEP_FILES = ./$(DEPDIR)/asyncd.Po ./$(DEPDIR)/debug.Po \ +@AMDEP_TRUE@ ./$(DEPDIR)/socket.Po +COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ + $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +LTCOMPILE = $(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) \ + $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +CCLD = $(CC) +LINK = $(LIBTOOL) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ + $(AM_LDFLAGS) $(LDFLAGS) -o $@ +DIST_SOURCES = $(asyncd_SOURCES) +HEADERS = $(noinst_HEADERS) + +DIST_COMMON = README $(noinst_HEADERS) Makefile.am Makefile.in +SOURCES = $(asyncd_SOURCES) + +all: all-am + +.SUFFIXES: +.SUFFIXES: .c .lo .o .obj +$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4) + cd $(top_srcdir) && \ + $(AUTOMAKE) --gnu filesystems/cefs/asyncd/Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe) +binPROGRAMS_INSTALL = $(INSTALL_PROGRAM) +install-binPROGRAMS: $(bin_PROGRAMS) + @$(NORMAL_INSTALL) + $(mkinstalldirs) $(DESTDIR)$(bindir) + @list='$(bin_PROGRAMS)'; for p in $$list; do \ + p1=`echo $$p|sed 's/$(EXEEXT)$$//'`; \ + if test -f $$p \ + || test -f $$p1 \ + ; then \ + f=`echo "$$p1" | sed 's,^.*/,,;$(transform);s/$$/$(EXEEXT)/'`; \ + echo " $(INSTALL_PROGRAM_ENV) $(LIBTOOL) --mode=install $(binPROGRAMS_INSTALL) $$p $(DESTDIR)$(bindir)/$$f"; \ + $(INSTALL_PROGRAM_ENV) $(LIBTOOL) --mode=install $(binPROGRAMS_INSTALL) $$p $(DESTDIR)$(bindir)/$$f || exit 1; \ + else :; fi; \ + done + +uninstall-binPROGRAMS: + @$(NORMAL_UNINSTALL) + @list='$(bin_PROGRAMS)'; for p in $$list; do \ + f=`echo "$$p" | sed 's,^.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/'`; \ + echo " rm -f $(DESTDIR)$(bindir)/$$f"; \ + rm -f $(DESTDIR)$(bindir)/$$f; \ + done + +clean-binPROGRAMS: + @list='$(bin_PROGRAMS)'; for p in $$list; do \ + f=`echo $$p|sed 's/$(EXEEXT)$$//'`; \ + echo " rm -f $$p $$f"; \ + rm -f $$p $$f ; \ + done +asyncd$(EXEEXT): $(asyncd_OBJECTS) $(asyncd_DEPENDENCIES) + @rm -f asyncd$(EXEEXT) + $(LINK) $(asyncd_LDFLAGS) $(asyncd_OBJECTS) $(asyncd_LDADD) $(LIBS) + +mostlyclean-compile: + -rm -f *.$(OBJEXT) core *.core + +distclean-compile: + -rm -f *.tab.c + +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/asyncd.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/debug.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/socket.Po@am__quote@ + +distclean-depend: + -rm -rf ./$(DEPDIR) + +.c.o: +@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" \ +@am__fastdepCC_TRUE@ -c -o $@ `test -f '$<' || echo '$(srcdir)/'`$<; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; \ +@am__fastdepCC_TRUE@ else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; \ +@am__fastdepCC_TRUE@ fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(COMPILE) -c `test -f '$<' || echo '$(srcdir)/'`$< + +.c.obj: +@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" \ +@am__fastdepCC_TRUE@ -c -o $@ `if test -f '$<'; then $(CYGPATH_W) '$<'; else $(CYGPATH_W) '$(srcdir)/$<'; fi`; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; \ +@am__fastdepCC_TRUE@ else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; \ +@am__fastdepCC_TRUE@ fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(COMPILE) -c `if test -f '$<'; then $(CYGPATH_W) '$<'; else $(CYGPATH_W) '$(srcdir)/$<'; fi` + +.c.lo: +@am__fastdepCC_TRUE@ if $(LTCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" \ +@am__fastdepCC_TRUE@ -c -o $@ `test -f '$<' || echo '$(srcdir)/'`$<; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Plo"; \ +@am__fastdepCC_TRUE@ else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; \ +@am__fastdepCC_TRUE@ fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/$*.Plo' tmpdepfile='$(DEPDIR)/$*.TPlo' @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ `test -f '$<' || echo '$(srcdir)/'`$< + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs + +distclean-libtool: + -rm -f libtool +uninstall-info-am: + +ETAGS = etags +ETAGSFLAGS = + +CTAGS = ctags +CTAGSFLAGS = + +tags: TAGS + +ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + mkid -fID $$unique + +TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + tags=; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + test -z "$(ETAGS_ARGS)$$tags$$unique" \ + || $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$tags $$unique + +ctags: CTAGS +CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + tags=; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + test -z "$(CTAGS_ARGS)$$tags$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$tags $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && cd $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) $$here + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) + +top_distdir = ../../.. +distdir = $(top_distdir)/$(PACKAGE)-$(VERSION) + +distdir: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \ + list='$(DISTFILES)'; for file in $$list; do \ + case $$file in \ + $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ + $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ + esac; \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test "$$dir" != "$$file" && test "$$dir" != "."; then \ + dir="/$$dir"; \ + $(mkinstalldirs) "$(distdir)$$dir"; \ + else \ + dir=''; \ + fi; \ + if test -d $$d/$$file; then \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ + fi; \ + cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ + else \ + test -f $(distdir)/$$file \ + || cp -p $$d/$$file $(distdir)/$$file \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-am +all-am: Makefile $(PROGRAMS) $(HEADERS) + +installdirs: + $(mkinstalldirs) $(DESTDIR)$(bindir) +install: install-am +install-exec: install-exec-am +install-data: install-data-am +uninstall: uninstall-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-am +install-strip: + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + INSTALL_STRIP_FLAG=-s \ + `test -z '$(STRIP)' || \ + echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -rm -f Makefile $(CONFIG_CLEAN_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +clean: clean-am + +clean-am: clean-binPROGRAMS clean-generic clean-libtool mostlyclean-am + +distclean: distclean-am + +distclean-am: clean-am distclean-compile distclean-depend \ + distclean-generic distclean-libtool distclean-tags + +dvi: dvi-am + +dvi-am: + +info: info-am + +info-am: + +install-data-am: + +install-exec-am: install-binPROGRAMS + +install-info: install-info-am + +install-man: + +installcheck-am: + +maintainer-clean: maintainer-clean-am + +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-compile mostlyclean-generic \ + mostlyclean-libtool + +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + +uninstall-am: uninstall-binPROGRAMS uninstall-info-am + +.PHONY: CTAGS GTAGS all all-am check check-am clean clean-binPROGRAMS \ + clean-generic clean-libtool ctags distclean distclean-compile \ + distclean-depend distclean-generic distclean-libtool \ + distclean-tags distdir dvi dvi-am info info-am install \ + install-am install-binPROGRAMS install-data install-data-am \ + install-exec install-exec-am install-info install-info-am \ + install-man install-strip installcheck installcheck-am \ + installdirs maintainer-clean maintainer-clean-generic \ + mostlyclean mostlyclean-compile mostlyclean-generic \ + mostlyclean-libtool pdf pdf-am ps ps-am tags uninstall \ + uninstall-am uninstall-binPROGRAMS uninstall-info-am + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/filesystems/cefs/asyncd/README b/filesystems/cefs/asyncd/README new file mode 100644 index 0000000..ad70509 --- /dev/null +++ b/filesystems/cefs/asyncd/README @@ -0,0 +1,12 @@ +This is a patched version of asyncd from http://synce.sourceforge.org +project. It now correctly works with 4 digit passwords under PocketPC 2000. + Fedor Bezrukov + +This is a 'keepalive' daemon that allows an ActiveSync connection +to stay alive, by ping-ponging with the device. + +It creates a file '/tmp/cedevice' with informations on the connected +device. + + +See the file README in the main directory. diff --git a/filesystems/cefs/asyncd/asyncd.c b/filesystems/cefs/asyncd/asyncd.c new file mode 100644 index 0000000..407acfc --- /dev/null +++ b/filesystems/cefs/asyncd/asyncd.c @@ -0,0 +1,449 @@ +/* + * asyncd - prototype daemon asyncd v0.01 + * + * Copyright (C) 2001 Ludovic LANGE. + * + * 2002 Modified by Fedor Bezrukov + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#ifdef DEBUG +#include "debug.h" +#endif + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif /* HAVE_CONFIG_H */ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "little_endian.h" + +#define ASYNCD_INPUT 0 +#define ASYNCD_OUTPUT 1 +#define PING 0x12345678 +#define MAXBUF 512 +#define TRUE (1==1) +#define FALSE !TRUE +#define LOCKBUFFERSIZE ( 2 * ( 4 + 1 ) ) + +#ifdef DEBUG +void printbuf( unsigned char * buf, unsigned int size ) +{ + char buffer[4096]; + unsigned int i,j; + for( i=0,j=0; (i0) ) + { + fprintf( infofile, "\tpassphrase-size \"%d\";\n", lockbuffersize ); + fprintf( infofile, "\tpassphrase-data \"" ); + + for( i=0; (i correct password */ + /* 0 -> wrong password, you have 3 attempts altogether */ +#ifdef DEBUG + log_debug("locked reply pending:"); + printbuf(buffer, 2); +#endif + + locked_pending=FALSE; + goto ping; + } + + error=read( ASYNCD_INPUT, buffer, 4); + + pktsz = letoh32(*(long *)buffer); + if( pktsz == PING ) + { + /* Is there a pending ping ? */ + if( pending ) + { +#ifdef DEBUG + log_debug(" ping reply received"); +#endif + pending = FALSE; + } else { +#ifdef DEBUG + log_debug(" unexpected ping reply!"); +#endif + end_connexion = TRUE; + } + } + else + { + +#ifdef DEBUG + log_debug (" packet size (hex) : %02X %02X %02X %02X",buffer[0], buffer[1], buffer[2], buffer[3]); + log_debug (" packet size (int) : 0x%08X %lu",pktsz, pktsz); +#endif + + if( pktsz > 0 ) + { + if( pktsz < MAXBUF-4 ) + { + error=read(ASYNCD_INPUT, &buffer[4], pktsz); +#ifdef DEBUG + log_debug(" buffer received"); + printbuf( buffer, pktsz ); +#endif + /* Here, we should call a functionc to analyze the buffer + and, if it's a valid Device identification, fork a + process that will mount the filesystem. */ + + if(locked) + { + /*unsigned char lockbuffer[]={0xa, 0x0, 0xce, 0xfd, 0xc8, 0xfd, 0xc9, 0xfd, 0xcf, 0xfd, 0xfd, 0xfd};*/ + char *passphrase = "1234"; + compute_password( passphrase, locksignature & 0xFF, lockbuffer+2, &lockbuffersize ); + *((short *)lockbuffer) = htole16( lockbuffersize ); + + error = write( ASYNCD_OUTPUT, lockbuffer, lockbuffersize + 2 ); + + /* 1234: 0x0a 0x00 0xcc 0xfd 0xcf 0xfd 0xce 0xfd 0xc9 0xfd 0xfd 0xfd */ + /* 1111: 0x0a 0x00 0xcc 0xfd 0xcc 0xfd 0xcc 0xfd 0xcc 0xfd 0xfd 0xfd */ + /* algorithm to "encrypt" password: + + take unicode representation of 4 letter password + 0 term + xor each byte with 0xfd + that's it! + + */ + +#ifdef DEBUG + log_debug(" sending passphrase"); + printbuf( buffer, lockbuffersize + 2); +#endif + locked_pending = TRUE; + + buffer_ok = checkpacket( buffer, pktsz, lockbuffer, lockbuffersize + 2 ); + + } + else + { + buffer_ok = checkpacket( buffer, pktsz, NULL, 0 ); + goto ping; + } + } else { +// if( pktsz > 0x00010000 ) + { + locksignature = pktsz; + log_debug(" device is locked, signature = 0x%08X", locksignature); + locked = TRUE; +// } else { +#ifdef DEBUG +// log_debug(" buffer too small !! Aborting"); +#endif +// end_connexion = TRUE; + } + } + } else { +#ifdef DEBUG + log_debug(" empty data - can be normal"); +#endif + } + } + } else { /* No data, timeout */ +#ifdef DEBUG + log_debug("Timeout received :"); +#endif + if( locked_pending) + { + end_connexion = TRUE; + break; + } + + if( buffer_ok && !pending ) + { + ping: + *(long *)buffer = htole32(PING); + error = write( ASYNCD_OUTPUT, buffer, 4 ); +#ifdef DEBUG + log_debug(" sending ping"); + printbuf( buffer, 4 ); +#endif + pending = TRUE; + } else { +#ifdef DEBUG + log_debug(" timeout, aborting"); +#endif + end_connexion = TRUE; + } + } + } + + removeinfo(); + +#ifdef DEBUG + closedebug(); +#endif + + return 0; +} + diff --git a/filesystems/cefs/asyncd/asyncd.h b/filesystems/cefs/asyncd/asyncd.h new file mode 100644 index 0000000..a2fb121 --- /dev/null +++ b/filesystems/cefs/asyncd/asyncd.h @@ -0,0 +1,12 @@ +/* + * asyncd.h -- prototypes for async handling code + * + */ + +#ifndef _ASYNCD_H +#define _ASYNCD_H + +#define BUFSIZE 256 + + +#endif diff --git a/filesystems/cefs/asyncd/debug.c b/filesystems/cefs/asyncd/debug.c new file mode 100644 index 0000000..62e7e2d --- /dev/null +++ b/filesystems/cefs/asyncd/debug.c @@ -0,0 +1,84 @@ +/* + * debug - Routines d'affichage d'erreur + * + * Copyright (C) unknown ? + * + * 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. + */ + +#define EXTERN + +#include "debug.h" + +/* Syslog or not syslog ? */ +#ifdef USE_SYSLOG + +void log_debug (const char *fmt,...) +{ + char msg[256]; + + va_list listv; + va_start(listv,fmt); + vsprintf (msg, fmt, listv); + syslog(LOG_DEBUG, msg); +} + +void initdebug(const char *service) +{ + openlog(service, LOG_PID | LOG_CONS, LOG_DAEMON); +} + +void closedebug(void) +{ + closelog(); +} + +void log_err (const char *s) +{ + syslog(LOG_ERR, s); +} + +#else + +void log_debug (char *fmt,...) +{ + va_list listv; + va_start(listv,fmt); + fprintf (fp_console, "%s[%d] ",service_name, getpid()); + vfprintf (fp_console, fmt, listv); + fprintf (fp_console, "\n\r"); +} + +void initdebug(char *service) +{ + strcpy(service_name,service); +/* if ((fp_console = fopen ("/dev/console", "w")) == NULL) { + perror ("/dev/console"); + exit (1); + }*/ + fp_console = stderr; +} + +void closedebug(void) +{ +/* fclose (fp_console);*/ +} + +void log_err (char *s) +{ +} + +#endif /* USE_SYSLOG */ + diff --git a/filesystems/cefs/asyncd/debug.h b/filesystems/cefs/asyncd/debug.h new file mode 100644 index 0000000..0fd9f01 --- /dev/null +++ b/filesystems/cefs/asyncd/debug.h @@ -0,0 +1,46 @@ +/* + * + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#ifndef _DEBUG_H +#define _DEBUG_H + +#include +#include +#include +#include + +#ifndef EXTERN +#define EXTERN extern +#endif + +/* + * Variables + */ + +#ifndef USE_SYSLOG +EXTERN FILE *fp_console; +EXTERN char service_name[64]; +#endif + +void log_debug (const char *fmt,...); +void log_err (const char *s); +void initdebug(const char *service); +void closedebug(void); + +#endif + diff --git a/filesystems/cefs/asyncd/socket.c b/filesystems/cefs/asyncd/socket.c new file mode 100644 index 0000000..e489d1e --- /dev/null +++ b/filesystems/cefs/asyncd/socket.c @@ -0,0 +1,191 @@ +/* + * socket.c -- socket library functions + * + * For license terms, see the file COPYING in this directory. + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif /* HAVE_CONFIG_H */ +#include +#include +#ifdef HAVE_MEMORY_H +#include +#endif /* HAVE_MEMORY_H */ +#include +#include +#include +#include +#include +#if defined(STDC_HEADERS) +#include +#endif +#if defined(HAVE_UNISTD_H) +#include +#endif +#if defined(HAVE_STDARG_H) +#include +#else +#include +#endif +#include "socket.h" + +#ifndef INET_ATON +#ifndef INADDR_NONE +#ifdef INADDR_BROADCAST +#define INADDR_NONE INADDR_BROADCAST +#else +#define INADDR_NONE -1 +#endif +#endif +#endif /* INET_ATON */ + +int SockOpen(const char *host, int clientPort) +{ + int sock; +#ifndef INET_ATON + unsigned long inaddr; +#endif /* INET_ATON */ + struct sockaddr_in ad; + struct hostent *hp; + + memset(&ad, 0, sizeof(ad)); + ad.sin_family = AF_INET; + + /* we'll accept a quad address */ +#ifndef INET_ATON + inaddr = inet_addr(host); + if (inaddr != INADDR_NONE) + memcpy(&ad.sin_addr, &inaddr, sizeof(inaddr)); + else +#else + if (!inet_aton(host, &ad.sin_addr)) +#endif /* INET_ATON */ + { + hp = gethostbyname(host); + + /* + * Add a check to make sure the address has a valid IPv4 or IPv6 + * length. This prevents buffer spamming by a broken DNS. + */ + if (hp == NULL || (hp->h_length != 4 && hp->h_length != 8)) + return -1; + + memcpy(&ad.sin_addr, hp->h_addr, hp->h_length); + } + ad.sin_port = htons(clientPort); + + sock = socket(AF_INET, SOCK_STREAM, 0); + if (sock < 0) + return -1; + if (connect(sock, (struct sockaddr *) &ad, sizeof(ad)) < 0) + { + close(sock); + return -1; + } + + return(sock); +} + + +#if defined(HAVE_STDARG_H) +int SockPrintf(int sock, char* format, ...) +{ +#else +int SockPrintf(sock,format,va_alist) +int sock; +char *format; +va_dcl { +#endif + + va_list ap; + char buf[8192]; + +#if defined(HAVE_STDARG_H) + va_start(ap, format) ; +#else + va_start(ap); +#endif +#ifdef HAVE_VSNPRINTF + vsnprintf(buf, sizeof(buf), format, ap); +#else + vsprintf(buf, format, ap); +#endif + va_end(ap); + return SockWrite(sock, buf, strlen(buf)); + +} + +int SockWrite(int sock, char *buf, int len) +{ + int n, wrlen = 0; + + while (len) + { + n = write(sock, buf, len); + if (n <= 0) + return -1; + len -= n; + wrlen += n; + buf += n; + } + return wrlen; +} + +int SockRead(int sock, char *buf, int len) +{ + char *newline, *bp = buf; + int n; + + if (--len < 1) + return(-1); + do { + /* + * The reason for these gymnastics is that we want two things: + * (1) to read \n-terminated lines, + * (2) to return the true length of data read, even if the + * data coming in has embedded NULS. + */ + if ((n = recv(sock, bp, len, MSG_PEEK)) <= 0) + return(-1); + if ((newline = memchr(bp, '\n', n)) != NULL) + n = newline - bp + 1; + if ((n = read(sock, bp, n)) == -1) + return(-1); + bp += n; + len -= n; + } while + (!newline && len); + *bp = '\0'; + return bp - buf; +} + +int SockPeek(int sock) +/* peek at the next socket character without actually reading it */ +{ + int n; + char ch; + + if ((n = recv(sock, &ch, 1, MSG_PEEK)) == -1) + return -1; + else + return(ch); +} + +#ifdef MAIN +/* + * Use the chargen service to test input beuffering directly. + * You may have to uncomment the `chargen' service description in your + * inetd.conf (and then SIGHUP inetd) for this to work. + */ +main() +{ + int sock = SockOpen("localhost", 19); + char buf[80]; + + while (SockRead(sock, buf, sizeof(buf)-1)) + SockWrite(1, buf, strlen(buf)); +} +#endif /* MAIN */ + +/* socket.c ends here */ diff --git a/filesystems/cefs/asyncd/socket.h b/filesystems/cefs/asyncd/socket.h new file mode 100644 index 0000000..42f5c51 --- /dev/null +++ b/filesystems/cefs/asyncd/socket.h @@ -0,0 +1,42 @@ +/* + * socket.h -- declarations for socket library functions + * + * For license terms, see the file COPYING in this directory. + */ + +#ifndef SOCKET__ +#define SOCKET__ + +/* Create a new client socket; returns (FILE *)NULL on error */ +int SockOpen(const char *host, int clientPort); + +/* +Get a string terminated by an '\n' (matches interface of fgets). +Pass it a valid socket, a buffer for the string, and +the length of the buffer (including the trailing \0) +returns buffer on success, NULL on failure. +*/ +int SockRead(int sock, char *buf, int len); + +/* + * Peek at the next socket character without actually reading it. + */ +int SockPeek(int sock); + +/* +Write a chunk of bytes to the socket (matches interface of fwrite). +Returns number of bytes successfully written. +*/ +int SockWrite(int sock, char *buf, int size); + +/* +Send formatted output to the socket (matches interface of fprintf). +Returns number of bytes successfully written. +*/ +#if defined(HAVE_STDARG_H) +int SockPrintf(int sock, char *format, ...) ; +#else +int SockPrintf(); +#endif + +#endif /* SOCKET__ */ diff --git a/filesystems/cefs/cefs.cpp b/filesystems/cefs/cefs.cpp new file mode 100644 index 0000000..b2e3017 --- /dev/null +++ b/filesystems/cefs/cefs.cpp @@ -0,0 +1,658 @@ +/* Remote Windows CE device filesystem. + + Based on lufs "Userland filesystem" ( http://lufs.sourceforge.net/ ) + and synce ( http://synce.sourceforge.net/ ) + projects. + + Author: Fedor Bezrukov + */ + +#include +#include +#include +#include +#include + +#include +#include + +#include +#include + +#include +#include + +#include "cefs.h" + +#include +#include +#include +#include + +extern "C" { + +void* +cefs_init(struct list_head *cfg, struct dir_cache *cache, struct credentials *cred, void **global_ctx){ + return (void*)new CEFS(cfg, cache); +} + +void +cefs_free(void *ctx){ + CEFS *p = (CEFS*)ctx; + + delete p; +} + +int +cefs_mount(void *ctx){ + return ((CEFS*)ctx)->do_mount(); +} + +void +cefs_umount(void *ctx){ +// return ((CEFS*)ctx)->do_umount(); +} + +int +cefs_readdir(void *ctx, char *dir_name, struct directory *dir){ + return ((CEFS*)ctx)->do_readdir(dir_name, dir); +} + +int +cefs_stat(void *ctx, char *name, struct lufs_fattr *fattr){ + return ((CEFS*)ctx)->do_stat(name, fattr); +} + +int +cefs_mkdir(void *ctx, char *dir, int mode){ + return ((CEFS*)ctx)->do_mkdir(dir, mode); +} + +int +cefs_rmdir(void *ctx, char *dir){ + return ((CEFS*)ctx)->do_rmdir(dir); +} + +int +cefs_create(void *ctx, char *file, int mode){ + return ((CEFS*)ctx)->do_create(file, mode); +} + +int +cefs_unlink(void *ctx, char *file){ + return ((CEFS*)ctx)->do_unlink(file); +} + +int +cefs_rename(void *ctx, char *old_name, char *new_name){ + return ((CEFS*)ctx)->do_rename(old_name, new_name); +} + +int +cefs_open(void *ctx, char *file, unsigned mode){ + return ((CEFS*)ctx)->do_open(file, mode); +} + +int +cefs_release(void *ctx, char *file){ + return ((CEFS*)ctx)->do_release(file); +} + +int +cefs_read(void *ctx, char *file, long long offset, unsigned long count, char *buf){ + return ((CEFS*)ctx)->do_read(file, offset, count, buf); +} + +int +cefs_write(void *ctx, char *file, long long offset, unsigned long count, char *buf){ + return ((CEFS*)ctx)->do_write(file, offset, count, buf); +} + +int +cefs_readlink(void *ctx, char *link, char *buf, int buflen){ + return ((CEFS*)ctx)->do_readlink(link, buf, buflen); +} + +int +cefs_link(void *ctx, char *target, char *link){ + return ((CEFS*)ctx)->do_link(target, link); +} + +int +cefs_symlink(void *ctx, char *target, char *link){ + return ((CEFS*)ctx)->do_symlink(target, link); +} + +int +cefs_setattr(void *ctx, char *file, struct lufs_fattr *fattr){ + return ((CEFS*)ctx)->do_setattr(file, fattr); +} + +} /* extern "C" */ + + +/* + * It controls whether a new Rapi connection is initialized for every + * function or only once per process. I am not sure at the moment, + * what is better. + */ +#define CERAPIINIT_PER_PROCESS + +// WinCE Send buffer size +//#define MYBUF_SIZE (16*1024) +#define MYBUF_SIZE (64*1024) + +// +// Return values from main() +// +#define TEST_SUCCEEDED 0 +#define TEST_FAILED -1 +// +// HRESULT tests +// +#define VERIFY_HRESULT(call) \ +TRACE("CeRapiInit");\ +if (FAILED((call))) { WARN("FAIL."); return TEST_FAILED; } + + +// +// Convert text +// +char* from_unicode(const WCHAR* inbuf) +{ + size_t length = wcslen(inbuf); + size_t inbytesleft = length * 2, outbytesleft = length; + char* outbuf = new char[outbytesleft+1]; + char* outbuf_iterator = outbuf; + char* inbuf_iterator = (char*)inbuf; + + iconv_t cd = iconv_open("KOI8-R", "UNICODELITTLE"); + size_t result = iconv(cd, &inbuf_iterator, &inbytesleft, &outbuf_iterator, &outbytesleft); + iconv_close(cd); + + if ((size_t)-1 == result) + strcpy(outbuf, "(failed)"); + else + outbuf[length] = 0; + + return outbuf; +} + +WCHAR* to_unicode(const char* inbuf) +{ + size_t length = strlen(inbuf); + size_t inbytesleft = length, outbytesleft = (length+1)* 2; + char * inbuf_iterator = const_cast(inbuf); + WCHAR* outbuf = new WCHAR[inbytesleft+1]; + WCHAR* outbuf_iterator = outbuf; + + iconv_t cd = iconv_open("UNICODELITTLE", "KOI8-R"); + size_t result = iconv(cd, &inbuf_iterator, &inbytesleft, (char**)&outbuf_iterator, &outbytesleft); + iconv_close(cd); + + if ((size_t)-1 == result) + outbuf[0] = 0; + else + outbuf[length] = 0; + + return outbuf; +} + +char* ce_to_unix_name(const WCHAR* cefile) +{ + char* file = from_unicode(cefile); + for (char* pp=file; *pp!=0; pp++) + if (*pp=='/') *pp = '%'; + return file; +} + +WCHAR* unix_to_ce_name(const char* file) +{ + WCHAR* path = to_unicode(file); + for (WCHAR* pp=path; *pp!=0; pp++) + if (*pp=='/') *pp='\\'; + else if (*pp=='\\') *pp='%'; + return path; +} + +//static void noalrmHandler(int sig){ +// TRACE("False timeout..."); +// +// signal(SIGALRM, noalrmHandler); +// siginterrupt(SIGALRM, 1); +//} + +CEFS::CEFS(struct list_head* cf, struct dir_cache *cache, struct credentials *cred){ + cfg = cf; + this->cache = cache; + this->cred = cred; + + + stored_data = NULL; + stored_data_len = 0; + stored_file = NULL; + writing = FALSE; + + rhnd = new RAPIHandle; + rhnd->sock=0; + rhnd->_lasterror=0; + rhnd->buffer=NULL; + rhnd->hostname=NULL; + rhnd->lockbuffer=NULL; + rhnd->lockbuffersize=0; + + TRACE("in CEFS constructor"); +} + +CEFS::~CEFS(){ + delete rhnd; + TRACE("in CEFS destructor"); +} + +int +CEFS::do_mount(){ + TRACE("mounting a cefs."); +#ifdef CERAPIINIT_PER_PROCESS + VERIFY_HRESULT(CeRapiInit(rhnd)); +#endif + return 1; +} + +void +CEFS::do_umount(){ + TRACE("umounting a cefs."); +#ifdef CERAPIINIT_PER_PROCESS + CeRapiUninit(rhnd); +#endif +} + +int +CEFS::do_readdir(char* d, struct directory *dir){ + int result = -1; + + TRACE("reading '"<f_mode = S_IFREG; +// fattr->f_mode |= 0664; +// fattr->f_mode &= ~options.o_umask; + fattr->f_uid = 1; +// fattr->f_uid = options.o_uid; + fattr->f_gid = 1; +// fattr->f_gid = options.o_gid; + + if ( f=="/." ) { // Artificial root directory + fattr->f_mode = S_IFDIR; + return 0; + } + +#ifndef CERAPIINIT_PER_PROCESS + VERIFY_HRESULT(CeRapiInit(rhnd)); +#endif + + CE_FIND_DATA find_data; + HANDLE hnd=CeFindFirstFile(rhnd,path, &find_data); + delete[] path; + if (INVALID_HANDLE_VALUE==hnd) { + TRACE("CeFindFirstFile of '"<f_mode = S_IFDIR; +// fattr->f_mode |= 0111; + } +// fattr->f_mode |= 0666; +// fattr->f_mode &= ~options.o_umask; + fattr->f_nlink = 1; + fattr->f_size = find_data.nFileSizeLow; + fattr->f_atime = DOSFS_FileTimeToUnixTime( + &(find_data.ftLastAccessTime),NULL ); + fattr->f_mtime = DOSFS_FileTimeToUnixTime( + &(find_data.ftLastWriteTime),NULL ); + fattr->f_ctime = DOSFS_FileTimeToUnixTime( + &(find_data.ftCreationTime),NULL ); + + result = 0; +out: +#ifndef CERAPIINIT_PER_PROCESS + CeRapiUninit(rhnd); +#endif + return result; +} + +int +CEFS::do_mkdir(char *dir, int mode){ +#ifndef CERAPIINIT_PER_PROCESS + VERIFY_HRESULT(CeRapiInit(rhnd)); +#endif + WCHAR* path = unix_to_ce_name(dir); + int res = CeCreateDirectory(rhnd,path, NULL); + delete[] path; +#ifndef CERAPIINIT_PER_PROCESS + CeRapiUninit(rhnd); +#endif + return res ? 0:-1; +} + +int +CEFS::do_rmdir(char *dir){ +#ifndef CERAPIINIT_PER_PROCESS + VERIFY_HRESULT(CeRapiInit(rhnd)); +#endif + WCHAR* path = unix_to_ce_name(dir); + int res = CeRemoveDirectory(rhnd,path); + delete[] path; +#ifndef CERAPIINIT_PER_PROCESS + CeRapiUninit(rhnd); +#endif + return res ? 0:-1; +} + +int +CEFS::do_create(char *file, int mode){ + int result = -1; +#ifndef CERAPIINIT_PER_PROCESS + VERIFY_HRESULT(CeRapiInit(rhnd)); +#endif + TRACE(file<< " mode " << mode); + WCHAR* path = unix_to_ce_name(file); + HANDLE handle = CeCreateFile(rhnd,path, + GENERIC_WRITE, + 0, + NULL, + CREATE_ALWAYS, + FILE_ATTRIBUTE_NORMAL, + NULL); + delete[] path; + if (INVALID_HANDLE_VALUE==handle) goto out; + CeCloseHandle(rhnd,handle); + + result = 0; +out: +#ifndef CERAPIINIT_PER_PROCESS + CeRapiUninit(rhnd); +#endif + return result; +} + +int +CEFS::do_unlink(char *file){ +#ifndef CERAPIINIT_PER_PROCESS + VERIFY_HRESULT(CeRapiInit(rhnd)); +#endif + WCHAR* path =unix_to_ce_name(file); + int res = CeDeleteFile(rhnd,path); + delete[] path; +#ifndef CERAPIINIT_PER_PROCESS + CeRapiUninit(rhnd); +#endif + return res ? 0:-1; +} + +int +CEFS::do_rename(char *old, char *nnew){ +#ifndef CERAPIINIT_PER_PROCESS + VERIFY_HRESULT(CeRapiInit(rhnd)); +#endif + TRACE(old << " to " << nnew); + + WCHAR* oldpath = unix_to_ce_name(old); + WCHAR* newpath = unix_to_ce_name(nnew); + + int res=CeMoveFile(rhnd, oldpath,newpath ); + + delete[] oldpath; + delete[] newpath; + +#ifndef CERAPIINIT_PER_PROCESS + CeRapiUninit(rhnd); +#endif + return res ? 0:-1; +} + +int +CEFS::do_open(char *file, unsigned mode){ + + TRACE(file <<"mode" << mode); + if (stored_data_len) { + do_release(stored_file); + } + if ( mode&O_WRONLY ) { + writing = TRUE; + stored_file = strdup(file); + } + return 0; +} + +int +CEFS::do_release(char *file){ + TRACE(file); + int result = 0; + if (writing && stored_data_len) { + result = -1; +#ifndef CERAPIINIT_PER_PROCESS + VERIFY_HRESULT(CeRapiInit(rhnd)); +#endif + WCHAR* path = unix_to_ce_name(file); + HANDLE handle = CeCreateFile(rhnd,path, + GENERIC_WRITE, + 0, + NULL, + CREATE_ALWAYS, + FILE_ATTRIBUTE_NORMAL, + NULL); + delete[] path; + if (handle == INVALID_HANDLE_VALUE) goto out; + for ( char* buffer=stored_data; + buffer= stored_data+stored_data_len ) + bytes_read = stored_data+stored_data_len-buffer; + + if ( 0==CeWriteFile(rhnd,handle, buffer, bytes_read, &did_write, NULL) ) + goto out; + if (bytes_read != did_write) + WARN("Only wrote %lu bytes to file of %u possible.\n"<< did_write<< bytes_read); + usleep(100); + } + CeCloseHandle(rhnd,handle); + + result = 0; +out: +#ifndef CERAPIINIT_PER_PROCESS + CeRapiUninit(rhnd); +#endif + ; + } + if (stored_data_len) { + free(stored_data); + free(stored_file); + stored_data_len = 0; + stored_data=NULL; + stored_file=NULL; + } + writing = FALSE; + return result; +} + +int +CEFS::do_read(char *file, long long offset, unsigned long count, char *buf){ + TRACE("read "<stored_data_len) + count = stored_data_len-offset; + memcpy(buf,stored_data+offset,count); + result = count; + return result; +} + +int +CEFS::do_write(char *file, long long offset, unsigned long count, char *buf){ + + TRACE("write "<stored_data_len) { + stored_data_len = offset+count; + stored_data = (char*)realloc(stored_data,stored_data_len); + } + memcpy(stored_data+offset,buf,count); + return count; +} + + +int +CEFS::do_setattr(char* file, struct lufs_fattr*) +{ + TRACE(file); + return 0; +} diff --git a/filesystems/cefs/cefs.h b/filesystems/cefs/cefs.h new file mode 100644 index 0000000..0ba1f40 --- /dev/null +++ b/filesystems/cefs/cefs.h @@ -0,0 +1,52 @@ +/* + * cefs.h + * + * 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 _CEFS_H_ +#define _CEFS_H_ + +struct RAPIHandle; + +using namespace std; + +struct directory; + +class CEFS{ + struct credentials *cred; + struct dir_cache *cache; + struct list_head *cfg; + + char* stored_file; + int writing; + char* stored_data; + unsigned int stored_data_len; + struct RAPIHandle* rhnd; + + public: + CEFS(struct list_head*, struct dir_cache*, struct credentials*); + ~CEFS(); + + int do_mount(); + void do_umount(); + int do_readdir(char*, struct directory*); + int do_stat(char*, struct lufs_fattr*); + int do_mkdir(char*, int); + int do_rmdir(char*); + int do_create(char*, int); + int do_unlink(char*); + int do_rename(char*, char*); + int do_open(char*, unsigned); + int do_release(char*); + int do_read(char*, long long, unsigned long, char*); + int do_write(char*, long long, unsigned long, char*); +// int do_readlink(char*, char*, int); +// int do_link(char*, char*); +// int do_symlink(char*, char*); + int do_setattr(char*, struct lufs_fattr*); +}; + +#endif diff --git a/filesystems/cefs/chunk.c b/filesystems/cefs/chunk.c new file mode 100644 index 0000000..3bdb856 --- /dev/null +++ b/filesystems/cefs/chunk.c @@ -0,0 +1,471 @@ +/*************************************************************************** + * Copyright (C) 2001 by Ludovic LANGE * + * ludovic.lange@free.fr * + * * + * 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. * + ***************************************************************************/ + +#define BUFSIZE 16384 +#include +#include +#include +#include +#include +#include +#include + +#include +#include + +#include "chunk.h" +/* +#include +#include +#include +#include +#include +#include +#include +#include +#include +*/ + +/* ************************************************************************** */ +/* Functions for debugging buffers */ +/* ************************************************************************** */ + +void _DBG_printbuf( rapibuffer * buf ) +{ + int i, j, k; + long buflen; + long size; + long rem; + unsigned char * bufchar; + + /* szbuf = 4 + ( ( long ) * ( ( long * ) ( buf ) ) ); */ + + buflen = letoh32(buf->bufferlen); + + buflen += 4; + + DBG_printf( "Buflen = %04ld ", buflen ); + size = buflen / 16; + rem = buflen % 16; + bufchar = (unsigned char *) buf; + + for ( k = 0, j = 0; ( k < size ) && ( k < 100 ); k++ ) + { + for ( i = 0; i < 16; i++ ) + { + DBG_printf( "%02X ", bufchar[ k * 16 + i ] ); + if ( i == 7 ) + { + DBG_printf( " " ); + } + } + DBG_printf( " " ); + for ( i = 0; i < 16; i++ ) + { + DBG_printf( "%c", isprint( bufchar[ k * 16 + i ] ) ? bufchar[ k * 16 + i ] : '.' ); + if ( i == 7 ) + { + DBG_printf( " " ); + } + } + DBG_printf( "\n " ); + } + if ( rem > 0 ) + { + for ( i = 0; i < rem; i++ ) + { + DBG_printf( "%02X ", bufchar[ k * 16 + i ] ); + if ( i == 7 ) + { + DBG_printf( " " ); + } + } + for ( i = rem; i < 16; i++ ) + { + DBG_printf( " " ); + } + DBG_printf( " " ); + for ( i = 0; i < rem; i++ ) + { + DBG_printf( "%c", isprint( bufchar[ k * 16 + i ] ) ? bufchar[ k * 16 + i ] : '.' ); + if ( i == 7 ) + { + DBG_printf( " " ); + } + } + } + DBG_printf( "\n" ); +} + +void _DBG_printf( const char * str, ... ) +{ + va_list ap; + va_start( ap, str ); + vfprintf( stderr, str, ap ); + va_end( ap ); +} + +/***************************************************************************/ +/* Functions for sockets */ +/***************************************************************************/ + +int SockOpen( const char *host, int clientPort ) +{ + int sock; +#ifndef INET_ATON + unsigned long inaddr; +#endif /* INET_ATON */ + struct sockaddr_in ad; + struct hostent *hp; + + memset( &ad, 0, sizeof( ad ) ); + ad.sin_family = AF_INET; + + /* we'll accept a quad address */ +#ifndef INET_ATON + inaddr = inet_addr( host ); + if ( inaddr != INADDR_NONE ) + { + memcpy( &ad.sin_addr, &inaddr, sizeof( inaddr ) ); + } + else +#else +if ( !inet_aton( host, &ad.sin_addr ) ) +#endif /* INET_ATON */ + { + hp = gethostbyname( host ); + + /* + * Add a check to make sure the address has a valid IPv4 or IPv6 + * length. This prevents buffer spamming by a broken DNS. + */ + if ( hp == NULL || ( hp->h_length != 4 && hp->h_length != 8 ) ) + { + return -1; + } + memcpy( &ad.sin_addr, hp->h_addr, hp->h_length ); + } + ad.sin_port = htons( clientPort ); + + sock = socket( AF_INET, SOCK_STREAM, 0 ); + if ( sock < 0 ) + { + return -1; + } + if ( connect( sock, ( struct sockaddr * ) & ad, sizeof( ad ) ) < 0 ) + { + close( sock ); + return -1; + } + + return ( sock ); +} + +#define SKIP_HEADER 4 + +/* **************************************************************************** */ +/* Functions for buffers */ +/* **************************************************************************** */ + +long initBuf( rapibuffer * destbuf, long destbuflen ) +{ + destbuf->bufferlen = 0; + memset( &(destbuf->data), 0, destbuflen ); + return 0; +} + +int sendbuffer( int sock, rapibuffer * buffer ) +{ + long buflen; + + buflen=_getbufferlen(buffer); + + return write( sock, buffer, 4 + buflen ); +} + +/*int readbuffer( int sock, unsigned char * destbuf, long size ) +{ + long szbuf; + int result; + struct timeval tv; + fd_set set; + + tv.tv_sec = 5; + tv.tv_usec = 0; + FD_ZERO( &set ); + FD_SET( sock, &set ); + + result = select( ( 1 + sock ), &set, NULL, NULL, &tv ); + if ( result ) + { + result = read( sock, destbuf, 4 ); + if ( result == 4 ) + { + szbuf = ( long ) * ( ( long * ) ( destbuf ) ); + + if ( szbuf > 0 ) + { + if ( szbuf < size ) + { + result = read( sock, ( destbuf + 4 ), szbuf ); + } + } + } + } + return result; +} */ + +void flushbuffer( int sock ) +{ + long szbuf; + struct timeval tv; + fd_set set; + size_t result; + + tv.tv_sec = 0; + tv.tv_usec = 1000; + FD_ZERO( &set ); + FD_SET( sock, &set ); + + szbuf = 0; + do + { + result = select( ( 1 + sock ), &set, NULL, NULL, &tv ); + if ( result ) + { + result = read( sock, &szbuf, 4 ); +#ifdef DEBUGING + if(result>0) DBG_printf("!!! flushbuffer: %d !!!\n",result); +#endif + } + } + while ( result ); +} + +long getbufferlen( int sock ) +{ + long buflen; + struct timeval tv; + fd_set set; + size_t result; + + tv.tv_sec = 30; + tv.tv_usec = 0; + FD_ZERO( &set ); + FD_SET( sock, &set ); + + buflen = 0; + result = select( ( 1 + sock ), &set, NULL, NULL, &tv ); + if ( result ) + { + result = read( sock, &buflen, 4 ); + if ( result == 4 ) + { + buflen = letoh32( buflen ); + if ( buflen < 0 ) + { + buflen = 0; + } + } + else + { + buflen = 0; + } + } + else + { + DBG_printf("timeout!!!\n"); + } + if ( buflen == 0 ) + { + flushbuffer( sock ); + } + return buflen; +} + +size_t getbufferchunk( int sock, long *counter, void * buffer, long nbbytes ) +{ + long szbuf; + struct timeval tv; + fd_set set; + size_t result; + + szbuf = 0; + result = 0; + + DBG_printf("read counter=%ld nbbytes=%ld\n",*counter,nbbytes); + if( ( counter && ( *counter >= nbbytes ) ) || (!counter) ) + { + while( nbbytes > 0 ) + { + tv.tv_sec = 5; + tv.tv_usec = 0; + FD_ZERO( &set ); + FD_SET( sock, &set ); + + result = select( ( 1 + sock ), &set, NULL, NULL, &tv ); + if ( result ) + { + result = read( sock, buffer, nbbytes ); + if ( result > 0 ) + { + nbbytes -= result; + if( counter ) + { + ( *counter ) -= result; + } + buffer = (void *) ( (char *) buffer + result ); + } + } + else + { + nbbytes = 0; + result = 0; + } + } + } + return result; +} + +long pushLong( rapibuffer * destbuf, long destbuflen, long param ) +{ + long buflen; + unsigned char * destbufchar; + + buflen=_getbufferlen(destbuf); + + destbufchar = (unsigned char *) &(destbuf->data); + + if ( buflen < destbuflen ) + { + * ( ( long * ) ( destbufchar + buflen ) ) = htole32(param); + _setbufferlen(destbuf,buflen+sizeof(param)); + } + return buflen + sizeof( param ); +} + +long getLong( int sock, long *buflen ) +{ + long param; + size_t result; + + result = getbufferchunk( sock, buflen, ¶m, sizeof( param ) ); + + return param; +} + +long pushShort( rapibuffer * destbuf, long destbuflen, short param ) +{ + long buflen; + unsigned char * destbufchar; + + buflen = _getbufferlen(destbuf); + + destbufchar = (unsigned char *) &(destbuf->data); + + if ( buflen < destbuflen ) + { + * ( ( short * ) ( destbufchar + buflen ) ) = htole16(param); + _setbufferlen(destbuf,buflen+sizeof(param)); + } + return buflen + sizeof( param ); +} + +short getShort( int sock, long *buflen ) +{ + short param; + size_t result; + + result = getbufferchunk( sock, buflen, ¶m, sizeof( param ) ); + + return param; +} + +long pushString( rapibuffer * destbuf, long destbuflen, LPCWSTR string ) +{ + long buflen; + char * param; + unsigned int i; + size_t stlen; + unsigned char * destbufchar; + + stlen = 1 + wcslen( string ); + + buflen = _getbufferlen(destbuf); + + destbufchar = (unsigned char *) &(destbuf->data); + + if ( buflen < destbuflen ) + { + param = ( char * ) string; + for ( i = 0; i < stlen * sizeof( WCHAR ); i++ ) + { + * ( ( char * ) ( destbufchar + buflen + i) ) = param[ i ]; + } + + destbuf->bufferlen = htole32(buflen + stlen * sizeof( WCHAR )); + } + return buflen + stlen * sizeof( WCHAR ); +} + +size_t getFileTime( int sock, long *bufsize, FILETIME * param ) +{ + size_t result = 0; + + if ( param ) + { + result = getbufferchunk( sock, bufsize, param, sizeof( *param ) ); + } + + return result; +} + +WCHAR * getString( int sock, long *bufsize, long sz ) +{ +#ifdef CONVERT_STRING + iconv_t cd; + size_t ibl, obl; + char *iptr, *optr; +#endif + size_t result; + WCHAR* inbuf = (WCHAR*)malloc(BUFSIZE*sizeof(WCHAR)); + +#ifdef REAL_WCHAR_T + _WIN_WCHAR* destbuf= (_WIN_WCHAR*)malloc(BUFSIZE*sizeof(_WIN_WCHAR)); + long index; + result = getbufferchunk( sock, bufsize, destbuf, ( 2 * sz ) ); + for ( index = 0; index < sz; index ++ ) + { + DBG_printf( "%c", ( destbuf[ index ] & 0xFF ) > 31 ? ( destbuf[ index ] & 0xFF ) : '.' ); + inbuf[ index ] = ( WCHAR ) destbuf[ index ]; + } + DBG_printf( "\n" ); + free(destbuf); +#else + DBG_printf( "getString : size = %ld, lg = %ld\n", *bufsize, sz ); + result = getbufferchunk( sock, bufsize, inbuf, ( 2 * sz ) ); +#endif + + +#ifdef CONVERT_STRING + if ( result == sz ) + { + cd = iconv_open( "latin1", "UCS-2" ); + iptr = inbuf; + ibl = sz; + obl = BUFSIZE; + optr = destbuf; + result = iconv( cd, &iptr, &ibl, &optr, &obl ); + iconv_close( cd ); + } +#endif + return inbuf; +} + diff --git a/filesystems/cefs/chunk.h b/filesystems/cefs/chunk.h new file mode 100644 index 0000000..c37ec61 --- /dev/null +++ b/filesystems/cefs/chunk.h @@ -0,0 +1,176 @@ +/*************************************************************************** + * Copyright (C) 2001 by Ludovic LANGE * + * ludovic.lange@free.fr * + * * + * 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. * + ***************************************************************************/ +#ifndef __CHUNK_H__ +#define __CHUNK_H__ + +#include "windows.h" +#include "little_endian.h" + +typedef struct { + unsigned long bufferlen; + unsigned char * data; +} rapibuffer; + +#ifdef DEBUGING +#define DBG_printbuf(a) _DBG_printbuf( a ) +#define DBG_printf _DBG_printf +#else +#define DBG_printbuf(a) +#define DBG_printf( str, args... ) +#endif + +/** + * This library deals with packets (called 'rapibuffer') having the following format : + * 0x00000000 bufferlen: a long containing the len of the buffer. + * 0x00000008 Beginning of the data + * .......... ..................... + * 0x00000008 + bufferlen End of the data. + */ + +/** + * A debugging function. + * prints the content of the buffer. + * @param buf : a buffer + */ +void _DBG_printbuf( rapibuffer * buf ); + +/** + * A debugging function. + * prints the string. + * @param str : the format string. + */ +void _DBG_printf( const char * str, ... ); + +/***************************************************************************/ +/* internal inline functions */ +/***************************************************************************/ + +#define __inline__ extern inline + +/* FIXME: conceptional fault: the next three functions are used in + rapi.c:CeWriteFile() */ + +__inline__ void _setbufferlen(rapibuffer *buffer, unsigned long bufferlen) +{ + buffer->bufferlen = htole32(bufferlen); +} + +__inline__ unsigned long _getbufferlen(rapibuffer *buffer) +{ + return letoh32(buffer->bufferlen); +} + +/* A safer write(), since sockets might not write all but only some of + the bytes requested */ + +__inline__ int safe_write(int fd, char *buf, int len) +{ + int done,todo=len; + + while(todo) + { + done=write(fd,buf,todo); + if(done<=0) return(done); + buf+=done; + todo-=done; + } + return(len); +} + +/** + * Opens a socket to a specified host/port. + * @param host : the host name. + * @param clientPort : the port to connect to. + * @returns the socket, or -1 in case of error. + */ +int SockOpen( const char *host, int clientPort ); + +/** + * Initialises the specified buffer. Sets the size to 0. + * @param destbuf : a rapibuffer. + * @param destbuflen : the len of data in the buffer. + * @returns 0. + */ +long initBuf( rapibuffer * destbuf, long destbuflen ); + +/** + * Sends the buffer to the socket. The number of bytes to send is the buffersize field of the buffer ( aka *((long *)buffer[0]) ). + * @param sock : the socket, previously opened. + * @param buffer : a proper buffer. + * @returns the number of bytes written. Same meaning as the write() function. + */ +int sendbuffer( int sock, rapibuffer * buffer ); + +/** + * Reads bytes from the socket into the buffer. + * @param sock : the socket. + * @param destbuf : the buffer. + * @param size : number of bytes to read. + * @returns number of bytes read. Same meaning as the read() function. + */ +/* int readbuffer( int sock, rapibuffer * destbuf, long size ); */ + +/** + * Flushes the remaining unread bytes from the socket. Use only when debugging. + * @param sock : the socket. + */ +void flushbuffer( int sock ); + +/** + * A function that reads 4 bytes from the socket, and returns a long from it. Is the first function to call after + * receiving an answer from the device. + * @param sock : the socket. + * @returns : the length of the following buffer. + */ +long getbufferlen( int sock ); + +/** + * Reads a block of a give size into a buffer. Decreases a counter. + * @param sock : the socket. + * @param counter : pointer to a counter that will be decremented of the number of bytes read. Must be greater or equal than buflen, or NULL. + * @param buffer : a buffer to store the data. + * @param nbbytes : number of bytes to read. + * @returns the number of bytes read. + */ +size_t getbufferchunk( int sock, long *counter, void * buffer, long nbbytes ); + +/** + * Store a long param into the buffer, increments the bufferlen property of the buffer. + * @param destbuf : the buffer. its bufferlen property will be increased by 4 ( i.e. sizeof(long) ). + * @param destbuflen : the (allocated) maximum length the buffer can hold. A border not to cross. + * @param param : the long to store in the buffer. + * @returns the new bufferlen property of the buffer. + */ +long pushLong( rapibuffer * destbuf, long destbuflen, long param ); +long getLong( int sock, long *bufsize ); + +/** + * Store a short param into the buffer, increments the bufferlen property of the buffer. + * @param destbuf : the buffer. its bufferlen property will be increased by 2 ( i.e. sizeof(short) ). + * @param destbuflen : the (allocated) maximum length the buffer can hold. A border not to cross. + * @param param : the long to store in the buffer. + * @returns the new bufferlen property of the buffer. + */ +long pushShort( rapibuffer * destbuf, long destbuflen, short param ); +short getShort( int sock, long *bufsize ); + +size_t getFileTime( int sock, long *bufsize, FILETIME * param ); + +/** + * Store a wide string param into the buffer, increments the bufferlen property of the buffer. + * @param destbuf : the buffer. its bufferlen property will be increased by twice the number of characters in the string ( i.e. wstrlen(string) ). + * @param destbuflen : the (allocated) maximum length the buffer can hold. A border not to cross. + * @param string : the string to store in the buffer. + * @returns the new bufferlen property of the buffer. + */ +long pushString( rapibuffer * destbuf, long destbuflen, LPCWSTR /*const char * */ string ); +WCHAR * getString( int sock, long *bufsize, long sz ); + +#endif diff --git a/filesystems/cefs/little_endian.h b/filesystems/cefs/little_endian.h new file mode 100644 index 0000000..df8d814 --- /dev/null +++ b/filesystems/cefs/little_endian.h @@ -0,0 +1,49 @@ +/* + * This file will make sure that the functions/macros htole16 and htole32 + * are available. + */ +#ifndef __LITTLE_ENDIAN_H__ +#define __LITTLE_ENDIAN_H__ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#else +#error No config.h available. +#endif + +/* needed first */ +#ifdef HAVE_SYS_TYPES_H +#include +#endif + +/* byte swapping */ +#ifdef HAVE_BYTESWAP_H +#include +#elif HAVE_SYS_BYTESWAP_H +#include +#endif + +/* endianness */ +#ifdef HAVE_ENDIAN_H +#include +#elif HAVE_MACHINE_ENDIAN_H +#include +#endif + +/* define host-to-little-endian and little-endian-to-host macros */ +#if !defined(htole32) || !defined(htole16) || !defined(letoh16) || !defined(letoh32) +#ifdef WORDS_BIGENDIAN +#define htole16(x) bswap_16(x) +#define htole32(x) bswap_32(x) +#define letoh16(x) bswap_16(x) +#define letoh32(x) bswap_32(x) +#else +#define htole16(x) (x) +#define htole32(x) (x) +#define letoh16(x) (x) +#define letoh32(x) (x) +#endif +#endif + +#endif /* __LITTLE_ENDIAN_H__ */ + diff --git a/filesystems/cefs/rapi.c b/filesystems/cefs/rapi.c new file mode 100644 index 0000000..826d850 --- /dev/null +++ b/filesystems/cefs/rapi.c @@ -0,0 +1,2065 @@ +/*************************************************************************** + * Copyright (C) 2001 by Ludovic LANGE * + * ludovic.lange@free.fr * + * * + * 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. * + ***************************************************************************/ +/* + * rapi.c + * (c) 2001 Ludovic LANGE, + * except SockOpen, (c) Unknown ? from socket.c / socket.h + */ + +#include "config.h" + +#undef VERSION + +#define MIN(a,b) ((a)<(b)?(a):(b)) + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "little_endian.h" + +#include "chunk.h" +#include "rapi.h" + +#define BUFSIZE 16384 + + +/* + * Push parameter information to the buffer + * + * DWORD parameter values must be 4 byte little-endian + * WORD parameter values must be 2 byte little-endian + * WCHAR parameter values must be 2-byte UNICODE (is it endian stuff on these too?) + */ +static void pushParameter(RAPIHandleP rhnd,long size, void * parameterData, size_t parameterSize, int pushValue) +{ + if (parameterData) + { + pushLong( (rhnd->buffer), size, 1 ); + pushLong( (rhnd->buffer), size, parameterSize); + + if (pushValue) /* pushValue is boolean */ + { + long old_length; + long new_length; + + pushLong( (rhnd->buffer), size, 1 ); /* data follows */ + + old_length = _getbufferlen((rhnd->buffer)); + new_length = old_length + parameterSize; + + if (new_length < size) + { + memcpy(((unsigned char*)&((rhnd->buffer)->data)) + old_length, parameterData, parameterSize); + _setbufferlen((rhnd->buffer), new_length); + } + else + { + DBG_printf( "rapibuffer too small, this will fail\n"); + } + } + else + { + pushLong( (rhnd->buffer), size, 0 ); /* no data follows */ + } + } + else + { + pushLong( (rhnd->buffer), size, 0 ); /* no parameter info */ + } +} + +/* + * Push parameter information to the buffer, omitting size information (needed for CeRecordWriteProps + */ +static void pushParameter_no_size(RAPIHandleP rhnd,long size, void * parameterData, size_t parameterSize) +{ + long old_length; + long new_length; + + if (parameterData) + { + pushLong( (rhnd->buffer), size, 1 ); /* data follows */ + + old_length = _getbufferlen((rhnd->buffer)); + new_length = old_length + parameterSize; + + if (new_length < size) + { + memcpy(((unsigned char*)&((rhnd->buffer)->data)) + old_length, parameterData, parameterSize); + _setbufferlen((rhnd->buffer), new_length); + } + else + { + DBG_printf( "rapibuffer too small, this will fail\n"); + } + } + else + { + pushLong( (rhnd->buffer), size, 0 ); /* no data follows */ + } +} + + + + +/** + * Convert parameter to little endian before call to pushParameter + */ +#define pushParameterInt16(rhnd,size, parameterData, pushValue) \ +if (pushValue && parameterData) \ + { *(u_int16_t*)parameterData = htole16(*(u_int16_t*)parameterData); } \ +pushParameter(rhnd,size, parameterData, sizeof(u_int16_t), pushValue); + +#define pushParameterInt32(rhnd,size, parameterData, pushValue) \ +if (pushValue && parameterData) \ + { *(u_int32_t*)parameterData = htole32(*(u_int32_t*)parameterData); } \ +pushParameter(rhnd,size, parameterData, sizeof(u_int32_t), pushValue) + + +/** + * Pop parameter info from the buffer + */ +static void popParameter(RAPIHandleP rhnd,long* size, void * parameterData, size_t parameterMaxSize) +{ + long lng; + + lng = getLong((rhnd->sock), size); /* parameter info available? */ + + if (1 == lng) + { + size_t parameterRealSize = getLong((rhnd->sock), size); /* parameter value size in buffer */ + + lng = getLong((rhnd->sock), size); /* parameter value available? */ + + if (1 == lng) + { + int overflow; + + if (parameterData) + { + /* read directly to buffer */ + getbufferchunk((rhnd->sock), size, parameterData, MIN(parameterRealSize, parameterMaxSize)); + overflow = parameterRealSize - parameterMaxSize; + } + else + { + /* throw it all away */ + overflow = parameterRealSize; + } + + if (overflow > 0) + { + if (parameterData) + DBG_printf("Overflow by %i bytes. Parameter size is %i bytes but max %i bytes was expected. (%i bytes remaining)\n", + overflow, parameterRealSize, parameterMaxSize , *size); + + { + /* read overflowed buffer */ + void* tmp = malloc(overflow); + getbufferchunk((rhnd->sock), size, tmp, overflow); + free(tmp); + } + + } + } + else if (0 != lng) + { + DBG_printf("popParameter (a): Expected 0 or 1 but got %i=0x%x (%i bytes remaining)\n", lng, lng, *size); + } + } + else if (0 != lng) + { + DBG_printf("popParameter (b): Expected 0 or 1 but got %i=0x%x (%i bytes remaining)\n", lng, lng, *size); + } +} + +/** + * Convert parameter data from little endian after call to popParameter + */ +#define popParameterInt16(rhnd,size, parameterData) \ +popParameter(rhnd,size, parameterData, sizeof(u_int16_t)); \ +if (parameterData) \ + { *(u_int16_t*)parameterData = letoh16(*(u_int16_t*)parameterData); } + +#define popParameterInt32(rhnd,size, parameterData) \ +popParameter(rhnd,size, parameterData, sizeof(u_int32_t)); \ +if (parameterData) \ + { *(u_int32_t*)parameterData = letoh32(*(u_int32_t*)parameterData); } + +void checkpassword(RAPIHandleP rhnd) +{ + char buf[4]; + /* Is the device protected ? */ + /* ------------------------- */ + if( (rhnd->lockbuffersize) != 0 ) + { + safe_write( (rhnd->sock), (rhnd->lockbuffer), (rhnd->lockbuffersize) ); + read( (rhnd->sock), buf, 1 ); + } +} +/*=================================================================================================================* + *=================================================================================================================* + * RAPI - Global + *=================================================================================================================* + *=================================================================================================================*/ + +STDAPI_( DWORD ) CeGetSpecialFolderPath(RAPIHandleP rhnd, int nFolder, DWORD nBufferLength, LPWSTR lpBuffer ) +{ + long size = BUFSIZE; + long lng; + WCHAR * str; + +// checkpassword(); + + initBuf( (rhnd->buffer), size ); + pushLong( (rhnd->buffer), size, 0x44 ); /* Command */ + pushLong( (rhnd->buffer), size, nFolder ); /* Parameter1 : the folder */ + pushLong( (rhnd->buffer), size, nBufferLength ); /* Parameter2 : Buffer size that'll get the string */ + DBG_printbuf( (rhnd->buffer) ); + sendbuffer( (rhnd->sock), (rhnd->buffer) ); + + size = getbufferlen( (rhnd->sock) ); + + lng = getLong( (rhnd->sock), &size ); + DBG_printf( "long 1 : %ld (0x%08lx)\n", lng, lng ); + lng = getLong( (rhnd->sock), &size ); + DBG_printf( "long 2 : %ld (0x%08lx)\n", lng, lng ); + lng = getLong( (rhnd->sock), &size ); + DBG_printf( "string size : %ld (0x%08lx)\n", lng, lng ); + str = getString( (rhnd->sock), &size, lng+1 ); + DBG_printf( "string1 : %s\n", str ); + if ( lpBuffer ) + { + memcpy( lpBuffer, str, MIN( ((lng+1)*sizeof(WCHAR) ), nBufferLength*sizeof(WCHAR) ) ); + } + free(str); + return lng; +} + +/* ================================================================================================================= */ +/* ================================================================================================================= */ +/* RAPI - Registry */ +/* ================================================================================================================= */ +/* ================================================================================================================= */ + +/* +STDAPI_(LONG) CeRegDeleteKey( HKEY, LPCWSTR ); +STDAPI_(LONG) CeRegDeleteValue( HKEY, LPCWSTR ); +STDAPI_(LONG) CeRegQueryValueEx( HKEY, LPCWSTR, LPDWORD, LPDWORD, LPBYTE, LPDWORD ); +STDAPI_(LONG) CeRegSetValueEx( HKEY, LPCWSTR, DWORD, DWORD, LPBYTE, DWORD ); +*/ + +STDAPI_( LONG ) CeRegCreateKeyEx(RAPIHandleP rhnd, HKEY hKey, LPCWSTR lpszSubKey, DWORD Reserved, LPWSTR lpszClass, DWORD ulOptions, REGSAM samDesired, LPSECURITY_ATTRIBUTES lpSecurityAttributes, PHKEY phkResult, LPDWORD lpdwDisposition ) +{ + long size = BUFSIZE; + long lng; + long errcode; + LONG result = ERROR_SUCCESS; /* May be result is really errcode. */ + + DBG_printf( "CeRegCreatKeyEx( hKey = 0x%08X, lpszSubKey = 0x%08X, Reserved = 0x%08X, lpszClass = 0x%08X, ulOptions = 0x%08X, samDesired = 0x%08X, lpSecurityAttributes = 0x%08X, phkResult = 0x%08X, lpdwDisposition = 0x%08X )\n", + hKey, lpszSubKey, Reserved, lpszClass, ulOptions, samDesired, lpSecurityAttributes, phkResult, lpdwDisposition ); + + initBuf( (rhnd->buffer), size ); + pushLong( (rhnd->buffer), size, 0x20 ); /* Command */ + pushLong( (rhnd->buffer), size, hKey ); /* Parameter1 : */ + pushLong( (rhnd->buffer), size, 0x01 ); /* Parameter2 : */ + pushLong( (rhnd->buffer), size, 1 + wcslen( lpszSubKey ) ); /* Parameter3 : */ + pushString( (rhnd->buffer), size, lpszSubKey ); /* Parameter4 : the path */ + pushLong( (rhnd->buffer), size, 0x01 ); /* Parameter5 : */ + pushLong( (rhnd->buffer), size, 0x01 ); /* Parameter6 : */ + pushShort( (rhnd->buffer), size, 0x00 ); /* Parameter7 : */ + + DBG_printbuf( (rhnd->buffer) ); + sendbuffer( (rhnd->sock), (rhnd->buffer) ); + + size = getbufferlen( (rhnd->sock) ); + + errcode = getLong( (rhnd->sock), &size ); + DBG_printf( "errpresent : %ld (0x%08lx)\n", errcode, errcode ); + if ( errcode != 0 ) + { + errcode = getLong( (rhnd->sock), &size ); + DBG_printf( "errcode : %ld (0x%08lx)\n", errcode, errcode ); + } + else + { + lng = getLong( (rhnd->sock), &size ); + DBG_printf( "long 1 : %ld (0x%08lx)\n", lng, lng ); + lng = getLong( (rhnd->sock), &size ); + DBG_printf( "long 2 : %ld (0x%08lx)\n", lng, lng ); + *phkResult = ( HKEY ) getLong( (rhnd->sock), &size ); + DBG_printf( "pHkey : %ld (0x%08lx)\n", *phkResult, *phkResult ); + *lpdwDisposition = ( DWORD ) getLong( (rhnd->sock), &size ); + DBG_printf( "lpdwDisposition : %ld (0x%08lx)\n", *lpdwDisposition, *lpdwDisposition ); + } + return result; +} + +STDAPI_( LONG ) CeRegOpenKeyEx(RAPIHandleP rhnd, HKEY hKey, LPCWSTR lpszSubKey, DWORD ulOptions, REGSAM samDesired, PHKEY phkResult ) +{ + long size = BUFSIZE; + long errcode; + + DBG_printf( "CeRegOpenKeyEx( hKey = 0x%08X, lpszSubKey = 0x%08X, ulOptions = 0x%08X, samDesired = 0x%08X, phkResult = 0x%08X )\n", + hKey, lpszSubKey, ulOptions, samDesired, phkResult ); + + initBuf( (rhnd->buffer), size ); + pushLong( (rhnd->buffer), size, 0x1E ); /* Command */ + pushLong( (rhnd->buffer), size, hKey ); /* Parameter1 : */ +#if 0 + pushLong( (rhnd->buffer), size, 0x01 ); /* Parameter2 : */ + pushLong( (rhnd->buffer), size, 1 + wcslen( lpszSubKey ) ); /* Parameter3 : */ + pushString( (rhnd->buffer), size, lpszSubKey ); /* Parameter4 : the path */ +#else + pushParameter(rhnd,size, lpszSubKey, lpszSubKey ? (wcslen(lpszSubKey) + 1) * sizeof(WCHAR) : 0, 1); + pushLong( (rhnd->buffer), size, ulOptions); + pushLong( (rhnd->buffer), size, samDesired); + pushParameterInt32(rhnd,size, phkResult, 0); +#endif + DBG_printbuf( (rhnd->buffer) ); + sendbuffer( (rhnd->sock), (rhnd->buffer) ); + + size = getbufferlen( (rhnd->sock) ); + + errcode = getLong( (rhnd->sock), &size ); + DBG_printf( "errcode : %ld (0x%08lx)\n", errcode, errcode ); + + errcode = getLong( (rhnd->sock), &size ); + DBG_printf( "errpresent : %ld (0x%08lx)\n", errcode, errcode ); + (rhnd->_lasterror) = getLong( (rhnd->sock), &size ); + DBG_printf( "long : %ld (0x%08lx)\n", (rhnd->_lasterror), (rhnd->_lasterror) ); + if ( errcode == 0 ) + { + *phkResult = ( HKEY ) getLong( (rhnd->sock), &size ); + DBG_printf( "pHkey : %ld (0x%08lx)\n", *phkResult, *phkResult ); + } + return errcode; +} + +STDAPI_( LONG ) CeRegCloseKey( RAPIHandleP rhnd,HKEY hKey ) +{ + long size = BUFSIZE; + long lng; + long result; + + DBG_printf( "CeRegCloseKey( hKey = 0x%08X )\n", + hKey ); + + initBuf( (rhnd->buffer), size ); + pushLong( (rhnd->buffer), size, 0x21 ); /* Command */ + pushLong( (rhnd->buffer), size, hKey ); /* Parameter1 : */ + + DBG_printbuf( (rhnd->buffer) ); + sendbuffer( (rhnd->sock), (rhnd->buffer) ); + size = getbufferlen( (rhnd->sock) ); + + result = getLong( (rhnd->sock), &size ); + DBG_printf( "result : %ld (0x%08lx)\n", result, result ); + lng = getLong( (rhnd->sock), &size ); + DBG_printf( "long 2 : %ld (0x%08lx)\n", lng, lng ); + lng = getLong( (rhnd->sock), &size ); + DBG_printf( "long 3 : %ld (0x%08lx)\n", lng, lng ); + return result; +} + +STDAPI_( LONG ) CeRegQueryInfoKey(RAPIHandleP rhnd, HKEY hKey, LPWSTR lpClass, LPDWORD lpcbClass, LPDWORD lpReserved, LPDWORD lpcSubKeys, LPDWORD lpcbMaxSubKeyLen, LPDWORD lpcbMaxClassLen, LPDWORD lpcValues, LPDWORD lpcbMaxValueNameLen, LPDWORD lpcbMaxValueLen, LPDWORD lpcbSecurityDescriptor, PFILETIME lpftLastWriteTime ) +{ + long size = BUFSIZE; + long lng; + LONG result = ERROR_SUCCESS; + +#if 0 + DBG_printf( "CeRegQueryInfoKey( hKey = 0x%08X, lpClass = 0x%08X, lpcbClass = 0x%08X, lpReserved = 0x%08X, lpcSubKeys = 0x%08X, lpcbMaxSubKeyLen = 0x%08X, lpcbMaxClassLen = 0x%08X, lpcValues = 0x%08X, lpcbMaxValueNameLen = 0x%08X, lpcbMaxValueLen = 0x%08X, lpcbSecurityDescriptor = 0x%08X, lpftLastWriteTime = 0x%08X )\n", + hKey, lpClass, lpcbClass, lpReserved, lpcSubKeys, lpcbMaxSubKeyLen, lpcbMaxClassLen, lpcValues, lpcbMaxValueNameLen, lpcbMaxValueLen, lpcbSecurityDescriptor, lpftLastWriteTime ); +#endif + + initBuf( (rhnd->buffer), size ); + pushLong( (rhnd->buffer), size, 0x25 ); /* Command */ + pushLong( (rhnd->buffer), size, hKey ); /* hKey */ + + pushParameter(rhnd,size, lpClass, lpcbClass ? *lpcbClass * sizeof(WCHAR): 0, 0); + pushParameterInt32(rhnd,size, lpcbClass, 1); + pushParameterInt32(rhnd,size, lpReserved, 0); + pushParameterInt32(rhnd,size, lpcSubKeys, 0); + pushParameterInt32(rhnd,size, lpcbMaxSubKeyLen, 0); + pushParameterInt32(rhnd,size, lpcbMaxClassLen, 0); + pushParameterInt32(rhnd,size, lpcValues, 0); + pushParameterInt32(rhnd,size, lpcbMaxValueNameLen, 0); + pushParameterInt32(rhnd,size, lpcbMaxValueLen, 0); + pushParameterInt32(rhnd,size, lpcbSecurityDescriptor, 1); + if (lpftLastWriteTime) + { + lpftLastWriteTime->dwLowDateTime = (DWORD)htole32(lpftLastWriteTime->dwLowDateTime); + lpftLastWriteTime->dwHighDateTime = (DWORD)htole32(lpftLastWriteTime->dwHighDateTime); + } + pushParameter(rhnd,size, lpftLastWriteTime, sizeof(FILETIME), 0); + +/* DBG_printbuf( (rhnd->buffer) );*/ + sendbuffer( (rhnd->sock), (rhnd->buffer) ); + + size = getbufferlen( (rhnd->sock) ); + + result = lng = getLong( (rhnd->sock), &size ); + (rhnd->_lasterror) = lng = getLong( (rhnd->sock), &size ); + + if (ERROR_SUCCESS == result) + { + popParameter(rhnd,&size, lpClass, lpcbClass ? *lpcbClass: 0); + popParameterInt32(rhnd,&size, lpcbClass); + popParameterInt32(rhnd,&size, lpReserved); + popParameterInt32(rhnd,&size, lpcSubKeys); + popParameterInt32(rhnd,&size, lpcbMaxSubKeyLen); + popParameterInt32(rhnd,&size, lpcbMaxClassLen); + popParameterInt32(rhnd,&size, lpcValues); + popParameterInt32(rhnd,&size, lpcbMaxValueNameLen); + popParameterInt32(rhnd,&size, lpcbMaxValueLen); + popParameterInt32(rhnd,&size, lpcbSecurityDescriptor); + popParameter(rhnd,&size, lpftLastWriteTime, sizeof(FILETIME)); + if (lpftLastWriteTime) + { + lpftLastWriteTime->dwLowDateTime = (DWORD)letoh32(lpftLastWriteTime->dwLowDateTime); + lpftLastWriteTime->dwHighDateTime = (DWORD)letoh32(lpftLastWriteTime->dwHighDateTime); + } + } + + if ( size > 0 ) + { + DBG_printf( "size : %d\n", size ); +/* flushbuffer( (rhnd->sock) );*/ + } + return result; +} + +STDAPI_( LONG ) CeRegEnumValue(RAPIHandleP rhnd, HKEY hKey, DWORD dwIndex, LPWSTR lpszValueName, LPDWORD lpcbValueName, LPDWORD lpReserved, LPDWORD lpType, LPBYTE lpData, LPDWORD lpcbData ) +{ + LONG result = ERROR_SUCCESS; + long size = BUFSIZE; + +#if 0 + DBG_printf( "CeRegEnumValue( hKey = 0x%08X, dwIndex = 0x%08X, lpszValueName = 0x%08X, lpcbValueName = 0x%08X, lpReserved = 0x%08X, lpType = 0x%08X, lpData = 0x%08X, lpcbData = 0x%08X )\n", + hKey, dwIndex, lpszValueName, ( *lpcbValueName ), lpReserved, ( *lpType ), ( *lpData ), ( *lpcbData ) ); +#endif + + /* maybe check more parameters */ + if (!lpcbValueName || lpReserved) + return 87; /* ERROR_INVALID_PARAMETER */ + + initBuf( (rhnd->buffer), size ); + pushLong( (rhnd->buffer), size, 0x23 ); /* Command */ + pushLong( (rhnd->buffer), size, hKey ); /* Parameter1 : */ + pushLong( (rhnd->buffer), size, dwIndex ); /* Parameter2 : */ + + pushParameter(rhnd,size, lpszValueName, lpcbValueName ? *lpcbValueName * sizeof(WCHAR): 0, 0); + pushParameterInt32(rhnd,size, lpcbValueName, 1); + pushParameterInt32(rhnd,size, lpReserved, 1); + pushParameterInt32(rhnd,size, lpType, 1); + pushParameter(rhnd,size, lpData, lpcbData ? *lpcbData : 0, 0); + pushParameterInt32(rhnd,size, lpcbData, 1); + +/* DBG_printbuf( (rhnd->buffer) );*/ + sendbuffer( (rhnd->sock), (rhnd->buffer) ); + + size = getbufferlen( (rhnd->sock) ); + + result = getLong( (rhnd->sock), &size ); + (rhnd->_lasterror) = getLong( (rhnd->sock), &size ); + + if (ERROR_SUCCESS == result) + { + /* here comes a result again! */ + result = getLong( (rhnd->sock), &size ); + } + + if (ERROR_SUCCESS == result) + { + popParameter(rhnd,&size, lpszValueName, lpcbValueName ? *lpcbValueName : 0); + popParameterInt32(rhnd,&size, lpcbValueName); + popParameterInt32(rhnd,&size, lpType); + popParameter(rhnd,&size, lpData, lpcbData ? *lpcbData : 0); + popParameterInt32(rhnd,&size, lpcbData); + } + + if ( size > 0 ) + { + DBG_printf( "size : %d\n", size ); +/* flushbuffer( (rhnd->sock) );*/ + } + return result; +} + +STDAPI_( LONG ) CeRegEnumKeyEx(RAPIHandleP rhnd, HKEY hKey, DWORD dwIndex, LPWSTR lpName, LPDWORD lpcbName, LPDWORD lpReserved, LPWSTR lpClass, LPDWORD lpcbClass, PFILETIME lpftLastWriteTime ) +{ + long size = BUFSIZE; + long lng; + WCHAR * str; + int i; + long errcode; + long strsz; + long maxsz; + + DBG_printf( "CeRegEnumKeyEx( hKey = 0x%08X, dwIndex = 0x%08X, lpcbName = 0x%08X, lpReserved = 0x%08X, lpClass = 0x%08X, lpcbClass = 0x%08X, lpftLastWriteTime = 0x%08X )\n", + hKey, dwIndex, lpName, lpcbName ? ( (void*)*lpcbName ) : lpcbName, lpReserved, lpClass, lpcbClass ? ( (void*)*lpcbClass ) : lpcbClass, lpftLastWriteTime ); + + initBuf( (rhnd->buffer), size ); + pushLong( (rhnd->buffer), size, 0x1F ); /* Command */ + pushLong( (rhnd->buffer), size, hKey ); /* Parameter1 : */ + pushLong( (rhnd->buffer), size, dwIndex ); /* Parameter2 : */ + pushLong( (rhnd->buffer), size, 0x01 ); /* Parameter3 : */ + pushLong( (rhnd->buffer), size, 0x0202 ); /* Parameter4 : */ + pushLong( (rhnd->buffer), size, 0x00 ); /* Parameter5 : */ + pushLong( (rhnd->buffer), size, 0x01 ); /* Parameter6 : */ + pushLong( (rhnd->buffer), size, 0x04 ); /* Parameter7 : */ + pushLong( (rhnd->buffer), size, 0x01 ); /* Parameter8 : */ + pushLong( (rhnd->buffer), size, lpcbName ? ( *lpcbName ) : 0 ); /* Parameter9 : */ + pushLong( (rhnd->buffer), size, 0x00 ); /* Parameter10 : */ + pushLong( (rhnd->buffer), size, 0x00 ); /* Parameter11 : */ + pushLong( (rhnd->buffer), size, 0x00 ); /* Parameter12 : */ + pushLong( (rhnd->buffer), size, 0x00 ); /* Parameter13 : */ + DBG_printbuf( (rhnd->buffer) ); + sendbuffer( (rhnd->sock), (rhnd->buffer) ); + + size = getbufferlen( (rhnd->sock) ); + lng = getLong( (rhnd->sock), &size ); + DBG_printf( "long : %ld (0x%08lx)\n", lng, lng ); + (rhnd->_lasterror) = getLong( (rhnd->sock), &size ); + DBG_printf( "long : %ld (0x%08lx)\n", (rhnd->_lasterror), (rhnd->_lasterror) ); + errcode = getLong( (rhnd->sock), &size ); + DBG_printf( "errcode : %ld (0x%08lx)\n", errcode, errcode ); + lng = getLong( (rhnd->sock), &size ); + DBG_printf( "long : %ld (0x%08lx)\n", lng, lng ); + if ( errcode == 0 ) + { + strsz = getLong( (rhnd->sock), &size ); + DBG_printf( "long : %ld (0x%08lx)\n", strsz, strsz ); + maxsz = 0; + if ( lpcbName != NULL ) + { + maxsz = ( *lpcbName ); + ( *lpcbName ) = strsz - 1; + } + lng = getLong( (rhnd->sock), &size ); + DBG_printf( "long : %ld (0x%08lx)\n", lng, lng ); + str = getString( (rhnd->sock), &size, strsz >> 1 ); + DBG_printf( "string1 : %s\n", str ); + if ( ( lpName != NULL ) ) + { + memcpy( lpName, str, MIN( strsz, maxsz ) ); + } + free(str); + for ( i = 0; i < 7; i++ ) + { + lng = getLong( (rhnd->sock), &size ); + DBG_printf( "long %d : %ld (0x%08lx)\n", i, lng, lng ); + } + } + + return errcode; +} + +/* ================================================================================================================= */ +/* ================================================================================================================= */ +/* RAPI - Tests */ +/* ================================================================================================================= */ +/* ================================================================================================================= */ + +#if 0 +DWORD CeTestSec1() +{ + long size=BUFSIZE; + long lng; + int result; + long index; + + initBuf( (rhnd->buffer), size ); + pushLong( (rhnd->buffer), size, 0x27 ); /* Command */ + pushLong( (rhnd->buffer), size, 0x80000002 ); /* Parameter1 : */ + pushLong( (rhnd->buffer), size, 0x01 ); /* Parameter2 : */ + pushLong( (rhnd->buffer), size, 0x20 ); /* Parameter3 : */ + pushString( (rhnd->buffer), size, "Comm\\SecurityProviders\\SCHANNEL" ); /* Parameter4 : the path */ + pushLong( (rhnd->buffer), size, 0x01 ); /* Parameter2 : */ + pushLong( (rhnd->buffer), size, 0x01 ); /* Parameter2 : */ + pushShort( (rhnd->buffer), size, 0x00 ); /* Parameter2 : */ + + DBG_printbuf( (rhnd->buffer) ); + sendbuffer( (rhnd->sock), (rhnd->buffer) ); + result = readbuffer( (rhnd->sock), (rhnd->buffer), size ); + DBG_printbuf( (rhnd->buffer) ); + index = 0; + return 2*lng; +} + +DWORD CeTest0() +{ + long size=BUFSIZE; + long lng; + int result; + long index; + + initBuf( (rhnd->buffer), size ); + pushLong( (rhnd->buffer), size, 0x1E ); /* Command */ + pushLong( (rhnd->buffer), size, 0x80000000 ); /* Parameter1 : */ + pushLong( (rhnd->buffer), size, 0x01 ); /* Parameter2 : */ + pushLong( (rhnd->buffer), size, 0x27 ); /* Parameter3 : */ + pushString( (rhnd->buffer), size, "{000214A0-0000-0000-C000-000000000046}" ); /* Parameter3 : the path */ + + DBG_printbuf( (rhnd->buffer) ); + sendbuffer( (rhnd->sock), (rhnd->buffer) ); + result = readbuffer( (rhnd->sock), (rhnd->buffer), size ); + DBG_printbuf( (rhnd->buffer) ); + index = 0; + return 2*lng; +} +#endif + +/* ================================================================================================================= */ +/* ================================================================================================================= */ +/* RAPI - Files */ +/* ================================================================================================================= */ +/* ================================================================================================================= */ + +STDAPI_( BOOL ) CeFindAllFiles(RAPIHandleP rhnd, LPCWSTR szPath, DWORD dwFlags, LPDWORD lpdwFoundCount, LPLPCE_FIND_DATA ppFindDataArray ) +{ + long size = BUFSIZE; + long lng; + WCHAR * str; + long stlen = 0; + long i; + CE_FIND_DATA *ptr; + + DBG_printf( "CeFindAllFiles : szPath = 0x%08X, dwFlags = 0x%08X, lpdwFoundCount = 0x%08X, ppFindDataArray = 0x%08X\n", szPath, dwFlags, lpdwFoundCount, ppFindDataArray ); + +// checkpassword(); + + initBuf( (rhnd->buffer), size ); + pushLong( (rhnd->buffer), size, 0x09 ); /* Command */ + pushLong( (rhnd->buffer), size, 0x01 ); /* Parameter1 : */ + pushLong( (rhnd->buffer), size, 1 + wcslen( szPath ) ); /* Parameter2 : */ + pushString( (rhnd->buffer), size, szPath ); /* Parameter3 : the path */ + pushLong( (rhnd->buffer), size, dwFlags ); /* Parameter4 : Flags ? */ + DBG_printbuf( (rhnd->buffer) ); + sendbuffer( (rhnd->sock), (rhnd->buffer) ); + + size = getbufferlen( (rhnd->sock) ); + lng = getLong( (rhnd->sock), &size ); + DBG_printf( "long 1 : %ld (0x%08lx)\n", lng, lng ); + lng = getLong( (rhnd->sock), &size ); + DBG_printf( "long 2 (nb answer) : %ld (0x%08lx)\n", lng, lng ); + if ( lpdwFoundCount ) + { + *lpdwFoundCount = lng; + } + if ( ppFindDataArray ) + { + DBG_printf( "Before allocation\n" ); + *ppFindDataArray = ( LPCE_FIND_DATA ) calloc( lng, sizeof( CE_FIND_DATA ) ); + DBG_printf( "After allocation : *ppFindDataArray = %08X\n", *ppFindDataArray ); + if ( ( *ppFindDataArray ) ) + { + for ( i = 0; i < lng; i++ ) + { + ptr = &( ( *ppFindDataArray ) [ i ] ); + DBG_printf( "i=%d : ptr=%08X\n", i, ptr ); + if ( dwFlags & FAF_NAME ) + { + stlen = getLong( (rhnd->sock), &size ); + DBG_printf( "string size : %ld (0x%08lx)\n", stlen, stlen ); + } + if ( dwFlags & FAF_ATTRIBUTES ) + { + ptr->dwFileAttributes = getLong( (rhnd->sock), &size ); + DBG_printf( "ptr->dwFileAttributes : %ld (0x%08lx)\n", ptr->dwFileAttributes, ptr->dwFileAttributes ); + } + if ( dwFlags & FAF_CREATION_TIME ) + { + ptr->ftCreationTime.dwLowDateTime = getLong( (rhnd->sock), &size ); + DBG_printf( "ptr->ftCreationTime.dwLowDateTime : %ld (0x%08lx)\n", ptr->ftCreationTime.dwLowDateTime, ptr->ftCreationTime.dwLowDateTime ); + ptr->ftCreationTime.dwHighDateTime = getLong( (rhnd->sock), &size ); + DBG_printf( "ptr->ftCreationTime.dwHighDateTime : %ld (0x%08lx)\n", ptr->ftCreationTime.dwHighDateTime, ptr->ftCreationTime.dwHighDateTime ); + } + if ( dwFlags & FAF_LASTACCESS_TIME ) + { + ptr->ftLastAccessTime.dwLowDateTime = getLong( (rhnd->sock), &size ); + DBG_printf( "ptr->ftLastAccessTime.dwLowDateTime : %ld (0x%08lx)\n", ptr->ftLastAccessTime.dwLowDateTime, ptr->ftLastAccessTime.dwLowDateTime ); + ptr->ftLastAccessTime.dwHighDateTime = getLong( (rhnd->sock), &size ); + DBG_printf( "ptr->ftLastAccessTime.dwHighDateTime : %ld (0x%08lx)\n", ptr->ftLastAccessTime.dwHighDateTime, ptr->ftLastAccessTime.dwHighDateTime ); + } + if ( dwFlags & FAF_LASTWRITE_TIME ) + { + ptr->ftLastWriteTime.dwLowDateTime = getLong( (rhnd->sock), &size ); + DBG_printf( "ptr->ftLastWriteTime.dwLowDateTime : %ld (0x%08lx)\n", ptr->ftLastWriteTime.dwLowDateTime, ptr->ftLastWriteTime.dwLowDateTime ); + ptr->ftLastWriteTime.dwHighDateTime = getLong( (rhnd->sock), &size ); + DBG_printf( "ptr->ftLastWriteTime.dwHighDateTime : %ld (0x%08lx)\n", ptr->ftLastWriteTime.dwHighDateTime, ptr->ftLastWriteTime.dwHighDateTime ); + } + if ( dwFlags & FAF_SIZE_HIGH ) + { + ptr->nFileSizeHigh = getLong( (rhnd->sock), &size ); + DBG_printf( "ptr->nFileSizeHigh : %ld (0x%08lx)\n", ptr->nFileSizeHigh, ptr->nFileSizeHigh ); + } + if ( dwFlags & FAF_SIZE_LOW ) + { + ptr->nFileSizeLow = getLong( (rhnd->sock), &size ); + DBG_printf( "ptr->nFileSizeLow : %ld (0x%08lx)\n", ptr->nFileSizeLow, ptr->nFileSizeLow ); + } + if ( dwFlags & FAF_OID ) + { + ptr->dwOID = getLong( (rhnd->sock), &size ); + DBG_printf( "ptr->dwOID : %ld (0x%08lx)\n", ptr->dwOID, ptr->dwOID ); + } + if ( dwFlags & FAF_NAME ) + { + str = getString( (rhnd->sock), &size, stlen ); + memcpy( ptr->cFileName, str, MAX_PATH ); + DBG_printf( "ptr->cFileName : %s\n", ptr->cFileName ); + free(str); + } + } + } + } + return TRUE; +} + +STDAPI_( HANDLE ) CeFindFirstFile(RAPIHandleP rhnd, LPCWSTR lpFileName, LPCE_FIND_DATA lpFileFindData ) +{ + long size = BUFSIZE; + long lng; + HANDLE result; + size_t stlen; + /* CEDB_FIND_DATA *ptr; */ + + DBG_printf( "CeFindFirstFile( lpFileName = 0x%08X, lpFileFindData = 0x%08X )\n", + lpFileName, lpFileFindData ); + + initBuf( (rhnd->buffer), size ); + DBG_printf(" line : %d\n", __LINE__ ); + pushLong( (rhnd->buffer), size, 0x00 ); /* Command */ + DBG_printf(" line : %d\n", __LINE__ ); + pushLong( (rhnd->buffer), size, 0x01 ); /* Parameter1 : */ + DBG_printf(" line : %d\n", __LINE__ ); + if ( lpFileName ) + { + stlen = wcslen( lpFileName ); + } + else + { + stlen = -1; + } + DBG_printf( "size : %d\n", stlen ); + pushLong( (rhnd->buffer), size, 1 + stlen ); /* Parameter2 : Flags ? */ + pushString( (rhnd->buffer), size, lpFileName ); /* Parameter3 : the path */ + DBG_printbuf( (rhnd->buffer) ); + sendbuffer( (rhnd->sock), (rhnd->buffer) ); + + size = getbufferlen( (rhnd->sock) ); + + lng = getLong( (rhnd->sock), &size ); + DBG_printf( "long 1 : %ld (0x%08lx)\n", lng, lng ); + (rhnd->_lasterror) = getLong( (rhnd->sock), &size ); + DBG_printf( "long 2 (errorcode?): %ld (0x%08lx)\n", (rhnd->_lasterror), (rhnd->_lasterror) ); + result = ( HANDLE ) getLong( (rhnd->sock), &size ); + DBG_printf( "long 3 : (size=%d) HANDLE %ld (0x%08lx)\n", size, result, result ); + lng = getLong( (rhnd->sock), &size ); + DBG_printf( "long 4 : %ld (0x%08lx)\n", lng, lng ); + if ( lpFileFindData ) + { + lpFileFindData->dwFileAttributes = getLong( (rhnd->sock), &size ); + getbufferchunk( (rhnd->sock), &size, &( lpFileFindData->ftCreationTime ), sizeof( FILETIME ) ); + getbufferchunk( (rhnd->sock), &size, &( lpFileFindData->ftLastAccessTime ), sizeof( FILETIME ) ); + getbufferchunk( (rhnd->sock), &size, &( lpFileFindData->ftLastWriteTime ), sizeof( FILETIME ) ); + lpFileFindData->nFileSizeHigh = getLong( (rhnd->sock), &size ); + lpFileFindData->nFileSizeLow = getLong( (rhnd->sock), &size ); + lpFileFindData->dwOID = getLong( (rhnd->sock), &size ); + memset( &( lpFileFindData->cFileName ), 0, MAX_PATH ); + getbufferchunk( (rhnd->sock), &size, &( lpFileFindData->cFileName ), size ); + } + + DBG_printf( "size : %d\n", size ); + if ( size > 0 ) + { + flushbuffer( (rhnd->sock) ); + } + DBG_printf( "long 5 : %ld (0x%08lx)\n", lpFileFindData->dwFileAttributes, lpFileFindData->dwFileAttributes ); + return result; +} + +STDAPI_( BOOL ) CeFindNextFile(RAPIHandleP rhnd, HANDLE hFindFile, /*LPWIN32_FIND_DATA ?*/LPCE_FIND_DATA lpFileFindData ) +{ + long size = BUFSIZE; + long lng; + int result; + /* CEDB_FIND_DATA *ptr; */ + + DBG_printf( "CeFindNextFile( hFindFile = 0x%08X, lpFileFindData = 0x%08X )\n", + hFindFile, lpFileFindData ); + + initBuf( (rhnd->buffer), size ); + pushLong( (rhnd->buffer), size, 0x01 ); /* Command */ + pushLong( (rhnd->buffer), size, ( long ) hFindFile ); /* Parameter1 : */ + DBG_printbuf( (rhnd->buffer) ); + sendbuffer( (rhnd->sock), (rhnd->buffer) ); + + size = getbufferlen( (rhnd->sock) ); + + lng = getLong( (rhnd->sock), &size ); + DBG_printf( "long 1 : %ld (0x%08lx)\n", lng, lng ); + (rhnd->_lasterror) = getLong( (rhnd->sock), &size ); + DBG_printf( "long 2 (errorcode?): %ld (0x%08lx)\n", (rhnd->_lasterror), (rhnd->_lasterror) ); + lng = getLong( (rhnd->sock), &size ); + DBG_printf( "long 3 (size=%d): %ld (0x%08lx)\n", size, lng, lng ); + lng = getLong( (rhnd->sock), &size ); + DBG_printf( "long 4 : %ld (0x%08lx)\n", lng, lng ); + if ( lpFileFindData ) + { + lpFileFindData->dwFileAttributes = getLong( (rhnd->sock), &size ); + getbufferchunk( (rhnd->sock), &size, &( lpFileFindData->ftCreationTime ), sizeof( FILETIME ) ); + getbufferchunk( (rhnd->sock), &size, &( lpFileFindData->ftLastAccessTime ), sizeof( FILETIME ) ); + getbufferchunk( (rhnd->sock), &size, &( lpFileFindData->ftLastWriteTime ), sizeof( FILETIME ) ); + lpFileFindData->nFileSizeHigh = getLong( (rhnd->sock), &size ); + lpFileFindData->nFileSizeLow = getLong( (rhnd->sock), &size ); + lpFileFindData->dwOID = getLong( (rhnd->sock), &size ); + memset( &( lpFileFindData->cFileName ), 0, MAX_PATH ); + getbufferchunk( (rhnd->sock), &size, &( lpFileFindData->cFileName ), size ); + } + DBG_printf( "size : %d\n", size ); + + if ( size > 0 ) + { + flushbuffer( (rhnd->sock) ); + } + result = ( (rhnd->_lasterror) == 0 ); + return result; +} + +STDAPI_( BOOL ) CeFindClose(RAPIHandleP rhnd, HANDLE hFindFile ) +{ + long size = BUFSIZE; + long lng; + + DBG_printf( "CeFindClose()\n" ); + + initBuf( (rhnd->buffer), size ); + pushLong( (rhnd->buffer), size, 0x02 ); /* Command */ + pushLong( (rhnd->buffer), size, ( long ) hFindFile ); /* Parameter1 : */ + DBG_printbuf( (rhnd->buffer) ); + sendbuffer( (rhnd->sock), (rhnd->buffer) ); + + size = getbufferlen( (rhnd->sock) ); + lng = getLong( (rhnd->sock), &size ); + DBG_printf( "long 1 : %ld (0x%08lx)\n", lng, lng ); + (rhnd->_lasterror) = getLong( (rhnd->sock), &size ); + DBG_printf( "long 2 (lasterror): %ld (0x%08lx)\n", (rhnd->_lasterror), (rhnd->_lasterror) ); + lng = getLong( (rhnd->sock), &size ); + DBG_printf( "long 3 : %ld (0x%08lx)\n", lng, lng ); + + if ( size > 0 ) + { + DBG_printf( "size : %d\n", size ); + flushbuffer( (rhnd->sock) ); + } + + return lng; +} + +STDAPI_( HANDLE ) CeCreateFile(RAPIHandleP rhnd, LPCWSTR lpFileName, DWORD dwDesiredAccess, DWORD dwShareMode, LPSECURITY_ATTRIBUTES lpSecurityAttributes, DWORD dwCreationDisposition, DWORD dwFlagsAndAttributes, HANDLE hTemplateFile ) +{ + long size = BUFSIZE; + long lng; + HANDLE result; + long stlen; + + DBG_printf( "CeCreateFile( lpFileName = 0x%08X, dwDesiredAccess = 0x%08X, dwShareMode = 0x%08X )\n", + lpFileName, dwDesiredAccess, dwShareMode ); + +// checkpassword(); + + initBuf( (rhnd->buffer), size ); + pushLong( (rhnd->buffer), size, 0x05 ); /* Command */ + pushLong( (rhnd->buffer), size, dwDesiredAccess ); /* Parameter1 */ + pushLong( (rhnd->buffer), size, dwShareMode ); /* Parameter2 */ + pushLong( (rhnd->buffer), size, dwCreationDisposition ); /* Parameter3 */ + pushLong( (rhnd->buffer), size, dwFlagsAndAttributes ); /* Parameter4 */ + pushLong( (rhnd->buffer), size, ( long ) hTemplateFile ); /* Parameter5 */ + pushLong( (rhnd->buffer), size, 1 ); /* Parameter6 */ + stlen = wcslen( lpFileName ); + pushLong( (rhnd->buffer), size, 1 + stlen ); /* Parameter7 */ + pushString( (rhnd->buffer), size, lpFileName ); /* Parameter8 */ + DBG_printbuf( (rhnd->buffer) ); + sendbuffer( (rhnd->sock), (rhnd->buffer) ); + + size = getbufferlen( (rhnd->sock) ); + + lng = getLong( (rhnd->sock), &size ); + DBG_printf( "long 1 : %ld (0x%08lx)\n", lng, lng ); + (rhnd->_lasterror) = getLong( (rhnd->sock), &size ); + DBG_printf( "long 2 (errorcode?): %ld (0x%08lx)\n", (rhnd->_lasterror), (rhnd->_lasterror) ); + result = ( HANDLE ) getLong( (rhnd->sock), &size ); + DBG_printf( "long 3 (HANDLE): %ld (0x%08lx)\n", result, result ); + + if ( size > 0 ) + { + flushbuffer( (rhnd->sock) ); + } + + return result; +} + +STDAPI_( BOOL ) CeReadFile(RAPIHandleP rhnd, HANDLE hFile, LPVOID lpBuffer, DWORD nNumberOfBytesToRead, LPDWORD lpNumberOfBytesRead, LPOVERLAPPED lpOverlapped ) +{ + long size = BUFSIZE; + long lng; + BOOL result; + /* CEDB_FIND_DATA *ptr; */ + + DBG_printf( "CeReadFile( hFile = 0x%08X, nNumberOfBytesToRead = 0x%08X )\n", + hFile, nNumberOfBytesToRead ); + + initBuf( (rhnd->buffer), size ); + pushLong( (rhnd->buffer), size, 0x06 ); /* Command */ + pushLong( (rhnd->buffer), size, ( long ) hFile ); /* Parameter1 */ + pushLong( (rhnd->buffer), size, 0x01 ); /* Parameter2 */ + pushLong( (rhnd->buffer), size, nNumberOfBytesToRead ); /* Parameter3 */ + pushLong( (rhnd->buffer), size, 0x00 ); /* Parameter4 */ + DBG_printbuf( (rhnd->buffer) ); + sendbuffer( (rhnd->sock), (rhnd->buffer) ); + + size = getbufferlen( (rhnd->sock) ); + + lng = getLong( (rhnd->sock), &size ); + DBG_printf( "long 1 : %ld (0x%08lx)\n", lng, lng ); + (rhnd->_lasterror) = getLong( (rhnd->sock), &size ); + DBG_printf( "long 2 (errorcode?): %ld (0x%08lx)\n", (rhnd->_lasterror), (rhnd->_lasterror) ); + result = ( BOOL ) getLong( (rhnd->sock), &size ); + DBG_printf( "long 3 (BOOL): %ld (0x%08lx)\n", result, result ); + lng = getLong( (rhnd->sock), &size ); + DBG_printf( "long 4 (size): %ld (0x%08lx)\n", lng, lng ); + + if ( lpNumberOfBytesRead ) + { + *lpNumberOfBytesRead = lng; + } + if ( ( lpBuffer ) && ( lng > 0 ) ) + { + getbufferchunk( (rhnd->sock), &size, lpBuffer, lng ); + } + + if ( size > 0 ) + { + DBG_printf( "Size != 0 : size=%d\n", size ); + flushbuffer( (rhnd->sock) ); + } + + return result; +} + +STDAPI_( BOOL ) CeWriteFile(RAPIHandleP rhnd, HANDLE hFile, LPVOID lpBuffer, + DWORD nNumberOfBytesToWrite, + LPDWORD lpNumberOfBytesWritten, + LPOVERLAPPED lpOverlapped ) +{ + long size = BUFSIZE; + long lng; + BOOL result; + unsigned long buflen; + + + /* CEDB_FIND_DATA *ptr; */ + + DBG_printf( "CeWriteFile( hFile = 0x%08X, nNumberOfBytesToWrite = 0x%08X )\n", + hFile, nNumberOfBytesToWrite ); + + initBuf( (rhnd->buffer), size ); + pushLong( (rhnd->buffer), size, 0x07 ); /* Command */ + pushLong( (rhnd->buffer), size, ( long ) hFile ); /* Parameter1 */ + pushLong( (rhnd->buffer), size, 0x01 ); /* Parameter2 */ + pushLong( (rhnd->buffer), size, nNumberOfBytesToWrite ); /* Parameter3 */ + + buflen=_getbufferlen((rhnd->buffer)); + _setbufferlen( (rhnd->buffer), buflen + nNumberOfBytesToWrite + 4); + + (void) safe_write((rhnd->sock), (void *) (rhnd->buffer), buflen + 4); + + (void) safe_write((rhnd->sock), lpBuffer, nNumberOfBytesToWrite); + lng=0; + (void) safe_write((rhnd->sock), (void *) &lng, sizeof(lng)); /* ??? continue ??? */ + + size = getbufferlen( (rhnd->sock) ); + + lng = getLong( (rhnd->sock), &size ); + DBG_printf( "long 1 : %ld (0x%08lx)\n", lng, lng ); + (rhnd->_lasterror) = getLong( (rhnd->sock), &size ); + DBG_printf( "long 2 (errorcode?): %ld (0x%08lx)\n", (rhnd->_lasterror), (rhnd->_lasterror) ); + + result = ( BOOL ) getLong( (rhnd->sock), &size ); + DBG_printf( "long 3 (BOOL): %ld (0x%08lx)\n", result, result ); + lng = getLong( (rhnd->sock), &size ); + DBG_printf( "long 4 (size): %ld (0x%08lx)\n", lng, lng ); + + if ( lpNumberOfBytesWritten ) + { + *lpNumberOfBytesWritten = lng; + } + if ( size > 0 ) + { + flushbuffer( (rhnd->sock) ); + } + + return result; +} + +/* ================================================================================================================= */ +/* ================================================================================================================= */ +/* RAPI - Databases */ +/* ================================================================================================================= */ +/* ================================================================================================================= */ + + +STDAPI_( BOOL ) CeFindAllDatabases(RAPIHandleP rhnd, DWORD dwDbaseType, WORD wFlags, LPWORD cFindData, LPLPCEDB_FIND_DATA ppFindData ) +{ + long size = BUFSIZE; + long lng; + WCHAR * str; + long stlen = 0; + long i, j; + WORD wrd; + CEDB_FIND_DATA *ptr; + +// checkpassword(); + + DBG_printf( "CeFindAllDatabases( dwDbaseType = 0x%08X, wFlags = 0x%04X, cFindData = 0x%08X, ppFindData = 0x%08X )\n", + dwDbaseType, wFlags, cFindData, ppFindData ); + + initBuf( (rhnd->buffer), size ); + pushLong( (rhnd->buffer), size, 0x2C ); /* Command */ + pushLong( (rhnd->buffer), size, dwDbaseType ); /* Parameter1 : */ + pushShort( (rhnd->buffer), size, wFlags ); /* Parameter2 : Flags ? */ + DBG_printbuf( (rhnd->buffer) ); + sendbuffer( (rhnd->sock), (rhnd->buffer) ); + + size = getbufferlen( (rhnd->sock) ); + lng = getLong( (rhnd->sock), &size ); + DBG_printf( "long 1 (errorcode?): %ld (0x%08lx)\n", lng, lng ); + wrd = getShort( (rhnd->sock), &size ); + DBG_printf( "word 1 : %d (0x%08lx)\n", wrd, wrd ); + if ( cFindData ) + { + *cFindData = wrd; + } + if ( ppFindData && ( wrd > 0 ) ) + { + DBG_printf( "Before allocation\n" ); + *ppFindData = ( LPCEDB_FIND_DATA ) calloc( wrd, sizeof( CEDB_FIND_DATA ) ); + DBG_printf( "After allocation : *ppFindData = %08X\n", *ppFindData ); + if ( ( *ppFindData ) ) + { + for ( i = 0; i < wrd; i++ ) + { + ptr = &( ( *ppFindData ) [ i ] ); + DBG_printf( "i=%d : ptr=%08X\n", i, ptr ); + if ( wFlags & FAD_OID ) + { + ptr->OidDb = getLong( (rhnd->sock), &size ); + DBG_printf( "OidDb : %ld (0x%08lx)\n", ptr->OidDb, ptr->OidDb ); + } + if ( wFlags & FAD_NAME ) + { + stlen = getLong( (rhnd->sock), &size ); + DBG_printf( "string size : %ld (0x%08lx)\n", stlen, stlen ); + } + if ( wFlags & FAD_FLAGS ) + { + ptr->DbInfo.dwFlags = getLong( (rhnd->sock), &size ); + DBG_printf( "dwFlags : %ld (0x%08lx)\n", ptr->DbInfo.dwFlags, ptr->DbInfo.dwFlags ); + } + if ( wFlags & FAD_NAME ) + { + str = getString( (rhnd->sock), &size, stlen ); + memcpy( ptr->DbInfo.szDbaseName, str, sizeof( WCHAR ) * ( CEDB_MAXDBASENAMELEN > ( stlen ) ? CEDB_MAXDBASENAMELEN : ( stlen ) ) ); + DBG_printf( "ptr->DbInfo.szDbaseName : %s\n", ptr->DbInfo.szDbaseName ); + free(str); + } + if ( wFlags & FAD_TYPE ) + { + ptr->DbInfo.dwDbaseType = getLong( (rhnd->sock), &size ); + DBG_printf( "dwDbaseType : %ld (0x%08lx)\n", ptr->DbInfo.dwDbaseType, ptr->DbInfo.dwDbaseType ); + } + if ( wFlags & FAD_NUM_RECORDS ) + { + ptr->DbInfo.wNumRecords = getShort( (rhnd->sock), &size ); + DBG_printf( "wNumRecords : %ld (0x%08lx)\n", ptr->DbInfo.wNumRecords, ptr->DbInfo.wNumRecords ); + } + if ( wFlags & FAD_NUM_SORT_ORDER ) + { + ptr->DbInfo.wNumSortOrder = getShort( (rhnd->sock), &size ); + DBG_printf( "wNumSortOrder : %ld (0x%08lx)\n", ptr->DbInfo.wNumSortOrder, ptr->DbInfo.wNumSortOrder ); + } + if ( wFlags & FAD_SIZE ) + { + ptr->DbInfo.dwSize = getLong( (rhnd->sock), &size ); + DBG_printf( "dwSize : %ld (0x%08lx)\n", ptr->DbInfo.dwSize, ptr->DbInfo.dwSize ); + } + if ( wFlags & FAD_LAST_MODIFIED ) + { + getFileTime( (rhnd->sock), &size, &( ptr->DbInfo.ftLastModified ) ); + DBG_printf( "ftLastModified : %ld (0x%08lx)\n", ptr->DbInfo.ftLastModified, ptr->DbInfo.ftLastModified ); + } + if ( wFlags & FAD_SORT_SPECS ) + { + for ( j = 0; j < CEDB_MAXSORTORDER; j++ ) + { + getbufferchunk( (rhnd->sock), &size, &( ( ptr->DbInfo.rgSortSpecs ) [ j ] ), sizeof( SORTORDERSPEC ) ); + DBG_printf( "sortOrder[%d] : %ld (0x%08lx)\n", j, ( ptr->DbInfo.rgSortSpecs ) [ j ].propid, ( ptr->DbInfo.rgSortSpecs ) [ j ].propid ); + DBG_printf( "sortOrder[%d] : %ld (0x%08lx)\n", j, ( ptr->DbInfo.rgSortSpecs ) [ j ].dwFlags, ( ptr->DbInfo.rgSortSpecs ) [ j ].dwFlags ); + } + } + } + } + } + return TRUE; +} + +STDAPI_( HANDLE ) CeOpenDatabase(RAPIHandleP rhnd, PCEOID poid, LPWSTR lpszName, CEPROPID propid, DWORD dwFlags, HWND hwndNotify ) +{ + long size = BUFSIZE; + long lng; + HANDLE result; + + DBG_printf( "CeOpenDatabase( poid = 0x%08X, lpszName = 0x%08X, propid = 0x%08X, dwFlags = 0x%08X, hwndNotify = 0x%08X )\n", + poid ? ( (void*)*poid ) : NULL, lpszName, propid, dwFlags, hwndNotify ); + + initBuf( (rhnd->buffer), size ); + pushLong( (rhnd->buffer), size, 0x0E ); /* Command */ + pushLong( (rhnd->buffer), size, poid ? ( ( long ) ( *poid ) ) : ( ( long ) NULL ) ); /* Parameter1 : */ + pushLong( (rhnd->buffer), size, propid ); /* Parameter2 : */ + pushLong( (rhnd->buffer), size, dwFlags ); /* Parameter3 : */ + DBG_printbuf( (rhnd->buffer) ); + sendbuffer( (rhnd->sock), (rhnd->buffer) ); + + size = getbufferlen( (rhnd->sock) ); + lng = getLong( (rhnd->sock), &size ); + DBG_printf( "long 1 (errorcode?): %ld (0x%08lx)\n", lng, lng ); + lng = getLong( (rhnd->sock), &size ); + DBG_printf( "long 2 (errorcode?): %ld (0x%08lx)\n", lng, lng ); + (rhnd->_lasterror) = lng; + result = ( HANDLE ) getLong( (rhnd->sock), &size ); + DBG_printf( "long 3 (errorcode?): %ld (0x%08lx)\n", result, result ); + + return result; +} + +STDAPI_( CEOID ) CeReadRecordProps(RAPIHandleP rhnd, HANDLE hDbase, DWORD dwFlags, LPWORD lpcPropID, CEPROPID* rgPropID, LPBYTE* lplpBuffer, LPDWORD lpcbBuffer ) +{ + long size = BUFSIZE; + long lng; + long index; + long i; + WORD wrd; + CEPROPVAL *ptr; + LPBYTE ptrbyte; + CEOID result; + + DBG_printf( "CeReadRecordProps( hDbase = 0x%08X, dwFlags = 0x%08X, lpcPropID = 0x%08X, rgPropID = 0x%08X, lplpBuffer = 0x%08X, lpcbBuffer = 0x%08X )\n", + hDbase, dwFlags, lpcPropID, rgPropID, lplpBuffer, lpcbBuffer ); + + initBuf( (rhnd->buffer), size ); + pushLong( (rhnd->buffer), size, 0x10 ); /* Command */ + pushLong( (rhnd->buffer), size, ( long ) hDbase ); /* Parameter1 : */ + pushLong( (rhnd->buffer), size, dwFlags ); /* Parameter2 : Flags ? */ + pushLong( (rhnd->buffer), size, 0 ); /* Parameter3 */ + pushLong( (rhnd->buffer), size, 0 ); /* Parameter4 */ + pushShort( (rhnd->buffer), size, 0 ); /* Parameter5 */ + DBG_printbuf( (rhnd->buffer) ); + sendbuffer( (rhnd->sock), (rhnd->buffer) ); + + size = getbufferlen( (rhnd->sock) ); + lng = getLong( (rhnd->sock), &size ); + DBG_printf( "long 1 (errorcode?): %ld (0x%08lx)\n", lng, lng ); + (rhnd->_lasterror) = getLong( (rhnd->sock), &size ); + DBG_printf( "long 2: lasterror %ld (0x%08lx)\n", (rhnd->_lasterror), (rhnd->_lasterror) ); + result = getLong( (rhnd->sock), &size ); + DBG_printf( "long 3: CEOID %ld (0x%08lx)\n", result, result ); + lng = getLong( (rhnd->sock), &size ); + DBG_printf( "long 4: (taille buffer) %ld (0x%08lx)\n", lng, lng ); + if ( lpcbBuffer && ( ( *lpcbBuffer ) == 0 ) ) + { + *lpcbBuffer = lng; + } + wrd = getShort( (rhnd->sock), &size ); + DBG_printf( "word 1: (nbprops) %ld (0x%08lx)\n", wrd, wrd ); + if ( !rgPropID ) + { + if ( lpcPropID ) + { + *lpcPropID = wrd; + } + } + + /* if( cFindData ) + { + *cFindData = wrd; + }*/ + if ( lplpBuffer && ( wrd > 0 ) ) + { + if ( *lplpBuffer == NULL ) + { + DBG_printf( "Before allocation\n" ); + *lplpBuffer = ( LPBYTE ) calloc( 1, lng ); + DBG_printf( "After allocation : *ppFindData = %08X\n", *lplpBuffer ); + } + ptr = ( CEPROPVAL * ) ( *lplpBuffer ); + for ( i = 0; i < wrd; i++ ) + { + DBG_printf( "i=%d : ptr=%08X\n", i, ptr ); + getbufferchunk( (rhnd->sock), &size, &( ptr[ i ] ), sizeof( CEPROPVAL ) ); + DBG_printf( "propval: propid %ld (0x%08lx) \n", ptr[ i ].propid, ptr[ i ].propid ); + DBG_printf( "propval: wLenData %d (0x%04x) \n", ptr[ i ].wLenData, ptr[ i ].wLenData ); + DBG_printf( "propval: wFlags %d (0x%04x) \n", ptr[ i ].wFlags, ptr[ i ].wFlags ); + switch ( ( ptr[ i ].propid ) & 0xFFFF ) + { + case CEVT_BLOB: + ptr[ i ].val.blob.lpb = ( LPBYTE ) ( ( DWORD ) ptr + ( DWORD ) ptr[ i ].val.blob.lpb ); + DBG_printf( "propval: BLOB (size : %d, ptr %-8X)\n", ptr[ i ].val.blob.dwCount, ptr[ i ].val.blob.lpb ); + break; + case CEVT_LPWSTR: + ptr[ i ].val.lpwstr = ( LPWSTR ) ( ( DWORD ) ptr + ( DWORD ) ptr[ i ].val.lpwstr ); + DBG_printf( "propval: LPWSTR %ld (0x%08lx) \n", ptr[ i ].val.lpwstr, ptr[ i ].val.lpwstr ); + break; + case CEVT_I2: + DBG_printf( "propval: I2 %d (0x%04x) \n", ptr[ i ].val.iVal, ptr[ i ].val.iVal ); + break; + case CEVT_UI2: + DBG_printf( "propval: UI2 %d (0x%04x) \n", ptr[ i ].val.uiVal, ptr[ i ].val.uiVal ); + break; + case CEVT_I4: + DBG_printf( "propval: I4 %ld (0x%08lx) \n", ptr[ i ].val.lVal, ptr[ i ].val.lVal ); + break; + case CEVT_UI4: + DBG_printf( "propval: UI4 %ld (0x%08lx) \n", ptr[ i ].val.ulVal, ptr[ i ].val.ulVal ); + break; + case CEVT_BOOL: + DBG_printf( "propval: BOOL %s\n", ptr[ i ].val.boolVal ? "true" : "false" ); + break; + case CEVT_FILETIME: + DBG_printf( "propval: FILETIME 0x%-8x\n", ptr[ i ].val.filetime ); + break; + case CEVT_R8: + DBG_printf( "propval: R8 %d ", ptr[ i ].val.dblVal ); + break; + default: + break; + } + /* DBG_printf( "propval: sz:%d %ld (0x%08lx) \n", sizeof(CEVALUNION), valunion, valunion ); */ + } + + ptrbyte = ( LPBYTE ) & ( ptr[ wrd ] ); + index = ( long ) ( lng - ( ptrbyte - ( *lplpBuffer ) ) ); + DBG_printf( " getchunk : index = %d, size = %d\n", index, size ); + getbufferchunk( (rhnd->sock), &size, ptrbyte, ( ( long ) ptrbyte > index ) ? index : ( long ) ptrbyte ); + } + return result; +} + +STDAPI_(CEOID) CeWriteRecordProps(RAPIHandleP rhnd, HANDLE hDbase, CEOID oidRecord, WORD cPropID, CEPROPVAL* rgPropVal) +{ + long size = BUFSIZE; + long lng; + long datalen, buflen; + long i; + CEOID result; + + DBG_printf( "CeWriteRecordProps( hDbase = 0x%08X, oidRecord = 0x%08X, cPropID = 0x%08X, rgPropVal = 0x%08X )\n", + hDbase, oidRecord, cPropID, rgPropVal ); + + /* + * Format of the CeWriteRecordProps packet - primitives are encoded in the CEPROPVAL structures, lpwstr and blob properties are + * attached to the end of the buffer and referenced by offset pointers + * + * long hDBase | long oidRecord | long cPropID | long datalen (of following data) | n * CEPROPVAL | char[] data + * + * Because CEPROPVAL is a union, the format is different for every type of prop: + * + * long or short (iVal, uiVal, lVal, ulVal, boolVal): long propid | short wFlags | short wLenData (unused, set to 0) | short iVal or boolVal | short uiVal | long lVal or ulVal + * + * FILETIME or double: long propid | short wFlags | short wLenData (unused) | DWORD FILETIME or double + * + * lpwstr: long propid | short wFlags | short wLenData (unused) | long offset ( points to string data in data buffer, counted from beginning of CEPROPVALs) + * + * blob: long propid | short wFlags | short wLenData (unused) | long blobsize | long offset (same as lpwstr) + */ + + + initBuf( (rhnd->buffer), size ); + pushLong( (rhnd->buffer), size, 0x11 ); /* Command */ + pushLong( (rhnd->buffer), size, ( long ) hDbase ); /* Parameter1 : */ + pushLong( (rhnd->buffer), size, oidRecord ); /* Parameter2 : Flags ? */ + pushShort( (rhnd->buffer), size, cPropID ); /* Parameter3 */ + + +/* + * we have to go through the rgPropVals array three times: + * 1. to determine the size of the whole buffer, including data + * 2. to write out the CEPROPVAL array + * 3. to write the data segment + */ + + /* calculate the length of the whole buffer, including the data segment at the end */ + + buflen = cPropID * sizeof( CEPROPVAL ); /* length of all cepropvals */ + + for ( i = 0; i < cPropID; i++ ) + { + switch ( ( rgPropVal[i].propid ) & 0xFFFF ) + { + case CEVT_BLOB: + buflen += rgPropVal[i].val.blob.dwCount; + break; + case CEVT_LPWSTR: + buflen += 2* ( wcslen( rgPropVal[i].val.lpwstr ) + 1 ); + break; + default: + break; + } + } + + pushLong( (rhnd->buffer), size, buflen); + + /* + second time: write n * CEPROPVAL. Can't do it in one block, as we have to adjust the buffer offsets + */ + + datalen = cPropID * sizeof( CEPROPVAL ); /* holds the offset to the end of the data buffer */ + + for ( i = 0; i < cPropID; i++ ) + { + pushLong( (rhnd->buffer), size, rgPropVal[i].propid ); + pushShort( (rhnd->buffer), size, rgPropVal[i].wLenData ); + pushShort( (rhnd->buffer), size, rgPropVal[i].wFlags ); + + switch ( ( rgPropVal[i].propid ) & 0xFFFF ) + { + case CEVT_BLOB: + pushLong( (rhnd->buffer), size, rgPropVal[i].val.blob.dwCount ); + datalen += rgPropVal[i].val.blob.dwCount; + pushLong( (rhnd->buffer), size, datalen ); + break; + case CEVT_LPWSTR: + datalen += 2* ( wcslen( rgPropVal[i].val.lpwstr ) + 1 ); + pushLong( (rhnd->buffer), size, datalen ); + pushLong( (rhnd->buffer), size, 0 ); + break; + case CEVT_I2: + case CEVT_UI2: + case CEVT_I4: + case CEVT_UI4: + pushShort( (rhnd->buffer), size, rgPropVal[i].val.iVal ); + pushShort( (rhnd->buffer), size, rgPropVal[i].val.uiVal ); + pushLong( (rhnd->buffer), size, rgPropVal[i].val.lVal ); + break; + case CEVT_BOOL: + pushShort( (rhnd->buffer), size, rgPropVal[i].val.boolVal ); + pushShort( (rhnd->buffer), size, 0 ); + pushLong( (rhnd->buffer), size, 0 ); + break; + case CEVT_FILETIME: + /* this assumes that the FILETIME is already in ole32 format! Is this a problem? */ + pushLong( (rhnd->buffer), size, rgPropVal[i].val.filetime.dwLowDateTime ); + pushLong( (rhnd->buffer), size, rgPropVal[i].val.filetime.dwHighDateTime ); + break; + case CEVT_R8: + pushParameter(rhnd, size, &(rgPropVal[i].val.dblVal), 4, 1 ); + break; + default: + break; + } + } + + /* 3. write the data segment */ + + for ( i = 0; i < cPropID; i++ ) + { + switch ( ( rgPropVal[i].propid ) & 0xFFFF ) + { + case CEVT_BLOB: + pushParameter_no_size(rhnd, size, rgPropVal[i].val.blob.lpb, rgPropVal[i].val.blob.dwCount ); + break; + case CEVT_LPWSTR: + pushParameter_no_size(rhnd, size, rgPropVal[i].val.lpwstr, 2* ( wcslen( rgPropVal[i].val.lpwstr ) + 1) ); + break; + default: + break; + } + } + + DBG_printbuf( (rhnd->buffer) ); + sendbuffer( (rhnd->sock), (rhnd->buffer) ); + + size = getbufferlen( (rhnd->sock) ); + + lng = getLong( (rhnd->sock), &size ); + DBG_printf( "long 1 : %ld (0x%08lx)\n", lng, lng ); + (rhnd->_lasterror) = getLong( (rhnd->sock), &size ); + DBG_printf( "long 2 (errorcode?): %ld (0x%08lx)\n", (rhnd->_lasterror), (rhnd->_lasterror) ); + result = ( HANDLE ) getLong( (rhnd->sock), &size ); + DBG_printf( "long 3 (HANDLE): %ld (0x%08lx)\n", result, result ); + + if ( size > 0 ) + { + flushbuffer( (rhnd->sock) ); + } + + return result; +} + + +/* ================================================================================================================= */ +/* ================================================================================================================= */ +/* RAPI - Processes */ +/* ================================================================================================================= */ +/* ================================================================================================================= */ + +STDAPI_( BOOL ) CeCreateProcess(RAPIHandleP rhnd, LPCWSTR lpApplicationName, + LPCWSTR lpCommandLine, + LPSECURITY_ATTRIBUTES lpProcessAttributes, + LPSECURITY_ATTRIBUTES lpThreadAttributes, + BOOL bInheritHandles, + DWORD dwCreationFlags, + LPVOID lpEnvironment, + LPWSTR lpCurrentDirectory, + LPSTARTUPINFO lpStartupInfo, + LPPROCESS_INFORMATION lpProcessInformation ) +{ + long size = BUFSIZE; + long lng; + long stlen; + BOOL result = FALSE; + + DBG_printf( "CeCreateProcess( lpApplication = 0x%08X, lpCommandLine = 0x%08X )\n", + lpApplicationName, lpCommandLine ); + + initBuf( (rhnd->buffer), size ); + pushLong( (rhnd->buffer), size, 0x19 ); /* Command */ + if(lpApplicationName!=NULL) + { + pushLong( (rhnd->buffer), size, 0x01 ); + stlen = wcslen( lpApplicationName ); + pushLong( (rhnd->buffer), size, (stlen+1)*2 ); + pushLong( (rhnd->buffer), size, 0x01 ); + pushString( (rhnd->buffer), size, lpApplicationName ); + } + else + { + pushLong( (rhnd->buffer), size, 0x00 ); + } + if(lpCommandLine!=NULL) + { + pushLong( (rhnd->buffer), size, 0x01 ); + stlen = wcslen( lpCommandLine ); + pushLong( (rhnd->buffer), size, (stlen+1)*2 ); + pushLong( (rhnd->buffer), size, 0x01 ); + pushString( (rhnd->buffer), size, lpCommandLine ); + } + else + { + pushLong( (rhnd->buffer), size, 0x00 ); + } + + pushLong( (rhnd->buffer), size, 0x00 ); /* Parameter3 : lpProcessAttibutes ? */ + pushLong( (rhnd->buffer), size, 0x00 ); /* Parameter4 : lpThreadAttributes ? */ + pushLong( (rhnd->buffer), size, 0x00 ); /* Parameter5 : bInheritHandles ? */ + pushLong( (rhnd->buffer), size, dwCreationFlags ); + pushLong( (rhnd->buffer), size, 0x00 ); /* Parameter7 : lpEnvironment ? */ + pushLong( (rhnd->buffer), size, 0x00 ); /* Parameter8 : lpCurrentDirectory ? */ + pushLong( (rhnd->buffer), size, 0x00 ); /* Parameter9 : lpStartupInfo ? */ + pushLong( (rhnd->buffer), size, 0x00 ); /* Parametera : lpProcessInformation ? */ + + DBG_printbuf( (rhnd->buffer) ); + + sendbuffer( (rhnd->sock), (rhnd->buffer) ); + + size = getbufferlen( (rhnd->sock) ); + lng = getLong( (rhnd->sock), &size ); + DBG_printf( "long 1 (errorcode?): %ld (0x%08lx)\n", lng, lng ); + (rhnd->_lasterror) = getLong( (rhnd->sock), &size ); + DBG_printf( "long 2: lasterror %ld (0x%08lx)\n", (rhnd->_lasterror), (rhnd->_lasterror) ); + + result = getLong( (rhnd->sock), &size ); + DBG_printf( "long 3: %ld (0x%08lx)\n", result, result ); + if(result) + { + lng = getLong( (rhnd->sock), &size ); + DBG_printf( "long 4: %ld (0x%08lx)\n", lng, lng ); + lng = getLong( (rhnd->sock), &size ); + DBG_printf( "long 5: %ld (0x%08lx)\n", lng, lng ); + lng = getLong( (rhnd->sock), &size ); + DBG_printf( "long 6: %ld (0x%08lx)\n", lng, lng ); + lng = getLong( (rhnd->sock), &size ); + DBG_printf( "long 7: %ld (0x%08lx)\n", lng, lng ); + lng = getLong( (rhnd->sock), &size ); + DBG_printf( "long 8: %ld (0x%08lx)\n", lng, lng ); + lng = getLong( (rhnd->sock), &size ); + DBG_printf( "long 9: %ld (0x%08lx)\n", lng, lng ); + lng = getLong( (rhnd->sock), &size ); + DBG_printf( "long a: %ld (0x%08lx)\n", lng, lng ); + } + else + { + lng = getLong( (rhnd->sock), &size ); + DBG_printf( "long 4: %ld (0x%08lx)\n", lng, lng ); + } + + if ( size > 0 ) + { + flushbuffer( (rhnd->sock) ); + } + + return result; +} + +/* ================================================================================================================= */ +/* ================================================================================================================= */ +/* RAPI - General */ +/* ================================================================================================================= */ +/* ================================================================================================================= */ + +STDAPI_( BOOL ) CeCloseHandle(RAPIHandleP rhnd, HANDLE hObject ) +{ + long size = BUFSIZE; + long lng; + + DBG_printf( "CeCloseHandle()\n" ); + + initBuf( (rhnd->buffer), size ); + pushLong( (rhnd->buffer), size, 0x08 ); /* Command */ + pushLong( (rhnd->buffer), size, ( long ) hObject ); /* Parameter1 : */ + DBG_printbuf( (rhnd->buffer) ); + sendbuffer( (rhnd->sock), (rhnd->buffer) ); + + size = getbufferlen( (rhnd->sock) ); + lng = getLong( (rhnd->sock), &size ); + DBG_printf( "long 1 : %ld (0x%08lx)\n", lng, lng ); + (rhnd->_lasterror) = getLong( (rhnd->sock), &size ); + DBG_printf( "long 2 (lasterror): %ld (0x%08lx)\n", (rhnd->_lasterror), (rhnd->_lasterror) ); + lng = getLong( (rhnd->sock), &size ); + DBG_printf( "long 3 : %ld (0x%08lx)\n", lng, lng ); + + return lng; +} + +STDAPI_( DWORD ) CeGetLastError(RAPIHandleP rhnd) +{ + return (rhnd->_lasterror); +} + +/* ================================================================================================================= */ +/* ================================================================================================================= */ +/* RAPI - Library */ +/* ================================================================================================================= */ +/* ================================================================================================================= */ + +void findquotes( char * *ptrstart, char * *ptrstop ) +{ + /* Go to the first double quote */ + /* ---------------------------- */ + while( ( *(*ptrstart) != 0 ) && ( *(*ptrstart) != '"' ) ) + { + (*ptrstart) ++; + } + if( *(*ptrstart) != 0 ) + { + (*ptrstart) ++; + *ptrstop = *ptrstart; + /* Reach the next double quote */ + /* --------------------------- */ + while( ( *(*ptrstop) != 0 ) && ( *(*ptrstop) != '"' ) ) + { + (*ptrstop) ++; + } + } +} + +int parseinfofile( RAPIHandleP rhnd ); + +int parseinfofile( RAPIHandleP rhnd ) +{ + BOOL result = FALSE; + struct stat st; + int res; + FILE * f; + char line[ 1024 ]; + char * ptrstart; + char * ptrstop; + BOOL devicefound; + int i; + + devicefound = FALSE; + + DBG_printf( "Before stat...\n" ); + res = stat( INFOFILE, &st ); + DBG_printf( "stat(), result = %d...\n", res ); + if ( res != -1 ) + { + f = fopen( INFOFILE, "r" ); + DBG_printf( "fopen(), result = 0x%08X...\n", f ); + if ( f ) + { + while ( ( !feof( f ) ) && ( result == FALSE ) ) + { + line[ 0 ] = '\0'; + if ( fgets( line, 1024, f ) != NULL ) + { + DBG_printf( "fscanf(), line = '%s'...\n", line ); + if ( line[ 0 ] != '#' ) + { + /* Beginning of block : device { */ + /* ---------------------------------- */ + if( ((rhnd->hostname)==NULL) && ( ( ptrstart = strstr( line, "device" ) ) != NULL ) ) + { + devicefound = TRUE; + ptrstart += 7; + for ( ptrstop = ptrstart; ( ( *ptrstop ) != 0 ) && ( ( *ptrstop ) != '{' ); ptrstop++ ); + ( *ptrstop ) = 0; + (rhnd->hostname) = strdup( ptrstart ); + DBG_printf( "strdup(), hostname = '%s'...\n", (rhnd->hostname) ); + } + + if( devicefound ) + { + + /* End of block : } */ + /* ---------------- */ + if( strstr( line, "}" ) != NULL ) + { + + devicefound = FALSE; + result = TRUE; + + } else { + + /* let's check for the passphrase */ + /* ------------------------------ */ + if( ( ((rhnd->lockbuffersize)!=0) || ((rhnd->lockbuffer)==NULL)) && ( ( ptrstart = strstr( line, "passphrase" ) ) != NULL ) ) + { + DBG_printf( "found string passphrase = %s\n", line ); + findquotes( &ptrstart, &ptrstop ); + + if( (*ptrstart) != 0 ) + { + (*ptrstop) = '\0'; + if( NULL != strstr( line, "size" ) ) + { + DBG_printf( "found string passphrase-size = %s\n", ptrstart ); + if( 1 == sscanf( ptrstart, "%d", &(rhnd->lockbuffersize) ) ) + { + DBG_printf( "found passphrase-size = %d\n", (rhnd->lockbuffersize) ); + (rhnd->lockbuffer) = (unsigned char *) malloc( 1+ (rhnd->lockbuffersize) ); + } + } else { + for( i=0; i<(rhnd->lockbuffersize); i++ ) + { + sscanf( ptrstart + (3*i), "%02X", (unsigned int *)&((rhnd->lockbuffer)[i]) ); + DBG_printf("%02X ", (rhnd->lockbuffer)[i] ); + } + DBG_printf( "\nfound passphrase-data = %s\n", ptrstart ); + } + } + } + } + } + } + } + } + fclose( f ); + } + } + return result; +} + +STDAPI_( HRESULT ) CeRapiInit(RAPIHandleP rhnd) +{ + if ( (rhnd->sock) == 0 ) + { + parseinfofile(rhnd); + if ( (rhnd->hostname) ) + { + DBG_printf( "CeRapiInit(%s)\n", (rhnd->hostname) ); + (rhnd->sock) = SockOpen( (rhnd->hostname), 990 ); + if ( (rhnd->sock) > 0 ) + { + DBG_printf( "CeRapiInit(%s) ok\n", (rhnd->hostname) ); + free( (rhnd->hostname) ); + (rhnd->buffer) = (rapibuffer *)malloc( 4 + BUFSIZE ); + + checkpassword(rhnd); + + return E_SUCCESS; + } + else + { + DBG_printf( "CeRapiInit(%s) Nok\n", (rhnd->hostname) ); + free( (rhnd->hostname) ); + return E_FAIL; + } + free( (rhnd->hostname) ); + } + else + { + DBG_printf( "No CE Device found !?!\n" ); + return E_FAIL; + } + } + else + { + DBG_printf( "CeRapiInit() already done\n" ); + return CERAPI_E_ALREADYINITIALIZED; + } +} +/* STDAPI CeRapiInitEx (RAPIINIT*); */ + +STDAPI_( HRESULT ) CeRapiUninit(RAPIHandleP rhnd) +{ + HRESULT result = FALSE; + if( (rhnd->buffer) ) + { + free( (rhnd->buffer) ); + (rhnd->buffer) = NULL; + } + if ( (rhnd->sock) > 0 ) + { + result = (close( (rhnd->sock) )==0) ? TRUE : FALSE; + DBG_printf( "CeRapiUninit() %s\n", (result ? "ok" : "failed") ); + + /* the following is needed to make subsequent init/uninit calls to RAPI + * (e.g. device disconnect/reconnect) */ + + if (result) { + (rhnd->sock) = 0; + (rhnd->hostname) = NULL; + } + + } + else + { + DBG_printf( "CeRapiUninit() no need\n" ); + } + return result; +} + +STDAPI_( HRESULT ) CeRapiFreeBuffer(RAPIHandleP rhnd, LPVOID Buffer ) +{ + if ( Buffer ) + { + free( Buffer ); + } + return ( HRESULT ) NULL; +} + +STDAPI_(BOOL) CeGetVersionEx(RAPIHandleP rhnd,LPCEOSVERSIONINFO lpVersion) +{ + BOOL result = FALSE; + long size = BUFSIZE; + LONG lng; + +// checkpassword(); + + initBuf((rhnd->buffer), size); + + pushLong((rhnd->buffer), size, 0x3B); /* Command */ + pushParameter(rhnd,size, lpVersion, lpVersion->dwOSVersionInfoSize, 0); + + sendbuffer( (rhnd->sock), (rhnd->buffer) ); + size = getbufferlen( (rhnd->sock) ); + + /* + * The return package looks like this + * + * Offset Size Value + * 00 4 0 + * 04 4 0 + * 08 4 1 + * 0c 4 n = real size of buffer + * 10 n first n bytes of struct + */ + + lng = getLong((rhnd->sock), &size); + (rhnd->_lasterror) = getLong((rhnd->sock), &size); + + if (0 == lng) + { + result = getLong((rhnd->sock), &size); + if (1 == result) + { + long real_length = getLong((rhnd->sock), &size); + getbufferchunk((rhnd->sock), &size, lpVersion, real_length); + } + } + else + { + DBG_printf("Warning: expected 0 but got %i=0x%x\n", lng, lng); + } + + if ( size > 0 ) + { + DBG_printf( "size : %d\n", size ); + flushbuffer( (rhnd->sock) ); + } + + return result; +} + +STDAPI_(BOOL) CeCreateDirectory(RAPIHandleP rhnd,LPCWSTR lpDirName, LPSECURITY_ATTRIBUTES lpSecAttr) +{ + BOOL result = FALSE; + long size = BUFSIZE; + LONG lng; + + initBuf((rhnd->buffer), size); + + pushLong((rhnd->buffer), size, 0x17); /* Command */ + pushParameter(rhnd,size, (void*)lpDirName, (wcslen(lpDirName) + 1) * sizeof(WCHAR), 1); + pushLong((rhnd->buffer), size, 0); /* lpSecAttr not used */ + + /*DBG_printbuf( (rhnd->buffer) );*/ + sendbuffer( (rhnd->sock), (rhnd->buffer) ); + size = getbufferlen( (rhnd->sock) ); + + /* + * The return package looks like this + * + * Offset Size Value + * 00 4 0 + * 04 4 error code if the value below is 0 + * 08 4 0/1 + */ + + lng = getLong((rhnd->sock), &size); + (rhnd->_lasterror) = getLong((rhnd->sock), &size); + + if (0 == lng) + { + result = getLong((rhnd->sock), &size); + } + else + { + DBG_printf("Warning: expected 0 but got %i=0x%x\n", lng, lng); + } + + if ( size > 0 ) + { + DBG_printf( "size : %d\n", size ); + flushbuffer( (rhnd->sock) ); + } + + return result; +} + +STDAPI_(BOOL) CeRemoveDirectory(RAPIHandleP rhnd,LPCWSTR lpPathName) +{ + BOOL result = FALSE; + long size = BUFSIZE; + LONG lng; + + initBuf((rhnd->buffer), size); + + pushLong((rhnd->buffer), size, 0x18); /* Command */ + pushParameter(rhnd,size, (void*)lpPathName, (wcslen(lpPathName) + 1) * sizeof(WCHAR), 1); + + /*DBG_printbuf( (rhnd->buffer) );*/ + sendbuffer( (rhnd->sock), (rhnd->buffer) ); + size = getbufferlen( (rhnd->sock) ); + + /* + * The return package looks like this + * + * Offset Size Value + * 00 4 0 + * 04 4 error code if the value below is 0 + * 08 4 0/1 + */ + + lng = getLong((rhnd->sock), &size); + (rhnd->_lasterror) = getLong((rhnd->sock), &size); + + if (0 == lng) + { + result = getLong((rhnd->sock), &size); + } + else + { + DBG_printf("Warning: expected 0 but got %i=0x%x\n", lng, lng); + } + + if ( size > 0 ) + { + DBG_printf( "size : %d\n", size ); + flushbuffer( (rhnd->sock) ); + } + + return result; +} + +STDAPI_(BOOL) CeDeleteFile(RAPIHandleP rhnd,LPCWSTR lpFileName) +{ + BOOL result = FALSE; + long size = BUFSIZE; + LONG lng; + + initBuf((rhnd->buffer), size); + + pushLong((rhnd->buffer), size, 0x1c); /* Command */ + pushParameter(rhnd,size, (void*)lpFileName, (wcslen(lpFileName) + 1) * sizeof(WCHAR), 1); + + /*DBG_printbuf( (rhnd->buffer) );*/ + sendbuffer( (rhnd->sock), (rhnd->buffer) ); + size = getbufferlen( (rhnd->sock) ); + + /* + * The return package looks like this + * + * Offset Size Value + * 00 4 0 + * 04 4 error code if the value below is 0 + * 08 4 0/1 + */ + + lng = getLong((rhnd->sock), &size); + DBG_printf("long 1 : %ld (0x%08lx)\n", lng, lng); + (rhnd->_lasterror) = getLong((rhnd->sock), &size); + DBG_printf("long 2 : %ld (0x%08lx)\n", (rhnd->_lasterror), (rhnd->_lasterror)); + + if (0 == lng) + { + result = getLong((rhnd->sock), &size); + DBG_printf("long 3 : %ld (0x%08lx)\n", result, result); + } + else + { + DBG_printf("Warning: expected 0 but got %i=0x%x\n", lng, lng); + } + + if ( size > 0 ) + { + DBG_printf( "size : %d\n", size ); + flushbuffer( (rhnd->sock) ); + } + + return result; +} + +STDAPI_( BOOL ) CeMoveFile(RAPIHandleP rhnd, LPCWSTR lpExistingFileName, LPCWSTR lpNewFileName ) +{ + BOOL result = FALSE; + long size = BUFSIZE; + LONG lng; + + initBuf((rhnd->buffer), size); + + pushLong((rhnd->buffer), size, 0x1a); /* Command */ + pushParameter(rhnd,size, (void*)lpExistingFileName, (wcslen(lpExistingFileName) + 1) * sizeof(WCHAR), 1); + pushParameter(rhnd,size, (void*)lpNewFileName, (wcslen(lpNewFileName) + 1) * sizeof(WCHAR), 1); + + /*DBG_printbuf( (rhnd->buffer) );*/ + sendbuffer( (rhnd->sock), (rhnd->buffer) ); + size = getbufferlen( (rhnd->sock) ); + + /* + * The return package looks like this + * + * Offset Size Value + * 00 4 0 + * 04 4 error code if the value below is 0 + * 08 4 0/1 + */ + + lng = getLong((rhnd->sock), &size); + DBG_printf("long 1 : %ld (0x%08lx)\n", lng, lng); + (rhnd->_lasterror) = getLong((rhnd->sock), &size); + DBG_printf("long 2 : %ld (0x%08lx)\n", (rhnd->_lasterror), (rhnd->_lasterror)); + + if (0 == lng) + { + result = getLong((rhnd->sock), &size); + DBG_printf("long 3 : %ld (0x%08lx)\n", result, result); + } + else + { + DBG_printf("Warning: expected 0 but got %i=0x%x\n", lng, lng); + } + + if ( size > 0 ) + { + DBG_printf( "size : %d\n", size ); + flushbuffer( (rhnd->sock) ); + } + + return result; +} + +void CeGetSystemInfo(RAPIHandleP rhnd,LPSYSTEM_INFO lpSystemInfo) +{ + BOOL result = FALSE; + long size = BUFSIZE; + LONG lng; + + initBuf((rhnd->buffer), size); + + pushLong((rhnd->buffer), size, 0x2f); /* Command */ + pushParameter(rhnd,size, lpSystemInfo, sizeof(SYSTEM_INFO), 0); + + sendbuffer( (rhnd->sock), (rhnd->buffer) ); + size = getbufferlen( (rhnd->sock) ); + + /* + * The return package looks like this + * + * Offset Size Value + * 00 4 0 + * 04 4 0 + * 08 4 1 + * 0c 4 n = real size of buffer + * 10 n first n bytes of struct + */ + + lng = getLong((rhnd->sock), &size); + (rhnd->_lasterror) = getLong((rhnd->sock), &size); + + /* + * Note: On my system, 36 bytes are returned but sizeof(SYSTEM_INFO) is only 32! + * + * "Overflow by 4 bytes. Parameter size is 36 bytes but max 32 bytes was expected." + */ + + if (0 == lng) + { + popParameter(rhnd,&size, lpSystemInfo, sizeof(SYSTEM_INFO)); + } + else + { + DBG_printf("Warning: expected 0 but got %i=0x%x\n", lng, lng); + } + + if ( size > 0 ) + { + DBG_printf( "size : %d\n", size ); + flushbuffer( (rhnd->sock) ); + } +} + + diff --git a/filesystems/cefs/rapi.h b/filesystems/cefs/rapi.h new file mode 100644 index 0000000..ea54adf --- /dev/null +++ b/filesystems/cefs/rapi.h @@ -0,0 +1,435 @@ +/*************************************************************************** + * Copyright (C) 2001 by Ludovic LANGE * + * ludovic.lange@free.fr * + * * + * 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. * + *************************************************************************** + * Parts of this file are : * + * (c) mingw header files. * + * "This file is part of a free library for the Win32 API. * + * This library is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." * + ***************************************************************************/ +/* rapi.h - main header file for the RAPI API + + NOTE: This strictly does not belong in the Win32 API since it's + really part of Platform SDK. + +*/ + +#ifndef _RAPI_H +#define _RAPI_H + +#include +#include + +#include "chunk.h" + +#ifdef __cplusplus +extern "C" +{ +#endif /* __cplusplus */ + + struct RAPIHandle + { + int sock; + DWORD _lasterror; + rapibuffer * buffer; + char * hostname; + unsigned char * lockbuffer; + size_t lockbuffersize ; + }; + typedef struct RAPIHandle* RAPIHandleP; + + typedef struct + { + DWORD a; + DWORD b; + DWORD c; + DWORD d; + } + CEGUID; + typedef CEGUID *PCEGUID; + +#define CREATE_INVALIDGUID(guid) (memset((guid), -1, sizeof((guid)))) + +#define MAX_PATH 256 + + typedef struct IRAPIStream + { + struct IRAPIStreamVtbl * lpVtbl; + } + IRAPIStream; + + typedef struct IRAPIStreamVtbl IRAPIStreamVtbl; + + typedef enum tagRAPISTREAMFLAG + { + STREAM_TIMEOUT_READ + } RAPISTREAMFLAG; + +#if 0 + struct IRAPIStreamVtbl + { + HRESULT ( * SetRapiStat ) ( IRAPIStream *, RAPISTREAMFLAG, DWORD ); + HRESULT ( * GetRapiStat ) ( IRAPIStream *, RAPISTREAMFLAG, DWORD * ); + }; +#endif + + typedef HRESULT ( STDAPICALLTYPE RAPIEXT ) ( DWORD, BYTE, DWORD, BYTE, IRAPIStream * ); + + typedef struct _RAPIINIT + { + DWORD cbSize; + HANDLE heRapiInit; + HRESULT hrRapiInit; + } + RAPIINIT; + +#define CERAPI_E_ALREADYINITIALIZED 0x8004101 + STDAPI CeRapiInit(RAPIHandleP); + STDAPI CeRapiInitEx (RAPIHandleP, RAPIINIT* ); + STDAPI_( BOOL ) CeCreateProcess ( RAPIHandleP,LPCWSTR, LPCWSTR, LPSECURITY_ATTRIBUTES, LPSECURITY_ATTRIBUTES, + BOOL, DWORD, LPVOID, LPWSTR, LPSTARTUPINFO, LPPROCESS_INFORMATION ); + STDAPI CeRapiUninit(RAPIHandleP); + +#define GENERIC_WRITE 0x40000000 +#define GENERIC_READ 0x80000000 +#define FILE_SHARE_READ 0x00000001 + +/* dwCreationDisposition */ +#define CREATE_NEW 1 +#define CREATE_ALWAYS 2 +#define OPEN_EXISTING 3 +#define OPEN_ALWAYS 4 +#define TRUNCATE_EXISTING 5 +#define OPEN_FOR_LOADER 6 + + STDAPI_( HANDLE ) CeCreateFile ( RAPIHandleP,LPCWSTR, DWORD, DWORD, LPSECURITY_ATTRIBUTES, DWORD, DWORD, HANDLE ); + STDAPI_( BOOL ) CeCreateDirectory ( RAPIHandleP,LPCWSTR, LPSECURITY_ATTRIBUTES ); + STDAPI_( DWORD ) CeGetLastError ( RAPIHandleP ); + STDAPI_( BOOL ) CeGetFileTime ( RAPIHandleP,HANDLE, LPFILETIME, LPFILETIME, LPFILETIME ); + STDAPI_( BOOL ) CeCloseHandle ( RAPIHandleP,HANDLE ); + + /* LLA ADDON */ + + STDAPI_( HRESULT ) CeRapiFreeBuffer( RAPIHandleP,LPVOID Buffer ); + STDAPI_( HRESULT ) CeRapiGetError(RAPIHandleP ); + STDAPI_( HRESULT ) CeRapiInvoke( RAPIHandleP,LPCWSTR, LPCWSTR, DWORD, BYTE *, DWORD *, BYTE **, IRAPIStream **, DWORD ); + + STDAPI_( BOOL ) CeCopyFile( RAPIHandleP,LPCWSTR lpExistingFileName, LPCWSTR lpNewFileName, BOOL bFailIfExists ); + STDAPI_( BOOL ) CeDeleteFile( RAPIHandleP,LPCWSTR lpFileName ); + + typedef struct _CE_FIND_DATA + { + DWORD dwFileAttributes; + FILETIME ftCreationTime; + FILETIME ftLastAccessTime; + FILETIME ftLastWriteTime; + DWORD nFileSizeHigh; + DWORD nFileSizeLow; + DWORD dwOID; + TCHAR cFileName[ MAX_PATH ]; + } + CE_FIND_DATA, *LPCE_FIND_DATA; + + typedef CE_FIND_DATA** LPLPCE_FIND_DATA; + +#define FAF_ATTRIBUTES 0x00001 +#define FAF_CREATION_TIME 0x00002 +#define FAF_LASTACCESS_TIME 0x00004 +#define FAF_LASTWRITE_TIME 0x00008 + +#define FAF_SIZE_HIGH 0x00010 +#define FAF_SIZE_LOW 0x00020 +#define FAF_OID 0x00040 +#define FAF_NAME 0x00080 + +#define FAF_ATTRIB_CHILDREN 0x01000 +#define FAF_ATTRIB_NO_HIDDEN 0x02000 +#define FAF_FOLDERS_ONLY 0x04000 +#define FAF_NO_HIDDEN_SYS_ROMMODULES 0x08000 + +#define FILE_ATTRIBUTE_READONLY 0x00000001 +#define FILE_ATTRIBUTE_HIDDEN 0x00000002 +#define FILE_ATTRIBUTE_SYSTEM 0x00000004 +#define FILE_ATTRIBUTE_1 0x00000008 + +#define FILE_ATTRIBUTE_DIRECTORY 0x00000010 +#define FILE_ATTRIBUTE_ARCHIVE 0x00000020 +#define FILE_ATTRIBUTE_INROM 0x00000040 +#define FILE_ATTRIBUTE_NORMAL 0x00000080 + +#define FILE_ATTRIBUTE_TEMPORARY 0x00000100 +#define FILE_ATTRIBUTE_2 0x00000200 +#define FILE_ATTRIBUTE_3 0x00000400 +#define FILE_ATTRIBUTE_COMPRESSED 0x00000800 + +#define FILE_ATTRIBUTE_ROMSTATICREF 0x00001000 +#define FILE_ATTRIBUTE_ROMMODULE 0x00002000 +#define FILE_ATTRIBUTE_4 0x00004000 +#define FILE_ATTRIBUTE_5 0x00008000 + +#define FILE_ATTRIBUTE_HAS_CHILDREN 0x00010000 +#define FILE_ATTRIBUTE_SHORTCUT 0x00020000 +#define FILE_ATTRIBUTE_6 0x00040000 +#define FILE_ATTRIBUTE_7 0x00080000 + +#define FAF_GETTARGET ((DWORD) 0x10000) + STDAPI_( BOOL ) CeFindAllFiles( RAPIHandleP,LPCWSTR szPath, DWORD dwFlags, LPDWORD lpdwFoundCount, LPLPCE_FIND_DATA ppFindDataArray ); + STDAPI_( HANDLE ) CeFindFirstFile( RAPIHandleP,LPCWSTR lpFileName, LPCE_FIND_DATA lpFileFindData ); + STDAPI_( BOOL ) CeFindNextFile( RAPIHandleP,HANDLE hFindFile, /*LPWIN32_FIND_DATA ?*/LPCE_FIND_DATA lpFileFindData ); + STDAPI_( DWORD ) CeGetFileAttributes( RAPIHandleP,LPCWSTR lpFileName ); + STDAPI_( DWORD ) CeGetFileSize( RAPIHandleP,HANDLE hFile, LPDWORD lpFileSizeHigh ); + + +#define CSIDL_PROGRAMS 0x0002 +#define CSIDL_PERSONAL 0x0005 +#define CSIDL_FAVORITES_GRYPHON 0x0006 +#define CSIDL_STARTUP 0x0007 +#define CSIDL_RECENT 0x0008 +#define CSIDL_STARTMENU 0x000b +#define CSIDL_DESKTOPDIRECTORY 0x0010 +#define CSIDL_FONTS 0x0014 +#define CSIDL_FAVORITES 0x0016 + + STDAPI_( DWORD ) CeGetSpecialFolderPath( RAPIHandleP,int nFolder, DWORD nBufferLength, LPWSTR lpBuffer ); + + STDAPI_( DWORD ) CeGetTempPath( RAPIHandleP,DWORD nBufferLength, LPWSTR lpBuffer ); + STDAPI_( BOOL ) CeMoveFile( RAPIHandleP,LPCWSTR lpExistingFileName, LPCWSTR lpNewFileName ); + STDAPI_( BOOL ) CeReadFile( RAPIHandleP,HANDLE hFile, LPVOID lpBuffer, DWORD nNumberOfBytesToRead, LPDWORD lpNumberOfBytesRead, LPOVERLAPPED lpOverlapped ); + STDAPI_( BOOL ) CeWriteFile( RAPIHandleP,HANDLE hFile, LPVOID lpBuffer, DWORD nNumberOfBytesToWrite, LPDWORD lpNumberOfBytesWritten, LPOVERLAPPED lpOverlapped ); + STDAPI_( BOOL ) CeRemoveDirectory(RAPIHandleP, LPCWSTR lpPathName ); + STDAPI_( BOOL ) CeSetEndOfFile( RAPIHandleP,HANDLE hFile ); + STDAPI_( BOOL ) CeSetFileAttributes( RAPIHandleP,LPCWSTR lpFileName, DWORD dwFileAttributes ); + STDAPI_( DWORD ) CeSetFilePointer( RAPIHandleP,HANDLE hFile, LONG lDistanceToMove, PLONG lpDistanceToMoveHigh, DWORD dwMoveMethod ); + STDAPI_( BOOL ) CeSetFileTime( RAPIHandleP,HANDLE hFile, LPFILETIME lpCreationTime, LPFILETIME lpLastAccessTime, LPFILETIME lpLastWriteTime ); + STDAPI_( DWORD ) CeSHCreateShortcut( RAPIHandleP,LPWSTR lpszShortcut, LPWSTR lpszTarget ); + STDAPI_( BOOL ) CeSHGetShortcutTarget( RAPIHandleP,LPWSTR lpszShortcut, LPWSTR lpszTarget, INT cbMax ); + +#define HKEY_CLASSES_ROOT ( ( HKEY ) 0x80000000 ) +#define HKEY_CURRENT_USER ( ( HKEY ) 0x80000001 ) +#define HKEY_LOCAL_MACHINE ( ( HKEY ) 0x80000002 ) +#define HKEY_USERS ( ( HKEY ) 0x80000003 ) +#define REG_CREATED_NEW_KEY ( 0x00000001L ) +#define REG_OPENED_EXISTING_KEY ( 0x00000002L ) + +#define REG_NONE 0 +#define REG_SZ 1 +#define REG_EXPAND_SZ 2 +#define REG_BINARY 3 +#define REG_DWORD 4 +#define REG_LINK 6 +#define REG_MULTI_SZ 7 +#define REG_RESOURCE_LIST 8 + +#define ERROR_NO_MORE_ITEMS 259 + STDAPI_( LONG ) CeRegOpenKeyEx( RAPIHandleP,HKEY, LPCWSTR, DWORD, REGSAM, PHKEY ); + STDAPI_( LONG ) CeRegEnumKeyEx( RAPIHandleP,HKEY, DWORD, LPWSTR, LPDWORD, LPDWORD, LPWSTR, LPDWORD, PFILETIME ); + STDAPI_( LONG ) CeRegCreateKeyEx( RAPIHandleP,HKEY, LPCWSTR, DWORD, LPWSTR, DWORD, REGSAM, LPSECURITY_ATTRIBUTES, PHKEY, LPDWORD ); + STDAPI_( LONG ) CeRegCloseKey( RAPIHandleP,HKEY ); + STDAPI_( LONG ) CeRegDeleteKey( RAPIHandleP,HKEY, LPCWSTR ); + STDAPI_( LONG ) CeRegEnumValue( RAPIHandleP,HKEY, DWORD, LPWSTR, LPDWORD, LPDWORD, LPDWORD, LPBYTE, LPDWORD ); + STDAPI_( LONG ) CeRegDeleteValue( RAPIHandleP,HKEY, LPCWSTR ); + STDAPI_( LONG ) CeRegQueryInfoKey( RAPIHandleP,HKEY, LPWSTR, LPDWORD, LPDWORD, LPDWORD, LPDWORD, LPDWORD, LPDWORD, LPDWORD, LPDWORD, LPDWORD, PFILETIME ); + STDAPI_( LONG ) CeRegQueryValueEx( RAPIHandleP,HKEY, LPCWSTR, LPDWORD, LPDWORD, LPBYTE, LPDWORD ); + STDAPI_( LONG ) CeRegSetValueEx( RAPIHandleP,HKEY, LPCWSTR, DWORD, DWORD, LPBYTE, DWORD ); + + /* Database */ + typedef DWORD CEPROPID; + typedef CEPROPID *PCEPROPID; +#define TypeFromPropID(propid) LOWORD(propid) + typedef DWORD CEOID; + typedef CEOID *PCEOID; + +#define CEDB_MAXDBASENAMELEN 32 +#define CEDB_MAXSORTORDER 4 + +#define CEDB_VALIDNAME 0x0001 +#define CEDB_VALIDTYPE 0x0002 +#define CEDB_VALIDSORTSPEC 0x0004 +#define CEDB_VALIDMODTIME 0x0008 + +#define CEDB_AUTOINCREMENT 0x00000001 +#define CEDB_NOCOMPRESS 0x00010000 + +#define CEDB_SORT_DESCENDING 0x00000001 +#define CEDB_SORT_CASEINSENSITIVE 0x00000002 +#define CEDB_SORT_UNKNOWNFIRST 0x00000004 +#define CEDB_SORT_GENERICORDER 0x00000008 + +#define CEDB_SEEK_CEOID 0x00000001 +#define CEDB_SEEK_BEGINNING 0x00000002 +#define CEDB_SEEK_END 0x00000004 +#define CEDB_SEEK_CURRENT 0x00000008 + +#define CEDB_SEEK_VALUESMALLER 0x00000010 +#define CEDB_SEEK_VALUEFIRSTEQUAL 0x00000020 +#define CEDB_SEEK_VALUEGREATER 0x00000040 +#define CEDB_SEEK_VALUENEXTEQUAL 0x00000080 + +#define CEDB_PROPNOTFOUND 0x0100 +#define CEDB_PROPDELETE 0x0200 +#define CEDB_MAXDATABLOCKSIZE 4092 +#define CEDB_MAXPROPDATASIZE (CEDB_MAXDATABLOCKSIZE*16) +#define CEDB_MAXRECORDSIZE (128*1024) +#define CEDB_ALLOWREALLOC 0x00000001 + +#define FAD_OID 0x0001 +#define FAD_FLAGS 0x0002 +#define FAD_NAME 0x0004 +#define FAD_TYPE 0x0008 + +#define FAD_NUM_RECORDS 0x0010 +#define FAD_NUM_SORT_ORDER 0x0020 +#define FAD_SIZE 0x0040 +#define FAD_LAST_MODIFIED 0x0080 + +#define FAD_SORT_SPECS 0x0100 + + typedef struct _SORTORDERSPEC + { + CEPROPID propid; + DWORD dwFlags; + } + SORTORDERSPEC; + + typedef struct _CEDBASEINFO + { + DWORD dwFlags; + WCHAR szDbaseName[ CEDB_MAXDBASENAMELEN ]; + DWORD dwDbaseType; + WORD wNumRecords; + WORD wNumSortOrder; + DWORD dwSize; + FILETIME ftLastModified; + SORTORDERSPEC rgSortSpecs[ CEDB_MAXSORTORDER ]; + } + CEDBASEINFO; + + typedef struct _CEDB_FIND_DATA + { + CEOID OidDb; + CEDBASEINFO DbInfo; + } + CEDB_FIND_DATA, *LPCEDB_FIND_DATA; + + typedef CEDB_FIND_DATA ** LPLPCEDB_FIND_DATA; + + typedef struct _CEBLOB + { + DWORD dwCount; + LPBYTE lpb; + } + CEBLOB; + +#define CEVT_I2 2 +#define CEVT_I4 3 +#define CEVT_R8 5 +#define CEVT_BOOL 11 +#define CEVT_UI2 18 +#define CEVT_UI4 19 +#define CEVT_LPWSTR 31 +#define CEVT_FILETIME 64 +#define CEVT_BLOB 65 + + typedef union _CEVALUNION { + short iVal; + USHORT uiVal; + long lVal; + ULONG ulVal; + FILETIME filetime; + LPWSTR lpwstr; + CEBLOB blob; + BOOL boolVal; + double dblVal; + } CEVALUNION; + + typedef struct _CEPROPVAL + { + CEPROPID propid; + WORD wLenData; + WORD wFlags; + CEVALUNION val; + } + CEPROPVAL, *PCEPROPVAL; + + STDAPI_( BOOL ) CeFindAllDatabases( RAPIHandleP,DWORD, WORD, LPWORD, LPLPCEDB_FIND_DATA ); + STDAPI_( HANDLE ) CeOpenDatabase( RAPIHandleP,PCEOID, LPWSTR, CEPROPID, DWORD, HWND ); + STDAPI_( CEOID ) CeReadRecordProps( RAPIHandleP,HANDLE, DWORD, LPWORD, CEPROPID*, LPBYTE*, LPDWORD ); + /* + STDAPI_(BOOL) CeCheckPassword( LPWSTR ); + + STDAPI_(CEOID) CeCreateDatabase( LPWSTR, DWORD, WORD, SORTORDERSPEC* ); + STDAPI_(BOOL) CeDeleteDatabase( CEOID ); + STDAPI_(HANDLE) CeFindFirstDatabase( DWORD ); + STDAPI_(CEOID) CeFindNextDatabase( HANDLE ); + STDAPI_(CEOID) CeSeekDatabase( HANDLE, DWORD, LONG, LPDWORD ); + STDAPI_(BOOL) CeSetDatabaseInfo( CEOID, CEDBASEINFO* ); + + STDAPI_(BOOL) CeDeleteRecord( HANDLE, CEOID ); + + STDAPI_(BOOL) CeFindClose( HANDLE ); + + STDAPI_(int) CeGetClassName( HWND, LPWSTR, int ); + STDAPI_(INT) CeGetDesktopDeviceCaps( INT ); + STDAPI_(BOOL) CeGetStoreInformation( LPSTORE_INFORMATION ); + */ + STDAPI_(BOOL) CeFindClose( RAPIHandleP,HANDLE ); + + typedef struct _SYSTEM_INFO { + union { + DWORD dwOemId; + struct _dummy { + WORD wProcessorArchitecture; + WORD wReserved; + }; + }; + DWORD dwPageSize; + LPVOID lpMinimumApplicationAddress; + LPVOID lpMaximumApplicationAddress; + DWORD dwActiveProcessorMask; + DWORD dwNumberOfProcessors; + DWORD dwProcessorType; + DWORD dwAllocationGranularity; + WORD wProcessorLevel; + WORD wProcessorRevision; + } SYSTEM_INFO, *LPSYSTEM_INFO; + + STDAPI_(VOID) CeGetSystemInfo( RAPIHandleP,LPSYSTEM_INFO ); + /* + STDAPI_(INT) CeGetSystemMetrics( INT ); + STDAPI_(BOOL) CeGetSystemPowerStatusEx( PSYSTEM_POWER_STATUS_EX, BOOL ); + */ + typedef struct _CEOSVERSIONINFO{ + DWORD dwOSVersionInfoSize; + DWORD dwMajorVersion; + DWORD dwMinorVersion; + DWORD dwBuildNumber; + DWORD dwPlatformId; + WCHAR szCSDVersion[128]; + } CEOSVERSIONINFO, *LPCEOSVERSIONINFO; + + STDAPI_(BOOL) CeGetVersionEx( RAPIHandleP,LPCEOSVERSIONINFO ); + /* + STDAPI_(HWND) CeGetWindow( HWND, UINT ); + STDAPI_(LONG) CeGetWindowLong( HWND, int ); + STDAPI_(int) CeGetWindowText( HWND, LPWSTR, int ); + STDAPI_(VOID) CeGlobalMemoryStatus( LPMEMORYSTATUS ); + + STDAPI_(BOOL) CeOidGetInfo( CEOID, CEOIDINFO* ); + + + STDAPI_(CEOID) CeWriteRecordProps( HANDLE, CEOID, WORD, CEPROPVAL* ); + */ + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#endif /* _RAPI_H */ + diff --git a/filesystems/cefs/windows.h b/filesystems/cefs/windows.h new file mode 100644 index 0000000..9a77a9a --- /dev/null +++ b/filesystems/cefs/windows.h @@ -0,0 +1,163 @@ +/*************************************************************************** + * Copyright (C) 2001 by Ludovic LANGE * + * ludovic.lange@free.fr * + * * + * 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. * + *************************************************************************** + * Some parts are : * + * Copyright (c) 1993-2000 the Wine project authors (see the file AUTHORS * + * for a complete list) * + ***************************************************************************/ +#ifndef WINDOWS_TYPES_H +#define WINDOWS_TYPES_H + +#include "little_endian.h" + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +/*#ifdef REAL_WCHAR_T +#include +#endif*/ +#include +#include +#include +#include + +typedef u_int8_t BYTE; +typedef BYTE * PBYTE; +typedef BYTE * LPBYTE; + +typedef u_int16_t USHORT; + +typedef u_int16_t WORD; +typedef WORD * LPWORD; + +typedef u_int32_t DWORD; +typedef DWORD * LPDWORD; + +typedef u_int32_t UINT; +typedef int32_t INT; + +typedef int32_t LONG; +typedef LONG * PLONG; + +typedef LONG BOOL; +typedef BOOL * LPBOOL; + +typedef DWORD ULONG; + +typedef double DOUBLE; + +typedef int8_t CHAR; +typedef CHAR * LPSTR; +typedef const CHAR * LPCSTR; + +typedef u_int16_t WCHAR; +typedef u_int16_t _WIN_WCHAR; + +typedef WCHAR TCHAR; +typedef WCHAR * LPWSTR; +typedef TCHAR * LPTSTR; +typedef const WCHAR * LPCWSTR; +typedef const TCHAR * LPCTSTR; + +typedef void VOID; +typedef VOID * PVOID; +typedef VOID * LPVOID; +typedef const VOID * LPCVOID; + +typedef LONG HRESULT; +typedef void * HANDLE; + + +typedef HRESULT STDAPI; +#define STDAPI_(a) a +#define __stdcall +#define STDAPICALLTYPE + +typedef CHAR * LPSECURITY_ATTRIBUTES; +typedef CHAR * LPSTARTUPINFO; +typedef CHAR * LPPROCESS_INFORMATION; +typedef CHAR * LPOVERLAPPED; +typedef LONG HKEY; +typedef HKEY * PHKEY; +typedef LONG REGSAM; + +#define FAILED(a) (a<0) +#define E_SUCCESS 0 +#define ERROR_SUCCESS 0 +#define ERROR_FILE_NOT_FOUND 2 +#define ERROR_NOT_ENOUGH_MEMORY 8 +#define ERROR_SEEK 25 +#define ERROR_INVALID_PARAMETER 87 +#define ERROR_INSUFFICIENT_BUFFER 122 +#define ERROR_NO_DATA 232 +#define ERROR_NO_MORE_ITEMS 259 +#define ERROR_KEY_DELETED 1018 +#define E_FAIL 0x80004005 +#define INVALID_HANDLE_VALUE ((HANDLE)-1) + +typedef void * HWND; + +#define LocalFree( ptr ) free( ptr ); + +typedef struct _PROCESS_INFORMATION { + HANDLE hProcess; + HANDLE hThread; + DWORD dwProcessId; + DWORD dwThreadId; +} PROCESS_INFORMATION, *LPROCESS_INFORMATION; + +typedef struct _FILETIME { /* it seems to be : nbr of 100ns since Jan 1 1601 ??? */ + DWORD dwLowDateTime; + DWORD dwHighDateTime; +} FILETIME; +#define LPFILETIME FILETIME * +#define PFILETIME FILETIME * + +#define TRUE (BOOL)(1==1) +#define FALSE (BOOL)(!TRUE) + + + + +size_t _WIN_wcstombs( char *s, const TCHAR *pwcs, size_t n ); +size_t _WIN_mbstowcs( _WIN_WCHAR * strDestination, char * strSource, size_t n ); +size_t _WIN_wcslen( const _WIN_WCHAR * str ); +int _WIN_wprintf( const WCHAR * format, ... ); +unsigned int strlenW( const WCHAR * str ); +WCHAR * strcpyW( WCHAR * dst, const WCHAR * src ); +WCHAR * strcatW( WCHAR *dst, const WCHAR *src ); +time_t DOSFS_FileTimeToUnixTime( const FILETIME *filetime, DWORD *remainder ); +BOOL FileTimeToDosDateTime( const FILETIME * lpFileTime, LPWORD lpFatDate, LPWORD lpFatTime ); + +#define TEXT(a) (L##a) +#define _tprintf _WIN_wprintf +#define _tcscpy wcscpy +#define wprintf _WIN_wprintf +#define wcslen strlenW +#define wcstombs _WIN_wcstombs +#define mbstowcs _WIN_mbstowcs +#define wcslen strlenW +#define wcscpy strcpyW +#define wcscat strcatW + + + + + + + + + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + + +#endif /* WINDOWS_TYPES_H */ diff --git a/filesystems/cefs/wine.c b/filesystems/cefs/wine.c new file mode 100644 index 0000000..bbbe4bf --- /dev/null +++ b/filesystems/cefs/wine.c @@ -0,0 +1,349 @@ +/*************************************************************************** + * Copyright (C) 2001 by Ludovic LANGE * + * ludovic.lange@free.fr * + * * + * 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. * + *************************************************************************** + * Some parts are : * + * Copyright (c) 1993-2000 the Wine project authors (see the file AUTHORS * + * for a complete list) * + ***************************************************************************/ + +#include + +#ifdef WINDOWS +#define _WIN_wcstombs wcstombs +#define _WIN_mbstowcs mbstowcs +#else +#include + +size_t _WIN_wcstombs( char *s, const TCHAR *pwcs, size_t n ) +{ + iconv_t cd; + char *iptr, *optr; + size_t ibl, obl; + size_t result = 0; + + cd = iconv_open( "UTF-8", "UCS-2" ); + + iptr = ( char * ) pwcs; + ibl = n * sizeof( _WIN_WCHAR ); + obl = n; + optr = s; + result = iconv( cd, &iptr, &ibl, &optr, &obl ); + + iconv_close( cd ); + + s[ n ] = '\0'; + + return ( ibl == 0 ) ? n : ( size_t ) - 1; +} + +/*Stolen from Wine*/ +int _WIN_wprintf( const WCHAR * format, ... ) +{ + unsigned int written = 0; + const WCHAR *iter = format; + char printbuf[ 1024 ]; + int len = 1024; + WCHAR storebuf[ 2048 ]; + WCHAR * str = storebuf; + char bufa[ 256 ], fmtbufa[ 64 ], *fmta; + va_list valist; + va_start( valist, format ); + + /* TRACE("(%d,%s)\n",len,debugstr_w(format)); */ + + while ( *iter ) + { + while ( *iter && *iter != ( WCHAR ) L'%' ) + { + if ( written++ >= len ) + return -1; + *str++ = *iter++; + } + if ( *iter == ( WCHAR ) L'%' ) + { + fmta = fmtbufa; + *fmta++ = *iter++; + while ( *iter == ( WCHAR ) L'0' || + *iter == ( WCHAR ) L'+' || + *iter == ( WCHAR ) L'-' || + *iter == ( WCHAR ) L' ' || + *iter == ( WCHAR ) L'0' || + *iter == ( WCHAR ) L'*' || + *iter == ( WCHAR ) L'#' ) + { + if ( *iter == ( WCHAR ) L'*' ) + { + char * buffiter = bufa; + int fieldlen = va_arg( valist, int ); + sprintf( buffiter, "%d", fieldlen ); + while ( *buffiter ) + * fmta++ = *buffiter++; + } + else + *fmta++ = *iter; + iter++; + } + + while ( isdigit( *iter ) ) + * fmta++ = *iter++; + + if ( *iter == ( WCHAR ) L'.' ) + { + *fmta++ = *iter++; + if ( *iter == ( WCHAR ) L'*' ) + { + char * buffiter = bufa; + int fieldlen = va_arg( valist, int ); + sprintf( buffiter, "%d", fieldlen ); + while ( *buffiter ) + * fmta++ = *buffiter++; + } + else + while ( isdigit( *iter ) ) + * fmta++ = *iter++; + } + if ( *iter == ( WCHAR ) L'h' || + *iter == ( WCHAR ) L'l' ) + { + *fmta++ = *iter++; + *fmta++ = *iter++; + } + + switch ( *iter ) + { + case ( WCHAR ) L's': + { + static const WCHAR none[] = { '(', 'n', 'u', 'l', 'l', ')', 0 }; + const WCHAR *wstr = va_arg( valist, const WCHAR * ); + const WCHAR *striter = wstr ? wstr : none; + while ( *striter ) + { + if ( written++ >= len ) + return -1; + *str++ = *striter++; + } + iter++; + break; + } + + case ( WCHAR ) L'c': + if ( written++ >= len ) + return -1; + *str++ = ( WCHAR ) va_arg( valist, int ); + iter++; + break; + + default: + { + /* For non wc types, use system sprintf and append to wide char output */ + /* FIXME: for unrecognised types, should ignore % when printing */ + char *bufaiter = bufa; + if ( *iter == ( WCHAR ) L'p' ) + sprintf( bufaiter, "%08lX", va_arg( valist, long ) ); + else + { + *fmta++ = *iter; + *fmta = '\0'; + if ( *iter == ( WCHAR ) L'f' ) + sprintf( bufaiter, fmtbufa, va_arg( valist, double ) ); + else + sprintf( bufaiter, fmtbufa, va_arg( valist, void * ) ); + } + while ( *bufaiter ) + { + if ( written++ >= len ) + return -1; + *str++ = *bufaiter++; + } + iter++; + break; + } + } + } + } + if ( written >= len ) + return -1; + *str++ = ( WCHAR ) L'\0'; + + _WIN_wcstombs( printbuf, storebuf, len ); + printf( "%s", printbuf ); + va_end( valist ); + return ( int ) written; +} + +size_t _WIN_mbstowcs( _WIN_WCHAR * strDestination, char * strSource, size_t n ) +{ + iconv_t cd; + char *iptr, *optr; + size_t ibl, obl; + size_t result = 0; + + cd = iconv_open( "UCS-2", "UTF-8" ); + + iptr = strSource; + ibl = n; + obl = n * sizeof( _WIN_WCHAR ); + optr = ( char * ) strDestination; + result = iconv( cd, &iptr, &ibl, &optr, &obl ); + + iconv_close( cd ); + + strDestination[ n ] = ( _WIN_WCHAR ) 0; + + return ( ibl == 0 ) ? n : ( size_t ) - 1; +} + +size_t _WIN_wcslen( const _WIN_WCHAR * str ) +{ + size_t result = 0; + const _WIN_WCHAR * ptr; + if ( str ) + { + for ( ptr = str; ( *ptr ) != 0x00; ptr++ ) + { + result ++; + } + } + return result; +} + +/* Stolen from Wine ! */ +unsigned int strlenW( const WCHAR * str ) +{ + const WCHAR * s = str; + while ( *s ) s++; + return s -str; +} + +/* Stolen from Wine ! */ +WCHAR * strcpyW( WCHAR * dst, const WCHAR * src ) +{ + WCHAR * p = dst; + while ( ( *p++ = *src++ ) ); + return dst; +} + +/* Stolen from Wine ! */ +WCHAR * strcatW( WCHAR *dst, const WCHAR *src ) +{ + printf("sizeof(WCHAR): %d\n",sizeof(WCHAR)); + + strcpyW( dst + strlenW( dst ), src ); + return dst; +} + +/* Stolen from Wine ! */ +/*********************************************************************** +* DOSFS_FileTimeToUnixTime +* +* Convert a FILETIME format to Unix time. +* If not NULL, 'remainder' contains the fractional part of the filetime, +* in the range of [0..9999999] (even if time_t is negative). +*/ +time_t DOSFS_FileTimeToUnixTime( const FILETIME *filetime, DWORD *remainder ) +{ + /* Read the comment in the function DOSFS_UnixTimeToFileTime. */ +#if USE_LONG_LONG + + long long int t = filetime->dwHighDateTime; + t <<= 32; + t += ( UINT ) filetime->dwLowDateTime; + t -= 116444736000000000LL; + if ( t < 0 ) + { + if ( remainder ) * remainder = 9999999 - ( -t - 1 ) % 10000000; + return -1 - ( ( -t - 1 ) / 10000000 ); + } + else + { + if ( remainder ) * remainder = t % 10000000; + return t / 10000000; + } + +#else /* ISO version */ + +UINT a0; /* 16 bit, low bits */ +UINT a1; /* 16 bit, medium bits */ +UINT a2; /* 32 bit, high bits */ +UINT r; /* remainder of division */ +unsigned int carry; /* carry bit for subtraction */ +int negative; /* whether a represents a negative value */ + +/* Copy the time values to a2/a1/a0 */ +a2 = ( UINT ) filetime->dwHighDateTime; +a1 = ( ( UINT ) filetime->dwLowDateTime ) >> 16; +a0 = ( ( UINT ) filetime->dwLowDateTime ) & 0xffff; + +/* Subtract the time difference */ +if ( a0 >= 32768 ) a0 -= 32768 , carry = 0; +else a0 += ( 1 << 16 ) - 32768 , carry = 1; + +if ( a1 >= 54590 + carry ) a1 -= 54590 + carry, carry = 0; +else a1 += ( 1 << 16 ) - 54590 - carry, carry = 1; + +a2 -= 27111902 + carry; + +/* If a is negative, replace a by (-1-a) */ +negative = ( a2 >= ( ( UINT ) 1 ) << 31 ); +if ( negative ) +{ + /* Set a to -a - 1 (a is a2/a1/a0) */ + a0 = 0xffff - a0; + a1 = 0xffff - a1; + a2 = ~a2; +} +/* Divide a by 10000000 (a = a2/a1/a0), put the rest into r. +Split the divisor into 10000 * 1000 which are both less than 0xffff. */ +a1 += ( a2 % 10000 ) << 16; +a2 /= 10000; +a0 += ( a1 % 10000 ) << 16; +a1 /= 10000; +r = a0 % 10000; +a0 /= 10000; + +a1 += ( a2 % 1000 ) << 16; +a2 /= 1000; +a0 += ( a1 % 1000 ) << 16; +a1 /= 1000; +r += ( a0 % 1000 ) * 10000; +a0 /= 1000; + +/* If a was negative, replace a by (-1-a) and r by (9999999 - r) */ +if ( negative ) +{ + /* Set a to -a - 1 (a is a2/a1/a0) */ + a0 = 0xffff - a0; + a1 = 0xffff - a1; + a2 = ~a2; + + r = 9999999 - r; +} + +if ( remainder ) * remainder = r; + +/* Do not replace this by << 32, it gives a compiler warning and it does +not work. */ +return ( ( ( ( time_t ) a2 ) << 16 ) << 16 ) + ( a1 << 16 ) + a0; +#endif +} + +/* Stolen from Wine ! */ +BOOL FileTimeToDosDateTime( const FILETIME * lpFileTime, LPWORD lpFatDate, LPWORD lpFatTime ) +{ + time_t unixtime = DOSFS_FileTimeToUnixTime( lpFileTime, NULL ); + struct tm *tm = localtime( &unixtime ); + if ( lpFatTime ) + * lpFatTime = ( ( tm->tm_hour ) << 11 ) + ( tm->tm_min << 5 ) + ( tm->tm_sec / 2 ); + if ( lpFatDate ) + * lpFatDate = ( ( tm->tm_year - 80 ) << 9 ) + ( ( tm->tm_mon + 1 ) << 5 ) + + tm->tm_mday; + return 1; +} + +#endif /* ifndef( WINDOWS )*/ diff --git a/filesystems/ftpfs/Makefile.am b/filesystems/ftpfs/Makefile.am new file mode 100644 index 0000000..a66f3d3 --- /dev/null +++ b/filesystems/ftpfs/Makefile.am @@ -0,0 +1,6 @@ +INCLUDES=-I../ @all_includes@ +lib_LTLIBRARIES=liblufs-ftpfs.la + +noinst_HEADERS=ftpfs.h ftplib.h ftpsys.h ftpsys_unix.h ftpsys_netware.h ftpsys_windows.h +liblufs_ftpfs_la_SOURCES=ftpfs.cpp ftplib.cpp ftpsys_unix.cpp ftpsys_netware.cpp ftpsys_windows.cpp +liblufs_ftpfs_la_LDFLAGS=-version-info 2:0:0 diff --git a/filesystems/ftpfs/Makefile.in b/filesystems/ftpfs/Makefile.in new file mode 100644 index 0000000..0091bc0 --- /dev/null +++ b/filesystems/ftpfs/Makefile.in @@ -0,0 +1,466 @@ +# Makefile.in generated by automake 1.7.5 from Makefile.am. +# @configure_input@ + +# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003 +# Free Software Foundation, Inc. +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ + +srcdir = @srcdir@ +top_srcdir = @top_srcdir@ +VPATH = @srcdir@ +pkgdatadir = $(datadir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +top_builddir = ../.. + +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +INSTALL = @INSTALL@ +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = @build@ +host_triplet = @host@ +target_triplet = @target@ +ACLOCAL = @ACLOCAL@ +AMDEP_FALSE = @AMDEP_FALSE@ +AMDEP_TRUE = @AMDEP_TRUE@ +AMTAR = @AMTAR@ +AUTOCONF = @AUTOCONF@ +AUTOFS_INSTALL = @AUTOFS_INSTALL@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CXX = @CXX@ +CXXDEPMODE = @CXXDEPMODE@ +CXXFLAGS = @CXXFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DEBUG_FLAGS = @DEBUG_FLAGS@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +ECHO = @ECHO@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +EXEEXT = @EXEEXT@ +GCONF = @GCONF@ +GVFSCONF = @GVFSCONF@ +GVFS_CFLAGS = @GVFS_CFLAGS@ +GVFS_LDADD = @GVFS_LDADD@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +KDEBUG_FLAGS = @KDEBUG_FLAGS@ +KERNEL_DIR = @KERNEL_DIR@ +KERNEL_HDR = @KERNEL_HDR@ +LDFLAGS = @LDFLAGS@ +LIBCHIPCARD_INCLUDES = @LIBCHIPCARD_INCLUDES@ +LIBCHIPCARD_LIB = @LIBCHIPCARD_LIB@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LIBTOOL = @LIBTOOL@ +LN_S = @LN_S@ +LTLIBOBJS = @LTLIBOBJS@ +LUFS_SUID = @LUFS_SUID@ +MAKEINFO = @MAKEINFO@ +MODULES_DIR = @MODULES_DIR@ +MODV_FLAGS = @MODV_FLAGS@ +OBJEXT = @OBJEXT@ +OS_DIR = @OS_DIR@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +RANLIB = @RANLIB@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +SSHPROG = @SSHPROG@ +STRIP = @STRIP@ +VERSION = @VERSION@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_CXX = @ac_ct_CXX@ +ac_ct_RANLIB = @ac_ct_RANLIB@ +ac_ct_STRIP = @ac_ct_STRIP@ +all_includes = @all_includes@ +all_libraries = @all_libraries@ +am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ +am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ +am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@ +am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +datadir = @datadir@ +define_has_libchipcard = @define_has_libchipcard@ +exec_prefix = @exec_prefix@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localstatedir = @localstatedir@ +mandir = @mandir@ +oldincludedir = @oldincludedir@ +opt_fs = @opt_fs@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +sysconfdir = @sysconfdir@ +target = @target@ +target_alias = @target_alias@ +target_cpu = @target_cpu@ +target_os = @target_os@ +target_vendor = @target_vendor@ +INCLUDES = -I../ @all_includes@ +lib_LTLIBRARIES = liblufs-ftpfs.la + +noinst_HEADERS = ftpfs.h ftplib.h ftpsys.h ftpsys_unix.h ftpsys_netware.h ftpsys_windows.h +liblufs_ftpfs_la_SOURCES = ftpfs.cpp ftplib.cpp ftpsys_unix.cpp ftpsys_netware.cpp ftpsys_windows.cpp +liblufs_ftpfs_la_LDFLAGS = -version-info 2:0:0 +subdir = filesystems/ftpfs +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +mkinstalldirs = $(SHELL) $(top_srcdir)/config/mkinstalldirs +CONFIG_HEADER = $(top_builddir)/config.h +CONFIG_CLEAN_FILES = +LTLIBRARIES = $(lib_LTLIBRARIES) + +liblufs_ftpfs_la_LIBADD = +am_liblufs_ftpfs_la_OBJECTS = ftpfs.lo ftplib.lo ftpsys_unix.lo \ + ftpsys_netware.lo ftpsys_windows.lo +liblufs_ftpfs_la_OBJECTS = $(am_liblufs_ftpfs_la_OBJECTS) + +DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir) +depcomp = $(SHELL) $(top_srcdir)/config/depcomp +am__depfiles_maybe = depfiles +@AMDEP_TRUE@DEP_FILES = ./$(DEPDIR)/ftpfs.Plo ./$(DEPDIR)/ftplib.Plo \ +@AMDEP_TRUE@ ./$(DEPDIR)/ftpsys_netware.Plo \ +@AMDEP_TRUE@ ./$(DEPDIR)/ftpsys_unix.Plo \ +@AMDEP_TRUE@ ./$(DEPDIR)/ftpsys_windows.Plo +CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ + $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) +LTCXXCOMPILE = $(LIBTOOL) --mode=compile $(CXX) $(DEFS) \ + $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ + $(AM_CXXFLAGS) $(CXXFLAGS) +CXXLD = $(CXX) +CXXLINK = $(LIBTOOL) --mode=link $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) \ + $(AM_LDFLAGS) $(LDFLAGS) -o $@ +DIST_SOURCES = $(liblufs_ftpfs_la_SOURCES) +HEADERS = $(noinst_HEADERS) + +DIST_COMMON = $(noinst_HEADERS) Makefile.am Makefile.in +SOURCES = $(liblufs_ftpfs_la_SOURCES) + +all: all-am + +.SUFFIXES: +.SUFFIXES: .cpp .lo .o .obj +$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4) + cd $(top_srcdir) && \ + $(AUTOMAKE) --gnu filesystems/ftpfs/Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe) +libLTLIBRARIES_INSTALL = $(INSTALL) +install-libLTLIBRARIES: $(lib_LTLIBRARIES) + @$(NORMAL_INSTALL) + $(mkinstalldirs) $(DESTDIR)$(libdir) + @list='$(lib_LTLIBRARIES)'; for p in $$list; do \ + if test -f $$p; then \ + f="`echo $$p | sed -e 's|^.*/||'`"; \ + echo " $(LIBTOOL) --mode=install $(libLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) $$p $(DESTDIR)$(libdir)/$$f"; \ + $(LIBTOOL) --mode=install $(libLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) $$p $(DESTDIR)$(libdir)/$$f; \ + else :; fi; \ + done + +uninstall-libLTLIBRARIES: + @$(NORMAL_UNINSTALL) + @list='$(lib_LTLIBRARIES)'; for p in $$list; do \ + p="`echo $$p | sed -e 's|^.*/||'`"; \ + echo " $(LIBTOOL) --mode=uninstall rm -f $(DESTDIR)$(libdir)/$$p"; \ + $(LIBTOOL) --mode=uninstall rm -f $(DESTDIR)$(libdir)/$$p; \ + done + +clean-libLTLIBRARIES: + -test -z "$(lib_LTLIBRARIES)" || rm -f $(lib_LTLIBRARIES) + @list='$(lib_LTLIBRARIES)'; for p in $$list; do \ + dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \ + test "$$dir" = "$$p" && dir=.; \ + echo "rm -f \"$${dir}/so_locations\""; \ + rm -f "$${dir}/so_locations"; \ + done +liblufs-ftpfs.la: $(liblufs_ftpfs_la_OBJECTS) $(liblufs_ftpfs_la_DEPENDENCIES) + $(CXXLINK) -rpath $(libdir) $(liblufs_ftpfs_la_LDFLAGS) $(liblufs_ftpfs_la_OBJECTS) $(liblufs_ftpfs_la_LIBADD) $(LIBS) + +mostlyclean-compile: + -rm -f *.$(OBJEXT) core *.core + +distclean-compile: + -rm -f *.tab.c + +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ftpfs.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ftplib.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ftpsys_netware.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ftpsys_unix.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ftpsys_windows.Plo@am__quote@ + +distclean-depend: + -rm -rf ./$(DEPDIR) + +.cpp.o: +@am__fastdepCXX_TRUE@ if $(CXXCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" \ +@am__fastdepCXX_TRUE@ -c -o $@ `test -f '$<' || echo '$(srcdir)/'`$<; \ +@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; \ +@am__fastdepCXX_TRUE@ else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; \ +@am__fastdepCXX_TRUE@ fi +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ `test -f '$<' || echo '$(srcdir)/'`$< + +.cpp.obj: +@am__fastdepCXX_TRUE@ if $(CXXCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" \ +@am__fastdepCXX_TRUE@ -c -o $@ `if test -f '$<'; then $(CYGPATH_W) '$<'; else $(CYGPATH_W) '$(srcdir)/$<'; fi`; \ +@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; \ +@am__fastdepCXX_TRUE@ else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; \ +@am__fastdepCXX_TRUE@ fi +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ `if test -f '$<'; then $(CYGPATH_W) '$<'; else $(CYGPATH_W) '$(srcdir)/$<'; fi` + +.cpp.lo: +@am__fastdepCXX_TRUE@ if $(LTCXXCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" \ +@am__fastdepCXX_TRUE@ -c -o $@ `test -f '$<' || echo '$(srcdir)/'`$<; \ +@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Plo"; \ +@am__fastdepCXX_TRUE@ else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; \ +@am__fastdepCXX_TRUE@ fi +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ depfile='$(DEPDIR)/$*.Plo' tmpdepfile='$(DEPDIR)/$*.TPlo' @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(LTCXXCOMPILE) -c -o $@ `test -f '$<' || echo '$(srcdir)/'`$< + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs + +distclean-libtool: + -rm -f libtool +uninstall-info-am: + +ETAGS = etags +ETAGSFLAGS = + +CTAGS = ctags +CTAGSFLAGS = + +tags: TAGS + +ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + mkid -fID $$unique + +TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + tags=; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + test -z "$(ETAGS_ARGS)$$tags$$unique" \ + || $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$tags $$unique + +ctags: CTAGS +CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + tags=; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + test -z "$(CTAGS_ARGS)$$tags$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$tags $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && cd $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) $$here + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) + +top_distdir = ../.. +distdir = $(top_distdir)/$(PACKAGE)-$(VERSION) + +distdir: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \ + list='$(DISTFILES)'; for file in $$list; do \ + case $$file in \ + $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ + $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ + esac; \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test "$$dir" != "$$file" && test "$$dir" != "."; then \ + dir="/$$dir"; \ + $(mkinstalldirs) "$(distdir)$$dir"; \ + else \ + dir=''; \ + fi; \ + if test -d $$d/$$file; then \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ + fi; \ + cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ + else \ + test -f $(distdir)/$$file \ + || cp -p $$d/$$file $(distdir)/$$file \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-am +all-am: Makefile $(LTLIBRARIES) $(HEADERS) + +installdirs: + $(mkinstalldirs) $(DESTDIR)$(libdir) +install: install-am +install-exec: install-exec-am +install-data: install-data-am +uninstall: uninstall-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-am +install-strip: + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + INSTALL_STRIP_FLAG=-s \ + `test -z '$(STRIP)' || \ + echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -rm -f Makefile $(CONFIG_CLEAN_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +clean: clean-am + +clean-am: clean-generic clean-libLTLIBRARIES clean-libtool \ + mostlyclean-am + +distclean: distclean-am + +distclean-am: clean-am distclean-compile distclean-depend \ + distclean-generic distclean-libtool distclean-tags + +dvi: dvi-am + +dvi-am: + +info: info-am + +info-am: + +install-data-am: + +install-exec-am: install-libLTLIBRARIES + +install-info: install-info-am + +install-man: + +installcheck-am: + +maintainer-clean: maintainer-clean-am + +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-compile mostlyclean-generic \ + mostlyclean-libtool + +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + +uninstall-am: uninstall-info-am uninstall-libLTLIBRARIES + +.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ + clean-libLTLIBRARIES clean-libtool ctags distclean \ + distclean-compile distclean-depend distclean-generic \ + distclean-libtool distclean-tags distdir dvi dvi-am info \ + info-am install install-am install-data install-data-am \ + install-exec install-exec-am install-info install-info-am \ + install-libLTLIBRARIES install-man install-strip installcheck \ + installcheck-am installdirs maintainer-clean \ + maintainer-clean-generic mostlyclean mostlyclean-compile \ + mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ + tags uninstall uninstall-am uninstall-info-am \ + uninstall-libLTLIBRARIES + +# 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/filesystems/ftpfs/ftpfs.cpp b/filesystems/ftpfs/ftpfs.cpp new file mode 100644 index 0000000..c5d02ca --- /dev/null +++ b/filesystems/ftpfs/ftpfs.cpp @@ -0,0 +1,550 @@ +/* + * ftpfs.cpp + * Copyright (C) 2002 Florin Malita + * + * This file is part of LUFS, a free userspace filesystem implementation. + * See http://lufs.sourceforge.net/ for updates. + * + * LUFS 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. + * + * LUFS 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 "ftpfs.h" +#include "ftplib.h" +#include "ftpsys.h" +#include "ftpsys_unix.h" +#include "ftpsys_netware.h" +#include "ftpsys_windows.h" + +extern "C"{ + +void* +ftpfs_init(struct list_head *cfg, struct dir_cache *cache, struct credentials *cred, void **global_ctx){ + + if(!lu_opt_getchar(cfg, "MOUNT", "host")){ + ERROR("you must specify a host!"); + return NULL; + } + + return (void*)new FTPFS(cfg, cache, cred); +} + +void +ftpfs_free(void *ctx){ + FTPFS *p = (FTPFS*)ctx; + + delete p; +} + +int +ftpfs_mount(void *ctx){ + return ((FTPFS*)ctx)->do_mount(); +} + +void +ftpfs_umount(void *ctx){ +// return ((FTPFS*)ctx)->do_umount(); +} + +int +ftpfs_readdir(void *ctx, char *dir_name, struct directory *dir){ + return ((FTPFS*)ctx)->do_readdir(dir_name, dir); +} + +int +ftpfs_stat(void *ctx, char *name, struct lufs_fattr *fattr){ + return ((FTPFS*)ctx)->do_stat(name, fattr); +} + +int +ftpfs_mkdir(void *ctx, char *dir, int mode){ + return ((FTPFS*)ctx)->do_mkdir(dir, mode); +} + +int +ftpfs_rmdir(void *ctx, char *dir){ + return ((FTPFS*)ctx)->do_rmdir(dir); +} + +int +ftpfs_create(void *ctx, char *file, int mode){ + return ((FTPFS*)ctx)->do_create(file, mode); +} + +int +ftpfs_unlink(void *ctx, char *file){ + return ((FTPFS*)ctx)->do_unlink(file); +} + +int +ftpfs_rename(void *ctx, char *old_name, char *new_name){ + return ((FTPFS*)ctx)->do_rename(old_name, new_name); +} + +int +ftpfs_open(void *ctx, char *file, unsigned mode){ + return ((FTPFS*)ctx)->do_open(file, mode); +} + +int +ftpfs_release(void *ctx, char *file){ + return ((FTPFS*)ctx)->do_release(file); +} + +int +ftpfs_read(void *ctx, char *file, long long offset, unsigned long count, char *buf){ + return ((FTPFS*)ctx)->do_read(file, offset, count, buf); +} + +int +ftpfs_write(void *ctx, char *file, long long offset, unsigned long count, char *buf){ + return ((FTPFS*)ctx)->do_write(file, offset, count, buf); +} + +int +ftpfs_readlink(void *ctx, char *link, char *buf, int buflen){ + return ((FTPFS*)ctx)->do_readlink(link, buf, buflen); +} + +int +ftpfs_link(void *ctx, char *target, char *link){ + return -1; +} + +int +ftpfs_symlink(void *ctx, char *target, char *link){ + return -1; +} + +int +ftpfs_setattr(void *ctx, char *file, struct lufs_fattr *fattr){ + return ((FTPFS*)ctx)->do_setattr(file, fattr); +} + +} /* extern "C" */ + + + + +FTPFS::FTPFS(struct list_head *cf, struct dir_cache *cache, struct credentials *cred){ + const char *c, *user, *pass; + long int port; + int active = 0; + + TRACE("in constructor"); + + cfg = cf; + this->cache = cache; + this->cred = cred; + + rw_timeout = 0; + if((c = lu_opt_getchar(cfg, "FTPFS", "RWTimeout"))){ + rw_timeout = atoi(c); + TRACE("RWTimeout set to "<connect(); + if(res >= 0){ + /* ftpsys initialization */ + if(!strcmp(conn->system, "NETWARE")) + ftpsys = new ftpsys_netware(); + else if(!strcmp(conn->system, "Windows_NT")) + ftpsys = new ftpsys_windows(); + else + ftpsys = new ftpsys_unix(); + + TRACE("list command: "<CMD_LIST); + } + + + return (res < 0) ? 0 : 1; +} + +void +FTPFS::do_umount(){ + TRACE(""); + + conn->disconnect(); +} + +int +FTPFS::do_readdir(char *dir, struct directory *d){ + int res; + struct lufs_fattr fattr; + + TRACE("dir: "<execute_retry(string("CWD ") + dir, 250, 1)) < 0){ + WARN("CWD failed!"); + goto out; + } + + if((res = conn->execute_open(string(ftpsys->CMD_LIST), string("A"), 0)) < 0){ + WARN("execute_open failed!"); + goto out; + } + + if((res = lu_check_to(conn->dsock, 0, rw_timeout))){ + conn->disconnect(); + goto out; + } + + while(fgets(buf, FTP_MAXLINE, conn->dfd)){ + if(ftpsys->parse_line(buf, file, &fattr, link, cred) >= 0){ + lu_cache_add2dir(d, file, link, &fattr); + } + } + if(ferror(conn->dfd)){ + conn->disconnect(); + res = -1; + goto out; + } + + conn->close_data(); + res = 0; + out: + delete buf; + delete link; + delete file; + return res; +} + +int +FTPFS::do_stat(char *file, struct lufs_fattr *fattr){ + string link, s(file); + unsigned i; + void *ddir; + + TRACE("file: "<close_data(); + return 0; +} + +int +FTPFS::do_read(char *file, long long offset, unsigned long count, char *b){ + int res = 0, tries = 0; + + again: + TRACE("read "< FTP_MAXTRIES){ + WARN("too many failures!"); + if(res < 0) + return res; + else + return -1; + } + + if((res = conn->execute_open(string("RETR ") + file, string("I"), offset)) < 0){ + WARN("couldn't open data connection!"); + return res; + } + + if((res = lu_check_to(conn->dsock, 0, rw_timeout))){ + conn->close_data(); + goto again; + } + + if((res = fread(b, 1, count, conn->dfd)) < (int)count){ + TRACE("short read: "<dfd)){ + conn->close_data(); + goto again; + } + } + + conn->last_off += res; + + return res; +} + +int +FTPFS::do_mkdir(char *dir, int mode){ + int res; + + TRACE(""); + + if((res = conn->execute_retry(string("MKD ") + dir, 257, 1)) < 0){ + WARN("MKDIR failed!"); + return res; + } + + return 0; +} + + +int +FTPFS::do_rmdir(char *dir){ + int res; + + TRACE(""); + + if((res = conn->execute_retry(string("RMD ") + dir, 0, 1)) < 0){ + WARN("execute failed!"); + return res; + } + + /* Ugly WarFTP hack */ + if((conn->get_response() / 100) != 2){ + WARN("RMDIR failed!"); + return -1; + } + + return 0; +} + +int +FTPFS::do_unlink(char *file){ + int res; + + TRACE(""); + + if((res = conn->execute_retry(string("DELE ") + file, 250, 1)) < 0){ + WARN("DELE failed!"); + return res; + } + + return 0; +} + +int +FTPFS::do_create(char *file, int mode){ + int res; + + TRACE(""); + + if((res = conn->execute_open(string("STOR ") + file, string("I"), 0)) < 0){ + WARN("couldn't create file!"); + return res; + } + + conn->close_data(); + + return 0; +} + +int +FTPFS::do_rename(char *old, char *nnew){ + int res; + + TRACE(""); + + if((res = conn->execute_retry(string("RNFR ") + old, 350, 1)) < 0){ + WARN("RNFR failed!"); + return res; + } + + + if((res = conn->execute_retry(string("RNTO ") + nnew, 250, 1)) < 0){ + WARN("RNTO failed!"); + return res; + } + + return 0; +} + +int +FTPFS::do_write(char *file, long long offset, unsigned long count, char *b){ + int res = 0, tries = 0; + + TRACE(""); + + again: + if(tries++ > FTP_MAXTRIES){ + WARN("too many failures!"); + if(res < 0) + return res; + else + return -1; + } + + if((res = conn->execute_open(string("STOR ") + file, string("I"), offset)) < 0){ + WARN("couldn't open data connection!"); + return res; + } + + if((res = lu_check_to(0, conn->dsock, rw_timeout))){ + conn->close_data(); + goto again; + } + + if((res = fwrite(b, 1, count, conn->dfd)) < (int)count){ + TRACE("short write: "<dfd)){ + conn->close_data(); + goto again; + } + } + + conn->last_off += res; + + return res; +} + +int +FTPFS::do_setattr(char *file, struct lufs_fattr *fattr){ + int res; + char buf[10]; + + TRACE("setattr "<f_mode & 0777) >= 10) + buf[9] = 0; + + string cmd = string ("SITE CHMOD ") + buf + string(" ") + file; + + TRACE("cmd: "<execute_retry(cmd, 200, 1)) < 0){ + WARN("SITE CHMOD failed!"); + return res; + } + + return 0; +} + + diff --git a/filesystems/ftpfs/ftpfs.h b/filesystems/ftpfs/ftpfs.h new file mode 100644 index 0000000..70b172f --- /dev/null +++ b/filesystems/ftpfs/ftpfs.h @@ -0,0 +1,68 @@ +/* + * ftpfs.h + * Copyright (C) 2002 Florin Malita + * + * This file is part of LUFS, a free userspace filesystem implementation. + * See http://lufs.sourceforge.net/ for updates. + * + * LUFS 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. + * + * LUFS 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 _FTPFS_H_ +#define _FTPFS_H_ + +using namespace std; + +struct directory; +struct dir_cache; + +class FTPConnection; +class FTPsys; + +class FTPFS{ + private: + struct credentials *cred; + struct dir_cache *cache; + struct list_head *cfg; + + FTPConnection *conn; + FTPsys *ftpsys; + int rw_timeout; + + public: + FTPFS(struct list_head*, struct dir_cache*, struct credentials*); + ~FTPFS(); + + int do_mount(); + void do_umount(); + int do_readdir(char*, struct directory*); + int do_stat(char*, struct lufs_fattr*); + int do_readlink(char*, char*, int); + int do_open(char*, unsigned); + int do_release(char*); + int do_read(char*, long long, unsigned long, char*); + int do_mkdir(char*, int); + int do_rmdir(char*); + int do_unlink(char*); + int do_create(char*, int); + int do_rename(char*, char*); + int do_write(char*, long long, unsigned long, char*); + int do_setattr(char*, struct lufs_fattr*); +}; + + +#endif + + diff --git a/filesystems/ftpfs/ftplib.cpp b/filesystems/ftpfs/ftplib.cpp new file mode 100644 index 0000000..96777bf --- /dev/null +++ b/filesystems/ftpfs/ftplib.cpp @@ -0,0 +1,528 @@ +/* + * ftplib.cpp + * Copyright (C) 2002 Florin Malita + * + * This file is part of LUFS, a free userspace filesystem implementation. + * See http://lufs.sourceforge.net/ for updates. + * + * LUFS 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. + * + * LUFS 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 "ftplib.h" + + +FTPConnection::FTPConnection(int act, char *h, unsigned short p, char *u, char *pw){ + TRACE("in constructor"); + + host = string(h); + port = p; + user = string(u); + pass = string(pw); + last_cmd = string(""); + active = act; + csock = dsock = 0; + cfd = dfd = NULL; +} + +FTPConnection::~FTPConnection(){ + TRACE("in destructor"); + disconnect(); +} + +void +FTPConnection::disconnect(){ + if(dfd) + fclose(dfd); + if(dsock) + close(dsock); + if(cfd) + fclose(cfd); + if(csock) + close(csock); + + csock = dsock = 0; + cfd = dfd = 0; +} + +int +FTPConnection::connect(){ + struct hostent *hst; + struct sockaddr_in addr; + int res, i; + + disconnect(); + + if(!(hst = gethostbyname(host.c_str()))){ + ERROR("could not resolve host " << host); + return -1; + } + + if((csock = socket(PF_INET, SOCK_STREAM, 0)) < 0){ + ERROR("socket call failed!"); + return -1; + } + + + memset(&addr, 0, sizeof(struct sockaddr_in)); + addr.sin_family = AF_INET; + addr.sin_port = htons(port); + + for(i = 0; hst->h_addr_list[i]; i++){ + memcpy(&addr.sin_addr.s_addr, hst->h_addr_list[i], 4); + + TRACE("trying to connect to "<h_addr_list[i])<<"..."); + if(!::connect(csock, (struct sockaddr*)&addr, sizeof(struct sockaddr_in))){ + TRACE("connect succeded..."); + break; + } + } + + if(! hst->h_addr_list[i]){ + ERROR("could not connect to server!"); + goto error; + } + + if(!(cfd = fdopen(csock, "r+"))){ + WARN("could not create filestream!"); + goto error; + } + + if(get_response() != 220){ + WARN("protocol error!"); + goto error; + } + + if(execute(string("USER ") + user, 0, 0) < 0){ + WARN("USER failed!"); + goto error; + } + + res = get_response(); + + if((res < 0) || ((res != 331) && (res != 230))){ + WARN("invalid user!"); + goto error; + } + + if((res == 331) && (execute(string("PASS ") + pass, 230, 0) < 0)){ + WARN("login failed!"); + goto error; + } + + if((res = execute(string("SYST"), 0, 0)) < 0){ + WARN("SYST command failed!"); + goto error; + } + + if(! fgets(buf, FTP_MAXLINE, cfd)){ + WARN("no response to SYST!"); + goto error; + } + + if((sscanf(buf, "%u %32s", &res, system) != 2) || (res != 215)){ + WARN("bad response to SYST!"); + goto error; + } + + + + TRACE("logged in. system type is " << system << "."); + + return 0; + + error: + disconnect(); + return -1; +} + +int +FTPConnection::get_response(){ + int res = 0; + unsigned multiline = 0; + + if(!cfd) + return -1; + + if(!fgets(buf, FTP_MAXLINE, cfd)){ + WARN("broken control socket!"); + return -1; + } + + TRACE("line: " << buf); + + if(buf[3] == '-'){ + if(!sscanf(buf, "%u-", &multiline)){ + WARN("bad response!"); + return -1; + } + TRACE("multiline: " << multiline); + } + + if(multiline) + do { + if(!fgets(buf, FTP_MAXLINE, cfd)){ + WARN("broken control socket!"); + return -1; + } + + TRACE("line: " << buf); + + if(buf[3] == ' ') + sscanf(buf, "%u ", &res); + }while((unsigned)res != multiline); + + else if(!sscanf(buf, "%u", &res)){ + WARN("bad response!"); + return -1; + } + + return res; +} + +int +FTPConnection::close_data(){ + if(dfd){ + fclose(dfd); + dfd = NULL; + } + + if(dsock){ + close(dsock); + dsock = 0; + return get_response(); + } + + return 0; +} + +int +FTPConnection::execute_retry(string cmd, int r, int reconnect){ + int res, tries = 0; + + do { + res = execute(cmd, r, reconnect); + }while((res == -EAGAIN) && (tries++ < FTP_MAXTRIES)); + + return res; +} + +int +FTPConnection::execute(string cmd, int r, int reconnect){ + int res; + + close_data(); + + if(cfd == NULL){ + if((!reconnect) || (connect() < 0)){ + WARN("could not connect!"); + return -1; + } + } + TRACE("executing " << cmd); + + cmd += "\r\n"; + + if((res = fwrite(cmd.c_str(), 1, cmd.size(), cfd)) != (int)cmd.size() || (fflush(cfd))){ + WARN("write error!"); + if((!reconnect) || ((res = connect()) < 0)){ + WARN("could not reconnect!"); + return res; + } + } + + if(r){ + if((res = get_response()) != r){ + WARN("command failed!"); + if((reconnect) && ((res < 0) || (res == 421))){ + if((res = connect()) < 0) + return res; + else + return -EAGAIN; + }else + return -1; + } + } + + return 0; +} + +int +FTPConnection::execute_open(string cmd, string type, long long offset){ + + if((!csock) || (!cfd)){ + TRACE("control socket not connected."); + disconnect(); + if(connect() < 0) + return -1; + } + + if(active) + return execute_open_active(cmd, type, offset); + else + return execute_open_passive(cmd, type, offset); +} + +int +FTPConnection::execute_open_active(string cmd, string type, long long offset){ + struct sockaddr_in addr, ctrl; + int res, ssock, tries = 0; + + + if((dsock == 0) || (dfd == NULL) || (offset != last_off) || (cmd != last_cmd)){ + + again: + + if(tries++ > FTP_MAXTRIES){ + WARN("too many failures!"); + return -1; + } + + close_data(); + memset(&addr, 0, sizeof(struct sockaddr_in)); + addr.sin_addr.s_addr = INADDR_ANY; + addr.sin_port = 0; + addr.sin_family = AF_INET; + + if((ssock = socket(PF_INET, SOCK_STREAM, 0)) < 0){ + WARN("socket call failed!"); + return ssock; + } + + if((res = bind(ssock, (struct sockaddr*)&addr, sizeof(struct sockaddr_in))) < 0){ + WARN("bind call failed!"); + close(ssock); + return res; + } + + if((res = listen(ssock, 2)) < 0){ + WARN("listen call failed!"); + close(ssock); + return res; + } + + res = sizeof(struct sockaddr_in); + if((res = getsockname(csock, (struct sockaddr*)&ctrl, (socklen_t*)&res)) < 0){ + WARN("getsockname call failed!"); + close(ssock); + return res; + } + + res = sizeof(struct sockaddr_in); + if((res = getsockname(ssock, (struct sockaddr*)&addr, (socklen_t*)&res)) < 0){ + WARN("getsockname call failed!"); + close(ssock); + return res; + } + + sprintf(buf, "PORT %u,%u,%u,%u,%u,%u", + ctrl.sin_addr.s_addr & 0xff, + (ctrl.sin_addr.s_addr >> 8) & 0xff, + (ctrl.sin_addr.s_addr >> 16) & 0xff, + (ctrl.sin_addr.s_addr >> 24) & 0xff, + ntohs(addr.sin_port) >> 8, + ntohs(addr.sin_port) & 0xff); + TRACE("cmd: " << buf); + + if((res = execute(string(buf), 200, 1)) < 0){ + close(ssock); + if(res == -EAGAIN) + goto again; + return res; + } + + if((res = execute(string("TYPE ") + type, 200, 1)) < 0){ + close(ssock); + if(res == -EAGAIN) + goto again; + return res; + } + + sprintf(buf, "REST %llu", offset); + if(offset && ((res = execute(string(buf), 350,1)) < 0)){ + close(ssock); + if(res == -EAGAIN) + goto again; + return res; + } + + if((res = execute(cmd, 150, 1)) < 0){ + close(ssock); + if(res == -EAGAIN) + goto again; + return res; + } + + res = sizeof(struct sockaddr_in); + if((res = accept(ssock, (struct sockaddr*)&addr, (socklen_t*)&res)) < 0){ + WARN("accept call failed!"); + close(ssock); + return res; + } + + close(ssock); + + dsock = res; + if((dfd = fdopen(dsock, "r+")) == NULL){ + WARN("fdopen failed!"); + return -1; + } + + last_cmd = cmd; + last_off = offset; + + }else + TRACE("keepalive..."); + + return 0; +} + +int +getIP(char *buf, unsigned long *ip, unsigned short *port){ + int res; + unsigned char i0,i1, i2, i3, p0, p1; + + if((res = sscanf(buf," (%hhu,%hhu,%hhu,%hhu,%hhu,%hhu)", &i0, &i1, &i2, &i3, &p0, &p1)) != 6){ + WARN("bad format, res=" << res); + return -1; + } + + TRACE("buf: " << buf); + TRACE("(i0,i1,i2,i3,p0,p1)=("<<(int)i0<<","<<(int)i1<<","<<(int)i2<<","<<(int)i3<<","<<(int)p0<<","<<(int)p1<<")"); + + *ip = ntohl((unsigned)i0 + (((unsigned)i1) << 8) + (((unsigned)i2) << 16) + (((unsigned)i3) << 24)); + *port = ntohs((unsigned)p0 + (((unsigned)p1) << 8)); + + TRACE("IP: " << *ip << "(" << inet_ntoa(*(struct in_addr*)ip) << ")"); + TRACE("port: " << *port); + + return 0; +} + +int +FTPConnection::execute_open_passive(string cmd, string type, long long offset){ + int res, tries = 0; + unsigned long ip; + unsigned short port; + struct sockaddr_in addr; + + TRACE("dsock: "< FTP_MAXTRIES){ + WARN("too many failures!"); + return -1; + } + + TRACE("reopening data connection..."); + + if((res = execute(string("PASV"), 0, 1)) < 0){ + WARN("PASV command failed!"); + + if(res == -EAGAIN) + goto again; + return res; + } + + if(!fgets(buf, FTP_MAXLINE, cfd)){ + WARN("no response!"); + goto again; + } + + if((!sscanf(buf, "%u", &res)) || (res != 227)){ + WARN("bad response!"); + goto again; + } + + if(getIP(strchr(buf, '('), &ip, &port) < 0){ + WARN("could not extract ip/port information!"); + goto again; + } + + if((res = execute(string("TYPE ") + type, 200, 1)) < 0){ + if(res == -EAGAIN) + goto again; + return res; + } + + sprintf(buf, "REST %llu", offset); + if(offset && (res = execute(string(buf), 350, 1)) < 0){ + WARN("could not set offset!"); + if(res == -EAGAIN) + goto again; + return res; + } + + if((res = execute(cmd, 0, 1)) < 0){ + if(res == -EAGAIN) + goto again; + return res; + } + + if((dsock = socket(PF_INET, SOCK_STREAM, 0)) < 0){ + WARN("socket call failed!"); + return dsock; + } + + memset(&addr, 0, sizeof(struct sockaddr_in)); + addr.sin_family = AF_INET; + addr.sin_addr.s_addr = htonl(ip); + addr.sin_port = htons(port); + + if(::connect(dsock, (struct sockaddr*)&addr, sizeof(struct sockaddr_in)) < 0){ + WARN("could not connect to server!"); + return -1; + } + + if(get_response() != 150){ + WARN("bad server response!"); + close(dsock); + dsock = 0; + return -1; + } + + if((dfd = fdopen(dsock, "r+")) == NULL){ + WARN("fdopen failed!"); + close_data(); + return -1; + } + + last_cmd = cmd; + last_off = offset; + }else + TRACE("keepalive..."); + + return 0; +} + diff --git a/filesystems/ftpfs/ftplib.h b/filesystems/ftpfs/ftplib.h new file mode 100644 index 0000000..f05087a --- /dev/null +++ b/filesystems/ftpfs/ftplib.h @@ -0,0 +1,62 @@ +/* + * ftplib.h + * Copyright (C) 2002 Florin Malita + * + * This file is part of LUFS, a free userspace filesystem implementation. + * See http://lufs.sourceforge.net/ for updates. + * + * LUFS 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. + * + * LUFS 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 _FTPLIB_H_ +#define _FTPLIB_H_ + +using namespace std; + +#define FTP_MAXLINE 4096 +#define FTP_MAXFILE 1024 +#define FTP_MAXTRIES 7 + +class FTPConnection { + private: + char buf[FTP_MAXLINE]; + string host, user, pass; + unsigned short port; + int active; + string last_cmd; + + int execute_open_active(string, string, long long); + int execute_open_passive(string, string, long long); + + public: + long long last_off; + int csock, dsock; + FILE *cfd, *dfd; + char system[32]; + + FTPConnection(int, char*, unsigned short, char*, char*); + ~FTPConnection(); + int connect(); + void disconnect(); + int get_response(); + int close_data(); + int execute(string, int, int); + int execute_retry(string, int, int); + int execute_open(string, string, long long); +}; + + +#endif + diff --git a/filesystems/ftpfs/ftpsys.h b/filesystems/ftpfs/ftpsys.h new file mode 100644 index 0000000..f1b6114 --- /dev/null +++ b/filesystems/ftpfs/ftpsys.h @@ -0,0 +1,38 @@ +/* + * ftpsys.h + * Copyright (C) 2002 Florin Malita + * + * This file is part of LUFS, a free userspace filesystem implementation. + * See http://lufs.sourceforge.net/ for updates. + * + * LUFS 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. + * + * LUFS 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 _FTPSYS_H_ +#define _FTPSYS_H_ + +using namespace std; + +class FTPsys { + public: + char *CMD_LIST; + + FTPsys() { }; + virtual ~FTPsys() { }; + virtual int parse_line(char*, char*, struct lufs_fattr*, char*, struct credentials*) = 0; +}; + +#endif + diff --git a/filesystems/ftpfs/ftpsys_netware.cpp b/filesystems/ftpfs/ftpsys_netware.cpp new file mode 100644 index 0000000..891721c --- /dev/null +++ b/filesystems/ftpfs/ftpsys_netware.cpp @@ -0,0 +1,139 @@ +/* + * ftpsys_netware.cpp + * Copyright (C) 2002 Jaroslav Rohel + * inspired by ftpsys_unix writen by Florian Malita + * + * This file is part of LUFS, a free userspace filesystem implementation. + * See http://lufs.sourceforge.net/ for updates. + * + * LUFS 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. + * + * LUFS 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 + +#ifndef __USE_XOPEN +#define __USE_XOPEN +#endif +#include + +#include +#include + +#include "ftpsys.h" +#include "ftpsys_netware.h" + +static char* +next_word(char *c){ + while( (*c != ' ') && (*c != 0)) + c++; + if(! *c) + return c; + + while(*c == ' ') + c++; + return c; +} + +static char* +nth_word(char *line, int n){ + int i; + char *c; + + for(c = line, i = 0; (c != NULL) && (i < n); i++) + c = next_word(c); + + return c; +} + +ftpsys_netware::ftpsys_netware(){ + CMD_LIST = "LIST -al"; +} + +ftpsys_netware::~ftpsys_netware(){ + +} + +int +ftpsys_netware::parse_line(char *buf, char *file, struct lufs_fattr *fattr, char *link, struct credentials *cred){ + unsigned long nlink, size; + int res, own = 0; + struct tm tm; + time_t tt; + char user[32], month[5], day[5], year[6], date[20]; + char *c, *cc; + + *file = *link = user[0] = month[0] = day[0] = year[0] = 0; + + nlink = 1; + if((res = sscanf(buf, "%*2s %*12s %32s %lu %3s %2s %5s %1024s", user, &size, month, day, year, file)) < 6){ + WARN("could only match "<user, user)) + own = 1; + + memset(fattr, 0, sizeof(struct lufs_fattr)); + fattr->f_nlink = nlink; + fattr->f_size = size; + fattr->f_ctime = fattr->f_mtime = fattr->f_atime = mktime(&tm); + + if(tolower(buf[0]) == 'd') fattr->f_mode = S_IFDIR; + else fattr->f_mode = S_IFREG; + + fattr->f_mode |= S_IRUSR | S_IRGRP | S_IROTH | S_IWUSR | S_IWGRP | S_IWOTH; + if (fattr->f_mode & S_IFDIR) fattr->f_mode |= S_IXUSR | S_IXGRP | S_IXOTH; + + for(c = buf; *c; c++){ + if((*c == 0x0a) || (*c == 0x0d)){ + *c = 0; + break; + } + } + + if((c = nth_word(buf, 8))){ + + TRACE("left: " << c); + cc=strstr(c, "->"); + if(cc != NULL){ + *(cc-1) = 0; + strcpy(file, c); + strcpy(link, (cc + 3)); + }else{ + strcpy(file, c); + } + + TRACE("file: " << file<<", link: " << link); + return 0; + }else + return -1; +} diff --git a/filesystems/ftpfs/ftpsys_netware.h b/filesystems/ftpfs/ftpsys_netware.h new file mode 100644 index 0000000..9283cdb --- /dev/null +++ b/filesystems/ftpfs/ftpsys_netware.h @@ -0,0 +1,36 @@ +/* + * ftpsys_netware.h + * Copyright (C) 2002 Jaroslav Rohel + * + * This file is part of LUFS, a free userspace filesystem implementation. + * See http://lufs.sourceforge.net/ for updates. + * + * LUFS 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. + * + * LUFS 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 _FTPSYS_NETWARE_H_ +#define _FTPSYS_NETWARE_H_ + +using namespace std; + +class ftpsys_netware : public FTPsys { + public: + ftpsys_netware(); + virtual ~ftpsys_netware(); + virtual int parse_line(char*, char*, struct lufs_fattr*, char*, struct credentials*); +}; + +#endif + diff --git a/filesystems/ftpfs/ftpsys_unix.cpp b/filesystems/ftpfs/ftpsys_unix.cpp new file mode 100644 index 0000000..2d28227 --- /dev/null +++ b/filesystems/ftpfs/ftpsys_unix.cpp @@ -0,0 +1,163 @@ +/* + * ftpsys_unix.cpp + * Copyright (C) 2002 Florin Malita + * + * This file is part of LUFS, a free userspace filesystem implementation. + * See http://lufs.sourceforge.net/ for updates. + * + * LUFS 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. + * + * LUFS 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 + +#ifndef __USE_XOPEN +#define __USE_XOPEN +#endif + +#include + +#include +#include + +#include "ftpsys.h" +#include "ftpsys_unix.h" + +static char* +next_word(char *c){ + while( (*c != ' ') && (*c != 0)) + c++; + if(! *c) + return c; + + while(*c == ' ') + c++; + return c; +} + +static char* +nth_word(char *line, int n){ + int i; + char *c; + + for(c = line, i = 0; (c != NULL) && (i < n); i++) + c = next_word(c); + + return c; +} + +ftpsys_unix::ftpsys_unix(){ + CMD_LIST = "LIST -al"; +} + +ftpsys_unix::~ftpsys_unix(){ + +} + +int +ftpsys_unix::parse_line(char *buf, char *file, struct lufs_fattr *fattr, char *link, struct credentials *cred){ + unsigned long nlink, size; + int res; + struct tm tm; + time_t tt; + char user[32], group[32], month[5], day[5], year[6], date[20]; + char *c, *cc; + + *file = *link = user[0] = group[0] = month[0] = day[0] = year[0] = 0; + + if((res = sscanf(buf, "%*11s %lu %32s %32s %lu %3s %2s %5s %1024s -> %1024s", &nlink, user, group, &size, month, day, year, file, link)) < 7){ + TRACE("could only match "<uid == atoi(user)) + fattr->f_uid = 1; + }else{ + if(!strcmp(cred->user, user)) + fattr->f_uid = 1; + } + + strtol(group, &c, 10); + if(*c == 0){ + if((int)cred->gid == atoi(group)) + fattr->f_gid = 1; + }else{ + if(!strcmp(cred->group, group)) + fattr->f_gid = 1; + } + + fattr->f_nlink = nlink; + fattr->f_size = size; + fattr->f_ctime = fattr->f_mtime = fattr->f_atime = mktime(&tm); + + if(tolower(buf[0]) == 'd') fattr->f_mode = S_IFDIR; + else if(tolower(buf[0]) == 'l') fattr->f_mode = S_IFLNK; + else fattr->f_mode = S_IFREG; + + if(tolower(buf[1]) != '-') fattr->f_mode |= S_IRUSR; + if(tolower(buf[2]) != '-') fattr->f_mode |= S_IWUSR; + if(tolower(buf[3]) != '-') fattr->f_mode |= S_IXUSR; + if(tolower(buf[4]) != '-') fattr->f_mode |= S_IRGRP; + if(tolower(buf[5]) != '-') fattr->f_mode |= S_IWGRP; + if(tolower(buf[6]) != '-') fattr->f_mode |= S_IXGRP; + if(tolower(buf[7]) != '-') fattr->f_mode |= S_IROTH; + if(tolower(buf[8]) != '-') fattr->f_mode |= S_IWOTH; + if(tolower(buf[9]) != '-') fattr->f_mode |= S_IXOTH; + + for(c = buf; *c; c++){ + if((*c == 0x0a) || (*c == 0x0d)){ + *c = 0; + break; + } + } + + + if((c = nth_word(buf, 8))){ + + TRACE("left: " << c); + cc=strstr(c, "->"); + if(cc != NULL){ + *(cc-1) = 0; + strcpy(file, c); + strcpy(link, (cc + 3)); + }else{ + strcpy(file, c); + } + + TRACE("file: " << file<<", link: " << link); + return 0; + }else + return -1; +} diff --git a/filesystems/ftpfs/ftpsys_unix.h b/filesystems/ftpfs/ftpsys_unix.h new file mode 100644 index 0000000..5be304a --- /dev/null +++ b/filesystems/ftpfs/ftpsys_unix.h @@ -0,0 +1,38 @@ +/* + * ftpsys_unix.h + * Copyright (C) 2002 Florin Malita + * + * This file is part of LUFS, a free userspace filesystem implementation. + * See http://lufs.sourceforge.net/ for updates. + * + * LUFS 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. + * + * LUFS 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 _FTPSYS_UNIX_H_ +#define _FTPSYS_UNIX_H_ + +using namespace std; + +class ftpsys_unix : public FTPsys { + public: + ftpsys_unix(); + virtual ~ftpsys_unix(); + virtual int parse_line(char*, char*, struct lufs_fattr*, char*, struct credentials*); +}; + + + +#endif + diff --git a/filesystems/ftpfs/ftpsys_windows.cpp b/filesystems/ftpfs/ftpsys_windows.cpp new file mode 100644 index 0000000..b445882 --- /dev/null +++ b/filesystems/ftpfs/ftpsys_windows.cpp @@ -0,0 +1,114 @@ +/* + * ftpsys_windows.cpp + * Copyleft (C) 2002 Zachary Bedell + * Based on ftpsys_unix.cpp which is: + * Copyright (C) 2002 Florin Malita + * + * This file is part of LUFS, a free userspace filesystem implementation. + * See http://lufs.sourceforge.net/ for updates. + * + * LUFS 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. + * + * LUFS 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 + +#ifndef __USE_XOPEN +#define __USE_XOPEN +#endif + +#include + +#include +#include + +#include "ftpsys.h" +#include "ftpsys_windows.h" + +static char* +next_word(char *c){ + while( (*c != ' ') && (*c != 0)) + c++; + if(! *c) + return c; + + while(*c == ' ') + c++; + return c; +} + +ftpsys_windows::ftpsys_windows(){ + CMD_LIST = "LIST -al"; +} + +ftpsys_windows::~ftpsys_windows(){ + +} + +int +ftpsys_windows::parse_line(char *buf, char *file, struct lufs_fattr *fattr, char *link, struct credentials *cred){ + unsigned long size = 0; + int res; + struct tm tm; + time_t tt; + char sDate[20], sTime[20], datetime[40]; + + *file = *link = sDate[0] = sTime[0] = datetime[0] = 0; + + if(tolower(buf[25]) == 'd') { + res = sscanf(buf, "%8s %7s %*5s %1024s", sDate, sTime, file); + } else { + res = sscanf(buf, "%8s %7s %lu %1024s", sDate, sTime, &size, file); + } + + if(res < 2) { + TRACE("could only match "<f_uid = 1; + fattr->f_gid = 1; + + fattr->f_nlink = 0; + fattr->f_size = size; + fattr->f_ctime = fattr->f_mtime = fattr->f_atime = mktime(&tm); + + if(tolower(buf[25]) == 'd') fattr->f_mode = S_IFDIR; + else fattr->f_mode = S_IFREG; + + fattr->f_mode |= S_IRUSR | S_IWUSR | S_IXUSR | S_IRGRP | S_IWGRP | S_IXGRP | S_IROTH | S_IWOTH | S_IXOTH; + + TRACE("file: " << file<<", link: " << link); + return 0; +} + + diff --git a/filesystems/ftpfs/ftpsys_windows.h b/filesystems/ftpfs/ftpsys_windows.h new file mode 100644 index 0000000..1ff7124 --- /dev/null +++ b/filesystems/ftpfs/ftpsys_windows.h @@ -0,0 +1,38 @@ +/* + * ftpsys_windows.h + * Copyleft (C) 2002 Zachary Bedell + * Based on ftpsys_unix.h which is: + * Copyright (C) 2002 Florin Malita + * + * This file is part of LUFS, a free userspace filesystem implementation. + * See http://lufs.sourceforge.net/ for updates. + * + * LUFS 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. + * + * LUFS 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 _FTPSYS_WINDOWS_H_ +#define _FTPSYS_WINDOWS_H_ + +using namespace std; + +class ftpsys_windows : public FTPsys { + public: + ftpsys_windows(); + virtual ~ftpsys_windows(); + virtual int parse_line(char*, char*, struct lufs_fattr*, char*, struct credentials*); +}; + + +#endif diff --git a/filesystems/gnetfs/Makefile.am b/filesystems/gnetfs/Makefile.am new file mode 100644 index 0000000..21837ba --- /dev/null +++ b/filesystems/gnetfs/Makefile.am @@ -0,0 +1,12 @@ +INCLUDES=-I../ @all_includes@ + +noinst_LIBRARIES=libgnet.a +lib_LTLIBRARIES=liblufs-gnetfs.la + +noinst_HEADERS=xfer.h search.h vtree.h gnetfs.h list.h gnet.h gnet_lib.h gnet_engine.h gnet_channel.h gnet_proto.h gnet_msg.h gnet_defaults.h gnet_search.h gnet_host.h gnet_xfer.h + +libgnet_a_SOURCES=gnet_engine.c gnet_channel.c gnet_proto.c gnet_msg.c gnet_search.c gnet_host.c gnet_xfer.c + +liblufs_gnetfs_la_SOURCES=xfer.c search.c vtree.c gnetfs.c +liblufs_gnetfs_la_LDFLAGS=-version-info 1:0:0 +liblufs_gnetfs_la_LIBADD=libgnet.a diff --git a/filesystems/gnetfs/Makefile.in b/filesystems/gnetfs/Makefile.in new file mode 100644 index 0000000..2bba5b0 --- /dev/null +++ b/filesystems/gnetfs/Makefile.in @@ -0,0 +1,495 @@ +# Makefile.in generated by automake 1.7.5 from Makefile.am. +# @configure_input@ + +# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003 +# Free Software Foundation, Inc. +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ + +srcdir = @srcdir@ +top_srcdir = @top_srcdir@ +VPATH = @srcdir@ +pkgdatadir = $(datadir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +top_builddir = ../.. + +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +INSTALL = @INSTALL@ +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = @build@ +host_triplet = @host@ +target_triplet = @target@ +ACLOCAL = @ACLOCAL@ +AMDEP_FALSE = @AMDEP_FALSE@ +AMDEP_TRUE = @AMDEP_TRUE@ +AMTAR = @AMTAR@ +AUTOCONF = @AUTOCONF@ +AUTOFS_INSTALL = @AUTOFS_INSTALL@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CXX = @CXX@ +CXXDEPMODE = @CXXDEPMODE@ +CXXFLAGS = @CXXFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DEBUG_FLAGS = @DEBUG_FLAGS@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +ECHO = @ECHO@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +EXEEXT = @EXEEXT@ +GCONF = @GCONF@ +GVFSCONF = @GVFSCONF@ +GVFS_CFLAGS = @GVFS_CFLAGS@ +GVFS_LDADD = @GVFS_LDADD@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +KDEBUG_FLAGS = @KDEBUG_FLAGS@ +KERNEL_DIR = @KERNEL_DIR@ +KERNEL_HDR = @KERNEL_HDR@ +LDFLAGS = @LDFLAGS@ +LIBCHIPCARD_INCLUDES = @LIBCHIPCARD_INCLUDES@ +LIBCHIPCARD_LIB = @LIBCHIPCARD_LIB@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LIBTOOL = @LIBTOOL@ +LN_S = @LN_S@ +LTLIBOBJS = @LTLIBOBJS@ +LUFS_SUID = @LUFS_SUID@ +MAKEINFO = @MAKEINFO@ +MODULES_DIR = @MODULES_DIR@ +MODV_FLAGS = @MODV_FLAGS@ +OBJEXT = @OBJEXT@ +OS_DIR = @OS_DIR@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +RANLIB = @RANLIB@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +SSHPROG = @SSHPROG@ +STRIP = @STRIP@ +VERSION = @VERSION@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_CXX = @ac_ct_CXX@ +ac_ct_RANLIB = @ac_ct_RANLIB@ +ac_ct_STRIP = @ac_ct_STRIP@ +all_includes = @all_includes@ +all_libraries = @all_libraries@ +am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ +am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ +am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@ +am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +datadir = @datadir@ +define_has_libchipcard = @define_has_libchipcard@ +exec_prefix = @exec_prefix@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localstatedir = @localstatedir@ +mandir = @mandir@ +oldincludedir = @oldincludedir@ +opt_fs = @opt_fs@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +sysconfdir = @sysconfdir@ +target = @target@ +target_alias = @target_alias@ +target_cpu = @target_cpu@ +target_os = @target_os@ +target_vendor = @target_vendor@ +INCLUDES = -I../ @all_includes@ + +noinst_LIBRARIES = libgnet.a +lib_LTLIBRARIES = liblufs-gnetfs.la + +noinst_HEADERS = xfer.h search.h vtree.h gnetfs.h list.h gnet.h gnet_lib.h gnet_engine.h gnet_channel.h gnet_proto.h gnet_msg.h gnet_defaults.h gnet_search.h gnet_host.h gnet_xfer.h + +libgnet_a_SOURCES = gnet_engine.c gnet_channel.c gnet_proto.c gnet_msg.c gnet_search.c gnet_host.c gnet_xfer.c + +liblufs_gnetfs_la_SOURCES = xfer.c search.c vtree.c gnetfs.c +liblufs_gnetfs_la_LDFLAGS = -version-info 1:0:0 +liblufs_gnetfs_la_LIBADD = libgnet.a +subdir = filesystems/gnetfs +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +mkinstalldirs = $(SHELL) $(top_srcdir)/config/mkinstalldirs +CONFIG_HEADER = $(top_builddir)/config.h +CONFIG_CLEAN_FILES = +LIBRARIES = $(noinst_LIBRARIES) + +libgnet_a_AR = $(AR) cru +libgnet_a_LIBADD = +am_libgnet_a_OBJECTS = gnet_engine.$(OBJEXT) gnet_channel.$(OBJEXT) \ + gnet_proto.$(OBJEXT) gnet_msg.$(OBJEXT) gnet_search.$(OBJEXT) \ + gnet_host.$(OBJEXT) gnet_xfer.$(OBJEXT) +libgnet_a_OBJECTS = $(am_libgnet_a_OBJECTS) +LTLIBRARIES = $(lib_LTLIBRARIES) + +liblufs_gnetfs_la_DEPENDENCIES = libgnet.a +am_liblufs_gnetfs_la_OBJECTS = xfer.lo search.lo vtree.lo gnetfs.lo +liblufs_gnetfs_la_OBJECTS = $(am_liblufs_gnetfs_la_OBJECTS) + +DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir) +depcomp = $(SHELL) $(top_srcdir)/config/depcomp +am__depfiles_maybe = depfiles +@AMDEP_TRUE@DEP_FILES = ./$(DEPDIR)/gnet_channel.Po \ +@AMDEP_TRUE@ ./$(DEPDIR)/gnet_engine.Po ./$(DEPDIR)/gnet_host.Po \ +@AMDEP_TRUE@ ./$(DEPDIR)/gnet_msg.Po ./$(DEPDIR)/gnet_proto.Po \ +@AMDEP_TRUE@ ./$(DEPDIR)/gnet_search.Po ./$(DEPDIR)/gnet_xfer.Po \ +@AMDEP_TRUE@ ./$(DEPDIR)/gnetfs.Plo ./$(DEPDIR)/search.Plo \ +@AMDEP_TRUE@ ./$(DEPDIR)/vtree.Plo ./$(DEPDIR)/xfer.Plo +COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ + $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +LTCOMPILE = $(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) \ + $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +CCLD = $(CC) +LINK = $(LIBTOOL) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ + $(AM_LDFLAGS) $(LDFLAGS) -o $@ +DIST_SOURCES = $(libgnet_a_SOURCES) $(liblufs_gnetfs_la_SOURCES) +HEADERS = $(noinst_HEADERS) + +DIST_COMMON = $(noinst_HEADERS) Makefile.am Makefile.in +SOURCES = $(libgnet_a_SOURCES) $(liblufs_gnetfs_la_SOURCES) + +all: all-am + +.SUFFIXES: +.SUFFIXES: .c .lo .o .obj +$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4) + cd $(top_srcdir) && \ + $(AUTOMAKE) --gnu filesystems/gnetfs/Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe) + +AR = ar + +clean-noinstLIBRARIES: + -test -z "$(noinst_LIBRARIES)" || rm -f $(noinst_LIBRARIES) +libgnet.a: $(libgnet_a_OBJECTS) $(libgnet_a_DEPENDENCIES) + -rm -f libgnet.a + $(libgnet_a_AR) libgnet.a $(libgnet_a_OBJECTS) $(libgnet_a_LIBADD) + $(RANLIB) libgnet.a +libLTLIBRARIES_INSTALL = $(INSTALL) +install-libLTLIBRARIES: $(lib_LTLIBRARIES) + @$(NORMAL_INSTALL) + $(mkinstalldirs) $(DESTDIR)$(libdir) + @list='$(lib_LTLIBRARIES)'; for p in $$list; do \ + if test -f $$p; then \ + f="`echo $$p | sed -e 's|^.*/||'`"; \ + echo " $(LIBTOOL) --mode=install $(libLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) $$p $(DESTDIR)$(libdir)/$$f"; \ + $(LIBTOOL) --mode=install $(libLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) $$p $(DESTDIR)$(libdir)/$$f; \ + else :; fi; \ + done + +uninstall-libLTLIBRARIES: + @$(NORMAL_UNINSTALL) + @list='$(lib_LTLIBRARIES)'; for p in $$list; do \ + p="`echo $$p | sed -e 's|^.*/||'`"; \ + echo " $(LIBTOOL) --mode=uninstall rm -f $(DESTDIR)$(libdir)/$$p"; \ + $(LIBTOOL) --mode=uninstall rm -f $(DESTDIR)$(libdir)/$$p; \ + done + +clean-libLTLIBRARIES: + -test -z "$(lib_LTLIBRARIES)" || rm -f $(lib_LTLIBRARIES) + @list='$(lib_LTLIBRARIES)'; for p in $$list; do \ + dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \ + test "$$dir" = "$$p" && dir=.; \ + echo "rm -f \"$${dir}/so_locations\""; \ + rm -f "$${dir}/so_locations"; \ + done +liblufs-gnetfs.la: $(liblufs_gnetfs_la_OBJECTS) $(liblufs_gnetfs_la_DEPENDENCIES) + $(LINK) -rpath $(libdir) $(liblufs_gnetfs_la_LDFLAGS) $(liblufs_gnetfs_la_OBJECTS) $(liblufs_gnetfs_la_LIBADD) $(LIBS) + +mostlyclean-compile: + -rm -f *.$(OBJEXT) core *.core + +distclean-compile: + -rm -f *.tab.c + +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gnet_channel.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gnet_engine.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gnet_host.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gnet_msg.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gnet_proto.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gnet_search.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gnet_xfer.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gnetfs.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/search.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/vtree.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xfer.Plo@am__quote@ + +distclean-depend: + -rm -rf ./$(DEPDIR) + +.c.o: +@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" \ +@am__fastdepCC_TRUE@ -c -o $@ `test -f '$<' || echo '$(srcdir)/'`$<; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; \ +@am__fastdepCC_TRUE@ else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; \ +@am__fastdepCC_TRUE@ fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(COMPILE) -c `test -f '$<' || echo '$(srcdir)/'`$< + +.c.obj: +@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" \ +@am__fastdepCC_TRUE@ -c -o $@ `if test -f '$<'; then $(CYGPATH_W) '$<'; else $(CYGPATH_W) '$(srcdir)/$<'; fi`; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; \ +@am__fastdepCC_TRUE@ else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; \ +@am__fastdepCC_TRUE@ fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(COMPILE) -c `if test -f '$<'; then $(CYGPATH_W) '$<'; else $(CYGPATH_W) '$(srcdir)/$<'; fi` + +.c.lo: +@am__fastdepCC_TRUE@ if $(LTCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" \ +@am__fastdepCC_TRUE@ -c -o $@ `test -f '$<' || echo '$(srcdir)/'`$<; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Plo"; \ +@am__fastdepCC_TRUE@ else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; \ +@am__fastdepCC_TRUE@ fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/$*.Plo' tmpdepfile='$(DEPDIR)/$*.TPlo' @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ `test -f '$<' || echo '$(srcdir)/'`$< + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs + +distclean-libtool: + -rm -f libtool +uninstall-info-am: + +ETAGS = etags +ETAGSFLAGS = + +CTAGS = ctags +CTAGSFLAGS = + +tags: TAGS + +ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + mkid -fID $$unique + +TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + tags=; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + test -z "$(ETAGS_ARGS)$$tags$$unique" \ + || $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$tags $$unique + +ctags: CTAGS +CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + tags=; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + test -z "$(CTAGS_ARGS)$$tags$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$tags $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && cd $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) $$here + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) + +top_distdir = ../.. +distdir = $(top_distdir)/$(PACKAGE)-$(VERSION) + +distdir: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \ + list='$(DISTFILES)'; for file in $$list; do \ + case $$file in \ + $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ + $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ + esac; \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test "$$dir" != "$$file" && test "$$dir" != "."; then \ + dir="/$$dir"; \ + $(mkinstalldirs) "$(distdir)$$dir"; \ + else \ + dir=''; \ + fi; \ + if test -d $$d/$$file; then \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ + fi; \ + cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ + else \ + test -f $(distdir)/$$file \ + || cp -p $$d/$$file $(distdir)/$$file \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-am +all-am: Makefile $(LIBRARIES) $(LTLIBRARIES) $(HEADERS) + +installdirs: + $(mkinstalldirs) $(DESTDIR)$(libdir) +install: install-am +install-exec: install-exec-am +install-data: install-data-am +uninstall: uninstall-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-am +install-strip: + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + INSTALL_STRIP_FLAG=-s \ + `test -z '$(STRIP)' || \ + echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -rm -f Makefile $(CONFIG_CLEAN_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +clean: clean-am + +clean-am: clean-generic clean-libLTLIBRARIES clean-libtool \ + clean-noinstLIBRARIES mostlyclean-am + +distclean: distclean-am + +distclean-am: clean-am distclean-compile distclean-depend \ + distclean-generic distclean-libtool distclean-tags + +dvi: dvi-am + +dvi-am: + +info: info-am + +info-am: + +install-data-am: + +install-exec-am: install-libLTLIBRARIES + +install-info: install-info-am + +install-man: + +installcheck-am: + +maintainer-clean: maintainer-clean-am + +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-compile mostlyclean-generic \ + mostlyclean-libtool + +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + +uninstall-am: uninstall-info-am uninstall-libLTLIBRARIES + +.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ + clean-libLTLIBRARIES clean-libtool clean-noinstLIBRARIES ctags \ + distclean distclean-compile distclean-depend distclean-generic \ + distclean-libtool distclean-tags distdir dvi dvi-am info \ + info-am install install-am install-data install-data-am \ + install-exec install-exec-am install-info install-info-am \ + install-libLTLIBRARIES install-man install-strip installcheck \ + installcheck-am installdirs maintainer-clean \ + maintainer-clean-generic mostlyclean mostlyclean-compile \ + mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ + tags uninstall uninstall-am uninstall-info-am \ + uninstall-libLTLIBRARIES + +# 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/filesystems/gnetfs/gnet.h b/filesystems/gnetfs/gnet.h new file mode 100644 index 0000000..460eb65 --- /dev/null +++ b/filesystems/gnetfs/gnet.h @@ -0,0 +1,46 @@ +#ifndef _GNET_H_ +#define _GNET_H_ + +struct gnet; + +struct gnet_config { + int shared_files; + int shared_kb; + unsigned short listen_port; + unsigned short query_ttl; + unsigned query_wait; + unsigned min_speed; + unsigned min_hosts; + unsigned max_hosts; + unsigned keep_peers; + unsigned keep_connecting; + unsigned connect_to; + unsigned rw_to; + unsigned check_to; +}; + + +struct gnet_xfer; +struct gnet_locator { + char *name; + char ip[4]; + char guid[16]; + unsigned short port; + unsigned long index; + unsigned long size; + unsigned long bwidth; + struct list_head list; + struct gnet_xfer *xfer; + int firewalled; +}; + +struct gnet *gnet_init(struct gnet_config*); +void gnet_shutdown(struct gnet*); +void gnet_set_defaults(struct gnet_config*); +void gnet_stop_search(struct gnet*, unsigned long); +void gnet_xfer_shutdown(struct gnet_locator*); +int gnet_start_search(struct gnet*, char*, void(*)(void*, struct gnet_locator*, unsigned long), void*, unsigned, unsigned long*); +int gnet_add_peer(struct gnet*, char*, unsigned short); +int gnet_xfer_read(struct gnet*, struct gnet_locator*, unsigned long, unsigned long, char*); + +#endif diff --git a/filesystems/gnetfs/gnet_channel.c b/filesystems/gnetfs/gnet_channel.c new file mode 100644 index 0000000..98c7e74 --- /dev/null +++ b/filesystems/gnetfs/gnet_channel.c @@ -0,0 +1,481 @@ +#include +#include +#include +#include +#include +#include +#include + +#include +#include + +#include "list.h" +#include "gnet_lib.h" +#include "gnet_channel.h" +#include "gnet_engine.h" +#include "gnet_proto.h" +#include "gnet_msg.h" +#include "gnet_host.h" + +static char CONNECT_STRING[] = "GNUTELLA CONNECT/0.6\r\nUser-Agent: lufs\r\nBye-Packet: 0.1\r\n\r\n"; +static char CONFIRM_STRING[] = "GNUTELLA/0.6 200 OK\r\n\r\n"; + +struct channel* +gnet_channel_create(struct gnet *gnet){ + struct channel *chan; + + if(!(chan = malloc(sizeof(struct channel)))) + return NULL; + + memset(chan, 0, sizeof(struct channel)); + + INIT_LIST_HEAD(&chan->c_out); + INIT_LIST_HEAD(&chan->c_guids); + chan->c_engine = gnet; + + return chan; +} + +void +gnet_channel_destroy(struct gnet *gnet, struct channel *chan){ + struct list_head *p, *tmp; + struct msgref *ref; + struct bnode *node; + + list_for_each_safe(p, tmp, &chan->c_out){ + ref = list_entry(p, struct msgref, list); + + list_del(&ref->list); + gnet_delete_message(ref->msg); + free(ref); + } + + list_for_each_safe(p, tmp, &chan->c_guids){ + node = list_entry(p, struct bnode, list); + + if(gnet_delete_guid(gnet, node->guid) < 0) + WARN("could not delete guid?!"); + } + + free(chan); +} + +int +gnet_channel_connect(struct channel *chan){ + unsigned long flags; + struct sockaddr_in addr; + + memset(&addr, 0, sizeof(struct sockaddr_in)); + addr.sin_family = AF_INET; + addr.sin_port = htons(chan->c_port); + memcpy(&addr.sin_addr.s_addr, chan->c_addr, 4); + + chan->c_state = CHANNEL_STATE_CONNECTING; + chan->c_substate = CONNECT_STATE_START; + chan->c_testwr = 1; + chan->c_stamp = time(NULL); + + if((chan->c_fd = socket(PF_INET, SOCK_STREAM, 0)) < 0) + return -1; + + if(fcntl(chan->c_fd, F_GETFL, &flags) < 0){ + close(chan->c_fd); + return -1; + } + + flags |= O_NONBLOCK; + + if(fcntl(chan->c_fd, F_SETFL, &flags) < 0){ + close(chan->c_fd); + return -1; + } + + fcntl(chan->c_fd, F_GETFL, &flags); + if(!(flags & O_NONBLOCK)){ + ERROR("BLOCKING SOCKET!!!"); + } + + if(connect(chan->c_fd, (struct sockaddr*)&addr, sizeof(struct sockaddr_in)) < 0){ + if(errno != EINPROGRESS){ + close(chan->c_fd); + return -1; + } +// TRACE("connection initiated"); + }else{ + WARN("connection completed!?!?!?!"); + } + + return 0; +} + +int +gnet_add_peer(struct gnet *gnet, char *host, unsigned short port){ + struct hostent *hst; + struct channel *chan; + + if(!(hst = gethostbyname(host))){ + WARN("could not resolve host %s: %s", host, strerror(errno)); + return -1; + } + + if(!(chan = gnet_channel_create(gnet))) + return -1; + + memcpy(chan->c_addr, hst->h_addr_list[0], 4); + chan->c_port = port; + + if(gnet_channel_connect(chan) < 0){ + WARN("could not initiate connection: %s", strerror(errno)); + gnet_channel_destroy(gnet, chan); + return -1; + } + + pthread_mutex_lock(&gnet->g_channels_lock); + + list_add(&chan->c_list, &gnet->g_channels); + gnet->g_connecting_peers++; + + pthread_mutex_unlock(&gnet->g_channels_lock); + + gnet_engine_signal(gnet, 0); + +// TRACE("new peer added to list..."); + + return 0; +} + +void +gnet_test_rd(struct gnet *gnet, struct channel *chan){ + + chan->c_testrd = 1; + + FD_SET(chan->c_fd, &gnet->g_rdset); + FD_SET(chan->c_fd, &gnet->g_exset); + + if(chan->c_fd > gnet->g_maxfd) + gnet->g_maxfd = chan->c_fd; +} + +void +gnet_test_wr(struct gnet *gnet, struct channel *chan){ + + chan->c_testwr = 1; + + FD_SET(chan->c_fd, &gnet->g_wrset); + FD_SET(chan->c_fd, &gnet->g_exset); + + if(chan->c_fd > gnet->g_maxfd) + gnet->g_maxfd = chan->c_fd; +} + +void +gnet_untest_rd(struct gnet *gnet, struct channel *chan){ + + chan->c_testrd = 0; + + FD_CLR(chan->c_fd, &gnet->g_rdset); + + if(!FD_ISSET(chan->c_fd, &gnet->g_wrset)){ + FD_CLR(chan->c_fd, &gnet->g_exset); + if(chan->c_fd == gnet->g_maxfd) + gnet->g_maxfd--; + } +} + +void +gnet_untest_wr(struct gnet *gnet, struct channel *chan){ + + chan->c_testwr = 0; + + FD_CLR(chan->c_fd, &gnet->g_wrset); + + if(!FD_ISSET(chan->c_fd, &gnet->g_rdset)){ + FD_CLR(chan->c_fd, &gnet->g_exset); + if(chan->c_fd == gnet->g_maxfd) + gnet->g_maxfd--; + } +} + +void +gnet_drop_channel(struct gnet *gnet, struct channel *chan){ + + + TRACE("dropping channel %d", chan->c_fd); + + if(CONNECTED(chan)) + gnet->g_connected_peers--; + else + gnet->g_connecting_peers--; + + gnet_untest_rd(gnet, chan); + gnet_untest_wr(gnet, chan); + + close(chan->c_fd); + + list_del(&chan->c_list); + gnet_channel_destroy(gnet, chan); + + TRACE("peers left: %d", gnet->g_connected_peers); + + if(gnet->g_connected_peers < gnet->g_cfg->keep_peers){ +// TRACE("trying to open some more connections"); + gnet_check_peers(gnet); + } +} + +static void +handshake(struct gnet *gnet, struct channel *chan, int op){ + int res; + +// TRACE("substate: %d, op: %d", chan->c_substate, op); + + chan->c_stamp = time(NULL); + + switch(chan->c_substate){ + case CONNECT_STATE_START: + if(op == GNET_OP_WRITE){ + socklen_t len; + + len = sizeof(int); + if(getsockopt(chan->c_fd, SOL_SOCKET, SO_ERROR, &res, &len) < 0){ + WARN("could not get sock options!"); + gnet_drop_channel(gnet, chan); + break; + } + + if(res){ + WARN("connect failed: %s", strerror(res)); + gnet_drop_channel(gnet, chan); + break; + } + +// TRACE("connected..."); + + chan->c_substate = CONNECT_STATE_HANDSHAKE1; + chan->c_out_index = 0; + } + break; + + case CONNECT_STATE_HANDSHAKE1: + { + int to_send; + + to_send = strlen(CONNECT_STRING) - chan->c_out_index; + + if((res = write(chan->c_fd, CONNECT_STRING + chan->c_out_index, to_send)) <= 0){ + WARN("write failed: %s", strerror(errno)); + gnet_drop_channel(gnet, chan); + break; + } + + chan->c_out_index += res; + + if(res == to_send){ +// TRACE("connect string sent..."); + + chan->c_substate = CONNECT_STATE_HANDSHAKE2; + chan->c_in_index = 0; + gnet_test_rd(gnet, chan); + gnet_untest_wr(gnet, chan); + } + } + break; + + case CONNECT_STATE_HANDSHAKE2: + if((res = read(chan->c_fd, chan->c_buf + chan->c_in_index, MAX_BUFFER - chan->c_in_index)) <= 0){ + WARN("read failed: %s", strerror(errno)); + gnet_drop_channel(gnet, chan); + break; + } + +// TRACE("read %d bytes", res); + + if((chan->c_in_index += res) >= 4){ + if(!strncmp(chan->c_buf + chan->c_in_index - 4, "\r\n\r\n", 4)){ +// TRACE("connect string received..."); + + if(sscanf(chan->c_buf, "GNUTELLA/0.%*c %d ", &res) != 1){ + WARN("could not read status code!"); + gnet_drop_channel(gnet, chan); + break; + } + + if(res != 200){ + WARN("connection rejected: %d", res); + gnet_get_hosts(gnet, chan->c_buf); + gnet_drop_channel(gnet, chan); + break; + } + + chan->c_substate = CONNECT_STATE_HANDSHAKE3; + chan->c_out_index = 0; + gnet_test_wr(gnet, chan); + gnet_untest_rd(gnet, chan); + } + } + + break; + + case CONNECT_STATE_HANDSHAKE3: + { + int to_send; + + to_send = strlen(CONFIRM_STRING) - chan->c_out_index; + + if((res = write(chan->c_fd, CONFIRM_STRING + chan->c_out_index, to_send)) <= 0){ + WARN("write failed: %s", strerror(errno)); + gnet_drop_channel(gnet, chan); + break; + } + + chan->c_out_index += res; + + if(res == to_send){ + TRACE("channel connected :)"); + + chan->c_state = CHANNEL_STATE_CONNECTED; + chan->c_in_index = 0; + chan->c_out_index = 0; + gnet_test_rd(gnet, chan); + gnet_untest_wr(gnet, chan); + + gnet->g_connecting_peers--; + gnet->g_connected_peers++; + } + } + break; + + default: + WARN("unknown state %d", chan->c_substate); + gnet_drop_channel(gnet, chan); + } + +} + +static int +io_read(struct gnet *gnet, struct channel *chan){ + int res, len; + + if(chan->c_in_index < GNET_HDR_SIZE){ +// TRACE("reading header..."); + + len = GNET_HDR_SIZE - chan->c_in_index; + + }else{ +// TRACE("reading message..."); + if(GNET_SIZE(chan->c_buf) >= MAX_BUFFER - GNET_HDR_SIZE){ + ERROR("!!!message too long: %d!!!", GNET_SIZE(chan->c_buf)); + return 0; + } + +// TRACE("msg size: %d", GNET_SIZE(chan->c_buf)); + + len = GNET_HDR_SIZE + GNET_SIZE(chan->c_buf) - chan->c_in_index; + } + + if((res = read(chan->c_fd, chan->c_buf + chan->c_in_index, len)) <= 0) + return res; + +// TRACE("read %d bytes", res); + + chan->c_in_index += res; + chan->c_stamp = time(NULL); + + return res; +} + +static int +io_write(struct gnet *gnet, struct channel *chan){ + struct msgref *ref; + int len, res; + + ref = list_entry(chan->c_out.next, struct msgref, list); + len = GNET_HDR_SIZE + GNET_SIZE(ref->msg->m_data) - chan->c_out_index; + +// TRACE("trying to write %d bytes", len); + + if((res = write(chan->c_fd, ref->msg->m_data + chan->c_out_index, len)) <= 0) + return res; + +// TRACE("wrote %d bytes", res); + + chan->c_out_index += res; + chan->c_stamp = time(NULL); + + return res; +} + +void +gnet_channel_io(struct gnet *gnet, struct channel *chan, int op){ + struct msgref *ref; + int res; + +// TRACE("fd: %d, op: %d", chan->c_fd, op); + + switch(chan->c_state){ + case CHANNEL_STATE_CONNECTING: + handshake(gnet, chan, op); + break; + + case CHANNEL_STATE_CONNECTED: + if(op & GNET_OP_READ){ + if((res = io_read(gnet, chan)) <= 0){ + if(res < 0) + WARN("read failed: %d(%s)", errno, strerror(errno)); + else + WARN("connection closed by peer"); + + gnet_drop_channel(gnet, chan); + break; + } + + if(chan->c_in_index == GNET_HDR_SIZE + GNET_SIZE(chan->c_buf)){ +// TRACE("read a whole message"); + +// gnet_trace_message(chan->c_buf); + + if(gnet_handle_message(gnet, chan) < 0){ + WARN("processing failed!"); + gnet_drop_channel(gnet, chan); + break; + } + + chan->c_in_index = 0; + } + } + + if((op & GNET_OP_WRITE) && (!list_empty(&chan->c_out))){ + ref = list_entry(chan->c_out.next, struct msgref, list); + + if((res = io_write(gnet, chan)) <= 0){ + if(res < 0) + WARN("write failed: %d(%s)", errno, strerror(errno)); + gnet_drop_channel(gnet, chan); + break; + } + + if(chan->c_out_index == GNET_HDR_SIZE + GNET_SIZE(ref->msg->m_data)){ +// TRACE("wrote a whole message..."); + +// gnet_trace_message(ref->msg->m_data); + + chan->c_out_index = 0; + list_del(&ref->list); + gnet_delete_message(ref->msg); + free(ref); + + if(list_empty(&chan->c_out)){ +// TRACE("no more messages in queue."); + gnet_untest_wr(gnet, chan); + } + } + } + + + break; + + default: + WARN("unknown state: %d", chan->c_state); + gnet_drop_channel(gnet, chan); + } +} diff --git a/filesystems/gnetfs/gnet_channel.h b/filesystems/gnetfs/gnet_channel.h new file mode 100644 index 0000000..a66a2af --- /dev/null +++ b/filesystems/gnetfs/gnet_channel.h @@ -0,0 +1,52 @@ +#ifndef _GNET_CHANNEL_H_ +#define _GNET_CHANNEL_H_ + +#define GNET_OP_EX 0x00 +#define GNET_OP_READ 0x01 +#define GNET_OP_WRITE 0x02 + + +#define CHANNEL_STATE_DISCONNECTED 0x00 +#define CHANNEL_STATE_CONNECTING 0x01 +#define CHANNEL_STATE_CONNECTED 0x02 + +#define CONNECT_STATE_START 0x00 +#define CONNECT_STATE_HANDSHAKE1 0x01 +#define CONNECT_STATE_HANDSHAKE2 0x02 +#define CONNECT_STATE_HANDSHAKE3 0x03 + +#define CONNECTED(c) (c->c_state == CHANNEL_STATE_CONNECTED) + +struct gnet; + +struct channel { + int c_fd; + int c_state; + int c_substate; + int c_testrd; + int c_testwr; + int c_failures; + int c_out_index; + int c_in_index; + unsigned short c_port; + char c_addr[4]; + char c_buf[MAX_BUFFER]; + time_t c_stamp; + struct gnet *c_engine; + struct list_head c_list; + struct list_head c_out; + struct list_head c_guids; +}; + +int gnet_add_peer(struct gnet*, char*, unsigned short); +int gnet_channel_connect(struct channel*); +void gnet_channel_destroy(struct gnet*, struct channel*); +void gnet_channel_io(struct gnet*, struct channel*, int); +void gnet_test_rd(struct gnet*, struct channel*); +void gnet_test_wr(struct gnet*, struct channel*); +void gnet_untest_rd(struct gnet*, struct channel*); +void gnet_untest_wr(struct gnet*, struct channel*); +void gnet_drop_channel(struct gnet*, struct channel*); +struct channel *gnet_channel_create(struct gnet*); + +#endif diff --git a/filesystems/gnetfs/gnet_defaults.h b/filesystems/gnetfs/gnet_defaults.h new file mode 100644 index 0000000..384a4df --- /dev/null +++ b/filesystems/gnetfs/gnet_defaults.h @@ -0,0 +1,24 @@ +#ifndef _GNET_DEFAULTS_H_ +#define _GNET_DEFAULTS_H_ + +#define DEF_LISTEN_PORT 0 + +#define DEF_SHARED_FILES 10 +#define DEF_SHARED_KB 10000 + +#define DEF_MIN_SPEED 0 +#define DEF_QUERY_TTL 7 +#define DEF_QUERY_WAIT 180 + +#define DEF_KEEP_PEERS 4 +#define DEF_KEEP_CONNECTING 14 +#define DEF_MIN_HOSTS 3 +#define DEF_MAX_HOSTS 200 + +#define DEF_CHECK_TO 6 +#define DEF_CONNECT_TO 30 +#define DEF_RW_TO 100 + + +#endif + diff --git a/filesystems/gnetfs/gnet_engine.c b/filesystems/gnetfs/gnet_engine.c new file mode 100644 index 0000000..a220d4b --- /dev/null +++ b/filesystems/gnetfs/gnet_engine.c @@ -0,0 +1,278 @@ +#include +#include +#include +#include +#include + +#include +#include +#include + +#include + +#include "gnet_lib.h" +#include "gnet_engine.h" +#include "gnet_channel.h" +#include "gnet_msg.h" +#include "gnet_host.h" +#include "gnet_search.h" +#include "gnet_defaults.h" + +static void +rescan_sets(struct gnet *gnet){ + struct list_head *p; + struct channel *chan; + + FD_ZERO(&gnet->g_rdset); + FD_ZERO(&gnet->g_wrset); + FD_ZERO(&gnet->g_exset); + + FD_SET(gnet->g_signal_fd[0], &gnet->g_rdset); + FD_SET(gnet->g_signal_fd[0], &gnet->g_exset); + gnet->g_maxfd = gnet->g_signal_fd[0]; + + pthread_mutex_lock(&gnet->g_channels_lock); + + list_for_each(p, &gnet->g_channels){ + chan = list_entry(p, struct channel, c_list); +// TRACE("channel state: %d", chan->c_state); + + if(chan->c_state != CHANNEL_STATE_DISCONNECTED){ + if(chan->c_testrd){ +// TRACE("adding fd for reading..."); + + FD_SET(chan->c_fd, &gnet->g_rdset); + FD_SET(chan->c_fd, &gnet->g_exset); + if(chan->c_fd > gnet->g_maxfd) + gnet->g_maxfd = chan->c_fd; + } + + if(chan->c_testwr){ +// TRACE("adding fd for writing..."); + + FD_SET(chan->c_fd, &gnet->g_wrset); + FD_SET(chan->c_fd, &gnet->g_exset); + if(chan->c_fd > gnet->g_maxfd) + gnet->g_maxfd = chan->c_fd; + } + } + } + + pthread_mutex_unlock(&gnet->g_channels_lock); +} + +static int +check_to(struct gnet *gnet, struct channel *chan, time_t now){ + if(now - chan->c_stamp >= (chan->c_state == CHANNEL_STATE_CONNECTING ? gnet->g_cfg->connect_to : gnet->g_cfg->rw_to)){ + TRACE("channel timed out %s ", chan->c_state == CHANNEL_STATE_CONNECTING? "connecting":"on rw"); + + gnet_drop_channel(gnet, chan); + return 1; + } + + return 0; +} + +static void +engine_loop(struct gnet *gnet){ + struct list_head *p, *tmp; + struct timeval tv; + fd_set rd_set, wr_set, ex_set; + int res, done = 0; + time_t now; + + TRACE("entering I/O loop..."); + + rescan_sets(gnet); + + do { + rd_set = gnet->g_rdset; + wr_set = gnet->g_wrset; + ex_set = gnet->g_exset; + + tv.tv_sec = gnet->g_cfg->check_to; + tv.tv_usec = 0; + + if((res = select(gnet->g_maxfd + 1, &rd_set, &wr_set, &ex_set, &tv)) < 0){ + if(errno == EINTR){ + TRACE("interrupted..."); + continue; + }else{ + WARN("select failed: %s", strerror(errno)); + done = 1; + break; + } + } + +// TRACE("status: %d connected channels, %d connecting channels", gnet->g_connected_peers, gnet->g_connecting_peers); + + if(FD_ISSET(gnet->g_signal_fd[0], &rd_set)){ + while((res = read(gnet->g_signal_fd[0], gnet->g_buf, MAX_BUFFER)) == MAX_BUFFER); + if(res <= 0){ + TRACE("signal pipe closed"); + break; + } + + TRACE("got a rescan signal"); + + rescan_sets(gnet); + continue; + } + + pthread_mutex_lock(&gnet->g_channels_lock); + + now = time(NULL); + + list_for_each_safe(p, tmp, &gnet->g_channels){ + struct channel *chan = list_entry(p, struct channel, c_list); + + if(check_to(gnet, chan, now)) + continue; + + if(FD_ISSET(chan->c_fd, &rd_set)) + gnet_channel_io(gnet, chan, GNET_OP_READ); + else if(FD_ISSET(chan->c_fd, &wr_set)) + gnet_channel_io(gnet, chan, GNET_OP_WRITE); + else if(FD_ISSET(chan->c_fd, &ex_set)) + gnet_channel_io(gnet, chan, GNET_OP_EX); + + } + + gnet_check_peers(gnet); + + pthread_mutex_unlock(&gnet->g_channels_lock); + + }while(!done); + + TRACE("exiting I/O loop..."); + +} + +static void* +thread_launcher(void *param){ + struct gnet *gnet = (struct gnet*)param; + + TRACE("engine thread created..."); + + engine_loop(gnet); + + TRACE("engine thread exiting..."); + + return NULL; +} + +void +gnet_shutdown(struct gnet *gnet){ + struct list_head *p, *tmp; + struct query *q; + struct host *h; + int res; + + TRACE("shutting down gnet engine..."); + + close(gnet->g_signal_fd[1]); + + if((res = pthread_join(gnet->g_thread, NULL))) + TRACE("join failed: %s", strerror(res)); + + TRACE("engine thread stopped..."); + + list_for_each_safe(p, tmp, &gnet->g_channels) + gnet_channel_destroy(gnet, list_entry(p, struct channel, c_list)); + + list_for_each_safe(p, tmp, &gnet->g_queries){ + q = list_entry(p, struct query, list); + list_del(&q->list); + free(q); + } + + list_for_each_safe(p, tmp, &gnet->g_hosts){ + h = list_entry(p, struct host, list); + list_del(&h->list); + free(h); + } + + close(gnet->g_signal_fd[0]); + + free(gnet->g_cfg); + free(gnet); +} + +struct gnet* +gnet_init(struct gnet_config *conf){ + struct gnet *gnet; + struct gnet_config *cfg; + + TRACE("initializing gnet engine..."); + + srandom(time(NULL)); + + if(!(cfg = malloc(sizeof(struct gnet_config)))){ + WARN("out of mem!"); + return NULL; + } + + memcpy(cfg, conf, sizeof(struct gnet_config)); + + if(!(gnet = malloc(sizeof(struct gnet)))){ + WARN("out of memory!"); + goto fail_gnet; + } + + memset(gnet, 0, sizeof(struct gnet)); + + if(pipe(gnet->g_signal_fd) < 0){ + WARN("could not create pipe: %s", strerror(errno)); + goto fail_thread; + } + + gnet_make_guid(gnet->g_guid); + + gnet->g_cfg = cfg; + + INIT_LIST_HEAD(&gnet->g_channels); + INIT_LIST_HEAD(&gnet->g_queries); + INIT_LIST_HEAD(&gnet->g_hosts); + pthread_mutex_init(&gnet->g_channels_lock, NULL); + + gnet->g_guids_root.guid[0] = 0x80; + + if(pthread_create(&gnet->g_thread, NULL, thread_launcher, gnet)){ + WARN("could not create thread!"); + goto fail_thread; + } + + return gnet; + + fail_thread: + free(gnet); + fail_gnet: + free(cfg); + + return NULL; +} + +void +gnet_engine_signal(struct gnet *gnet, char sig){ + + write(gnet->g_signal_fd[1], &sig, 1); +} + +void +gnet_set_defaults(struct gnet_config *cfg){ + + cfg->shared_files = DEF_SHARED_FILES; + cfg->shared_kb = DEF_SHARED_KB; + cfg->listen_port = DEF_LISTEN_PORT; + cfg->query_ttl = DEF_QUERY_TTL; + cfg->query_wait = DEF_QUERY_WAIT; + cfg->min_speed = DEF_MIN_SPEED; + cfg->keep_peers = DEF_KEEP_PEERS; + cfg->keep_connecting= DEF_KEEP_CONNECTING; + cfg->min_hosts = DEF_MIN_HOSTS; + cfg->max_hosts = DEF_MAX_HOSTS; + cfg->check_to = DEF_CHECK_TO; + cfg->rw_to = DEF_RW_TO; + cfg->connect_to = DEF_CONNECT_TO; +} + diff --git a/filesystems/gnetfs/gnet_engine.h b/filesystems/gnetfs/gnet_engine.h new file mode 100644 index 0000000..737b7a0 --- /dev/null +++ b/filesystems/gnetfs/gnet_engine.h @@ -0,0 +1,7 @@ +#ifndef _GNET_ENGINE_H_ +#define _GNET_ENGINE_H_ + +void gnet_engine_signal(struct gnet*, char); + + +#endif diff --git a/filesystems/gnetfs/gnet_host.c b/filesystems/gnetfs/gnet_host.c new file mode 100644 index 0000000..dc32cde --- /dev/null +++ b/filesystems/gnetfs/gnet_host.c @@ -0,0 +1,134 @@ +#include +#include +#include +#include +#include +#include + +#include + +#include + +#include "gnet_lib.h" +#include "gnet_host.h" +#include "gnet_channel.h" + + + +static int +add_peer(struct gnet *gnet, struct host *hst){ + struct channel *chan; + + if(!(chan = gnet_channel_create(gnet))) + return -1; + + memcpy(chan->c_addr, &hst->ip, 4); + chan->c_port = hst->port; + + if(gnet_channel_connect(chan) < 0){ + WARN("could not initiate connection: %s", strerror(errno)); + gnet_channel_destroy(gnet, chan); + return -1; + } + + list_add(&chan->c_list, &gnet->g_channels); + gnet->g_connecting_peers++; + gnet_test_wr(gnet, chan); + +// TRACE("new peer added..."); + + return 0; +} + +int +gnet_add_host(struct gnet *gnet, char *ip, unsigned short port){ + struct host *hst; + +// TRACE("adding %s:%hu", ip, port); + + if(!(hst = malloc(sizeof(struct host))) || (gnet->g_nr_hosts >= gnet->g_cfg->max_hosts)) + return -1; + + hst->ip = inet_addr(ip); + hst->port = port; + + list_add_tail(&hst->list, &gnet->g_hosts); + gnet->g_nr_hosts++; + +// TRACE("%d known hosts", gnet->g_nr_hosts); + + return 0; +} + +int +gnet_check_peers(struct gnet *gnet){ + struct host *hst; + + if(gnet->g_connected_peers >= gnet->g_cfg->keep_peers){ +// TRACE("enough connected peers"); + return 0; + } + + while((gnet->g_connecting_peers < gnet->g_cfg->keep_connecting) && (!list_empty(&gnet->g_hosts))){ +// TRACE("adding peer"); + hst = list_entry(gnet->g_hosts.next, struct host, list); + + add_peer(gnet, hst); + + list_del(&hst->list); + gnet->g_nr_hosts--; + } + + if(gnet->g_connecting_peers >= gnet->g_cfg->keep_connecting){ +// TRACE("we have enough connecting peers"); + return 0; + }else{ +// TRACE("not enough known hosts..."); + return -1; + } + +} + +int +gnet_get_hosts(struct gnet *gnet, char *reply){ + char *xtry, *eol, *c, *sep; + int found = 0; + +// TRACE("scanning for new hosts..."); + + if(!(xtry = strstr(reply, "X-Try:"))){ +// TRACE("no hosts"); + return -1; + } + + if(!(eol = strstr(xtry, "\r\n"))){ + TRACE("no eol?!"); + return -1; + } + + *eol = 0; + xtry += strlen("X-Try:"); + + while((c = strsep(&xtry, ","))){ +// TRACE("host: %s", c); + + if(!(sep = strchr(c, ':'))){ + TRACE("no port delimiter"); + continue; + } + + *sep++ = 0; + + if(!atoi(sep)){ + TRACE("could not convert port"); + continue; + } + + gnet_add_host(gnet, c, atoi(sep)); + found++; + } + +// TRACE("done"); + + return found; +} diff --git a/filesystems/gnetfs/gnet_host.h b/filesystems/gnetfs/gnet_host.h new file mode 100644 index 0000000..08dbb17 --- /dev/null +++ b/filesystems/gnetfs/gnet_host.h @@ -0,0 +1,13 @@ +#ifndef _GNET_HOST_H_ +#define _GNET_HOST_H_ + +struct host { + in_addr_t ip; + unsigned short port; + struct list_head list; +}; + +int gnet_check_peers(struct gnet*); +int gnet_add_host(struct gnet*, char*, unsigned short); +int gnet_get_hosts(struct gnet*, char*); +#endif diff --git a/filesystems/gnetfs/gnet_lib.h b/filesystems/gnetfs/gnet_lib.h new file mode 100644 index 0000000..07417da --- /dev/null +++ b/filesystems/gnetfs/gnet_lib.h @@ -0,0 +1,62 @@ +#ifndef _GNET_LIB_H_ +#define _GNET_LIB_H_ + +#include +#include + +#include + +#include "list.h" +#include "gnet.h" + +#define MAX_BUFFER 32768 + +struct bnode { + struct bnode *left, *right, **plink; + struct channel *chan; + struct list_head list; + char guid[16]; +}; + +struct gnet { + fd_set g_rdset, g_wrset, g_exset; + int g_maxfd; + int g_signal_fd[2]; + int g_connected_peers; + int g_connecting_peers; + int g_nr_hosts; + pthread_t g_thread; + struct gnet_config *g_cfg; + struct list_head g_channels; + struct list_head g_queries; + struct list_head g_hosts; + pthread_mutex_t g_channels_lock; + char g_buf[MAX_BUFFER]; + char g_guid[16]; + unsigned long g_search_seq; + struct bnode g_guids_root; + unsigned g_guids; +}; + +#ifdef TRACE +#undef TRACE +#endif +#ifdef WARN +#undef WARN +#endif +#ifdef ERROR +#undef ERROR +#endif + +#ifdef DEBUGGING +#define TRACE(x...) do{fprintf(stdout, "[%x](%s) ", getpid(), __func__); fprintf(stdout, x); fprintf(stdout, "\n");}while(0) +#define WARN(x...) do{fprintf(stdout, "[%x](%s) ", getpid(), __func__); fprintf(stdout, x); fprintf(stdout, "\n");}while(0) +#define ERROR(x...) do{fprintf(stderr, "[%x](%s) ", getpid(), __func__); fprintf(stdout, x); fprintf(stdout, "\n");}while(0) +#else +#define TRACE(x...) do{}while(0) +#define WARN(x...) do{}while(0) +#define ERROR(x...) do{fprintf(stderr, x); fprintf(stderr, "\n");}while(0) +#endif + + +#endif diff --git a/filesystems/gnetfs/gnet_msg.c b/filesystems/gnetfs/gnet_msg.c new file mode 100644 index 0000000..c4d28ca --- /dev/null +++ b/filesystems/gnetfs/gnet_msg.c @@ -0,0 +1,257 @@ +#include +#include +#include + +#include "gnet_lib.h" +#include "gnet_channel.h" +#include "gnet_msg.h" +#include "gnet_proto.h" + +static inline int +compare(struct bnode *n1, char *guid){ + int i; + + for(i = 0; i < 16; i++) + if(n1->guid[i] < guid[i]) + return -1; + else if(n1->guid[i] > guid[i]) + return 1; + + return 0; +} + +static inline int +find(struct bnode *root, struct bnode **node, char *guid){ + int res; + + *node = NULL; + + while(root){ + *node = root; + + if(!(res = compare(root, guid))){ + TRACE("node found"); + return 0; + } + + if(res < 0) + root = root->left; + else + root = root->right; + } + + TRACE("node not found"); + + return -1; +} + +static inline int +add(struct bnode *node, struct bnode *root){ + struct bnode *n; + + if(find(root, &n, node->guid) == 0){ + WARN("guid already in tree!"); + return -1; + } + + if(n == NULL) + return -1; + + if(compare(n, node->guid) < 0){ + n->left = node; + node->plink = &n->left; + }else{ + n->right = node; + node->plink = &n->right; + } + + return 0; +} + +static inline void +delete(struct bnode *bnode){ + struct bnode *n; + + if(bnode->left == NULL){ + *(bnode->plink) = bnode->right; + if(bnode->right) + bnode->right->plink = bnode->plink; + + free(bnode); + }else + + if(bnode->right == NULL){ + *(bnode->plink) = bnode->left; + bnode->left->plink = bnode->plink; + + free(bnode); + }else{ + + for(n = bnode->left; n->right; n = n->right); + + bnode->chan = n->chan; + bnode->list = n->list; + memcpy(bnode->guid, n->guid, 16); + + *(n->plink) = n->left; + if(n->left) + n->left->plink = n->plink; + + free(n); + } +} + +int +gnet_delete_guid(struct gnet *gnet, char *guid){ + struct bnode *node; + + if(find(&gnet->g_guids_root, &node, guid) < 0) + return -1; + + list_del(&node->list); + delete(node); + + gnet->g_guids--; + + return 0; +} + +int +gnet_save_guid(struct gnet *gnet, struct channel *chan, char *guid){ + struct bnode *new; + + + if(!(new = malloc(sizeof(struct bnode)))) + return -1; + + memset(new, 0, sizeof(struct bnode)); + + new->chan = chan; + memcpy(new->guid, guid, 16); + + if(add(new, &gnet->g_guids_root) < 0){ + free(new); + return -1; + } + + list_add(&new->list, &chan->c_guids); + gnet->g_guids++; + + return 0; +} + +void +gnet_make_guid(char *guid){ + int i; + + for(i = 0; i < 16; i++) + guid[i] = (char)((((float)random())/RAND_MAX)*256); + + guid[8] = 0xff; + guid[15] = 0x00; +} + +struct message* +gnet_create_message(char *guid, unsigned char type, unsigned char ttl, unsigned char hops, unsigned short data_len){ + struct message *msg; + + if(!(msg = malloc(sizeof(struct message)))) + return NULL; + + memset(msg, 0, sizeof(struct message)); + + if(!(msg->m_data = malloc(GNET_HDR_SIZE + data_len))){ + free(msg); + return NULL; + } + + if(guid) + memcpy(msg->m_data + GNET_FIELD_ID, guid, 16); + else + gnet_make_guid(msg->m_data + GNET_FIELD_ID); + + *(msg->m_data + GNET_FIELD_TYPE) = type; + *(msg->m_data + GNET_FIELD_TTL) = ttl; + *(msg->m_data + GNET_FIELD_HOPS) = hops; + *(uint32_t*)(msg->m_data + GNET_FIELD_SIZE) = HTOGS(data_len); + + return msg; +} + +void +gnet_delete_message(struct message *msg){ + if(--msg->m_count <= 0){ +// TRACE("deleting message"); + free(msg->m_data); + free(msg); + } +} + +int +gnet_add_message(struct gnet *gnet, struct channel *chan, struct message *msg){ + struct msgref *ref; + + if(!(ref = malloc(sizeof(struct msgref)))) + return -1; + + ref->msg = msg; + msg->m_count++; + + list_add_tail(&ref->list, &chan->c_out); + + return 0; +} + +int +gnet_deliver_message_all(struct gnet *gnet, struct channel *skip, struct message *msg){ + struct list_head *p; + struct channel *chan; + int delivered = 0; + + list_for_each(p, &gnet->g_channels){ + chan = list_entry(p, struct channel, c_list); + if((chan->c_state == CHANNEL_STATE_CONNECTED) && (chan != skip)){ +// TRACE("adding message to channel queue..."); + delivered += gnet_add_message(gnet, chan, msg); + gnet_test_wr(gnet, chan); + } + } + + return delivered; +} + +int +gnet_deliver_message_one(struct gnet *gnet, struct channel *chan, struct message *msg){ + if(chan->c_state == CHANNEL_STATE_CONNECTED){ +// TRACE("adding message to channel queue..."); + gnet_test_wr(gnet, chan); + return gnet_add_message(gnet, chan, msg); + }else + return -1; +} + +int +gnet_deliver_message_guid(struct gnet *gnet, struct message *msg, char *guid){ + struct bnode *node; + + if(find(&gnet->g_guids_root, &node, guid) < 0){ + TRACE("message guid not found"); + return -1; + } + + return gnet_deliver_message_one(gnet, node->chan, msg); +} + +void +gnet_trace_message(char *msg){ + TRACE("*MSG_ID: %hhx%hhx%hhx%hhx%hhx%hhx%hhx%hhx%hhx%hhx%hhx%hhx%hhx%hhx%hhx%hhx", + msg[0], msg[1], msg[2], msg[3], + msg[4], msg[5], msg[6], msg[7], + msg[8], msg[9], msg[10], msg[11], + msg[12], msg[13], msg[14], msg[15]); + TRACE("*MSG_TYPE: %hhx", GNET_TYPE(msg)); + TRACE("*MSG_TTL: %hhd", GNET_TTL(msg)); + TRACE("*MSG_HOPS: %hhd", GNET_HOPS(msg)); + TRACE("*MSG_SIZE: %d", GTOHS(GNET_SIZE(msg))); +} + diff --git a/filesystems/gnetfs/gnet_msg.h b/filesystems/gnetfs/gnet_msg.h new file mode 100644 index 0000000..113b53c --- /dev/null +++ b/filesystems/gnetfs/gnet_msg.h @@ -0,0 +1,26 @@ +#ifndef _GNET_MSG_H_ +#define _GNET_MSG_H_ + +struct message { + int m_count; + char *m_data; +}; + +struct msgref { + struct message *msg; + struct list_head list; +}; + +void gnet_trace_message(char*); +void gnet_make_guid(char*); +void gnet_delete_message(struct message*); +struct message *gnet_create_message(char*, unsigned char, unsigned char, unsigned char, unsigned short); +int gnet_add_message(struct gnet*, struct channel*, struct message*); +int gnet_deliver_message_all(struct gnet*, struct channel*, struct message*); +int gnet_deliver_message_one(struct gnet*, struct channel*, struct message*); +int gnet_deliver_message_guid(struct gnet*, struct message*, char*); + +int gnet_save_guid(struct gnet*, struct channel*, char*); +int gnet_delete_guid(struct gnet*, char*); + +#endif diff --git a/filesystems/gnetfs/gnet_proto.c b/filesystems/gnetfs/gnet_proto.c new file mode 100644 index 0000000..1b1f880 --- /dev/null +++ b/filesystems/gnetfs/gnet_proto.c @@ -0,0 +1,147 @@ +#include +#include +#include +#include +#include + +#include +#include + +#include "gnet_lib.h" +#include "gnet_channel.h" +#include "gnet_proto.h" +#include "gnet_msg.h" +#include "gnet_search.h" + +static int +handle_bye(struct gnet *gnet, struct channel *chan){ + char *msg = chan->c_buf; + char *data = msg + GNET_HDR_SIZE; + + TRACE("***got a bye message: %hu", GTOHS(*(uint16_t*)data)); + TRACE("%s", data + 2); + + gnet_drop_channel(gnet, chan); + + return 0; +} + +static int +handle_ping(struct gnet *gnet, struct channel *chan){ + struct message *reply; + char *msg = chan->c_buf; + char *data; + + TRACE("got a ping"); + + if(!(reply = gnet_create_message(GNET_ID(msg), GNET_MSG_PONG, GNET_TTL(msg) + GNET_HOPS(msg), 0, GNET_PONG_SIZE))){ + WARN("could not create reply message: %s", strerror(errno)); + return -1; + } + + data = reply->m_data + GNET_HDR_SIZE; + + *(uint16_t*)data = HTOGS(gnet->g_cfg->listen_port); + *(uint32_t*)(data + 6) = HTOGL(gnet->g_cfg->shared_files); + *(uint32_t*)(data + 10) = HTOGL(gnet->g_cfg->shared_kb); + + if(gnet_deliver_message_one(gnet, chan, reply) < 0){ + WARN("could not deliver message: %s", strerror(errno)); + return -1; + } + + return 0; +} + +static int +handle_pong(struct gnet *gnet, struct channel *chan){ + + TRACE("got a pong"); +// TRACE("FIXME"); + + return 0; +} + +static int +handle_query(struct gnet *gnet, struct channel *chan){ +// TRACE("got a query"); +// TRACE("FIXME"); + + return 0; +} + +static int +handle_query_hits(struct gnet *gnet, struct channel *chan){ + struct gnet_locator loc; + uint8_t hits; + char *msg = chan->c_buf; + char *data = msg + GNET_HDR_SIZE; + char *c; + struct query *q; + int i; + +// TRACE("got some query hits"); + + if((q = gnet_find_query(gnet, msg))){ + hits = *data; + loc.port = GTOHS(*(uint16_t*)(data + 1)); + memcpy(loc.ip, (data + 3), 4); + loc.bwidth = GTOHL(*(uint32_t*)(data + 7)); + + TRACE("0x%hhx hits, server %s:%hu, bandwidth %luKbps", hits, inet_ntoa(*(struct in_addr*)loc.ip), loc.port, loc.bwidth); + + c = data + 11; + for(i = 0; i < hits; i++){ + + loc.index = GTOHL(*(uint32_t*)c); + loc.size = GTOHL(*(uint32_t*)(c + 4)); + loc.name = c + 8; + memcpy(loc.guid, data + GNET_SIZE(msg) - 16, 16); + + TRACE("file: %s, size: %lu, index: %lu", loc.name, loc.size, loc.index); + + c += strlen(loc.name) + 9; + + if(*c){ + TRACE("extension block present"); + } + + c += strlen(c) + 1; + + if(q->call_back) + q->call_back(q->ctx, &loc, q->id); + } + + } + + return 0; +} + +int +gnet_handle_message(struct gnet *gnet, struct channel *chan){ + char *msg = chan->c_buf; + + switch (GNET_TYPE(msg)){ + + case GNET_MSG_PING: + return handle_ping(gnet, chan); + + case GNET_MSG_PONG: + return handle_pong(gnet, chan); + + case GNET_MSG_QUERY: + return handle_query(gnet, chan); + + case GNET_MSG_QHITS: + return handle_query_hits(gnet, chan); + + case GNET_MSG_BYE: + return handle_bye(gnet, chan); + + default: + WARN("unknown message 0x%hhx", GNET_TYPE(msg)); + } + + return 0; +} + diff --git a/filesystems/gnetfs/gnet_proto.h b/filesystems/gnetfs/gnet_proto.h new file mode 100644 index 0000000..5c2153a --- /dev/null +++ b/filesystems/gnetfs/gnet_proto.h @@ -0,0 +1,50 @@ +#ifndef _GNET_PROTO_H_ +#define _GNET_PROTO_H_ + +#include +#include +#include + +#if __BYTE_ORDER == __LITTLE_ENDIAN + +#define GTOHS(x) (x) +#define GTOHL(x) (x) +#define HTOGS(x) (x) +#define HTOGL(x) (x) + +#else + +#define GTOHS(x) bswap_16(x) +#define GTOHL(x) bswap_32(x) +#define HTOGS(x) bswap_16(x) +#define HTOGL(x) bswap_32(x) + +#endif + +#define GNET_MSG_PING 0x00 +#define GNET_MSG_PONG 0x01 +#define GNET_MSG_BYE 0x02 +#define GNET_MSG_VENDOR 0x31 +#define GNET_MSG_STDEXT 0x32 +#define GNET_MSG_PUSH 0x40 +#define GNET_MSG_QUERY 0x80 +#define GNET_MSG_QHITS 0x81 + +#define GNET_FIELD_ID 0x00 +#define GNET_FIELD_TYPE 0x10 +#define GNET_FIELD_TTL 0x11 +#define GNET_FIELD_HOPS 0x12 +#define GNET_FIELD_SIZE 0x13 + +#define GNET_ID(x) ((unsigned char*)x + GNET_FIELD_ID) +#define GNET_TYPE(x) (*((uint8_t*)x + GNET_FIELD_TYPE)) +#define GNET_TTL(x) (*((uint8_t*)x + GNET_FIELD_TTL)) +#define GNET_HOPS(x) (*((uint8_t*)x + GNET_FIELD_HOPS)) +#define GNET_SIZE(x) GTOHL(*(uint32_t*)((char*)x + GNET_FIELD_SIZE)) + +#define GNET_HDR_SIZE 23 +#define GNET_PONG_SIZE 14 + +int gnet_handle_message(struct gnet*, struct channel*); + +#endif diff --git a/filesystems/gnetfs/gnet_search.c b/filesystems/gnetfs/gnet_search.c new file mode 100644 index 0000000..3441d6a --- /dev/null +++ b/filesystems/gnetfs/gnet_search.c @@ -0,0 +1,173 @@ +#include +#include +#include +#include +#include + +#include +#include + +#include +#include + +#include "gnet_lib.h" +#include "gnet_engine.h" +#include "gnet_search.h" +#include "gnet_channel.h" +#include "gnet_msg.h" +#include "gnet_proto.h" + +struct query* +gnet_find_query(struct gnet *gnet, char *id){ + struct list_head *p, *tmp; + struct query *q; + + list_for_each_safe(p, tmp, &gnet->g_queries){ + q = list_entry(p, struct query, list); + + if(time(NULL) - q->stamp > q->time_out){ + TRACE("query expired"); + + list_del(&q->list); + free(q); + continue; + } + + if(!strncmp(q->guid, id, 16)){ + TRACE("query found"); + return q; + } + } + + TRACE("query not found"); + + return NULL; +} + +void +gnet_stop_search(struct gnet *gnet, unsigned long id){ + struct list_head *p; + struct query *q; + + pthread_mutex_lock(&gnet->g_channels_lock); + + list_for_each(p, &gnet->g_queries){ + q = list_entry(p, struct query, list); + if(q->id == id){ + TRACE("query found"); + TRACE("search stopped"); + list_del(&q->list); + free(q); + break; + } + + } + + pthread_mutex_unlock(&gnet->g_channels_lock); + +} + +int +gnet_start_search(struct gnet *gnet, char *txt, void(*cb)(void*, struct gnet_locator*, unsigned long), void *ctx, unsigned to, unsigned long *srch_id){ + struct message *msg; + struct query *query; + char *data; + + TRACE("starting search for %s...", txt); + + if(!(query = malloc(sizeof(struct query)))) + return -1; + + if(!(msg = gnet_create_message(NULL, GNET_MSG_QUERY, gnet->g_cfg->query_ttl, 0, strlen(txt) + 3))){ + WARN("could not create message: %s", strerror(errno)); + free(query); + return -1; + } + + data = msg->m_data + GNET_HDR_SIZE; + *(uint16_t*)data = HTOGS(gnet->g_cfg->min_speed); + strcpy(data + 2, txt); + + memcpy(query->guid, msg->m_data, 16); + query->call_back = cb; + query->ctx = ctx; + query->stamp = time(NULL); + query->id = gnet->g_search_seq++; + + if(srch_id) + *srch_id = query->id; + + if(to) + query->time_out = to; + else + query->time_out = gnet->g_cfg->query_wait; + + pthread_mutex_lock(&gnet->g_channels_lock); + + list_add_tail(&query->list, &gnet->g_queries); + gnet_deliver_message_all(gnet, NULL, msg); + + pthread_mutex_unlock(&gnet->g_channels_lock); + + gnet_engine_signal(gnet, 0); + + return 0; +} + +int +gnet_send_push(struct gnet *gnet, struct gnet_locator *loc, unsigned short port){ + struct list_head *p; + struct channel *chan; + struct message *msg; + struct sockaddr_in addr; + socklen_t len; + char *data; + int found = 0; + + TRACE("sending a push for %s", loc->name); + + if(!(msg = gnet_create_message(NULL, GNET_MSG_PUSH, gnet->g_cfg->query_ttl, 0, 26))){ + WARN("could not create message: %s", strerror(errno)); + return -1; + } + + data = msg->m_data + GNET_HDR_SIZE; + + memcpy(data, loc->guid, 16); + *(uint32_t*)(data + 16) = HTOGL(loc->index); + *(uint16_t*)(data + 24) = HTOGS(port); + + pthread_mutex_lock(&gnet->g_channels_lock); + + list_for_each_prev(p, &gnet->g_channels){ + chan = list_entry(p, struct channel, c_list); + + if(chan->c_state == CHANNEL_STATE_CONNECTED){ + len = sizeof(struct sockaddr_in); + + if(getsockname(chan->c_fd, (struct sockaddr*)&addr, &len) < 0){ + TRACE("getsockname call failed: %s", strerror(errno)); + }else{ + TRACE("local interface: %s", inet_ntoa(*(struct in_addr*)&addr.sin_addr.s_addr)); + + *(uint32_t*)(data + 20) = addr.sin_addr.s_addr; + found = 1; + + break; + } + } + } + + if(!found){ + WARN("could not determine local interface ip!"); + pthread_mutex_unlock(&gnet->g_channels_lock); + return -1; + } + + gnet_deliver_message_all(gnet, NULL, msg); + pthread_mutex_unlock(&gnet->g_channels_lock); + + gnet_engine_signal(gnet, 0); + + return 0; +} diff --git a/filesystems/gnetfs/gnet_search.h b/filesystems/gnetfs/gnet_search.h new file mode 100644 index 0000000..5ce7f82 --- /dev/null +++ b/filesystems/gnetfs/gnet_search.h @@ -0,0 +1,17 @@ +#ifndef _GNET_SEARCH_H_ +#define _GNET_SEARCH_H_ + +struct query { + char guid[16]; + void *ctx; + void (*call_back)(void*, struct gnet_locator*, unsigned long); + struct list_head list; + time_t stamp; + unsigned time_out; + unsigned long id; +}; + +struct query *gnet_find_query(struct gnet*, char*); +int gnet_send_push(struct gnet*, struct gnet_locator*, unsigned short); + +#endif diff --git a/filesystems/gnetfs/gnet_xfer.c b/filesystems/gnetfs/gnet_xfer.c new file mode 100644 index 0000000..74a960c --- /dev/null +++ b/filesystems/gnetfs/gnet_xfer.c @@ -0,0 +1,390 @@ +#include +#include +#include +#include +#include + +#include +#include + +#include +#include + +#include +#include + +#include "gnet_lib.h" +#include "gnet_xfer.h" +#include "gnet_search.h" + +static inline int +set_nb(int fd){ + unsigned long flags; + + fcntl(fd, F_GETFL, &flags); + flags |= O_NONBLOCK; + fcntl(fd, F_SETFL, &flags); + + if((fcntl(fd, F_GETFL, &flags) < 0) || !(flags & O_NONBLOCK)){ + WARN("could not set non-blocking mode: %s", strerror(errno)); + return -1; + } + + return 0; +} + +static inline int +get_sock_error(int fd){ + int res; + socklen_t len = sizeof(int); + + if(getsockopt(fd, SOL_SOCKET, SO_ERROR, &res, &len) < 0){ + WARN("getsockopt failed: %s", strerror(errno)); + return -1; + } + return res; +} + +void +gnet_xfer_shutdown(struct gnet_locator *loc){ + struct gnet_xfer *xfer = loc->xfer; + + if(xfer){ + close(xfer->sock); + free(xfer); + } +} + +static struct gnet_xfer* +create_xfer(){ + struct gnet_xfer *xfer; + + TRACE("creating xfer"); + + xfer = malloc(sizeof(struct gnet_xfer)); + + if(xfer){ + memset(xfer, 0, sizeof(struct gnet_xfer)); + } + + return xfer; +} + +static int +connect_direct(struct gnet *gnet, struct gnet_locator *loc, int time_out){ + struct gnet_xfer *xfer = loc->xfer; + struct sockaddr_in addr; + int res; + + TRACE("connecting to %s:%d", inet_ntoa(*(struct in_addr*)loc->ip), loc->port); + + memset(&addr, 0, sizeof(struct sockaddr_in)); + addr.sin_family = AF_INET; + addr.sin_port = htons(loc->port); + memcpy(&addr.sin_addr.s_addr, loc->ip, 4); + + if(xfer->sock){ + close(xfer->sock); + xfer->connected = 0; + } + + if((xfer->sock = socket(PF_INET, SOCK_STREAM, 0)) < 0){ + WARN("socket call failed: %s", strerror(errno)); + goto fail; + } + + if(set_nb(xfer->sock) < 0) + goto fail_sock; + + if((connect(xfer->sock, (struct sockaddr*)&addr, sizeof(struct sockaddr_in)) < 0) && (errno != EINPROGRESS)){ + WARN("connect call failed: %s", strerror(errno)); + goto fail_sock; + } + + if(lu_check_to(0, xfer->sock, time_out) < 0) + goto fail_sock; + + if((res = get_sock_error(xfer->sock)) != 0){ + WARN("connect failed: %s", strerror(res)); + goto fail_sock; + } + + TRACE("connected"); + + return 0; + + fail_sock: + close(xfer->sock); + xfer->sock = 0; + fail: + return -1; +} + +static int +connect_push(struct gnet *gnet, struct gnet_locator *loc, int time_out){ + struct sockaddr_in addr; + struct gnet_xfer *xfer = loc->xfer; + socklen_t len; + int ssock, res = -1; + int lfs = 0; + char c; + + WARN("push-connecting..."); + + memset(&addr, 0, sizeof(struct sockaddr_in)); + addr.sin_family = AF_INET; + addr.sin_port = 0; + addr.sin_addr.s_addr = INADDR_ANY; + + if(xfer->sock){ + close(xfer->sock); + xfer->connected = 0; + } + + if((ssock = socket(PF_INET, SOCK_STREAM, 0)) < 0){ + WARN("socket call failed: %s", strerror(errno)); + goto out; + } + + if(set_nb(ssock) < 0) + goto out_ssock; + + if(bind(ssock, (struct sockaddr*)&addr, sizeof(struct sockaddr_in)) < 0){ + WARN("bind call failed: %s", strerror(errno)); + goto out_ssock; + } + + if(listen(ssock, 2) < 0){ + WARN("listen call failed: %s", strerror(errno)); + goto out_ssock; + } + + len = sizeof(struct sockaddr_in); + if(getsockname(ssock, (struct sockaddr*)&addr, &len) < 0){ + WARN("getsockname call failed: %s", strerror(errno)); + goto out_ssock; + } + + TRACE("listening on %s:%hu", inet_ntoa(*(struct in_addr*)&addr.sin_addr.s_addr), ntohs(addr.sin_port)); + + if(gnet_send_push(gnet, loc, ntohs(addr.sin_port)) < 0){ + TRACE("could not send push request!"); + goto out_ssock; + } + + if(lu_check_to(ssock, 0, time_out) < 0) + goto out_ssock; + + len = sizeof(struct sockaddr_in); + if((xfer->sock = accept(ssock, (struct sockaddr*)&addr, &len)) < 0){ + WARN("accept call failed: %s", strerror(errno)); + goto out_ssock; + } + + if(set_nb(xfer->sock) < 0) + goto out_ssock; + + do{ + if(lu_atomic_read(xfer->sock, &c, 1, time_out) < 0) + break; + + if(c == '\n') + lfs++; + else + lfs = 0; + }while(lfs < 2); + + if(lfs < 2){ + WARN("could not read reply!"); + goto out_ssock; + } + + TRACE("reply read"); + + res = 0; + + out_ssock: + close(ssock); + out: + return res; +} + +static int +request_file(int sock, struct gnet_locator *loc, unsigned long offset, unsigned long count, int time_out, char *buf, int buflen){ + int len, i, res; + + if(snprintf(buf, buflen, + "GET /get/%lu/%s HTTP/1.1\r\nUser-Agent: Gnutella\r\nHost: %hhu.%hhu.%hhu.%hhu:%hu\r\nConnection: Keep-Alive\r\nRange: bytes=%lu-%lu\r\n\r\n", + loc->index, loc->name, + loc->ip[0], loc->ip[1], loc->ip[2], loc->ip[3], + loc->port, offset, + (count != 0) ? (offset + count - 1) : (loc->size - 1)) >= buflen){ + WARN("buffer too small"); + return -E2BIG; + } + + TRACE(buf); + + len = strlen(buf); + + if((res = lu_atomic_write(sock, buf, len, time_out)) != len) + return res; + + i = 0; + + do{ + if((res = lu_atomic_read(sock, buf + i, 1, time_out)) < 1) + return (res < 0) ? res : -1; + + i++; + + if((i > 3) && !(strncmp(buf + i - 4, "\r\n\r\n", 4))){ + buf[i] = 0; + break; + } + }while(i < buflen - 1); + + if(i >= buflen - 1){ + TRACE("reply too long"); + return -E2BIG; + } + + if((sscanf(buf, "HTTP/1.%*c %d ", &i) != 1) && (sscanf(buf, "HTTP %d ", &i) != 1)){ + WARN("could not parse reply code: %s", buf); + return -EPROTO; + } + + if(i != 200){ + WARN("request rejected: %d", i); + return -EBUSY; + } + + TRACE("file data available"); + + loc->xfer->connected = 1; + loc->xfer->offset = offset; + + return 0; +} + +static int +connect_xfer(struct gnet *gnet, struct gnet_locator *loc, int time_out){ + + if(!loc->firewalled) + if(connect_direct(gnet, loc, time_out) >= 0) + return 0; + + return connect_push(gnet, loc, time_out); +} + +int +gnet_xfer_open(struct gnet *gnet, struct gnet_locator *loc, unsigned long offset, unsigned long count, int time_out){ + struct gnet_xfer *xfer = loc->xfer; + char *buf; + int res; + + if(!(buf = malloc(BUFFER_SIZE))) + return -ENOMEM; + + if(!xfer){ + if(!(xfer = create_xfer())){ + res = -ENOMEM; + goto out; + } + loc->xfer = xfer; + } + + + if(!(xfer->connected)){ + TRACE("xfer not connected"); + + if((res = connect_xfer(gnet, loc, time_out)) < 0) + goto out; + + if((res = request_file(xfer->sock, loc, offset, (xfer->type == TYPE_SERIAL) ? 0 : count, time_out, buf, BUFFER_SIZE)) < 0) + goto out; + + }else{ + TRACE("xfer connected, %s, offset=%lu", (xfer->type == TYPE_SERIAL) ? "serial" : "random", xfer->offset); + + if(xfer->type == TYPE_SERIAL){ + if(xfer->offset == offset){ + TRACE("keep-alive :):):)"); + xfer->last_rnd = 0; + xfer->last_ser++; + }else{ + TRACE("missed, reconnecting :("); + xfer->last_ser = 0; + xfer->last_rnd++; + + if(xfer->last_rnd > MODE_SWITCH){ + TRACE("switching to random mode"); + xfer->type = TYPE_RANDOM; + } + + if((res = connect_xfer(gnet, loc, time_out)) < 0) + goto out; + + if((res = request_file(xfer->sock, loc, offset, (xfer->type == TYPE_SERIAL) ? 0 : count, time_out, buf, BUFFER_SIZE)) < 0) + goto out; + } + }else{ + if(xfer->offset == offset){ + TRACE("serial hit"); + xfer->last_ser++; + xfer->last_rnd = 0; + + if(xfer->last_ser > MODE_SWITCH){ + TRACE("switching to serial mode"); + xfer->type = TYPE_SERIAL; + } + }else{ + TRACE("random hit"); + xfer->last_rnd++; + xfer->last_ser = 0; + } + + if((res = request_file(xfer->sock, loc, offset, (xfer->type == TYPE_SERIAL) ? 0 : count, time_out, buf, BUFFER_SIZE)) < 0) + goto out; + } + + } + + + res = 0; + + out: + free(buf); + return res; +} + + +int +gnet_xfer_read(struct gnet *gnet, struct gnet_locator *loc, unsigned long offset, unsigned long count, char *buf){ + struct gnet_xfer *xfer; + int res; + + if(offset >= loc->size){ + WARN("trying to seek past the end of file: %lu", offset); + return 0; + } + + if(offset + count >= loc->size){ + TRACE("trying to read past the end of file"); + count = loc->size - offset - 1; + } + + if((res = gnet_xfer_open(gnet, loc, offset, count, TIME_OUT)) < 0) + return res; + + xfer = loc->xfer; + + if((res = lu_atomic_read(xfer->sock, buf, count, TIME_OUT)) < 0) + return res; + + xfer->offset += res; + + TRACE("read %lu bytes", count); + + return res; +} diff --git a/filesystems/gnetfs/gnet_xfer.h b/filesystems/gnetfs/gnet_xfer.h new file mode 100644 index 0000000..b3cbbb7 --- /dev/null +++ b/filesystems/gnetfs/gnet_xfer.h @@ -0,0 +1,22 @@ +#ifndef _GNET_XFER_H_ +#define _GNET_XFER_H_ + +#define DATA_IN 1 +#define DATA_OUT 2 + +#define TYPE_SERIAL 0 +#define TYPE_RANDOM 1 + +#define BUFFER_SIZE 4096 +#define MODE_SWITCH 5 +#define TIME_OUT 10 + +struct gnet_xfer { + int sock; + int connected; + int type; + int last_ser, last_rnd; + unsigned long offset; +}; + +#endif diff --git a/filesystems/gnetfs/gnetfs.c b/filesystems/gnetfs/gnetfs.c new file mode 100644 index 0000000..eaca68c --- /dev/null +++ b/filesystems/gnetfs/gnetfs.c @@ -0,0 +1,376 @@ +#include +#include +#include +#include +#include +#include +#include + +#include +#include + +#include "list.h" +#include "gnet.h" +#include "gnetfs.h" +#include "vtree.h" +#include "search.h" +#include "xfer.h" + +static struct global_ctx* +init_global(struct list_head *cfg){ + struct global_ctx *glob; + struct gnet_config gcfg; + int i, known_peers = 5; + char buf[32], *sep; + const char *c; + struct lufs_fattr root_attr; + + TRACE("creating global context..."); + + gnet_set_defaults(&gcfg); + + root_attr.f_nlink = 1; + root_attr.f_uid = 1; + root_attr.f_gid = 1; + root_attr.f_blksize = 512; + root_attr.f_mtime = root_attr.f_atime = root_attr.f_ctime = time(NULL); + root_attr.f_mode = S_IFDIR | S_IRUSR | S_IXUSR | S_IRGRP | S_IXGRP | S_IROTH | S_IXOTH; + root_attr.f_size = 512; + root_attr.f_blocks = 1; + + + WARN("FIXME: parse gnet options"); + + if((c = lu_opt_getchar(cfg, "GNETFS", "KnownPeers")) && atoi(c)) + known_peers = atoi(c); + + if((c = lu_opt_getchar(cfg, "MOUNT", "KnownPeers")) && atoi(c)) + known_peers = atoi(c); + + TRACE("known_peers: %d", known_peers); + + + + if(!(glob = malloc(sizeof(struct global_ctx)))) + return NULL; + + memset(glob, 0, sizeof(struct global_ctx)); + + if(!(glob->vtree = lu_vtree_create(&root_attr))) + goto fail_glob; + + + root_attr.f_mode |= S_IWUSR; + lu_vtree_add(glob->vtree, "/", SEARCH_DIR + 1, NULL, &root_attr, NULL); + + INIT_LIST_HEAD(&glob->searches); + pthread_mutex_init(&glob->lock, NULL); + + if(!(glob->gnet = gnet_init(&gcfg))){ + ERROR("could not initialize gnutella engine!"); + goto fail_vtree; + } + + for(i = 0; i < known_peers; i++){ + sprintf(buf, "Host%d", i + 1); + + if(!(c = lu_opt_getchar(cfg, "MOUNT", buf))) + c = lu_opt_getchar(cfg, "GNETFS", buf); + + if(c && (sep = strchr(c, ':')) && (atoi(sep + 1))){ + TRACE("gnutella host found: %s", c); + *sep = 0; + gnet_add_peer(glob->gnet, (char*)c, atoi(sep + 1)); + *sep = ':'; + } + } + + return glob; + + fail_vtree: + lu_vtree_destroy(glob->vtree); + fail_glob: + free(glob); + return NULL; +} + +static void +destroy_global(struct global_ctx *glob){ + TRACE("destroying global context..."); + + gnet_shutdown(glob->gnet); + lu_vtree_destroy(glob->vtree); + + free(glob); +} + +void* +gnetfs_init(struct list_head *cfg, struct dir_cache *cache, struct credentials *cred, void **global_ctx){ + struct local_ctx *ctx; + + TRACE("initializing"); + + if(!(ctx = malloc(sizeof(struct local_ctx)))){ + ERROR("could not allocate local context: %s", strerror(errno)); + return NULL; + } + + memset(ctx, 0, sizeof(struct local_ctx)); + + ctx->global = (struct global_ctx**)global_ctx; + ctx->cfg = cfg; + INIT_LIST_HEAD(&ctx->opened_files); + + if(*ctx->global){ + TRACE("we already have a global context"); + + pthread_mutex_lock(&(*ctx->global)->lock); + (*ctx->global)->count++; + pthread_mutex_unlock(&(*ctx->global)->lock); + } + + return ctx; +} + +void +gnetfs_free(void *c){ + struct local_ctx *ctx = c; + struct global_ctx *glob = *ctx->global; + + TRACE("freeing filesystem"); + + if(glob){ + pthread_mutex_lock(&glob->lock); + + if(--glob->count <= 0) + destroy_global(glob); + else + pthread_mutex_unlock(&glob->lock); + } + + free(ctx); +} + +int +gnetfs_mount(void *ctx){ + TRACE("mounting"); + + return 1; +} + +void +gnetfs_umount(void *ctx){ + TRACE("unmounting"); +} + +int +gnetfs_stat(void *c, char *name, struct lufs_fattr *fattr){ + struct local_ctx *ctx = c; + struct global_ctx *glob; + int res; + + TRACE("stating %s", name); + + if(!(*ctx->global)){ + if(!(*ctx->global = init_global(ctx->cfg))){ + WARN("could not create global context!"); + return -1; + }else{ + TRACE("global context created"); + (*ctx->global)->count = 1; + } + } + + glob = (*ctx->global); + + pthread_mutex_lock(&glob->lock); + + if((res = lu_vtree_lookup(glob->vtree, name, fattr, NULL, 0, NULL)) < 0){ + WARN("lookup failed!"); + } + + pthread_mutex_unlock(&glob->lock); + + return res; +} + +int +gnetfs_readdir(void *c, char *dir_name, struct directory *dir){ + struct local_ctx *ctx = c; + struct global_ctx *glob = *ctx->global; + struct ventry *ve, *e; + struct list_head *p; + int res = -1; + + TRACE("reading dir %s", dir_name); + + pthread_mutex_lock(&glob->lock); + + if(*dir_name != '/'){ + TRACE("we need an absolute path here..."); + goto out; + } + + if(!strcmp(dir_name, "/")) + ve = &glob->vtree->root; + else + if(!(ve = lu_vtree_search(&glob->vtree->root, dir_name + 1))) + goto out; + + TRACE("directory found."); + + list_for_each(p, &ve->children){ + e = list_entry(p, struct ventry, list); + + lu_cache_add2dir(dir, e->name, e->link, &e->fattr); + } + + res = 0; + + out: + pthread_mutex_unlock(&glob->lock); + + return res; +} + + +int +gnetfs_mkdir(void *c, char *dir, int mode){ + struct local_ctx *ctx = c; + struct global_ctx *glob = *ctx->global; + struct lufs_fattr dattr; + int res; + + TRACE("mkdir %s", dir); + + if(strncasecmp(dir, SEARCH_DIR, strlen(SEARCH_DIR))){ + WARN("can only create dirs in %s", SEARCH_DIR); + return -EPERM; + } + + if(start_search(ctx, dir + strlen(SEARCH_DIR) + 1) < 0){ + WARN("could not start search"); + return -EIO; + } + + memset(&dattr, 0, sizeof(struct lufs_fattr)); + dattr.f_nlink = 1; + dattr.f_uid = dattr.f_gid = 1; + dattr.f_mode = S_IRUSR | S_IRGRP | S_IROTH | S_IXUSR | S_IXGRP | S_IXOTH | S_IFDIR | S_IWUSR; + dattr.f_mtime = dattr.f_ctime = dattr.f_atime = time(NULL); + dattr.f_size = 512; + + pthread_mutex_lock(&glob->lock); + + res = lu_vtree_add(glob->vtree, SEARCH_DIR, dir + strlen(SEARCH_DIR) + 1, NULL, &dattr, NULL); + + pthread_mutex_unlock(&glob->lock); + + return res; +} + +int +gnetfs_rmdir(void *c, char *dir){ + struct local_ctx *ctx = c; + struct global_ctx *glob = *ctx->global; + struct search *srch; + struct ventry *ve; + + TRACE("rmdir %s", dir); + + if(strncasecmp(dir, SEARCH_DIR, strlen(SEARCH_DIR))){ + WARN("can only erase dirs in %s", SEARCH_DIR); + return -EPERM; + } + + pthread_mutex_lock(&glob->lock); + + if((srch = find_search_by_txt(glob, dir + strlen(SEARCH_DIR) + 1))){ + gnet_stop_search(glob->gnet, srch->id); + delete_search(srch); + } + + if((ve = lu_vtree_find(glob->vtree, dir))) + lu_vtree_delete(ve); + + pthread_mutex_unlock(&glob->lock); + + return 0; +} + +int +gnetfs_unlink(void *c, char *file){ + struct local_ctx *ctx = c; + struct global_ctx *glob = *ctx->global; + struct ventry *ve; + struct search *srch; + struct result *res; + char *s, *sep; + + TRACE("unlink %s", file); + + if(strncasecmp(file, SEARCH_DIR, strlen(SEARCH_DIR))){ + WARN("can only delete files in %s", SEARCH_DIR); + return -EPERM; + } + + pthread_mutex_lock(&glob->lock); + + if((ve = lu_vtree_find(glob->vtree, file))) + lu_vtree_delete(ve); + + s = file + strlen(SEARCH_DIR) + 1; + + if((sep = strchr(s, '/'))){ + *sep++ = 0; + + TRACE("search: %s, result: %s", s, sep); + + if((srch = find_search_by_txt(glob, s)) && (res = find_result_by_name(srch, sep))) + delete_result(res); + } + + pthread_mutex_unlock(&glob->lock); + + return 0; +} + +int +gnetfs_open(void *c, char *file, unsigned mode){ + struct local_ctx *ctx = c; + struct global_ctx *glob = *ctx->global; + struct ventry *ve; + + TRACE("open %s", file); + + if(!glob) + return -1; + + pthread_mutex_lock(&glob->lock); + ve = lu_vtree_find(glob->vtree, file); + pthread_mutex_unlock(&glob->lock); + + if(!ve) + return -1; + + return 0; +} + +int +gnetfs_release(void *c, char *file){ + TRACE("close %s", file); + + return 0; +} + +int +gnetfs_read(void *c, char *file, unsigned long offset, unsigned long count, char *buf){ + TRACE("read %s@%lu, %lubytes", file, offset, count); + + if(strncasecmp(file, SEARCH_DIR, strlen(SEARCH_DIR))){ + WARN("can only read files in %s", SEARCH_DIR); + return -EPERM; + } + + return xfer_read((struct local_ctx*)c, file + strlen(SEARCH_DIR) + 1, offset, count, buf); +} diff --git a/filesystems/gnetfs/gnetfs.h b/filesystems/gnetfs/gnetfs.h new file mode 100644 index 0000000..7709353 --- /dev/null +++ b/filesystems/gnetfs/gnetfs.h @@ -0,0 +1,18 @@ +#ifndef _GNETFS_H_ +#define _GNETFS_H_ + +struct global_ctx{ + pthread_mutex_t lock; + struct list_head searches; + struct gnet *gnet; + struct vtree *vtree; + unsigned count; +}; + +struct local_ctx{ + struct global_ctx **global; + struct list_head *cfg; + struct list_head opened_files; +}; + +#endif diff --git a/filesystems/gnetfs/list.h b/filesystems/gnetfs/list.h new file mode 100644 index 0000000..f3cb6f5 --- /dev/null +++ b/filesystems/gnetfs/list.h @@ -0,0 +1,171 @@ +#ifndef _LINUX_LIST_H +#define _LINUX_LIST_H + +/* + * Simple doubly linked list implementation. + * + * Some of the internal functions ("__xxx") are useful when + * manipulating whole lists rather than single entries, as + * sometimes we already know the next/prev entries and we can + * generate better code by using them directly rather than + * using the generic single-entry routines. + */ + +struct list_head { + struct list_head *next, *prev; +}; + +#define LIST_HEAD_INIT(name) { &(name), &(name) } + +#define LIST_HEAD(name) \ + struct list_head name = LIST_HEAD_INIT(name) + +#define INIT_LIST_HEAD(ptr) do { \ + (ptr)->next = (ptr); (ptr)->prev = (ptr); \ +} while (0) + +/* + * Insert a new entry between two known consecutive entries. + * + * This is only for internal list manipulation where we know + * the prev/next entries already! + */ +static __inline__ void __list_add(struct list_head * nnew, + struct list_head * prev, + struct list_head * next) +{ + next->prev = nnew; + nnew->next = next; + nnew->prev = prev; + prev->next = nnew; +} + +/** + * list_add - add a new entry + * @new: new entry to be added + * @head: list head to add it after + * + * Insert a new entry after the specified head. + * This is good for implementing stacks. + */ +static __inline__ void list_add(struct list_head *nnew, struct list_head *head) +{ + __list_add(nnew, head, head->next); +} + +/** + * list_add_tail - add a new entry + * @nnew: new entry to be added + * @head: list head to add it before + * + * Insert a new entry before the specified head. + * This is useful for implementing queues. + */ +static __inline__ void list_add_tail(struct list_head *nnew, struct list_head *head) +{ + __list_add(nnew, head->prev, head); +} + +/* + * Delete a list entry by making the prev/next entries + * point to each other. + * + * This is only for internal list manipulation where we know + * the prev/next entries already! + */ +static __inline__ void __list_del(struct list_head * prev, + struct list_head * next) +{ + next->prev = prev; + prev->next = next; +} + +/** + * list_del - deletes entry from list. + * @entry: the element to delete from the list. + * Note: list_empty on entry does not return true after this, the entry is in an undefined state. + */ +static __inline__ void list_del(struct list_head *entry) +{ + __list_del(entry->prev, entry->next); +} + +/** + * list_del_init - deletes entry from list and reinitialize it. + * @entry: the element to delete from the list. + */ +static __inline__ void list_del_init(struct list_head *entry) +{ + __list_del(entry->prev, entry->next); + INIT_LIST_HEAD(entry); +} + +/** + * list_empty - tests whether a list is empty + * @head: the list to test. + */ +static __inline__ int list_empty(struct list_head *head) +{ + return head->next == head; +} + +/** + * list_splice - join two lists + * @list: the new list to add. + * @head: the place to add it in the first list. + */ +static __inline__ void list_splice(struct list_head *list, struct list_head *head) +{ + struct list_head *first = list->next; + + if (first != list) { + struct list_head *last = list->prev; + struct list_head *at = head->next; + + first->prev = head; + head->next = first; + + last->next = at; + at->prev = last; + } +} + +/** + * list_entry - get the struct for this entry + * @ptr: the &struct list_head pointer. + * @type: the type of the struct this is embedded in. + * @member: the name of the list_struct within the struct. + */ +#define list_entry(ptr, type, member) \ + ((type *)((char *)(ptr)-(unsigned long)(&((type *)0)->member))) + +/** + * list_for_each - iterate over a list + * @pos: the &struct list_head to use as a loop counter. + * @head: the head for your list. + */ +#define list_for_each(pos, head) \ + for (pos = (head)->next; pos != (head); \ + pos = pos->next) + +/** + * list_for_each_safe - iterate over a list safe against removal of list entry + * @pos: the &struct list_head to use as a loop counter. + * @n: another &struct list_head to use as temporary storage + * @head: the head for your list. + */ +#define list_for_each_safe(pos, n, head) \ + for (pos = (head)->next, n = pos->next; pos != (head); \ + pos = n, n = pos->next) + +/** + * list_for_each_prev - iterate over a list in reverse order + * @pos: the &struct list_head to use as a loop counter. + * @head: the head for your list. + */ +#define list_for_each_prev(pos, head) \ + for (pos = (head)->prev; pos != (head); \ + pos = pos->prev) + + +#endif diff --git a/filesystems/gnetfs/search.c b/filesystems/gnetfs/search.c new file mode 100644 index 0000000..3ef5e69 --- /dev/null +++ b/filesystems/gnetfs/search.c @@ -0,0 +1,246 @@ +#include +#include +#include +#include +#include +#include + +#include + +#include +#include + +#include "list.h" +#include "vtree.h" +#include "gnet.h" +#include "gnetfs.h" +#include "search.h" + +#define MAX_PATH 1024 + +static char path_buf[MAX_PATH]; + +void +delete_result(struct result *res){ + struct list_head *p, *tmp; + struct gnet_locator *loc; + + list_for_each_safe(p, tmp, &res->locators){ + loc = list_entry(p, struct gnet_locator, list); + + list_del(&loc->list); + free(loc); + } + + list_del(&res->list); + free(res->name); + free(res); +} + +void +delete_search(struct search *srch){ + struct list_head *p, *tmp; + + list_for_each_safe(p, tmp, &srch->results) + delete_result(list_entry(p, struct result, list)); + + list_del(&srch->list); + free(srch->txt); + free(srch); +} + +struct search* +find_search_by_txt(struct global_ctx *glob, char *txt){ + struct list_head *p; + struct search *srch; + + list_for_each(p, &glob->searches){ + srch = list_entry(p, struct search, list); + if(!strcmp(srch->txt, txt)){ + TRACE("search found"); + return srch; + } + } + + TRACE("search not found"); + + return NULL; +} + +struct search* +find_search_by_id(struct global_ctx *glob, unsigned long id){ + struct list_head *p; + struct search *srch; + + list_for_each(p, &glob->searches){ + srch = list_entry(p, struct search, list); + if(srch->id == id){ + TRACE("search found"); + return srch; + } + } + + TRACE("search not found"); + + return NULL; +} + +struct result* +find_result_by_name(struct search *srch, char *name){ + struct list_head *p; + struct result *r; + + list_for_each(p, &srch->results){ + r = list_entry(p, struct result, list); + + if(!strcmp(r->name, name)){ + TRACE("result found"); + return r; + } + } + + TRACE("result not found"); + + return NULL; + +} + +static struct result* +find_result_by_locator(struct search *srch, struct gnet_locator *loc){ + struct list_head *p; + struct result *r; + + list_for_each(p, &srch->results){ + r = list_entry(p, struct result, list); + + if(!(strcmp(r->name, loc->name)) && (r->size == loc->size)){ + TRACE("result found"); + return r; + } + } + + TRACE("result not found"); + + return NULL; +} + +static void +search_hit(void *c, struct gnet_locator *loc, unsigned long id){ + struct global_ctx *glob = c; + struct search *srch; + struct result *res; + struct gnet_locator *new_loc; + struct lufs_fattr fattr; + + TRACE("got a search hit, search id=%lx, file=%s", id, loc->name); + + pthread_mutex_lock(&glob->lock); + + if(!(srch = find_search_by_id(glob, id))){ + WARN("unknown search id %lx", id); + goto out; + } + + if(!(res = find_result_by_locator(srch, loc))){ + TRACE("new result"); + + if(!(res = malloc(sizeof(struct result)))){ + WARN("could not allocate result: %s", strerror(errno)); + goto out; + } + + memset(res, 0, sizeof(struct result)); + + if(!(res->name = malloc(strlen(loc->name) + 1))){ + WARN("could not allocate result: %s", strerror(errno)); + free(res); + goto out; + } + + INIT_LIST_HEAD(&res->locators); + res->stamp = time(NULL); + res->size = loc->size; + strcpy(res->name, loc->name); + list_add(&res->list, &srch->results); + } + + if(!(new_loc = malloc(sizeof(struct gnet_locator)))){ + WARN("could not allocate result locator"); + goto out; + } + + memset(new_loc, 0, sizeof(struct gnet_locator)); + + new_loc->name = res->name; + memcpy(new_loc->ip, loc->ip, 4); + memcpy(new_loc->guid, loc->guid, 16); + new_loc->port = loc->port; + new_loc->index = loc->index; + new_loc->size = loc->size; + new_loc->bwidth = loc->bwidth; + + list_add(&new_loc->list, &res->locators); + res->nr_locators ++; + + if(snprintf(path_buf, MAX_PATH, "%s/%s", SEARCH_DIR, srch->txt) >= MAX_PATH){ + WARN("search string too long"); + goto out; + } + + TRACE("adding %s to %s", loc->name, path_buf); + + memset(&fattr, 0, sizeof(struct lufs_fattr)); + fattr.f_nlink = res->nr_locators; + fattr.f_uid = fattr.f_gid = 1; + fattr.f_mode = S_IRUSR | S_IRGRP | S_IROTH | S_IFREG; + fattr.f_mtime = fattr.f_ctime = fattr.f_atime = res->stamp; + fattr.f_size = res->size; + + lu_vtree_add(glob->vtree, path_buf, res->name, NULL, &fattr, NULL); + + out: + pthread_mutex_unlock(&glob->lock); +} + +int +start_search(struct local_ctx *ctx, char *txt){ + struct search *srch; + struct global_ctx *glob = *ctx->global; + + TRACE("starting search for \"%s\"", txt); + + if(!(srch = malloc(sizeof(struct search)))) + goto fail; + + memset(srch, 0, sizeof(struct search)); + + if(!(srch->txt = malloc(strlen(txt) + 1))) + goto fail_srch; + + strcpy(srch->txt, txt); + + INIT_LIST_HEAD(&srch->results); + srch->stamp = time(NULL); + + if(gnet_start_search(glob->gnet, txt, search_hit, glob, 0, &srch->id) < 0){ + WARN("could not start gnet search: %s", strerror(errno)); + goto fail_txt; + } + + pthread_mutex_lock(&glob->lock); + + list_add_tail(&srch->list, &glob->searches); + + pthread_mutex_unlock(&glob->lock); + + TRACE("search started"); + + return 0; + + fail_txt: + free(srch->txt); + fail_srch: + free(srch); + fail: + return -1; +} diff --git a/filesystems/gnetfs/search.h b/filesystems/gnetfs/search.h new file mode 100644 index 0000000..2d89845 --- /dev/null +++ b/filesystems/gnetfs/search.h @@ -0,0 +1,31 @@ +#ifndef _SEARCH_H_ +#define _SEARCH_H_ + +#define SEARCH_DIR "/SEARCH" + +struct result { + struct list_head list; + struct list_head locators; + unsigned nr_locators; + time_t stamp; + char *name; + unsigned long size; +}; + +struct search { + struct list_head list; + struct list_head results; + char *txt; + unsigned long id; + time_t stamp; + +}; + +void delete_result(struct result*); +void delete_search(struct search*); +int start_search(struct local_ctx*, char*); +struct search *find_search_by_id(struct global_ctx*, unsigned long); +struct search *find_search_by_txt(struct global_ctx*, char*); +struct result *find_result_by_name(struct search*, char*); + +#endif diff --git a/filesystems/gnetfs/vtree.c b/filesystems/gnetfs/vtree.c new file mode 100644 index 0000000..8debf81 --- /dev/null +++ b/filesystems/gnetfs/vtree.c @@ -0,0 +1,260 @@ +#include +#include +#include +#include + +#include + +#include +#include + +#include "list.h" +#include "vtree.h" + + +struct vtree* +lu_vtree_create(struct lufs_fattr *root_fattr){ + struct vtree *vt; + + TRACE("creating vtree..."); + + if(!(vt = malloc(sizeof(struct vtree)))) + return NULL; + + memset(vt, 0, sizeof(struct vtree)); + + INIT_LIST_HEAD(&vt->root.children); + memcpy(&vt->root.fattr, root_fattr, sizeof(struct lufs_fattr)); + + vt->root.vtree = vt; + vt->root.name = "/"; + + vt->root.stamp = time(NULL); + + return vt; +} + +void +lu_vtree_delete(struct ventry *ve){ + struct list_head *p, *tmp; + + list_for_each_safe(p, tmp, &ve->children) + lu_vtree_delete(list_entry(p, struct ventry, list)); + + TRACE("deleting %s", ve->name); + + ve->vtree->entries--; + list_del(&ve->list); + + free(ve->name); + if(ve->link) + free(ve->link); + + free(ve); +} + +void +lu_vtree_destroy(struct vtree *vt){ + struct list_head *p, *tmp; + + TRACE("deleting tree"); + + list_for_each_safe(p, tmp, &vt->root.children) + lu_vtree_delete(list_entry(p, struct ventry, list)); + + free(vt); +} + +struct ventry* +lu_vtree_search(struct ventry *ve, char *name){ + struct list_head *p; + char *sep; + + TRACE("searching for %s in %s", name, ve->name); + + do{ + if((sep = strchr(name, '/'))){ + *sep = 0; + } + + TRACE("scanning for %s in %s", name, ve->name); + + list_for_each(p, &ve->children){ + if(!strcmp(name, list_entry(p, struct ventry, list)->name)){ + TRACE("portion found: %s", list_entry(p, struct ventry, list)->name); + ve = list_entry(p, struct ventry, list); + break; + } + } + + if(strcmp(name, ve->name)){ + TRACE("portion not found"); + return NULL; + } + + if(sep) + *sep = '/'; + + name = sep + 1; + + }while(sep); + + TRACE("entry found"); + + return ve; +} + +struct ventry* +lu_vtree_find(struct vtree *vt, char *entry){ + + TRACE("entry: %s", entry); + + if(*entry != '/'){ + TRACE("entry is not an absolute path"); + return NULL; + } + + if(!strcmp(entry, "/")) + return &vt->root; + + return lu_vtree_search(&vt->root, entry + 1); +} + +int +lu_vtree_add(struct vtree *vt, char *dir, char *name, char *link, struct lufs_fattr *fattr, void *private){ + struct ventry *ve, *new; + + TRACE("add %s to %s", name, dir); + + if(!(ve = lu_vtree_find(vt, dir))) + return -1; + + if(!(new = lu_vtree_search(ve, name))){ + TRACE("allocating new entry"); + + if(!(new = malloc(sizeof(struct ventry)))) + return -1; + + memset(new, 0, sizeof(struct ventry)); + + INIT_LIST_HEAD(&new->children); + new->vtree = vt; + + vt->entries++; + list_add_tail(&new->list, &ve->children); + }else{ + TRACE("emtry already in tree"); + + free(new->name); + if(new->link) + free(new->link); + } + + if(!(new->name = malloc(strlen(name) + 1))) + goto fail_entry; + + if(link && !(new->link = malloc(strlen(link) + 1))) + goto fail_name; + + strcpy(new->name, name); + if(link) + strcpy(new->link, link); + + memcpy(&new->fattr, fattr, sizeof(struct lufs_fattr)); + + new->private = private; + new->stamp = time(NULL); + + return 0; + + fail_name: + free(new->name); + fail_entry: + vt->entries--; + list_del(&new->list); + free(new); + return -1; +} + +int +lu_vtree_lookup(struct vtree *vt, char *file, struct lufs_fattr *fattr, char *link, int buflen, void **private){ + struct ventry *ve; + + TRACE("looking up %s", file); + + if(*file != '/'){ + TRACE("we need an absolute path here..."); + return -1; + } + + if(!strcmp(file, "/")) + ve = &vt->root; + else + if(!(ve = lu_vtree_search(&vt->root, file + 1))) + return -1; + + TRACE("file found"); + + memcpy(fattr, &ve->fattr, sizeof(struct lufs_fattr)); + if(link){ + if(ve->link){ + if(snprintf(link, buflen, "%s", ve->link) >= buflen){ + WARN("link too long!"); + link[buflen - 1] = 0; + } + }else{ + link[0] = 0; + } + } + + if(private) + *private = ve->private; + + return 0; +} + +int +lu_vtree_readdir(struct vtree *vt, char *dir, int offset, char *buf, int buflen){ + struct ventry *ve, *e; + struct list_head *p; + unsigned slen, off = 0, len = 0; + + TRACE("reading directory %s", dir); + + if(*dir != '/'){ + TRACE("we need an absolute path here..."); + return -1; + } + + if(!strcmp(dir, "/")) + ve = &vt->root; + else + if(!(ve = lu_vtree_search(&vt->root, dir + 1))) + return -1; + + TRACE("directory found"); + + buf[0] = 0; + + list_for_each(p, &ve->children){ + if(off >= offset){ + e = list_entry(p, struct ventry, list); + slen = strlen(e->name); + + if(len + slen + 2 >= buflen){ + TRACE("buffer filled up"); + break; + } + + strcat(buf, e->name); + strcat(buf, "\n"); + + len += slen + 1; + } + + off++; + } + + return len; +} + diff --git a/filesystems/gnetfs/vtree.h b/filesystems/gnetfs/vtree.h new file mode 100644 index 0000000..34bc5ab --- /dev/null +++ b/filesystems/gnetfs/vtree.h @@ -0,0 +1,31 @@ +#ifndef _VTREE_H_ +#define _VTREE_H_ + +struct vtree; + +struct ventry { + struct list_head children; + struct list_head list; + struct lufs_fattr fattr; + struct vtree *vtree; + unsigned nr_children; + char *name; + char *link; + void *private; + time_t stamp; +}; + +struct vtree { + struct ventry root; + unsigned entries; +}; + +struct vtree *lu_vtree_create(struct lufs_fattr*); +struct ventry *lu_vtree_search(struct ventry*, char*); +struct ventry *lu_vtree_find(struct vtree*, char*); +void lu_vtree_destroy(struct vtree*); +void lu_vtree_delete(struct ventry*); +int lu_vtree_add(struct vtree*, char*, char*, char*, struct lufs_fattr*, void*);int lu_vtree_lookup(struct vtree*, char*, struct lufs_fattr*, char*, int, void**); +int lu_vtree_readdir(struct vtree*, char*, int, char*, int); + +#endif diff --git a/filesystems/gnetfs/xfer.c b/filesystems/gnetfs/xfer.c new file mode 100644 index 0000000..f9f4e92 --- /dev/null +++ b/filesystems/gnetfs/xfer.c @@ -0,0 +1,136 @@ +#include +#include +#include +#include +#include +#include +#include + +#include +#include + +#include + +#include +#include + +#include "list.h" +#include "gnet.h" +#include "gnetfs.h" +#include "search.h" +#include "xfer.h" + +static void +stop_xfer(struct gnet_locator *loc){ + gnet_xfer_shutdown(loc); + + list_del(&loc->list); + + free(loc->name); + free(loc); +} + +struct gnet_locator* +find_xfer(struct local_ctx *ctx, char *txt){ + struct list_head *p; + + TRACE("searching xfer(%s)", txt); + + list_for_each(p, &ctx->opened_files) + if(!(strcmp(txt, list_entry(p, struct gnet_locator, list)->name))){ + TRACE("xfer found"); + return list_entry(p, struct gnet_locator, list); + } + + TRACE("xfer not found"); + + return NULL; +} + +struct gnet_locator* +create_xfer(struct local_ctx *ctx, char *txt){ + struct global_ctx *glob = *ctx->global; + struct gnet_locator *xfer; + struct search *srch; + struct result *res; + struct gnet_locator *loc; + char *sep; + + TRACE("creating xfer(%s)", txt); + + if(!(sep = strrchr(txt, '/'))){ + WARN("no '/' separator found!"); + return NULL; + } + + if((xfer = find_xfer(ctx, sep + 1))){ + TRACE("xfer already created"); + return xfer; + } + + *sep = 0; + + pthread_mutex_lock(&glob->lock); + + if(!(srch = find_search_by_txt(glob, txt))) + goto fail_lock; + + + if(!(res = find_result_by_name(srch, sep + 1))) + goto fail_lock; + + if(list_empty(&res->locators)){ + TRACE("no available locators"); + goto fail_lock; + } + + loc = list_entry(res->locators.next, struct gnet_locator, list); + + list_del(&loc->list); + list_add_tail(&loc->list, &res->locators); + + *sep = '/'; + + if(!(xfer = malloc(sizeof(struct gnet_locator)))) + goto fail_lock; + + memcpy(xfer, loc, sizeof(struct gnet_locator)); + + if(!(xfer->name = malloc(strlen(sep + 1) + 1))) + goto fail_xfer; + + strcpy(xfer->name, sep + 1); + xfer->xfer = NULL; + + pthread_mutex_unlock(&glob->lock); + + list_add(&xfer->list, &ctx->opened_files); + + TRACE("xfer created"); + + return xfer; + + fail_xfer: + free(xfer); + + fail_lock: + pthread_mutex_unlock(&glob->lock); + + return NULL; +} + +int +xfer_read(struct local_ctx *ctx, char *txt, unsigned int offset, unsigned int count, char *buf){ + struct gnet_locator *xfer; + + TRACE("txt: %s", txt); + + if(!(xfer = create_xfer(ctx, txt))){ + WARN("could not create xfer"); + return -1; + } + + TRACE("reading %d bytes", count); + + return gnet_xfer_read((*ctx->global)->gnet, xfer, offset, count, buf); +} diff --git a/filesystems/gnetfs/xfer.h b/filesystems/gnetfs/xfer.h new file mode 100644 index 0000000..3684941 --- /dev/null +++ b/filesystems/gnetfs/xfer.h @@ -0,0 +1,10 @@ +#ifndef _XFER_H_ +#define _XFER_H_ + +#define CONNECT_TIME_OUT 5 +#define BUF_SIZE 1024 + +int xfer_read(struct local_ctx*, char*, unsigned int, unsigned int, char*); + +#endif + diff --git a/filesystems/gvfs/Makefile.am b/filesystems/gvfs/Makefile.am new file mode 100644 index 0000000..6488528 --- /dev/null +++ b/filesystems/gvfs/Makefile.am @@ -0,0 +1,9 @@ +INCLUDES=-I../ @all_includes@ +lib_LTLIBRARIES=liblufs-gvfs.la + +noinst_HEADERS=gvfs.h +liblufs_gvfs_la_SOURCES=gvfs.cpp +liblufs_gvfs_la_LIBADD=@GVFS_LDADD@ +liblufs_gvfs_la_LDFLAGS=-version-info 2:0:0 + +CXXFLAGS=@GVFS_CFLAGS@ @DEBUG_FLAGS@ \ No newline at end of file diff --git a/filesystems/gvfs/Makefile.in b/filesystems/gvfs/Makefile.in new file mode 100644 index 0000000..3becb54 --- /dev/null +++ b/filesystems/gvfs/Makefile.in @@ -0,0 +1,460 @@ +# Makefile.in generated by automake 1.7.5 from Makefile.am. +# @configure_input@ + +# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003 +# Free Software Foundation, Inc. +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ + +srcdir = @srcdir@ +top_srcdir = @top_srcdir@ +VPATH = @srcdir@ +pkgdatadir = $(datadir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +top_builddir = ../.. + +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +INSTALL = @INSTALL@ +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = @build@ +host_triplet = @host@ +target_triplet = @target@ +ACLOCAL = @ACLOCAL@ +AMDEP_FALSE = @AMDEP_FALSE@ +AMDEP_TRUE = @AMDEP_TRUE@ +AMTAR = @AMTAR@ +AUTOCONF = @AUTOCONF@ +AUTOFS_INSTALL = @AUTOFS_INSTALL@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CXX = @CXX@ +CXXDEPMODE = @CXXDEPMODE@ + +CXXFLAGS = @GVFS_CFLAGS@ @DEBUG_FLAGS@ +CYGPATH_W = @CYGPATH_W@ +DEBUG_FLAGS = @DEBUG_FLAGS@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +ECHO = @ECHO@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +EXEEXT = @EXEEXT@ +GCONF = @GCONF@ +GVFSCONF = @GVFSCONF@ +GVFS_CFLAGS = @GVFS_CFLAGS@ +GVFS_LDADD = @GVFS_LDADD@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +KDEBUG_FLAGS = @KDEBUG_FLAGS@ +KERNEL_DIR = @KERNEL_DIR@ +KERNEL_HDR = @KERNEL_HDR@ +LDFLAGS = @LDFLAGS@ +LIBCHIPCARD_INCLUDES = @LIBCHIPCARD_INCLUDES@ +LIBCHIPCARD_LIB = @LIBCHIPCARD_LIB@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LIBTOOL = @LIBTOOL@ +LN_S = @LN_S@ +LTLIBOBJS = @LTLIBOBJS@ +LUFS_SUID = @LUFS_SUID@ +MAKEINFO = @MAKEINFO@ +MODULES_DIR = @MODULES_DIR@ +MODV_FLAGS = @MODV_FLAGS@ +OBJEXT = @OBJEXT@ +OS_DIR = @OS_DIR@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +RANLIB = @RANLIB@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +SSHPROG = @SSHPROG@ +STRIP = @STRIP@ +VERSION = @VERSION@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_CXX = @ac_ct_CXX@ +ac_ct_RANLIB = @ac_ct_RANLIB@ +ac_ct_STRIP = @ac_ct_STRIP@ +all_includes = @all_includes@ +all_libraries = @all_libraries@ +am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ +am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ +am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@ +am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +datadir = @datadir@ +define_has_libchipcard = @define_has_libchipcard@ +exec_prefix = @exec_prefix@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localstatedir = @localstatedir@ +mandir = @mandir@ +oldincludedir = @oldincludedir@ +opt_fs = @opt_fs@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +sysconfdir = @sysconfdir@ +target = @target@ +target_alias = @target_alias@ +target_cpu = @target_cpu@ +target_os = @target_os@ +target_vendor = @target_vendor@ +INCLUDES = -I../ @all_includes@ +lib_LTLIBRARIES = liblufs-gvfs.la + +noinst_HEADERS = gvfs.h +liblufs_gvfs_la_SOURCES = gvfs.cpp +liblufs_gvfs_la_LIBADD = @GVFS_LDADD@ +liblufs_gvfs_la_LDFLAGS = -version-info 2:0:0 +subdir = filesystems/gvfs +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +mkinstalldirs = $(SHELL) $(top_srcdir)/config/mkinstalldirs +CONFIG_HEADER = $(top_builddir)/config.h +CONFIG_CLEAN_FILES = +LTLIBRARIES = $(lib_LTLIBRARIES) + +liblufs_gvfs_la_DEPENDENCIES = +am_liblufs_gvfs_la_OBJECTS = gvfs.lo +liblufs_gvfs_la_OBJECTS = $(am_liblufs_gvfs_la_OBJECTS) + +DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir) +depcomp = $(SHELL) $(top_srcdir)/config/depcomp +am__depfiles_maybe = depfiles +@AMDEP_TRUE@DEP_FILES = ./$(DEPDIR)/gvfs.Plo +CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ + $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) +LTCXXCOMPILE = $(LIBTOOL) --mode=compile $(CXX) $(DEFS) \ + $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ + $(AM_CXXFLAGS) $(CXXFLAGS) +CXXLD = $(CXX) +CXXLINK = $(LIBTOOL) --mode=link $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) \ + $(AM_LDFLAGS) $(LDFLAGS) -o $@ +DIST_SOURCES = $(liblufs_gvfs_la_SOURCES) +HEADERS = $(noinst_HEADERS) + +DIST_COMMON = $(noinst_HEADERS) Makefile.am Makefile.in +SOURCES = $(liblufs_gvfs_la_SOURCES) + +all: all-am + +.SUFFIXES: +.SUFFIXES: .cpp .lo .o .obj +$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4) + cd $(top_srcdir) && \ + $(AUTOMAKE) --gnu filesystems/gvfs/Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe) +libLTLIBRARIES_INSTALL = $(INSTALL) +install-libLTLIBRARIES: $(lib_LTLIBRARIES) + @$(NORMAL_INSTALL) + $(mkinstalldirs) $(DESTDIR)$(libdir) + @list='$(lib_LTLIBRARIES)'; for p in $$list; do \ + if test -f $$p; then \ + f="`echo $$p | sed -e 's|^.*/||'`"; \ + echo " $(LIBTOOL) --mode=install $(libLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) $$p $(DESTDIR)$(libdir)/$$f"; \ + $(LIBTOOL) --mode=install $(libLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) $$p $(DESTDIR)$(libdir)/$$f; \ + else :; fi; \ + done + +uninstall-libLTLIBRARIES: + @$(NORMAL_UNINSTALL) + @list='$(lib_LTLIBRARIES)'; for p in $$list; do \ + p="`echo $$p | sed -e 's|^.*/||'`"; \ + echo " $(LIBTOOL) --mode=uninstall rm -f $(DESTDIR)$(libdir)/$$p"; \ + $(LIBTOOL) --mode=uninstall rm -f $(DESTDIR)$(libdir)/$$p; \ + done + +clean-libLTLIBRARIES: + -test -z "$(lib_LTLIBRARIES)" || rm -f $(lib_LTLIBRARIES) + @list='$(lib_LTLIBRARIES)'; for p in $$list; do \ + dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \ + test "$$dir" = "$$p" && dir=.; \ + echo "rm -f \"$${dir}/so_locations\""; \ + rm -f "$${dir}/so_locations"; \ + done +liblufs-gvfs.la: $(liblufs_gvfs_la_OBJECTS) $(liblufs_gvfs_la_DEPENDENCIES) + $(CXXLINK) -rpath $(libdir) $(liblufs_gvfs_la_LDFLAGS) $(liblufs_gvfs_la_OBJECTS) $(liblufs_gvfs_la_LIBADD) $(LIBS) + +mostlyclean-compile: + -rm -f *.$(OBJEXT) core *.core + +distclean-compile: + -rm -f *.tab.c + +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gvfs.Plo@am__quote@ + +distclean-depend: + -rm -rf ./$(DEPDIR) + +.cpp.o: +@am__fastdepCXX_TRUE@ if $(CXXCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" \ +@am__fastdepCXX_TRUE@ -c -o $@ `test -f '$<' || echo '$(srcdir)/'`$<; \ +@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; \ +@am__fastdepCXX_TRUE@ else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; \ +@am__fastdepCXX_TRUE@ fi +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ `test -f '$<' || echo '$(srcdir)/'`$< + +.cpp.obj: +@am__fastdepCXX_TRUE@ if $(CXXCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" \ +@am__fastdepCXX_TRUE@ -c -o $@ `if test -f '$<'; then $(CYGPATH_W) '$<'; else $(CYGPATH_W) '$(srcdir)/$<'; fi`; \ +@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; \ +@am__fastdepCXX_TRUE@ else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; \ +@am__fastdepCXX_TRUE@ fi +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ `if test -f '$<'; then $(CYGPATH_W) '$<'; else $(CYGPATH_W) '$(srcdir)/$<'; fi` + +.cpp.lo: +@am__fastdepCXX_TRUE@ if $(LTCXXCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" \ +@am__fastdepCXX_TRUE@ -c -o $@ `test -f '$<' || echo '$(srcdir)/'`$<; \ +@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Plo"; \ +@am__fastdepCXX_TRUE@ else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; \ +@am__fastdepCXX_TRUE@ fi +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ depfile='$(DEPDIR)/$*.Plo' tmpdepfile='$(DEPDIR)/$*.TPlo' @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(LTCXXCOMPILE) -c -o $@ `test -f '$<' || echo '$(srcdir)/'`$< + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs + +distclean-libtool: + -rm -f libtool +uninstall-info-am: + +ETAGS = etags +ETAGSFLAGS = + +CTAGS = ctags +CTAGSFLAGS = + +tags: TAGS + +ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + mkid -fID $$unique + +TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + tags=; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + test -z "$(ETAGS_ARGS)$$tags$$unique" \ + || $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$tags $$unique + +ctags: CTAGS +CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + tags=; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + test -z "$(CTAGS_ARGS)$$tags$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$tags $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && cd $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) $$here + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) + +top_distdir = ../.. +distdir = $(top_distdir)/$(PACKAGE)-$(VERSION) + +distdir: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \ + list='$(DISTFILES)'; for file in $$list; do \ + case $$file in \ + $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ + $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ + esac; \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test "$$dir" != "$$file" && test "$$dir" != "."; then \ + dir="/$$dir"; \ + $(mkinstalldirs) "$(distdir)$$dir"; \ + else \ + dir=''; \ + fi; \ + if test -d $$d/$$file; then \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ + fi; \ + cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ + else \ + test -f $(distdir)/$$file \ + || cp -p $$d/$$file $(distdir)/$$file \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-am +all-am: Makefile $(LTLIBRARIES) $(HEADERS) + +installdirs: + $(mkinstalldirs) $(DESTDIR)$(libdir) +install: install-am +install-exec: install-exec-am +install-data: install-data-am +uninstall: uninstall-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-am +install-strip: + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + INSTALL_STRIP_FLAG=-s \ + `test -z '$(STRIP)' || \ + echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -rm -f Makefile $(CONFIG_CLEAN_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +clean: clean-am + +clean-am: clean-generic clean-libLTLIBRARIES clean-libtool \ + mostlyclean-am + +distclean: distclean-am + +distclean-am: clean-am distclean-compile distclean-depend \ + distclean-generic distclean-libtool distclean-tags + +dvi: dvi-am + +dvi-am: + +info: info-am + +info-am: + +install-data-am: + +install-exec-am: install-libLTLIBRARIES + +install-info: install-info-am + +install-man: + +installcheck-am: + +maintainer-clean: maintainer-clean-am + +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-compile mostlyclean-generic \ + mostlyclean-libtool + +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + +uninstall-am: uninstall-info-am uninstall-libLTLIBRARIES + +.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ + clean-libLTLIBRARIES clean-libtool ctags distclean \ + distclean-compile distclean-depend distclean-generic \ + distclean-libtool distclean-tags distdir dvi dvi-am info \ + info-am install install-am install-data install-data-am \ + install-exec install-exec-am install-info install-info-am \ + install-libLTLIBRARIES install-man install-strip installcheck \ + installcheck-am installdirs maintainer-clean \ + maintainer-clean-generic mostlyclean mostlyclean-compile \ + mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ + tags uninstall uninstall-am uninstall-info-am \ + uninstall-libLTLIBRARIES + +# 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/filesystems/gvfs/gvfs.cpp b/filesystems/gvfs/gvfs.cpp new file mode 100644 index 0000000..513ce74 --- /dev/null +++ b/filesystems/gvfs/gvfs.cpp @@ -0,0 +1,548 @@ +/* + * gvfs.cpp + * Copyright (C) 2002 Florin Malita + * + * This file is part of LUFS, a free userspace filesystem implementation. + * See http://lufs.sourceforge.net/ for updates. + * + * LUFS 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. + * + * LUFS 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 "gvfs.h" + +#include +#include + +extern "C" { + +void* +gvfs_init(struct list_head *cfg, struct dir_cache *cache, struct credentials *cred, void **global_ctx){ + return (void*)new GVFS(cfg, cache, cred); +} + +void +gvfs_free(void *ctx){ + GVFS *p = (GVFS*)ctx; + + delete p; +} + +int +gvfs_mount(void *ctx){ + return ((GVFS*)ctx)->do_mount(); +} + +void +gvfs_umount(void *ctx){ + +} + +int +gvfs_readdir(void *ctx, char *dir_name, struct directory *dir){ + return ((GVFS*)ctx)->do_readdir(dir_name, dir); +} + +int +gvfs_stat(void *ctx, char *name, struct lufs_fattr *fattr){ + return ((GVFS*)ctx)->do_stat(name, fattr); +} + +int +gvfs_mkdir(void *ctx, char *dir, int mode){ + return ((GVFS*)ctx)->do_mkdir(dir, mode); +} + +int +gvfs_rmdir(void *ctx, char *dir){ + return ((GVFS*)ctx)->do_rmdir(dir); +} + +int +gvfs_create(void *ctx, char *file, int mode){ + return ((GVFS*)ctx)->do_create(file, mode); +} + +int +gvfs_unlink(void *ctx, char *file){ + return ((GVFS*)ctx)->do_unlink(file); +} + +int +gvfs_rename(void *ctx, char *old_name, char *new_name){ + return ((GVFS*)ctx)->do_rename(old_name, new_name); +} + +int +gvfs_open(void *ctx, char *file, unsigned mode){ + return ((GVFS*)ctx)->do_open(file, mode); +} + +int +gvfs_release(void *ctx, char *file){ + return ((GVFS*)ctx)->do_release(file); +} + +int +gvfs_read(void *ctx, char *file, long long offset, unsigned long count, char *buf){ + return ((GVFS*)ctx)->do_read(file, offset, count, buf); +} + +int +gvfs_write(void *ctx, char *file, long long offset, unsigned long count, char *buf){ + return ((GVFS*)ctx)->do_write(file, offset, count, buf); +} + +int +gvfs_readlink(void *ctx, char *link, char *buf, int buflen){ + return ((GVFS*)ctx)->do_readlink(link, buf, buflen); +} + +int +gvfs_link(void *ctx, char *target, char *link){ + return ((GVFS*)ctx)->do_link(target, link); +} + +int +gvfs_symlink(void *ctx, char *target, char *link){ + return ((GVFS*)ctx)->do_symlink(target, link); +} + +int +gvfs_setattr(void *ctx, char *file, struct lufs_fattr *fattr){ + return ((GVFS*)ctx)->do_setattr(file, fattr); +} + +} /* extern "C" */ + +static void +info2fattr(GnomeVFSFileInfo *info, struct lufs_fattr *fattr){ + memset(fattr, 0, sizeof(struct lufs_fattr)); + + TRACE("cooking " << info->name); + + if(info->valid_fields & GNOME_VFS_FILE_INFO_FIELDS_TYPE){ + TRACE("got the type"); + + switch(info->type){ + case GNOME_VFS_FILE_TYPE_DIRECTORY: + fattr->f_mode = S_IFDIR; + break; + case GNOME_VFS_FILE_TYPE_FIFO: + fattr->f_mode = S_IFIFO; + break; + case GNOME_VFS_FILE_TYPE_SOCKET: + fattr->f_mode = S_IFSOCK; + break; + case GNOME_VFS_FILE_TYPE_CHARACTER_DEVICE: + fattr->f_mode = S_IFCHR; + break; + case GNOME_VFS_FILE_TYPE_BLOCK_DEVICE: + fattr->f_mode = S_IFBLK; + break; + case GNOME_VFS_FILE_TYPE_SYMBOLIC_LINK: + fattr->f_mode = S_IFLNK; + break; + case GNOME_VFS_FILE_TYPE_REGULAR: + case GNOME_VFS_FILE_TYPE_UNKNOWN: + default: + fattr->f_mode = S_IFREG; + } + }else{ + TRACE("hmmm, no file type..."); + fattr->f_mode = S_IFREG; + } + + if(info->valid_fields & GNOME_VFS_FILE_INFO_FIELDS_PERMISSIONS){ + TRACE("got the permissions"); + fattr->f_mode |= info->permissions; + }else{ + TRACE("hmmm, no file permissions?!?!"); + fattr->f_mode |= S_IRUSR; + } + + if(info->valid_fields & GNOME_VFS_FILE_INFO_FIELDS_LINK_COUNT){ + TRACE("got the link count"); + fattr->f_nlink = info->link_count; + }else{ + TRACE("hmmm, no link count..."); + fattr->f_nlink = 1; + } + + if(info->valid_fields & GNOME_VFS_FILE_INFO_FIELDS_SIZE){ + TRACE("got the size"); + fattr->f_size = info->size; + }else{ + TRACE("hmmm, no size?!"); + fattr->f_size = 2048; + } + + if(info->valid_fields & GNOME_VFS_FILE_INFO_FIELDS_ATIME){ + TRACE("got the atime"); + fattr->f_atime = info->atime; + if(!(info->valid_fields & GNOME_VFS_FILE_INFO_FIELDS_MTIME)) + fattr->f_mtime = info->atime; + if(!(info->valid_fields & GNOME_VFS_FILE_INFO_FIELDS_CTIME)) + fattr->f_ctime = info->atime; + } + + if(info->valid_fields & GNOME_VFS_FILE_INFO_FIELDS_MTIME){ + TRACE("got the mtime"); + fattr->f_mtime = info->mtime; + if(!(info->valid_fields & GNOME_VFS_FILE_INFO_FIELDS_ATIME)) + fattr->f_atime = info->mtime; + if(!(info->valid_fields & GNOME_VFS_FILE_INFO_FIELDS_CTIME)) + fattr->f_ctime = info->mtime; + } + + if(info->valid_fields & GNOME_VFS_FILE_INFO_FIELDS_CTIME){ + TRACE("got the ctime"); + fattr->f_ctime = info->ctime; + if(!(info->valid_fields & GNOME_VFS_FILE_INFO_FIELDS_MTIME)) + fattr->f_mtime = info->ctime; + if(!(info->valid_fields & GNOME_VFS_FILE_INFO_FIELDS_ATIME)) + fattr->f_atime = info->ctime; + } + + fattr->f_uid = 1; + fattr->f_gid = 1; + +} + +GVFS::GVFS(struct list_head *c, struct dir_cache *cache, struct credentials *cred){ + TRACE("in GVFS constructor"); + + cfg = c; + this->cache = cache; + this->cred = cred; + + if(!gnome_vfs_initialized()) + gnome_vfs_init(); +} + +GVFS::~GVFS(){ + TRACE("in GVFS destructor"); +} + +int +GVFS::do_mount(){ + TRACE("mounting a gvfs."); + return 1; +} + +int +GVFS::do_readdir(char* d, struct directory *ddir){ + struct lufs_fattr fattr; + GnomeVFSDirectoryHandle *dir; + GnomeVFSURI *uri; + GnomeVFSFileInfo *info; + string s; + int res = -1; + + TRACE("dir: "<name); + + if(!strcmp(info->name, ".") || !strcmp(info->name, "..")) + continue; + + info2fattr(info, &fattr); + lu_cache_add2dir(ddir, info->name, (info->valid_fields & GNOME_VFS_FILE_INFO_FIELDS_SYMLINK_NAME) ? info->symlink_name : NULL, &fattr); + + } + + gnome_vfs_directory_close(dir); + res = 0; + + out_info: + gnome_vfs_file_info_unref(info); + out_uri: + gnome_vfs_uri_unref(uri); + out: + return res; +} + +int +GVFS::do_stat(char *nm, struct lufs_fattr *fattr){ + GnomeVFSURI *uri; + GnomeVFSFileInfo *info; + int res = -1; + + TRACE("file: "<valid_fields & GNOME_VFS_FILE_INFO_FIELDS_SYMLINK_NAME) + if(strlen(info->symlink_name) < buflen){ + strcpy(buf, info->symlink_name); + TRACE("target: " << buf); + res = 0; + } + + + out_info: + gnome_vfs_file_info_unref(info); + out_uri: + gnome_vfs_uri_unref(uri); + out: + return res; +} + +int +GVFS::do_link(char *old, char *nnew){ + TRACE(""); + return -1; +} + +int +GVFS::do_symlink(char *old, char *nnew){ + TRACE("symlink "< "<valid_fields = GNOME_VFS_FILE_INFO_FIELDS_PERMISSIONS; + info->permissions = (GnomeVFSFilePermissions)(fattr->f_mode & 0777); + + if(gnome_vfs_set_file_info(f + 1, info, GNOME_VFS_SET_FILE_INFO_PERMISSIONS) != GNOME_VFS_OK) + goto out_info; + + info->valid_fields = GNOME_VFS_FILE_INFO_FIELDS_CTIME; + info->atime = fattr->f_atime; + info->ctime = fattr->f_ctime; + info->mtime = fattr->f_mtime; + + if(gnome_vfs_set_file_info(f + 1, info, GNOME_VFS_SET_FILE_INFO_TIME) != GNOME_VFS_OK) + goto out_info; + + res = 0; + + out_info: + gnome_vfs_file_info_unref(info); + out: + return res; +} diff --git a/filesystems/gvfs/gvfs.h b/filesystems/gvfs/gvfs.h new file mode 100644 index 0000000..d7d8d71 --- /dev/null +++ b/filesystems/gvfs/gvfs.h @@ -0,0 +1,59 @@ +/* + * gvfs.h + * Copyright (C) 2002 Florin Malita + * + * This file is part of LUFS, a free userspace filesystem implementation. + * See http://lufs.sourceforge.net/ for updates. + * + * LUFS 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. + * + * LUFS 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 _GVFS_H_ +#define _GVFS_H_ + +using namespace std; + +struct directory; +struct dir_cache; + +class GVFS{ + private: + struct credentials *cred; + struct dir_cache *cache; + struct list_head *cfg; + + public: + GVFS(struct list_head*, struct dir_cache*, struct credentials*); + ~GVFS(); + + int do_mount(); + int do_readdir(char*, struct directory*); + int do_stat(char*, struct lufs_fattr*); + int do_mkdir(char*, int); + int do_rmdir(char*); + int do_create(char*, int); + int do_unlink(char*); + int do_rename(char*, char*); + int do_open(char*, unsigned); + int do_release(char*); + int do_read(char*, long long, unsigned long, char*); + int do_write(char*, long long, unsigned long, char*); + int do_readlink(char*, char*, int); + int do_link(char*, char*); + int do_symlink(char*, char*); + int do_setattr(char*, struct lufs_fattr*); +}; + +#endif diff --git a/filesystems/localfs/Makefile.am b/filesystems/localfs/Makefile.am new file mode 100644 index 0000000..ce2b64a --- /dev/null +++ b/filesystems/localfs/Makefile.am @@ -0,0 +1,6 @@ +INCLUDES=-I../ @all_includes@ +lib_LTLIBRARIES=liblufs-localfs.la + +noinst_HEADERS= +liblufs_localfs_la_SOURCES=localfs.c +liblufs_localfs_la_LDFLAGS=-version-info 2:0:0 diff --git a/filesystems/localfs/Makefile.in b/filesystems/localfs/Makefile.in new file mode 100644 index 0000000..7e8c12e --- /dev/null +++ b/filesystems/localfs/Makefile.in @@ -0,0 +1,457 @@ +# Makefile.in generated by automake 1.7.5 from Makefile.am. +# @configure_input@ + +# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003 +# Free Software Foundation, Inc. +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ + +srcdir = @srcdir@ +top_srcdir = @top_srcdir@ +VPATH = @srcdir@ +pkgdatadir = $(datadir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +top_builddir = ../.. + +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +INSTALL = @INSTALL@ +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = @build@ +host_triplet = @host@ +target_triplet = @target@ +ACLOCAL = @ACLOCAL@ +AMDEP_FALSE = @AMDEP_FALSE@ +AMDEP_TRUE = @AMDEP_TRUE@ +AMTAR = @AMTAR@ +AUTOCONF = @AUTOCONF@ +AUTOFS_INSTALL = @AUTOFS_INSTALL@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CXX = @CXX@ +CXXDEPMODE = @CXXDEPMODE@ +CXXFLAGS = @CXXFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DEBUG_FLAGS = @DEBUG_FLAGS@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +ECHO = @ECHO@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +EXEEXT = @EXEEXT@ +GCONF = @GCONF@ +GVFSCONF = @GVFSCONF@ +GVFS_CFLAGS = @GVFS_CFLAGS@ +GVFS_LDADD = @GVFS_LDADD@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +KDEBUG_FLAGS = @KDEBUG_FLAGS@ +KERNEL_DIR = @KERNEL_DIR@ +KERNEL_HDR = @KERNEL_HDR@ +LDFLAGS = @LDFLAGS@ +LIBCHIPCARD_INCLUDES = @LIBCHIPCARD_INCLUDES@ +LIBCHIPCARD_LIB = @LIBCHIPCARD_LIB@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LIBTOOL = @LIBTOOL@ +LN_S = @LN_S@ +LTLIBOBJS = @LTLIBOBJS@ +LUFS_SUID = @LUFS_SUID@ +MAKEINFO = @MAKEINFO@ +MODULES_DIR = @MODULES_DIR@ +MODV_FLAGS = @MODV_FLAGS@ +OBJEXT = @OBJEXT@ +OS_DIR = @OS_DIR@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +RANLIB = @RANLIB@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +SSHPROG = @SSHPROG@ +STRIP = @STRIP@ +VERSION = @VERSION@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_CXX = @ac_ct_CXX@ +ac_ct_RANLIB = @ac_ct_RANLIB@ +ac_ct_STRIP = @ac_ct_STRIP@ +all_includes = @all_includes@ +all_libraries = @all_libraries@ +am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ +am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ +am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@ +am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +datadir = @datadir@ +define_has_libchipcard = @define_has_libchipcard@ +exec_prefix = @exec_prefix@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localstatedir = @localstatedir@ +mandir = @mandir@ +oldincludedir = @oldincludedir@ +opt_fs = @opt_fs@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +sysconfdir = @sysconfdir@ +target = @target@ +target_alias = @target_alias@ +target_cpu = @target_cpu@ +target_os = @target_os@ +target_vendor = @target_vendor@ +INCLUDES = -I../ @all_includes@ +lib_LTLIBRARIES = liblufs-localfs.la + +noinst_HEADERS = +liblufs_localfs_la_SOURCES = localfs.c +liblufs_localfs_la_LDFLAGS = -version-info 2:0:0 +subdir = filesystems/localfs +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +mkinstalldirs = $(SHELL) $(top_srcdir)/config/mkinstalldirs +CONFIG_HEADER = $(top_builddir)/config.h +CONFIG_CLEAN_FILES = +LTLIBRARIES = $(lib_LTLIBRARIES) + +liblufs_localfs_la_LIBADD = +am_liblufs_localfs_la_OBJECTS = localfs.lo +liblufs_localfs_la_OBJECTS = $(am_liblufs_localfs_la_OBJECTS) + +DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir) +depcomp = $(SHELL) $(top_srcdir)/config/depcomp +am__depfiles_maybe = depfiles +@AMDEP_TRUE@DEP_FILES = ./$(DEPDIR)/localfs.Plo +COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ + $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +LTCOMPILE = $(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) \ + $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +CCLD = $(CC) +LINK = $(LIBTOOL) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ + $(AM_LDFLAGS) $(LDFLAGS) -o $@ +DIST_SOURCES = $(liblufs_localfs_la_SOURCES) +HEADERS = $(noinst_HEADERS) + +DIST_COMMON = $(noinst_HEADERS) Makefile.am Makefile.in +SOURCES = $(liblufs_localfs_la_SOURCES) + +all: all-am + +.SUFFIXES: +.SUFFIXES: .c .lo .o .obj +$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4) + cd $(top_srcdir) && \ + $(AUTOMAKE) --gnu filesystems/localfs/Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe) +libLTLIBRARIES_INSTALL = $(INSTALL) +install-libLTLIBRARIES: $(lib_LTLIBRARIES) + @$(NORMAL_INSTALL) + $(mkinstalldirs) $(DESTDIR)$(libdir) + @list='$(lib_LTLIBRARIES)'; for p in $$list; do \ + if test -f $$p; then \ + f="`echo $$p | sed -e 's|^.*/||'`"; \ + echo " $(LIBTOOL) --mode=install $(libLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) $$p $(DESTDIR)$(libdir)/$$f"; \ + $(LIBTOOL) --mode=install $(libLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) $$p $(DESTDIR)$(libdir)/$$f; \ + else :; fi; \ + done + +uninstall-libLTLIBRARIES: + @$(NORMAL_UNINSTALL) + @list='$(lib_LTLIBRARIES)'; for p in $$list; do \ + p="`echo $$p | sed -e 's|^.*/||'`"; \ + echo " $(LIBTOOL) --mode=uninstall rm -f $(DESTDIR)$(libdir)/$$p"; \ + $(LIBTOOL) --mode=uninstall rm -f $(DESTDIR)$(libdir)/$$p; \ + done + +clean-libLTLIBRARIES: + -test -z "$(lib_LTLIBRARIES)" || rm -f $(lib_LTLIBRARIES) + @list='$(lib_LTLIBRARIES)'; for p in $$list; do \ + dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \ + test "$$dir" = "$$p" && dir=.; \ + echo "rm -f \"$${dir}/so_locations\""; \ + rm -f "$${dir}/so_locations"; \ + done +liblufs-localfs.la: $(liblufs_localfs_la_OBJECTS) $(liblufs_localfs_la_DEPENDENCIES) + $(LINK) -rpath $(libdir) $(liblufs_localfs_la_LDFLAGS) $(liblufs_localfs_la_OBJECTS) $(liblufs_localfs_la_LIBADD) $(LIBS) + +mostlyclean-compile: + -rm -f *.$(OBJEXT) core *.core + +distclean-compile: + -rm -f *.tab.c + +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/localfs.Plo@am__quote@ + +distclean-depend: + -rm -rf ./$(DEPDIR) + +.c.o: +@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" \ +@am__fastdepCC_TRUE@ -c -o $@ `test -f '$<' || echo '$(srcdir)/'`$<; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; \ +@am__fastdepCC_TRUE@ else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; \ +@am__fastdepCC_TRUE@ fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(COMPILE) -c `test -f '$<' || echo '$(srcdir)/'`$< + +.c.obj: +@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" \ +@am__fastdepCC_TRUE@ -c -o $@ `if test -f '$<'; then $(CYGPATH_W) '$<'; else $(CYGPATH_W) '$(srcdir)/$<'; fi`; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; \ +@am__fastdepCC_TRUE@ else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; \ +@am__fastdepCC_TRUE@ fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(COMPILE) -c `if test -f '$<'; then $(CYGPATH_W) '$<'; else $(CYGPATH_W) '$(srcdir)/$<'; fi` + +.c.lo: +@am__fastdepCC_TRUE@ if $(LTCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" \ +@am__fastdepCC_TRUE@ -c -o $@ `test -f '$<' || echo '$(srcdir)/'`$<; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Plo"; \ +@am__fastdepCC_TRUE@ else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; \ +@am__fastdepCC_TRUE@ fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/$*.Plo' tmpdepfile='$(DEPDIR)/$*.TPlo' @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ `test -f '$<' || echo '$(srcdir)/'`$< + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs + +distclean-libtool: + -rm -f libtool +uninstall-info-am: + +ETAGS = etags +ETAGSFLAGS = + +CTAGS = ctags +CTAGSFLAGS = + +tags: TAGS + +ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + mkid -fID $$unique + +TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + tags=; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + test -z "$(ETAGS_ARGS)$$tags$$unique" \ + || $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$tags $$unique + +ctags: CTAGS +CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + tags=; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + test -z "$(CTAGS_ARGS)$$tags$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$tags $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && cd $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) $$here + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) + +top_distdir = ../.. +distdir = $(top_distdir)/$(PACKAGE)-$(VERSION) + +distdir: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \ + list='$(DISTFILES)'; for file in $$list; do \ + case $$file in \ + $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ + $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ + esac; \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test "$$dir" != "$$file" && test "$$dir" != "."; then \ + dir="/$$dir"; \ + $(mkinstalldirs) "$(distdir)$$dir"; \ + else \ + dir=''; \ + fi; \ + if test -d $$d/$$file; then \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ + fi; \ + cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ + else \ + test -f $(distdir)/$$file \ + || cp -p $$d/$$file $(distdir)/$$file \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-am +all-am: Makefile $(LTLIBRARIES) $(HEADERS) + +installdirs: + $(mkinstalldirs) $(DESTDIR)$(libdir) +install: install-am +install-exec: install-exec-am +install-data: install-data-am +uninstall: uninstall-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-am +install-strip: + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + INSTALL_STRIP_FLAG=-s \ + `test -z '$(STRIP)' || \ + echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -rm -f Makefile $(CONFIG_CLEAN_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +clean: clean-am + +clean-am: clean-generic clean-libLTLIBRARIES clean-libtool \ + mostlyclean-am + +distclean: distclean-am + +distclean-am: clean-am distclean-compile distclean-depend \ + distclean-generic distclean-libtool distclean-tags + +dvi: dvi-am + +dvi-am: + +info: info-am + +info-am: + +install-data-am: + +install-exec-am: install-libLTLIBRARIES + +install-info: install-info-am + +install-man: + +installcheck-am: + +maintainer-clean: maintainer-clean-am + +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-compile mostlyclean-generic \ + mostlyclean-libtool + +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + +uninstall-am: uninstall-info-am uninstall-libLTLIBRARIES + +.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ + clean-libLTLIBRARIES clean-libtool ctags distclean \ + distclean-compile distclean-depend distclean-generic \ + distclean-libtool distclean-tags distdir dvi dvi-am info \ + info-am install install-am install-data install-data-am \ + install-exec install-exec-am install-info install-info-am \ + install-libLTLIBRARIES install-man install-strip installcheck \ + installcheck-am installdirs maintainer-clean \ + maintainer-clean-generic mostlyclean mostlyclean-compile \ + mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ + tags uninstall uninstall-am uninstall-info-am \ + uninstall-libLTLIBRARIES + +# 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/filesystems/localfs/localfs.c b/filesystems/localfs/localfs.c new file mode 100644 index 0000000..be7dd0b --- /dev/null +++ b/filesystems/localfs/localfs.c @@ -0,0 +1,465 @@ +/* + * localfs.c + * Copyright (C) 2002 Florin Malita + * + * This file is part of LUFS, a free userspace filesystem implementation. + * See http://lufs.sourceforge.net/ for updates. + * + * LUFS 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. + * + * LUFS 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 + */ + + + +/* Sample (simple) file system. + * When mounting a lufs filesystem xxx, the lufsd daemon will try + * to open a shared library called liblufs-xxx.so. This is what your + * filesystem library should be called (in this case liblufs-localfs.so). + * + * Upon successful opening, it will try to resolve the following symbols: + * xxx_init(struct list_head*, struct dir_cache*, struct credentials*, void**), + * xxx_free(void*), + * xxx_mount(void*), + * xxx_umount(void), + * xxx_readdir(void*, char*, struct directory*), + * xxx_stat(void*, char*, struct lufs_fattr*), + * xxx_mkdir(void*, char*, int), + * xxx_rmdir(void*, char*), + * xxx_create(void*, char*, int), + * xxx_unlink(void*, char*), + * xxx_rename(void*, char*, char*), + * xxx_open(void*, char*, unsigned), + * xxx_release(void*, char*), + * xxx_read(void*, char*, long long, unsigned long, char*), + * xxx_write(void*, char*, long long, unsigned long, char*), + * xxx_readlink(void*, char*, char*, int), + * xxx_link(void*, char*, char*), + * xxx_symlink(void*, char*, char*), + * xxx_setattr(void*, char*, struct lufs_fattr*) + * + * Each of this (except xxx_init) receives as the first prameter a pointer + * to a structure allocated by xxx_init to hold state information. + * Most file system operations return 0 on success and -1 on failure. xxx_init + * will return a pointer the allocated structure, xxx_mount will return 1 + * on success and 0 upon failure, + * + * If you wish to have an object-oriented version of the filesystem, start + * with one of the other filesystems (such as sshfs) as your base. + * + * To create a new filesystem, you first need to update configure.in - + * model your changes to it after an already existant filesystem's + * configuration. Remember, you need both to add either a an AC_ARG_ENABLE + * or a AC_DEFINE line, and add the path to your new Makefile in the AC_OUTPUT + * statement at the bottom. To create your directory, pick a filesystem whose + * -configuration steps- are most similar to the one that you want to use, + * and copy it recursively to your new directory. Be sure to edit its + * Makefile.in and Makefile.am, and replace all special references to the + * old filesystem with references to your new filesystem. Update the list + * of source and header files as well as you change them. Finally, above all, + * don't forget to put the libraries that you want to link with in. You can + * either have the* names of the library calculated in configure and then + * passed in a variable (as in the case of GVFS), or simply hard-code them in + * - either way, you'll need to be modifying your lufs__la_LIBADD + * variable if you have any libraries to link with at all. + * + * A warning concerning libraries: Link errors very well may not show up until + * runtime. Be forewarned, and test thoroughly. :) + * + * To upgrade your code to the latest version of LUFS (as LUFS has been in + * fairly rapid development and you may well encounter significantly changed + * new releases) as well as to submit new code, context diffs can be very + * useful. Do a 'make distclean' on your source code, and unpack an + * unmodified, unbuilt LUFS of the same version that you have been working on + * in another directory. Type 'diff --new-file -r -C 3 > '. To patch SRBFS to handle + * your changes, including patching a newer version, if the patch is in the + * same directory as the freshly untarred LUFS, type 'patch -p1 < '. + * Accept the default answer on any questions that it asks. You can adjust + * the fuzz factor (how tolerant it is to changes) in the patch command + * with the -F option. + */ + + +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include + +#include +#include + +/* Localfs instances shared structure. + * Just an example... + */ +struct localfs_global{ + unsigned count; +}; + +/* Localfs state info structure. + * We don't need any state info for localfs, but just for kicks... + */ +struct localfs_context{ + struct localfs_global *global; +}; + +/* Initialization + * Here we allocate a structure to hold all the file system local info + * (localfs_local). This structure will then be passed as a parameter to + * the other functions. + * global_ctx holds info about another structure that can be shared between all + * instances of the filesystem. If the pointer is NULL, then this is the + * first instance and the structure should be allocated. + * ! You must implement locking/usage-count/deallocation logic when using + * a global context. (locking is omited here) + * ! Most filesystems don't need a global context so you can safely ignore the + * global_ctx parameter. + */ +void* +localfs_init(struct list_head *cfg, struct dir_cache *cache, struct credentials *cred, void **global_ctx){ + struct localfs_context *ctx; + + TRACE("initializing"); + + /* Initialize global context */ + if(!(*global_ctx)){ + TRACE("initializing global context"); + if(!(*global_ctx = malloc(sizeof(struct localfs_global)))) + return NULL; + ((struct localfs_global*)*global_ctx)->count = 0; + }else{ + TRACE("we already have a global context"); + } + + /* Increment global context usage count */ + ((struct localfs_global*)*global_ctx)->count++; + + /* Inilialize local context */ + if(!(ctx = malloc(sizeof(struct localfs_context)))){ + if(!(--((struct localfs_global*)*global_ctx)->count)){ + TRACE("freeing global context"); + free(*global_ctx); + } + return NULL; + } + /* Save a reference to the global context */ + ctx->global = *global_ctx; + + return ctx; +} + +/* Cleanup + * Check the global context count and free it if necessary. + * Deallocate memory and free all resources. + */ +void +localfs_free(void *c){ + struct localfs_context *ctx = c; + TRACE("freeing file system data"); + + if(!(--(ctx->global->count))){ + TRACE("freeing global context"); + free(ctx->global); + } + + free(ctx); +} + +/* Mount the file system. + * Called when a mount operation is performed. + * Initialize specific connections, login, etc. + * + * Notes: + * By default, LUFS may attempt multiple connections at once. If your + * filesystem doesn't support this, you need to specificy -c 1 on the + * lufsmount command line or connections=1 in the mount options. + * See ftpfs for an example of how to read configuration options + * from a configuration file if you want to, for example, be able to set + * default values. + */ +int +localfs_mount(void *ctx){ + TRACE("mounting"); + + return 1; +} + +/* Unmount the file system + * Called when the file system is unmounted. + */ +void +localfs_umount(void *ctx){ + TRACE("unmounting"); +} + +/* Read a file/dir's attributes + * Fill all relevant data into the fattr structure. + * The uid/gid fields are just ownership hints hints: + * != 0 => we own the file + * == 0 => we don't own it + * The credentials structure (if applicable and saved from _init) + * can help determine ownership based on remote uids/gids. + * + * Notes: + * If your filesysem doesn't natively support '.' or '..', + * don't forget to special-case them here. + * It is best to assume that name is a relative path, not an + * absolute one. Thus, you need to either be keeping track of the + * last accessed directory in readdir, or, as this code does, changing + * to the current directory there. + */ +int +localfs_stat(void *ctx, char *name, struct lufs_fattr *fattr){ + struct stat stat; + + if(lstat(name, &stat) < 0) + return -1; + + fattr->f_mode = stat.st_mode; + fattr->f_nlink = stat.st_nlink; + fattr->f_uid = (getuid() == stat.st_uid) ? 1 : 0; + fattr->f_gid = (getgid() == stat.st_gid) ? 1 : 0; + fattr->f_size = stat.st_size; + fattr->f_atime = stat.st_atime; + fattr->f_mtime = stat.st_mtime; + fattr->f_ctime = stat.st_ctime; + + return 0; +} + +/* Read a directory's content + * For each directory entry, call + * lu_cache_add2dir(struct directory *dir, char *name, char *link, struct lufs_fattr *fattr) + * to add its information. + * The link is optional(NULL) and applicable only if the entry is a + * (sym)link and we have the target info at hand. + * + * Notes: + * dir_name is an absolute path. However, it is generally a good idea + * to either change to that directory here or at least keep track of what + * directory was being called on, for function calls that might not get + * absolute paths. + * If your filesystem doesn't natively support '.' or '..', don't forget + * to add them to the cache first-thing here. + */ +int +localfs_readdir(void *ctx, char *dir_name, struct directory *ddir){ + DIR *dir; + struct lufs_fattr fattr; + struct dirent *dent; + int res; + + TRACE("readdir %s", dir_name); + + if(chdir(dir_name) < 0){ + WARN("chdir %s failed: %s", dir_name, strerror(errno)); + return -1; + } + + if(!(dir = opendir(dir_name))){ + WARN("could not open directory!"); + return -1; + } + + while((dent = readdir(dir))){ + TRACE("adding direntry %s", dent->d_name); + + if((res = localfs_stat(ctx, dent->d_name, &fattr)) < 0){ + WARN("could not stat file!"); + closedir(dir); + return -1; + } + + lu_cache_add2dir(ddir, dent->d_name, NULL, &fattr); + + } + + closedir(dir); + + return 0; +} + +/* Create a directory + */ +int +localfs_mkdir(void *ctx, char *dir, int mode){ + return mkdir(dir, mode); +} + +/* Delete a directory + */ +int +localfs_rmdir(void *ctx, char *dir){ + return rmdir(dir); +} + +/* Create a file + */ +int +localfs_create(void *ctx, char *file, int mode){ + return mknod(file, mode, 0); +} + +/* Delete a file + */ +int +localfs_unlink(void *ctx, char *file){ + return unlink(file); +} + +/* Rename a file/dir + */ +int +localfs_rename(void *ctx, char *old_name, char *new_name){ + return rename(old_name, new_name); +} + +/* Open a file + * + * Notes: + * By default, LUFS has no concept of file handles. To implement file + * handles, take a look at the atbl class in sshfs - it is easy to cut&paste + * for use, and can be easily adapted for whatever purpose you need handles + * for. + * + * Unlike the POSIX open command which has both a "mode" variable and + * a "flags" variable, this only has a "mode" variable. To convert to the + * POSIX version, ->flags=mode^O_ACCMODE and ->mode=mode&O_ACCMODE. + */ +int +localfs_open(void *ctx, char *file, unsigned mode){ + return 1; +} + +int +localfs_release(void *ctx, char *file){ + return 1; +} + +/* Read from a file. Changed to use the (2) routines not for efficiency, + * but to make it work with 64-bit offsets :-(. + */ +int +localfs_read(void *ctx, char *file, long long offset, unsigned long count, char *buf){ + int f, res; + + TRACE("read %s, offset %Ld, count %ld", file, offset, count); + + if((f = open(file, 0)) < 0){ + TRACE("open failed"); + return -1; + } + + if(lseek(f, offset, SEEK_SET) < 0){ + close(f); + TRACE("seek failed"); + return -1; + } + + res = read(f, buf, count); + + TRACE("read: %d", res); + + close(f); + + return res; +} + +/* Write to a file + */ +int +localfs_write(void *ctx, char *file, long long offset, unsigned long count, char *buf){ + int fd, res; + + TRACE("write %s, offset %Ld, count %ld", file, offset, count); + + if((fd = open(file, O_RDWR)) < 0){ + TRACE("open failed"); + return -1; + } + + if(lseek(fd, offset, SEEK_SET) < 0){ + TRACE("lseek failed"); + close(fd); + return -1; + } + + res = write(fd, buf, count); + + close(fd); + + return res; +} + +/* Resolve a link (if the info was not added to the dir cache when + * reading the parent dir) + */ +int +localfs_readlink(void *ctx, char *link, char *buf, int buflen){ + return readlink(link, buf, buflen); +} + +/* Create a link + */ +int +localfs_link(void *ctx, char *target, char *lnk){ + return link(target, lnk); +} + +/* Create a symlink + */ +int +localfs_symlink(void *ctx, char *target, char *link){ + return symlink(target, link); +} + +/* Change a file/dir's attributes + */ +int +localfs_setattr(void *ctx, char *file, struct lufs_fattr *fattr){ + struct stat stat; + int res; + + if((res = lstat(file, &stat)) < 0) + goto out; + + if(stat.st_size > fattr->f_size){ + TRACE("truncating file to %Ld bytes", fattr->f_size); + if((res = truncate(file, fattr->f_size)) < 0) + goto out; + } + + if(stat.st_mode != fattr->f_mode){ + TRACE("set mode %o, old=%o", (unsigned)fattr->f_mode, (unsigned)stat.st_mode); + if((res = chmod(file, fattr->f_mode)) < 0) + goto out; + } + + if((stat.st_atime != (time_t)fattr->f_atime) || (stat.st_mtime != (time_t)fattr->f_mtime)){ + struct utimbuf utim = {fattr->f_atime, fattr->f_mtime}; + + if((res = utime(file, &utim)) < 0) + goto out; + } + + out: + return res; +} + diff --git a/filesystems/locasefs/Makefile.am b/filesystems/locasefs/Makefile.am new file mode 100644 index 0000000..bd6b4c1 --- /dev/null +++ b/filesystems/locasefs/Makefile.am @@ -0,0 +1,6 @@ +INCLUDES=-I../ @all_includes@ +lib_LTLIBRARIES=liblufs-locasefs.la + +noinst_HEADERS=locasefs.h +liblufs_locasefs_la_SOURCES=locasefs.cpp +liblufs_locasefs_la_LDFLAGS=-version-info 2:0:0 \ No newline at end of file diff --git a/filesystems/locasefs/Makefile.in b/filesystems/locasefs/Makefile.in new file mode 100644 index 0000000..af9ac45 --- /dev/null +++ b/filesystems/locasefs/Makefile.in @@ -0,0 +1,458 @@ +# Makefile.in generated by automake 1.7.5 from Makefile.am. +# @configure_input@ + +# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003 +# Free Software Foundation, Inc. +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ + +srcdir = @srcdir@ +top_srcdir = @top_srcdir@ +VPATH = @srcdir@ +pkgdatadir = $(datadir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +top_builddir = ../.. + +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +INSTALL = @INSTALL@ +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = @build@ +host_triplet = @host@ +target_triplet = @target@ +ACLOCAL = @ACLOCAL@ +AMDEP_FALSE = @AMDEP_FALSE@ +AMDEP_TRUE = @AMDEP_TRUE@ +AMTAR = @AMTAR@ +AUTOCONF = @AUTOCONF@ +AUTOFS_INSTALL = @AUTOFS_INSTALL@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CXX = @CXX@ +CXXDEPMODE = @CXXDEPMODE@ +CXXFLAGS = @CXXFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DEBUG_FLAGS = @DEBUG_FLAGS@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +ECHO = @ECHO@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +EXEEXT = @EXEEXT@ +GCONF = @GCONF@ +GVFSCONF = @GVFSCONF@ +GVFS_CFLAGS = @GVFS_CFLAGS@ +GVFS_LDADD = @GVFS_LDADD@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +KDEBUG_FLAGS = @KDEBUG_FLAGS@ +KERNEL_DIR = @KERNEL_DIR@ +KERNEL_HDR = @KERNEL_HDR@ +LDFLAGS = @LDFLAGS@ +LIBCHIPCARD_INCLUDES = @LIBCHIPCARD_INCLUDES@ +LIBCHIPCARD_LIB = @LIBCHIPCARD_LIB@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LIBTOOL = @LIBTOOL@ +LN_S = @LN_S@ +LTLIBOBJS = @LTLIBOBJS@ +LUFS_SUID = @LUFS_SUID@ +MAKEINFO = @MAKEINFO@ +MODULES_DIR = @MODULES_DIR@ +MODV_FLAGS = @MODV_FLAGS@ +OBJEXT = @OBJEXT@ +OS_DIR = @OS_DIR@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +RANLIB = @RANLIB@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +SSHPROG = @SSHPROG@ +STRIP = @STRIP@ +VERSION = @VERSION@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_CXX = @ac_ct_CXX@ +ac_ct_RANLIB = @ac_ct_RANLIB@ +ac_ct_STRIP = @ac_ct_STRIP@ +all_includes = @all_includes@ +all_libraries = @all_libraries@ +am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ +am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ +am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@ +am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +datadir = @datadir@ +define_has_libchipcard = @define_has_libchipcard@ +exec_prefix = @exec_prefix@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localstatedir = @localstatedir@ +mandir = @mandir@ +oldincludedir = @oldincludedir@ +opt_fs = @opt_fs@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +sysconfdir = @sysconfdir@ +target = @target@ +target_alias = @target_alias@ +target_cpu = @target_cpu@ +target_os = @target_os@ +target_vendor = @target_vendor@ +INCLUDES = -I../ @all_includes@ +lib_LTLIBRARIES = liblufs-locasefs.la + +noinst_HEADERS = locasefs.h +liblufs_locasefs_la_SOURCES = locasefs.cpp +liblufs_locasefs_la_LDFLAGS = -version-info 2:0:0 +subdir = filesystems/locasefs +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +mkinstalldirs = $(SHELL) $(top_srcdir)/config/mkinstalldirs +CONFIG_HEADER = $(top_builddir)/config.h +CONFIG_CLEAN_FILES = +LTLIBRARIES = $(lib_LTLIBRARIES) + +liblufs_locasefs_la_LIBADD = +am_liblufs_locasefs_la_OBJECTS = locasefs.lo +liblufs_locasefs_la_OBJECTS = $(am_liblufs_locasefs_la_OBJECTS) + +DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir) +depcomp = $(SHELL) $(top_srcdir)/config/depcomp +am__depfiles_maybe = depfiles +@AMDEP_TRUE@DEP_FILES = ./$(DEPDIR)/locasefs.Plo +CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ + $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) +LTCXXCOMPILE = $(LIBTOOL) --mode=compile $(CXX) $(DEFS) \ + $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ + $(AM_CXXFLAGS) $(CXXFLAGS) +CXXLD = $(CXX) +CXXLINK = $(LIBTOOL) --mode=link $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) \ + $(AM_LDFLAGS) $(LDFLAGS) -o $@ +DIST_SOURCES = $(liblufs_locasefs_la_SOURCES) +HEADERS = $(noinst_HEADERS) + +DIST_COMMON = $(noinst_HEADERS) Makefile.am Makefile.in +SOURCES = $(liblufs_locasefs_la_SOURCES) + +all: all-am + +.SUFFIXES: +.SUFFIXES: .cpp .lo .o .obj +$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4) + cd $(top_srcdir) && \ + $(AUTOMAKE) --gnu filesystems/locasefs/Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe) +libLTLIBRARIES_INSTALL = $(INSTALL) +install-libLTLIBRARIES: $(lib_LTLIBRARIES) + @$(NORMAL_INSTALL) + $(mkinstalldirs) $(DESTDIR)$(libdir) + @list='$(lib_LTLIBRARIES)'; for p in $$list; do \ + if test -f $$p; then \ + f="`echo $$p | sed -e 's|^.*/||'`"; \ + echo " $(LIBTOOL) --mode=install $(libLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) $$p $(DESTDIR)$(libdir)/$$f"; \ + $(LIBTOOL) --mode=install $(libLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) $$p $(DESTDIR)$(libdir)/$$f; \ + else :; fi; \ + done + +uninstall-libLTLIBRARIES: + @$(NORMAL_UNINSTALL) + @list='$(lib_LTLIBRARIES)'; for p in $$list; do \ + p="`echo $$p | sed -e 's|^.*/||'`"; \ + echo " $(LIBTOOL) --mode=uninstall rm -f $(DESTDIR)$(libdir)/$$p"; \ + $(LIBTOOL) --mode=uninstall rm -f $(DESTDIR)$(libdir)/$$p; \ + done + +clean-libLTLIBRARIES: + -test -z "$(lib_LTLIBRARIES)" || rm -f $(lib_LTLIBRARIES) + @list='$(lib_LTLIBRARIES)'; for p in $$list; do \ + dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \ + test "$$dir" = "$$p" && dir=.; \ + echo "rm -f \"$${dir}/so_locations\""; \ + rm -f "$${dir}/so_locations"; \ + done +liblufs-locasefs.la: $(liblufs_locasefs_la_OBJECTS) $(liblufs_locasefs_la_DEPENDENCIES) + $(CXXLINK) -rpath $(libdir) $(liblufs_locasefs_la_LDFLAGS) $(liblufs_locasefs_la_OBJECTS) $(liblufs_locasefs_la_LIBADD) $(LIBS) + +mostlyclean-compile: + -rm -f *.$(OBJEXT) core *.core + +distclean-compile: + -rm -f *.tab.c + +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/locasefs.Plo@am__quote@ + +distclean-depend: + -rm -rf ./$(DEPDIR) + +.cpp.o: +@am__fastdepCXX_TRUE@ if $(CXXCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" \ +@am__fastdepCXX_TRUE@ -c -o $@ `test -f '$<' || echo '$(srcdir)/'`$<; \ +@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; \ +@am__fastdepCXX_TRUE@ else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; \ +@am__fastdepCXX_TRUE@ fi +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ `test -f '$<' || echo '$(srcdir)/'`$< + +.cpp.obj: +@am__fastdepCXX_TRUE@ if $(CXXCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" \ +@am__fastdepCXX_TRUE@ -c -o $@ `if test -f '$<'; then $(CYGPATH_W) '$<'; else $(CYGPATH_W) '$(srcdir)/$<'; fi`; \ +@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; \ +@am__fastdepCXX_TRUE@ else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; \ +@am__fastdepCXX_TRUE@ fi +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ `if test -f '$<'; then $(CYGPATH_W) '$<'; else $(CYGPATH_W) '$(srcdir)/$<'; fi` + +.cpp.lo: +@am__fastdepCXX_TRUE@ if $(LTCXXCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" \ +@am__fastdepCXX_TRUE@ -c -o $@ `test -f '$<' || echo '$(srcdir)/'`$<; \ +@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Plo"; \ +@am__fastdepCXX_TRUE@ else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; \ +@am__fastdepCXX_TRUE@ fi +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ depfile='$(DEPDIR)/$*.Plo' tmpdepfile='$(DEPDIR)/$*.TPlo' @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(LTCXXCOMPILE) -c -o $@ `test -f '$<' || echo '$(srcdir)/'`$< + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs + +distclean-libtool: + -rm -f libtool +uninstall-info-am: + +ETAGS = etags +ETAGSFLAGS = + +CTAGS = ctags +CTAGSFLAGS = + +tags: TAGS + +ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + mkid -fID $$unique + +TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + tags=; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + test -z "$(ETAGS_ARGS)$$tags$$unique" \ + || $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$tags $$unique + +ctags: CTAGS +CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + tags=; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + test -z "$(CTAGS_ARGS)$$tags$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$tags $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && cd $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) $$here + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) + +top_distdir = ../.. +distdir = $(top_distdir)/$(PACKAGE)-$(VERSION) + +distdir: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \ + list='$(DISTFILES)'; for file in $$list; do \ + case $$file in \ + $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ + $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ + esac; \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test "$$dir" != "$$file" && test "$$dir" != "."; then \ + dir="/$$dir"; \ + $(mkinstalldirs) "$(distdir)$$dir"; \ + else \ + dir=''; \ + fi; \ + if test -d $$d/$$file; then \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ + fi; \ + cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ + else \ + test -f $(distdir)/$$file \ + || cp -p $$d/$$file $(distdir)/$$file \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-am +all-am: Makefile $(LTLIBRARIES) $(HEADERS) + +installdirs: + $(mkinstalldirs) $(DESTDIR)$(libdir) +install: install-am +install-exec: install-exec-am +install-data: install-data-am +uninstall: uninstall-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-am +install-strip: + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + INSTALL_STRIP_FLAG=-s \ + `test -z '$(STRIP)' || \ + echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -rm -f Makefile $(CONFIG_CLEAN_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +clean: clean-am + +clean-am: clean-generic clean-libLTLIBRARIES clean-libtool \ + mostlyclean-am + +distclean: distclean-am + +distclean-am: clean-am distclean-compile distclean-depend \ + distclean-generic distclean-libtool distclean-tags + +dvi: dvi-am + +dvi-am: + +info: info-am + +info-am: + +install-data-am: + +install-exec-am: install-libLTLIBRARIES + +install-info: install-info-am + +install-man: + +installcheck-am: + +maintainer-clean: maintainer-clean-am + +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-compile mostlyclean-generic \ + mostlyclean-libtool + +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + +uninstall-am: uninstall-info-am uninstall-libLTLIBRARIES + +.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ + clean-libLTLIBRARIES clean-libtool ctags distclean \ + distclean-compile distclean-depend distclean-generic \ + distclean-libtool distclean-tags distdir dvi dvi-am info \ + info-am install install-am install-data install-data-am \ + install-exec install-exec-am install-info install-info-am \ + install-libLTLIBRARIES install-man install-strip installcheck \ + installcheck-am installdirs maintainer-clean \ + maintainer-clean-generic mostlyclean mostlyclean-compile \ + mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ + tags uninstall uninstall-am uninstall-info-am \ + uninstall-libLTLIBRARIES + +# 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/filesystems/locasefs/locasefs.cpp b/filesystems/locasefs/locasefs.cpp new file mode 100644 index 0000000..94f5d3d --- /dev/null +++ b/filesystems/locasefs/locasefs.cpp @@ -0,0 +1,697 @@ +/* + * locasefs.cpp + * + * This file is part of LUFS, a free userspace filesystem implementation. + * See http://lufs.sourceforge.net/ for updates. + * + * LUFS 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. + * + * LUFS 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 + */ + +/* + TTimo: filename casing operations + Use case: + Win32 filesystem is basically case insensitive. + Casing in file names is supported, but not relevant when opening files, a case insensitive matching is performed. + If working with source code obtained from win32 on *nix systems, you often have to manually convert into a lowercase-only tree to be safe + Getting into a more complicated situation where the *nix version has to interoperate with the win32 source, without + the ability to change all the casing to be correctly lowercase in the win32 master source. + Objective: + Provide a lowercase mapping of a filesystem (read/write). + Discussion: + There are probably several operating options, such as supporting a case-sensitive filesystem a-la-win32, mapping to uppercase, mapping to lowercase .. + Implementation: + get the lowercase mount as a flag over regular localfs? + NOTE: what happens if root has something like: File and file in same dir? first found will be selected +*/ + + +#include +#include +#include +#include +#include +#include +#include + +#include +#include + +#include "locasefs.h" + +extern "C"{ + +void* +locasefs_init(struct list_head *cfg, struct dir_cache *cache, struct credentials *cred, void **global_ctx){ + return (void*)new LocaseFS(cfg, cache, cred); +} + +void +locasefs_free(void *ctx){ + LocaseFS *p = (LocaseFS*)ctx; + + delete p; +} + +int +locasefs_mount(void *ctx){ + return ((LocaseFS*)ctx)->do_mount(); +} + +void +locasefs_umount(void *ctx){ +// return ((LocaseFS*)ctx)->do_umount(); +} + +int +locasefs_readdir(void *ctx, char *dir_name, struct directory *dir){ + return ((LocaseFS*)ctx)->do_readdir(dir_name, dir); +} + +int +locasefs_stat(void *ctx, char *name, struct lufs_fattr *fattr){ + return ((LocaseFS*)ctx)->do_stat(name, fattr); +} + +int +locasefs_mkdir(void *ctx, char *dir, int mode){ + return ((LocaseFS*)ctx)->do_mkdir(dir, mode); +} + +int +locasefs_rmdir(void *ctx, char *dir){ + return ((LocaseFS*)ctx)->do_rmdir(dir); +} + +int +locasefs_create(void *ctx, char *file, int mode){ + return ((LocaseFS*)ctx)->do_create(file, mode); +} + +int +locasefs_unlink(void *ctx, char *file){ + return ((LocaseFS*)ctx)->do_unlink(file); +} + +int +locasefs_rename(void *ctx, char *old_name, char *new_name){ + return ((LocaseFS*)ctx)->do_rename(old_name, new_name); +} + +int +locasefs_open(void *ctx, char *file, unsigned mode){ + return ((LocaseFS*)ctx)->do_open(file, mode); +} + +int +locasefs_release(void *ctx, char *file){ + return ((LocaseFS*)ctx)->do_release(file); +} + +int +locasefs_read(void *ctx, char *file, long long offset, unsigned long count, char *buf){ + return ((LocaseFS*)ctx)->do_read(file, offset, count, buf); +} + +int +locasefs_write(void *ctx, char *file, long long offset, unsigned long count, char *buf){ + return ((LocaseFS*)ctx)->do_write(file, offset, count, buf); +} + +int +locasefs_readlink(void *ctx, char *link, char *buf, int buflen){ + return ((LocaseFS*)ctx)->do_readlink(link, buf, buflen); +} + +int +locasefs_link(void *ctx, char *target, char *link){ + return ((LocaseFS*)ctx)->do_link(target, link); +} + +int +locasefs_symlink(void *ctx, char *target, char *link){ + return ((LocaseFS*)ctx)->do_symlink(target, link); +} + +int +locasefs_setattr(void *ctx, char *file, struct lufs_fattr *fattr){ + return ((LocaseFS*)ctx)->do_setattr(file, fattr); +} + +} + +/***** Some generic code *****/ + +/* Constructor. + * Importance: 10 + * Nothing interesting here, just call the superclass' constructor + */ +LocaseFS::LocaseFS(struct list_head *c, struct dir_cache *cache, struct credentials *cred){ + const char *root; + + TRACE("in LocaseFS constructor"); + + cfg = c; + this->cache = cache; + this->cred = cred; + + strcpy(root_dir, "/"); + if((root = lu_opt_getchar(c, "MOUNT", "root"))) + strcpy(root_dir, root); + + if(!root_dir[0]) + strcpy(root_dir, "/"); + + if (root_dir[strlen(root_dir)-1] == '/') + root_dir[strlen(root_dir)-1] = '\0'; + + TRACE("root dir: " << root_dir); +} + +/* Destructor. + * Importance: 10 + * Not too intresting either... + */ +LocaseFS::~LocaseFS(){ + TRACE("in LocaseFS destructor"); +} + + +/***** Utilities *****/ + +/* get_reference_path + * Retrieve the reference path from a local dir + * depending on lowercase, it's a simple copy or a lookup + * works on dirs and files + */ +bool +LocaseFS::get_reference_path(const char *d, string &ref_d) +{ + char *p; + + TRACE("path: "<d_name)) + { + // got a match, go down one level + ref_d += '/'; + ref_d += dent->d_name; + ::closedir(dir); + if (bEndLoop) + break; // we are done + // new match + match_p = match_cut; match_p++; + match_cut = strchr(match_p, '/'); + if (match_cut) + { + if (match_cut[1]=='\0') + bEndLoop = true; // stop after this, it's only a trailing / + match_cut[0] = '\0'; + } + else + bEndLoop = true; + // setup the next loop + dir = ::opendir(ref_d.c_str()); + if (!dir) + { + WARN("could not open directory!" << ref_d.c_str()); + return false; + } + } + } + if (!dent) + { + // we ran through the dir and didn't find any match + WARN("Didn't find case match for " << match_p); + ::closedir(dir); + return false; + } + TRACE(d << " matched to " << ref_d); + return true; +} + +/* get_top_reference_path + * get the reference path of the top directory (for a file or directory) + * leave the file unchanged (also works for dirs) + * this is used for dir/file creations + */ +bool +LocaseFS::get_top_reference_path(const char *d, string &ref_top_d) +{ + unsigned i; + string s_dir = d; + i = s_dir.find_last_of('/'); + if (i == string::npos){ + WARN("Could not isolate top directory from: " << d); + return -1; + } + string top_dir = (i == 0) ? string("/") : s_dir.substr(0, i); + string file = s_dir.substr(i + 1, s_dir.length() - i - 1); + if(!get_reference_path(top_dir.c_str(), ref_top_d)) + return false; + ref_top_d += string("/"); + ref_top_d += file; + TRACE("matched up to :" << ref_top_d.c_str()); + return true; +} + +/* int_do_stat: stat a file. + * Importance: 10 + * Will read a file/dir/link's attributes and store them in fattr. + * + */ +int +LocaseFS::int_do_stat(const char *nm, struct lufs_fattr *fattr){ + struct stat stat; + int res; + + if((res = ::lstat(nm, &stat)) < 0) + return res; + + fattr->f_mode = stat.st_mode; + fattr->f_nlink = stat.st_nlink; + fattr->f_uid = (getuid() == stat.st_uid) ? 1 : 0; + fattr->f_gid = (getgid() == stat.st_gid) ? 1 : 0; + fattr->f_size = stat.st_size; + fattr->f_atime = stat.st_atime; + fattr->f_mtime = stat.st_mtime; + fattr->f_ctime = stat.st_ctime; + + return 0; +} + + +/***** Next come the callbacks, associated with their respective VFS operations *****/ + +/* do_mount: mount the filesystem + * Importance: 10 + * This will initialize the filesystem (create connections, + * authenticate users, etc). + * For localfs there's nothing to initialize... + */ +int +LocaseFS::do_mount(){ + TRACE("mounting a localfs."); + return 1; +} + +/* do_readdir: read a directory in cache. + * Importance: 10 + * go through all the entries in the given dir and add them to + * the directory structure (lu_cache_add2dir(ddir, filename, link, fattr)). + * + * fields of fattr that must be filled: + * * f_mode + * * f_nlink + * * f_uid - should be != 0 if we have owner permissions on the entry, 0 otherwise. + * * f_gid - should be != 0 if we have group permissions on the entry, 0 otherwise. + * * f_size + * * f_atime + * * f_ctime + * * f_mtime + + * TTimo - bLowCase + * remap all the names to lowercase + */ + +int +LocaseFS::do_readdir(char* d, struct directory *ddir){ + DIR *dir; + struct lufs_fattr fattr; + int res; + string s; + string ref_d; // reference directory name + + TRACE("dir: "<< d); + + if (!get_reference_path(d, ref_d)) + return -1; + + if(!(dir = ::opendir(ref_d.c_str()))){ + WARN("could not open directory!"); + return -1; + } + + while(struct dirent *dent = ::readdir(dir)){ + // directly convert d_name to lowercase + // do we have any interest in keep the reverse mapping? + // (for faster lookups probably?) + // depends .. if we look into this systematically when we open the files.. then we should do this + + char d_name_low[PATH_MAX]; + strcpy(d_name_low, dent->d_name); + + char *p = d_name_low; + while(*p) { *p = tolower(*p); p++; } + + TRACE("adding direntry " << dent->d_name << " as " << d_name_low); + + // ref_d never has trailing slash + s = ref_d + '/' + dent->d_name; + + // here we need to stat the reference file + + TRACE("stating file " << s.c_str()); + + if((res = int_do_stat((char*)s.c_str(), &fattr)) < 0){ + WARN("could not stat file!"); + ::closedir(dir); + return res; + } + + // here we should be adding the lowercase version + lu_cache_add2dir(ddir, d_name_low, NULL, &fattr); + + } + + ::closedir(dir); + + return 0; +} + +/* do_stat: stat a file. + * Importance: 10 + * Will read a file/dir/link's attributes and store them in fattr. + * lowercase: will lookup the stat on the reference case version + */ +int +LocaseFS::do_stat(char *nm, struct lufs_fattr *fattr){ + string ref_nm; + if (!get_reference_path(nm, ref_nm)) + return -1; + + return int_do_stat(ref_nm.c_str(), fattr); +} + +/* do_mkdir: create a directory. + * Importance: 5 + * Will create the named directory with the given permissions. + * lowercase: we have to do some lookup to matchup the top dir + */ +int +LocaseFS::do_mkdir(char *dir, int mode){ + string ref_top_dir; + if (!get_top_reference_path(dir, ref_top_dir)) + return -1; + + return ::mkdir(ref_top_dir.c_str(), mode); +} + +/* do_rmdir: erase a directory. + * Importance: 5 + * Will erase the named directory. + * lowercase: lookup first + */ +int +LocaseFS::do_rmdir(char *dir){ + string ref_dir; + if (!get_reference_path(dir, ref_dir)) + return -1; + + return ::rmdir(ref_dir.c_str()); +} + +/* do_create: create a file. + * Importance: 6 + * Will create the named file with the given permissions. + * lowercase: lookup the top dir of the file to create + */ +int +LocaseFS::do_create(char *file_, int mode){ + string ref_top_file; + if (!get_top_reference_path(file_, ref_top_file)) + return -1; + + TRACE("create "< "<f_mode){ + TRACE("set mode "<f_mode<<" old="<f_mode)) < 0) + goto out; + } + + if((stat.st_atime != (time_t)fattr->f_atime) || (stat.st_mtime != (time_t)fattr->f_mtime)){ + struct utimbuf utim = {fattr->f_atime, fattr->f_mtime}; + + TRACE("set times "<f_atime<<","<f_mtime<<" old="< +#include + +using namespace std; + +struct directory; +struct dir_cache; + +/* Main filesystem class, extending FileSystem */ +class LocaseFS { + struct credentials *cred; + struct dir_cache *cache; + struct list_head *cfg; + char root_dir[PATH_MAX]; + + // get the complete reference path of an existing file/directory + bool get_reference_path(const char *d, string &ref_d); + // get the reference path of the top directory (for a file or directory) + // leave the file unchanged (also works for dirs) + // this is used for dir/file creations + bool get_top_reference_path(const char *d, string &ref_top_d); + // reference versions, unmodified, no path wrapping + int int_do_stat(const char*, struct lufs_fattr*); + + public: + LocaseFS(struct list_head*, struct dir_cache*, struct credentials*); + ~LocaseFS(); + + int do_mount(); + int do_readdir(char*, struct directory*); + int do_stat(char*, struct lufs_fattr*); + int do_mkdir(char*, int); + int do_rmdir(char*); + int do_create(char*, int); + int do_unlink(char*); + int do_rename(char*, char*); + int do_open(char*, unsigned); + int do_release(char*); + int do_read(char*, long long, unsigned long, char*); + int do_write(char*, long long, unsigned long, char*); + int do_readlink(char*, char*, int); + int do_link(char*, char*); + int do_symlink(char*, char*); + int do_setattr(char*, struct lufs_fattr*); +}; + +#endif + diff --git a/filesystems/sshfs/Makefile.am b/filesystems/sshfs/Makefile.am new file mode 100644 index 0000000..5b2fe82 --- /dev/null +++ b/filesystems/sshfs/Makefile.am @@ -0,0 +1,9 @@ +CXXFLAGS:= -O2 -Wall -DSSHPROG=\"@SSHPROG@\" @DEBUG_FLAGS@ + +INCLUDES=-I../ @all_includes@ +lib_LTLIBRARIES=liblufs-sshfs.la + +noinst_HEADERS=sshfs.h sftplib.h +liblufs_sshfs_la_SOURCES=sshfs.cpp sftplib.cpp + +liblufs_sshfs_la_LDFLAGS=-version-info 2:0:0 diff --git a/filesystems/sshfs/Makefile.in b/filesystems/sshfs/Makefile.in new file mode 100644 index 0000000..6dc0129 --- /dev/null +++ b/filesystems/sshfs/Makefile.in @@ -0,0 +1,461 @@ +# Makefile.in generated by automake 1.7.5 from Makefile.am. +# @configure_input@ + +# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003 +# Free Software Foundation, Inc. +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ + +srcdir = @srcdir@ +top_srcdir = @top_srcdir@ +VPATH = @srcdir@ +pkgdatadir = $(datadir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +top_builddir = ../.. + +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +INSTALL = @INSTALL@ +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = @build@ +host_triplet = @host@ +target_triplet = @target@ +ACLOCAL = @ACLOCAL@ +AMDEP_FALSE = @AMDEP_FALSE@ +AMDEP_TRUE = @AMDEP_TRUE@ +AMTAR = @AMTAR@ +AUTOCONF = @AUTOCONF@ +AUTOFS_INSTALL = @AUTOFS_INSTALL@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CXX = @CXX@ +CXXDEPMODE = @CXXDEPMODE@ +CXXFLAGS := -O2 -Wall -DSSHPROG=\"@SSHPROG@\" @DEBUG_FLAGS@ +CYGPATH_W = @CYGPATH_W@ +DEBUG_FLAGS = @DEBUG_FLAGS@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +ECHO = @ECHO@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +EXEEXT = @EXEEXT@ +GCONF = @GCONF@ +GVFSCONF = @GVFSCONF@ +GVFS_CFLAGS = @GVFS_CFLAGS@ +GVFS_LDADD = @GVFS_LDADD@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +KDEBUG_FLAGS = @KDEBUG_FLAGS@ +KERNEL_DIR = @KERNEL_DIR@ +KERNEL_HDR = @KERNEL_HDR@ +LDFLAGS = @LDFLAGS@ +LIBCHIPCARD_INCLUDES = @LIBCHIPCARD_INCLUDES@ +LIBCHIPCARD_LIB = @LIBCHIPCARD_LIB@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LIBTOOL = @LIBTOOL@ +LN_S = @LN_S@ +LTLIBOBJS = @LTLIBOBJS@ +LUFS_SUID = @LUFS_SUID@ +MAKEINFO = @MAKEINFO@ +MODULES_DIR = @MODULES_DIR@ +MODV_FLAGS = @MODV_FLAGS@ +OBJEXT = @OBJEXT@ +OS_DIR = @OS_DIR@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +RANLIB = @RANLIB@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +SSHPROG = @SSHPROG@ +STRIP = @STRIP@ +VERSION = @VERSION@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_CXX = @ac_ct_CXX@ +ac_ct_RANLIB = @ac_ct_RANLIB@ +ac_ct_STRIP = @ac_ct_STRIP@ +all_includes = @all_includes@ +all_libraries = @all_libraries@ +am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ +am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ +am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@ +am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +datadir = @datadir@ +define_has_libchipcard = @define_has_libchipcard@ +exec_prefix = @exec_prefix@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localstatedir = @localstatedir@ +mandir = @mandir@ +oldincludedir = @oldincludedir@ +opt_fs = @opt_fs@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +sysconfdir = @sysconfdir@ +target = @target@ +target_alias = @target_alias@ +target_cpu = @target_cpu@ +target_os = @target_os@ +target_vendor = @target_vendor@ + +INCLUDES = -I../ @all_includes@ +lib_LTLIBRARIES = liblufs-sshfs.la + +noinst_HEADERS = sshfs.h sftplib.h +liblufs_sshfs_la_SOURCES = sshfs.cpp sftplib.cpp + +liblufs_sshfs_la_LDFLAGS = -version-info 2:0:0 +subdir = filesystems/sshfs +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +mkinstalldirs = $(SHELL) $(top_srcdir)/config/mkinstalldirs +CONFIG_HEADER = $(top_builddir)/config.h +CONFIG_CLEAN_FILES = +LTLIBRARIES = $(lib_LTLIBRARIES) + +liblufs_sshfs_la_LIBADD = +am_liblufs_sshfs_la_OBJECTS = sshfs.lo sftplib.lo +liblufs_sshfs_la_OBJECTS = $(am_liblufs_sshfs_la_OBJECTS) + +DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir) +depcomp = $(SHELL) $(top_srcdir)/config/depcomp +am__depfiles_maybe = depfiles +@AMDEP_TRUE@DEP_FILES = ./$(DEPDIR)/sftplib.Plo ./$(DEPDIR)/sshfs.Plo +CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ + $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) +LTCXXCOMPILE = $(LIBTOOL) --mode=compile $(CXX) $(DEFS) \ + $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ + $(AM_CXXFLAGS) $(CXXFLAGS) +CXXLD = $(CXX) +CXXLINK = $(LIBTOOL) --mode=link $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) \ + $(AM_LDFLAGS) $(LDFLAGS) -o $@ +DIST_SOURCES = $(liblufs_sshfs_la_SOURCES) +HEADERS = $(noinst_HEADERS) + +DIST_COMMON = $(noinst_HEADERS) Makefile.am Makefile.in +SOURCES = $(liblufs_sshfs_la_SOURCES) + +all: all-am + +.SUFFIXES: +.SUFFIXES: .cpp .lo .o .obj +$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4) + cd $(top_srcdir) && \ + $(AUTOMAKE) --gnu filesystems/sshfs/Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe) +libLTLIBRARIES_INSTALL = $(INSTALL) +install-libLTLIBRARIES: $(lib_LTLIBRARIES) + @$(NORMAL_INSTALL) + $(mkinstalldirs) $(DESTDIR)$(libdir) + @list='$(lib_LTLIBRARIES)'; for p in $$list; do \ + if test -f $$p; then \ + f="`echo $$p | sed -e 's|^.*/||'`"; \ + echo " $(LIBTOOL) --mode=install $(libLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) $$p $(DESTDIR)$(libdir)/$$f"; \ + $(LIBTOOL) --mode=install $(libLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) $$p $(DESTDIR)$(libdir)/$$f; \ + else :; fi; \ + done + +uninstall-libLTLIBRARIES: + @$(NORMAL_UNINSTALL) + @list='$(lib_LTLIBRARIES)'; for p in $$list; do \ + p="`echo $$p | sed -e 's|^.*/||'`"; \ + echo " $(LIBTOOL) --mode=uninstall rm -f $(DESTDIR)$(libdir)/$$p"; \ + $(LIBTOOL) --mode=uninstall rm -f $(DESTDIR)$(libdir)/$$p; \ + done + +clean-libLTLIBRARIES: + -test -z "$(lib_LTLIBRARIES)" || rm -f $(lib_LTLIBRARIES) + @list='$(lib_LTLIBRARIES)'; for p in $$list; do \ + dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \ + test "$$dir" = "$$p" && dir=.; \ + echo "rm -f \"$${dir}/so_locations\""; \ + rm -f "$${dir}/so_locations"; \ + done +liblufs-sshfs.la: $(liblufs_sshfs_la_OBJECTS) $(liblufs_sshfs_la_DEPENDENCIES) + $(CXXLINK) -rpath $(libdir) $(liblufs_sshfs_la_LDFLAGS) $(liblufs_sshfs_la_OBJECTS) $(liblufs_sshfs_la_LIBADD) $(LIBS) + +mostlyclean-compile: + -rm -f *.$(OBJEXT) core *.core + +distclean-compile: + -rm -f *.tab.c + +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sftplib.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sshfs.Plo@am__quote@ + +distclean-depend: + -rm -rf ./$(DEPDIR) + +.cpp.o: +@am__fastdepCXX_TRUE@ if $(CXXCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" \ +@am__fastdepCXX_TRUE@ -c -o $@ `test -f '$<' || echo '$(srcdir)/'`$<; \ +@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; \ +@am__fastdepCXX_TRUE@ else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; \ +@am__fastdepCXX_TRUE@ fi +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ `test -f '$<' || echo '$(srcdir)/'`$< + +.cpp.obj: +@am__fastdepCXX_TRUE@ if $(CXXCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" \ +@am__fastdepCXX_TRUE@ -c -o $@ `if test -f '$<'; then $(CYGPATH_W) '$<'; else $(CYGPATH_W) '$(srcdir)/$<'; fi`; \ +@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; \ +@am__fastdepCXX_TRUE@ else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; \ +@am__fastdepCXX_TRUE@ fi +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ `if test -f '$<'; then $(CYGPATH_W) '$<'; else $(CYGPATH_W) '$(srcdir)/$<'; fi` + +.cpp.lo: +@am__fastdepCXX_TRUE@ if $(LTCXXCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" \ +@am__fastdepCXX_TRUE@ -c -o $@ `test -f '$<' || echo '$(srcdir)/'`$<; \ +@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Plo"; \ +@am__fastdepCXX_TRUE@ else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; \ +@am__fastdepCXX_TRUE@ fi +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ depfile='$(DEPDIR)/$*.Plo' tmpdepfile='$(DEPDIR)/$*.TPlo' @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(LTCXXCOMPILE) -c -o $@ `test -f '$<' || echo '$(srcdir)/'`$< + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs + +distclean-libtool: + -rm -f libtool +uninstall-info-am: + +ETAGS = etags +ETAGSFLAGS = + +CTAGS = ctags +CTAGSFLAGS = + +tags: TAGS + +ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + mkid -fID $$unique + +TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + tags=; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + test -z "$(ETAGS_ARGS)$$tags$$unique" \ + || $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$tags $$unique + +ctags: CTAGS +CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + tags=; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + test -z "$(CTAGS_ARGS)$$tags$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$tags $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && cd $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) $$here + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) + +top_distdir = ../.. +distdir = $(top_distdir)/$(PACKAGE)-$(VERSION) + +distdir: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \ + list='$(DISTFILES)'; for file in $$list; do \ + case $$file in \ + $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ + $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ + esac; \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test "$$dir" != "$$file" && test "$$dir" != "."; then \ + dir="/$$dir"; \ + $(mkinstalldirs) "$(distdir)$$dir"; \ + else \ + dir=''; \ + fi; \ + if test -d $$d/$$file; then \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ + fi; \ + cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ + else \ + test -f $(distdir)/$$file \ + || cp -p $$d/$$file $(distdir)/$$file \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-am +all-am: Makefile $(LTLIBRARIES) $(HEADERS) + +installdirs: + $(mkinstalldirs) $(DESTDIR)$(libdir) +install: install-am +install-exec: install-exec-am +install-data: install-data-am +uninstall: uninstall-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-am +install-strip: + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + INSTALL_STRIP_FLAG=-s \ + `test -z '$(STRIP)' || \ + echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -rm -f Makefile $(CONFIG_CLEAN_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +clean: clean-am + +clean-am: clean-generic clean-libLTLIBRARIES clean-libtool \ + mostlyclean-am + +distclean: distclean-am + +distclean-am: clean-am distclean-compile distclean-depend \ + distclean-generic distclean-libtool distclean-tags + +dvi: dvi-am + +dvi-am: + +info: info-am + +info-am: + +install-data-am: + +install-exec-am: install-libLTLIBRARIES + +install-info: install-info-am + +install-man: + +installcheck-am: + +maintainer-clean: maintainer-clean-am + +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-compile mostlyclean-generic \ + mostlyclean-libtool + +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + +uninstall-am: uninstall-info-am uninstall-libLTLIBRARIES + +.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ + clean-libLTLIBRARIES clean-libtool ctags distclean \ + distclean-compile distclean-depend distclean-generic \ + distclean-libtool distclean-tags distdir dvi dvi-am info \ + info-am install install-am install-data install-data-am \ + install-exec install-exec-am install-info install-info-am \ + install-libLTLIBRARIES install-man install-strip installcheck \ + installcheck-am installdirs maintainer-clean \ + maintainer-clean-generic mostlyclean mostlyclean-compile \ + mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ + tags uninstall uninstall-am uninstall-info-am \ + uninstall-libLTLIBRARIES + +# 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/filesystems/sshfs/sftplib.cpp b/filesystems/sshfs/sftplib.cpp new file mode 100644 index 0000000..4bdbef9 --- /dev/null +++ b/filesystems/sshfs/sftplib.cpp @@ -0,0 +1,1039 @@ +/* + * sftplib.cpp + * Copyright (C) 2002 Florin Malita + * + * This file is part of LUFS, a free userspace filesystem implementation. + * See http://lufs.sourceforge.net/ for updates. + * + * LUFS 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. + * + * LUFS 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 "sftplib.h" + +#ifndef SSHPROG +#error ssh not found!!! +#endif + +char *args[] = { + SSHPROG, + "-oFallBackToRsh no", + "-oForwardX11 no", + "-oForwardAgent no", + "-oClearAllForwardings yes", + "-oProtocol 2", + NULL, + NULL, + "-s", + NULL, + "sftp", + NULL +}; + +void +hton(void *buf, ...){ + va_list ap; + char *p; + int i; + long l; + + va_start(ap, buf); + + for(p = (char*)buf; (i = va_arg(ap, int)); p += i){ + switch(i){ + case 1: + break; + + case 2: + *((short*)p) = htons(*((short*)p)); + TRACE("fixing short"); + break; + + case 4: + *((long*)p) = htonl(*((long*)p)); + TRACE("fixing long"); + break; + + case 8: + l = *((long*)p); + *((long*)p) = htonl(*(((long*)p) + 1)); + *(((long*)p) + 1) = htonl(l); + TRACE("fixing quad"); + break; + + default: + WARN("invalid size " << i); + break; + } + } + + va_end(ap); +} + +void +ntoh(void *buf, ...){ + va_list ap; + char *p; + int i; + long l; + + va_start(ap, buf); + + for(p = (char*)buf; (i = va_arg(ap, int)); p += i){ + switch(i){ + + case 1: + break; + + case 2: + *((short*)p) = ntohs(*((short*)p)); + TRACE("fixing short"); + break; + + case 4: + *((long*)p) = ntohl(*((long*)p)); + TRACE("fixing long"); + break; + + case 8: + l = *((long*)p); + *((long*)p) = ntohl(*(((long*)p) + 1)); + *(((long*)p) + 1) = ntohl(l); + TRACE("fixing quad"); + break; + + default: + WARN("invalid size " << i); + break; + } + } + + va_end(ap); +} + + +SConnection::SConnection(){ + TRACE("in constructor"); + + connected = 0; + seq = 0; +} + +SConnection::~SConnection(){ + TRACE("in destructor"); + if(connected) + disconnect(); +} + +int +SConnection::connect(char *host, char *user, int port){ + char portstr[32]; + int pin[2], pout[2]; + int c_in, c_out; + int err_fd; + struct s_hdr hdr; + + TRACE("attempting to connect to " << host << ":" << port << " as " << user); + string usr = string("-l") + user; + sprintf(portstr, "-p%d", port); + + args[6] = portstr; + args[7] = (char*)usr.c_str(); + args[9] = host; + + for(int i = 0; args[i]; i++) + TRACE("args[" << i << "]=" << args[i]); + + if((pipe(pin) == -1) || (pipe(pout) == -1)){ + WARN("pipe failed"); + return -1; + } + + f_in = pin[0]; + f_out = pout[1]; + c_in = pout[0]; + c_out = pin[1]; + + if((sshpid = fork()) == -1){ + WARN("fork failed!"); + return -1; + }else if(sshpid == 0){ + + if((err_fd = ::open("/dev/null", O_WRONLY)) < 0){ + WARN("could not open /dev/null!"); + exit(1); + } + + TRACE("child launching ssh..."); + if((dup2(c_in, 0) == -1) || (dup2(c_out, 1) == -1) || (dup2(err_fd, 2) == -1)){ + WARN("dup2 failed!"); + exit(1); + } + + ::close(f_in); + ::close(f_out); + ::close(c_in); + ::close(c_out); + ::close(err_fd); + + execv(SSHPROG, args); + WARN("execv failed!"); + exit(1); + } + + ::close(c_in); + ::close(c_out); + + int version = htonl(SSH2_FILEXFER_VERSION); + + if(send_packet(SSH2_FXP_INIT, &version, 4) < 0){ + WARN("failed to init!"); + disconnect(); + return -1; + } + + if(recv_packet(&hdr, NULL, 0) < 0){ + WARN("failed to read version!"); + disconnect(); + return -1; + } + + if(hdr.type != SSH2_FXP_VERSION){ + WARN("unknown response!"); + disconnect(); + return -1; + } + + ntoh(this->buf, 4, 0); + TRACE("server protocol V" << *((long*)this->buf)); + + connected = 1; + username = string(user); + this->host = string(host); + this->port = port; + return 0; +} + +void +SConnection::disconnect(){ + ::close(f_in); + ::close(f_out); + kill(sshpid, SIGTERM); + connected = 0; +} + +int +SConnection::reconnect(){ + disconnect(); + return connect((char*)host.c_str(), (char*)username.c_str(), port); +} + +void +SConnection::show_error(int xlate){ + if(xlate) + ntoh(buf, 4, 4, 0); + + string err = string(&buf[12], ntohl(*((uint32_t*)&buf[8]))); + TRACE("SERVER FAILURE: "<buf; + max = MAXDATA; + } + + ntoh(hdr, 4, 0); + hdr->len--; + + if(hdr->len >= max){ + WARN("packet too big!"); + return -1; + } + + ((char*)buf)[hdr->len] = 0; + + return lu_atomic_read(f_in, (char*)buf, hdr->len, 0); +} + +int +SConnection::execute(unsigned type, void *buf, unsigned len, struct s_hdr *hdr){ + + if((send_packet(type, buf, len) < 0) || (recv_packet(hdr, NULL, 0) < 0)){ + TRACE("oops!"); + disconnect(); + pthread_exit(NULL); + } + + last_cmd = type; + + return hdr->type; +} + +int +SConnection::execute(unsigned type, struct iovec *iov, int count, struct s_hdr *hdr){ + + if((send_packet(type, iov, count) < 0) || (recv_packet(hdr, NULL, 0) < 0)){ + TRACE("oops!"); + disconnect(); + pthread_exit(NULL); + } + + last_cmd = type; + + return hdr->type; +} + +string +SConnection::opendir(char *dir){ + struct iovec iov[3]; + struct s_hdr hdr; + uint32_t id, slen; + int res; + string fail(""); + + TRACE("ssh_opendir: " << dir); + + id = htonl(seq++); + slen = htonl(strlen(dir)); + + iov[0].iov_base = &id; + iov[0].iov_len = 4; + iov[1].iov_base = &slen; + iov[1].iov_len = 4; + iov[2].iov_base = dir; + iov[2].iov_len = ntohl(slen);; + + if((res = execute(SSH2_FXP_OPENDIR, iov, 3, &hdr)) < 0){ + WARN("execute failed!"); + return fail; + } + + if(res != SSH2_FXP_HANDLE){ + WARN("unexpected response (" << res << ")!"); + if(res == SSH2_FXP_STATUS) + show_error(1); + return fail; + } + + ntoh(buf, 4, 4, 0); + id = *((uint32_t*)buf); + slen = *((uint32_t*)&buf[4]); + + TRACE("id=" << id << ", slen=" << slen); + + if((id != seq - 1) || (slen > MAXDATA - 9)){ + WARN("wrong params!"); + return fail; + } + + return string(&buf[8], slen); +} + +int +SConnection::close(string &handle){ + struct iovec iov[3]; + struct s_hdr hdr; + uint32_t id, slen; + int res; + + id = htonl(seq++); + slen = htonl(handle.size()); + + iov[0].iov_base = &id; + iov[0].iov_len = 4; + iov[1].iov_base = &slen; + iov[1].iov_len = 4; + iov[2].iov_base = (void*)handle.data(); + iov[2].iov_len = handle.size(); + + if((res = execute(SSH2_FXP_CLOSE, iov, 3, &hdr)) < 0){ + WARN("execute failed!"); + return res; + } + + if(res != SSH2_FXP_STATUS){ + WARN("unexpected response!"); + return -1; + } + + ntoh(buf, 4, 4, 0); + id = *((uint32_t*)buf); + slen = *((uint32_t*)&buf[4]); + + if((id != seq -1) || (slen != SSH2_FX_OK)){ + WARN("wrong params!"); + return -1; + } + + return 0; +} + +int +SConnection::readdir(string &handle){ + struct iovec iov[3]; + struct s_hdr hdr; + uint32_t id, slen; + int res; + + id = htonl(seq++); + slen = htonl(handle.size()); + + iov[0].iov_base = &id; + iov[0].iov_len = 4; + iov[1].iov_base = &slen; + iov[1].iov_len = 4; + iov[2].iov_base = (void*)handle.data(); + iov[2].iov_len = handle.size(); + + res = execute(SSH2_FXP_READDIR, iov, 3, &hdr); + + if(ntohl(*((uint32_t*)buf)) != seq - 1){ + WARN("out of sequence!"); + return -1; + } + + return res; +} + +int +SConnection::readlink(char *link){ + struct iovec iov[3]; + struct s_hdr hdr; + uint32_t id, len; + int res; + + id = htonl(seq++); + len = htonl(strlen(link)); + + iov[0].iov_base = &id; + iov[0].iov_len = 4; + iov[1].iov_base = &len; + iov[1].iov_len = 4; + iov[2].iov_base = link; + iov[2].iov_len = ntohl(len); + + res = execute(SSH2_FXP_READLINK, iov, 3, &hdr); + + if(ntohl(*((uint32_t*)buf)) != seq - 1){ + WARN("out of sequence!"); + return -1; + } + + return res; +} + +char* +SConnection::attr2fattr(char *ptr, struct lufs_fattr *fattr){ + uint32_t flags = ntohl(*(uint32_t*)ptr); + + ptr += 4; + + if(flags & SSH2_FILEXFER_ATTR_SIZE){ + fattr->f_size = ntohl(*(uint32_t*)(ptr+4)); + TRACE("size: " << fattr->f_size); + ptr += 8; + } + + if(flags & SSH2_FILEXFER_ATTR_UIDGID){ + ntoh(ptr, 4, 4, 0); + fattr->f_uid = *(uint32_t*)ptr; + fattr->f_gid = *(uint32_t*)(ptr+4); + TRACE("uid: " << fattr->f_uid << ", gid: " << fattr->f_gid); + ptr += 8; + } + + if(flags & SSH2_FILEXFER_ATTR_PERMISSIONS){ + fattr->f_mode = ntohl(*(uint32_t*)ptr); + TRACE("mode: " << std::oct<f_mode<f_atime = *(uint32_t*)ptr; + fattr->f_ctime = fattr->f_mtime = *(uint32_t*)(ptr+4); + TRACE("atime: " << fattr->f_atime << ", mtime: " << fattr->f_mtime); + ptr += 8; + } + + if(flags & SSH2_FILEXFER_ATTR_EXTENDED){ + TRACE("extended attributes!!!"); + + uint32_t count = *(uint32_t*)ptr; + ptr+=4; + + for(; count > 0; count--){ + string type = string(ptr + 4, ntohl(*(uint32_t*)ptr)); + ptr += 4 + type.size(); + string data = string(ptr + 4, ntohl(*(uint32_t*)ptr)); + ptr += 4 + data.size(); + + TRACE("type: " << type); + TRACE("count: " << data); + } + } + + return ptr; +} + +int +SConnection::lname2fattr(string &lname, struct lufs_fattr *fattr){ + unsigned b, e; + + if((b = lname.find_first_not_of(" ")) == string::npos) + return -1; + if((b = lname.find(" ", b)) == string::npos) + return -1; + if((b = lname.find_first_not_of(" ", b)) == string::npos) + return -1; + if((e = lname.find(" ", b)) == string::npos) + return -1; + + string nlink = lname.substr(b, e - b); + TRACE("nlink: " << nlink); + fattr->f_nlink = atoi(nlink.c_str()); + + return 0; +} + +int +SConnection::create(char *file, unsigned mode){ + struct iovec iov[6]; + struct s_hdr hdr; + uint32_t id, slen, pflags, attr, perms; + int res; + + TRACE("ssh_create: " << file << ", mode: " < readcache.offset) && (offset + count <= readcache.offset + readcache.count)){ + TRACE("data in cache"); + memcpy(b, buf + 8 + (offset - readcache.offset), count); + return count; + }else{ + TRACE("data not in cache, reading..."); + + id = htonl(seq++); + slen = htonl(handle.size()); + len = htonl(MAXDATA - 20); + off = (uint64_t)offset; + hton(&off, 8, 0); + + iov[0].iov_base = &id; + iov[0].iov_len = 4; + iov[1].iov_base = &slen; + iov[1].iov_len = 4; + iov[2].iov_base = (void*)handle.data(); + iov[2].iov_len = ntohl(slen); + iov[3].iov_base = &off; + iov[3].iov_len = 8; + iov[4].iov_base = &len; + iov[4].iov_len = 4; + + res = execute(SSH2_FXP_READ, iov, 5, &hdr); + + if(check_reply(res, SSH2_FXP_DATA) < 0) + return -1; + + readcache.handle = handle; + readcache.offset = offset; + readcache.count = ntohl(*(uint32_t*)(buf + 4)); + + TRACE(readcache.count << " bytes read in cache"); + + res = (readcache.count > count) ? count : readcache.count; + + memcpy(b, buf + 8, res); + + return res; + } +} + +int +SConnection::mkdir(char *dir, int mode){ + struct iovec iov[5]; + struct s_hdr hdr; + uint32_t id, slen, flags, perms; + int res; + + TRACE("ssh_mkdir " << dir << ", " << mode); + + id = htonl(seq++); + slen = htonl(strlen(dir)); + flags = htonl(SSH2_FILEXFER_ATTR_PERMISSIONS); + perms = htonl(mode); + + iov[0].iov_base = &id; + iov[0].iov_len = 4; + iov[1].iov_base = &slen; + iov[1].iov_len = 4; + iov[2].iov_base = dir; + iov[2].iov_len = ntohl(slen); + iov[3].iov_base = &flags; + iov[3].iov_len = 4; + iov[4].iov_base = &perms; + iov[4].iov_len = 4; + + res = execute(SSH2_FXP_MKDIR, iov, 5, &hdr); + if((res = check_status(res, SSH2_FX_OK)) < 0) + return res; + + return 0; +} + +int +SConnection::rmdir(char *dir){ + struct iovec iov[3]; + struct s_hdr hdr; + uint32_t id, slen; + int res; + + TRACE("ssh_rmdir: " << dir); + + id = htonl(seq++); + slen = htonl(strlen(dir)); + + iov[0].iov_base = &id; + iov[0].iov_len = 4; + iov[1].iov_base = &slen; + iov[1].iov_len = 4; + iov[2].iov_base = dir; + iov[2].iov_len = ntohl(slen); + + res = execute(SSH2_FXP_RMDIR, iov, 3, &hdr); + if((res = check_status(res, SSH2_FX_OK)) < 0) + return res; + + return 0; +} + +int +SConnection::remove(char *file){ + struct iovec iov[3]; + struct s_hdr hdr; + int res; + uint32_t id, slen; + + TRACE("ssh_remove: " << file); + + id = htonl(seq++); + slen = htonl(strlen(file)); + + iov[0].iov_base = &id; + iov[0].iov_len = 4; + iov[1].iov_base = &slen; + iov[1].iov_len = 4; + iov[2].iov_base = file; + iov[2].iov_len = ntohl(slen); + + res = execute(SSH2_FXP_REMOVE, iov, 3, &hdr); + if((res = check_status(res, SSH2_FX_OK)) < 0) + return res; + + return 0; +} + +int +SConnection::rename(char *old, char *nnew){ + struct iovec iov[5]; + struct s_hdr hdr; + int res; + uint32_t id, slen1, slen2; + + TRACE("ssh_rename: " << old << " to " << nnew); + + /* must delete existing entity first, otherwise will fail... */ + remove(nnew); + rmdir(nnew); + + id = htonl(seq++); + slen1 = htonl(strlen(old)); + slen2 = htonl(strlen(nnew)); + + iov[0].iov_base = &id; + iov[0].iov_len = 4; + iov[1].iov_base = &slen1; + iov[1].iov_len = 4; + iov[2].iov_base = old; + iov[2].iov_len = ntohl(slen1); + iov[3].iov_base = &slen2; + iov[3].iov_len = 4; + iov[4].iov_base = nnew; + iov[4].iov_len = ntohl(slen2); + + if((res = check_status(execute(SSH2_FXP_RENAME, iov, 5, &hdr), SSH2_FX_OK)) < 0) + return res; + + return 0; +} + +int +SConnection::setattr(char *file, struct lufs_fattr *fattr){ + struct iovec iov[4]; + struct s_hdr hdr; + uint32_t id, slen; + uint32_t pack[4]; + int res; + + TRACE("ssh_setattr: " << file); + TRACE("mode: "<f_mode<f_mode)){ + TRACE("it's a link, skip it..."); + return 0; + } + + if(!S_ISDIR(fattr->f_mode)){ + id = htonl(seq++); + pack[0] = SSH2_FILEXFER_ATTR_SIZE; + *(uint64_t*)&pack[1] = fattr->f_size; + hton(pack, 4, 8, 0); + iov[3].iov_len = 12; + + TRACE("setting size..."); + if((res = check_status(execute(SSH2_FXP_SETSTAT, iov, 4, &hdr), SSH2_FX_OK)) < 0){ + WARN("couldn't set size"); + return res; + } + } + + id = htonl(seq++); + pack[0] = SSH2_FILEXFER_ATTR_ACMODTIME | SSH2_FILEXFER_ATTR_PERMISSIONS; + pack[1] = fattr->f_mode; + pack[2] = fattr->f_atime; + pack[3] = fattr->f_mtime; + hton(pack, 4, 4, 4, 4, 0); + iov[3].iov_len = 16; + + TRACE("setting atime & mtime..."); + if((res = check_status(execute(SSH2_FXP_SETSTAT, iov, 4, &hdr), SSH2_FX_OK)) < 0){ + WARN("couldn't set times"); + return res; + } + + return 0; +} + +int +SConnection::write(string &handle, long long offset, unsigned long count, char *b){ + struct iovec iov[6]; + struct s_hdr hdr; + int res; + uint32_t id, slen1, slen2; + uint64_t off; + + TRACE("ssh_write: " << offset << ", " << count); + + id = htonl(seq++); + slen1 = htonl(handle.size()); + slen2 = htonl(count); + off = (uint64_t)offset; + hton(&off, 8, 0); + + iov[0].iov_base = &id; + iov[0].iov_len = 4; + iov[1].iov_base = &slen1; + iov[1].iov_len = 4; + iov[2].iov_base = (void*)handle.data(); + iov[2].iov_len = ntohl(slen1); + iov[3].iov_base = &off; + iov[3].iov_len = 8; + iov[4].iov_base = &slen2; + iov[4].iov_len = 4; + iov[5].iov_base = b; + iov[5].iov_len = ntohl(slen2); + + if((res = check_status(execute(SSH2_FXP_WRITE, iov, 6, &hdr), SSH2_FX_OK)) < 0) + return res; + + return 0; +} + +int +SConnection::symlink(char *file, char *link){ + struct iovec iov[5]; + struct s_hdr hdr; + int res; + uint32_t id, slen1, slen2; + + TRACE("ssh_symlink: " << file << " <=> " << link); + + id = htonl(seq++); + slen1 = htonl(strlen(file)); + slen2 = htonl(strlen(link)); + + iov[0].iov_base = &id; + iov[0].iov_len = 4; + iov[1].iov_base = &slen1; + iov[1].iov_len = 4; + iov[2].iov_base = file; + iov[2].iov_len = ntohl(slen1); + iov[3].iov_base = &slen2; + iov[3].iov_len = 4; + iov[4].iov_base = link; + iov[4].iov_len = ntohl(slen2); + + if((res = check_status(execute(SSH2_FXP_SYMLINK, iov, 5, &hdr), SSH2_FX_OK)) < 0) + return res; + + return 0; +} + +int +SConnection::stat(char *file, struct lufs_fattr *fattr){ + struct iovec iov[3]; + struct s_hdr hdr; + int res; + uint32_t id, slen; + + TRACE("ssh_stat: " << file); + + id = htonl(seq++); + slen = htonl(strlen(file)); + + iov[0].iov_base = &id; + iov[0].iov_len = 4; + iov[1].iov_base = &slen; + iov[1].iov_len = 4; + iov[2].iov_base = file; + iov[2].iov_len = ntohl(slen); + + if((res = check_reply(execute(SSH2_FXP_LSTAT, iov, 3, &hdr), SSH2_FXP_ATTRS)) < 0) + return res; + + attr2fattr(buf + 4, fattr); + fattr->f_nlink = 1; + + return 0; +} + diff --git a/filesystems/sshfs/sftplib.h b/filesystems/sshfs/sftplib.h new file mode 100644 index 0000000..8457183 --- /dev/null +++ b/filesystems/sshfs/sftplib.h @@ -0,0 +1,174 @@ +/* + * sftplib.h + * Copyright (C) 2002 Florin Malita + * + * This file is part of LUFS, a free userspace filesystem implementation. + * See http://lufs.sourceforge.net/ for updates. + * + * LUFS 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. + * + * LUFS 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 _SFTPLIB_H_ +#define _SFTPLIB_H_ + +#include +#include + +#include + +using namespace std; + +#define MAXDATA 32768 + +#define SSH2_FILEXFER_VERSION 3 + +/* client to server */ +#define SSH2_FXP_INIT 1 +#define SSH2_FXP_OPEN 3 +#define SSH2_FXP_CLOSE 4 +#define SSH2_FXP_READ 5 +#define SSH2_FXP_WRITE 6 +#define SSH2_FXP_LSTAT 7 +#define SSH2_FXP_STAT_VERSION_0 7 +#define SSH2_FXP_FSTAT 8 +#define SSH2_FXP_SETSTAT 9 +#define SSH2_FXP_FSETSTAT 10 +#define SSH2_FXP_OPENDIR 11 +#define SSH2_FXP_READDIR 12 +#define SSH2_FXP_REMOVE 13 +#define SSH2_FXP_MKDIR 14 +#define SSH2_FXP_RMDIR 15 +#define SSH2_FXP_REALPATH 16 +#define SSH2_FXP_STAT 17 +#define SSH2_FXP_RENAME 18 +#define SSH2_FXP_READLINK 19 +#define SSH2_FXP_SYMLINK 20 + +/* server to client */ +#define SSH2_FXP_VERSION 2 +#define SSH2_FXP_STATUS 101 +#define SSH2_FXP_HANDLE 102 +#define SSH2_FXP_DATA 103 +#define SSH2_FXP_NAME 104 +#define SSH2_FXP_ATTRS 105 + +#define SSH2_FXP_EXTENDED 200 +#define SSH2_FXP_EXTENDED_REPLY 201 + +/* attributes */ +#define SSH2_FILEXFER_ATTR_SIZE 0x00000001 +#define SSH2_FILEXFER_ATTR_UIDGID 0x00000002 +#define SSH2_FILEXFER_ATTR_PERMISSIONS 0x00000004 +#define SSH2_FILEXFER_ATTR_ACMODTIME 0x00000008 +#define SSH2_FILEXFER_ATTR_EXTENDED 0x80000000 + +/* portable open modes */ +#define SSH2_FXF_READ 0x00000001 +#define SSH2_FXF_WRITE 0x00000002 +#define SSH2_FXF_APPEND 0x00000004 +#define SSH2_FXF_CREAT 0x00000008 +#define SSH2_FXF_TRUNC 0x00000010 +#define SSH2_FXF_EXCL 0x00000020 + +/* status messages */ +#define SSH2_FX_OK 0 +#define SSH2_FX_EOF 1 +#define SSH2_FX_NO_SUCH_FILE 2 +#define SSH2_FX_PERMISSION_DENIED 3 +#define SSH2_FX_FAILURE 4 +#define SSH2_FX_BAD_MESSAGE 5 +#define SSH2_FX_NO_CONNECTION 6 +#define SSH2_FX_CONNECTION_LOST 7 +#define SSH2_FX_OP_UNSUPPORTED 8 +#define SSH2_FX_MAX 8 + +#define ATTRSIZE 24 +struct s_attr{ + uint32_t flags; + uint64_t size; + uint32_t permissions; + uint32_t atime; + uint32_t mtime; +}; + +#define HDRSIZE 5 +struct s_hdr{ + uint32_t len; + uint8_t type; +}; + +class SConnection { + private: + int connected; + int f_in, f_out; + int sshpid; + unsigned seq; + string username; + string host; + int port; + int last_cmd; + + struct { + string handle; + long long offset; + unsigned long count; + } readcache; + + public: + char buf[MAXDATA]; +// int ksock; + + SConnection(); + ~SConnection(); + + int connect(char*, char*, int); + void disconnect(); + int reconnect(); + void show_error(int); + int check_reply(int, int); + int check_status(int, int); + int atomic_read(char*, int); + int atomic_write(char*, int); + int send_packet(unsigned, void*, unsigned); + int send_packet(unsigned, struct iovec*, int); + int recv_packet(struct s_hdr*, void*, unsigned); + int execute(unsigned, void*, unsigned, struct s_hdr*); + int execute(unsigned, struct iovec*, int, struct s_hdr*); + + + string opendir(char*); + string open(char*, unsigned); + int create(char*, unsigned); + int read(string&, long long, unsigned long, char*); + int write(string&, long long, unsigned long, char*); + int close(string&); + int readdir(string&); + char* attr2fattr(char*, struct lufs_fattr*); + int lname2fattr(string&, struct lufs_fattr*); + int readlink(char*); + int mkdir(char*, int mode); + int rmdir(char*); + int remove(char*); + int rename(char*, char*); + int setattr(char*, struct lufs_fattr*); + int symlink(char*, char*); + int stat(char*, struct lufs_fattr*); +}; + +void hton(void*, ...); +void ntoh(void*, ...); + + +#endif diff --git a/filesystems/sshfs/sshfs.cpp b/filesystems/sshfs/sshfs.cpp new file mode 100644 index 0000000..c52b09d --- /dev/null +++ b/filesystems/sshfs/sshfs.cpp @@ -0,0 +1,475 @@ +/* + * sshfs.cpp + * Copyright (C) 2002 Florin Malita + * + * This file is part of LUFS, a free userspace filesystem implementation. + * See http://lufs.sourceforge.net/ for updates. + * + * LUFS 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. + * + * LUFS 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 "sshfs.h" +#include "sftplib.h" + +extern "C"{ + +void* +sshfs_init(struct list_head *cfg, struct dir_cache *cache, struct credentials *cred, void **global_ctx){ + if(!lu_opt_getchar(cfg, "MOUNT", "username") || !lu_opt_getchar(cfg, "MOUNT", "host")){ + ERROR("you must specify at least a host and an username!"); + return NULL; + } + + return (void*)new SSHFS(cfg, cache, cred); +} + +void +sshfs_free(void *ctx){ + SSHFS *p = (SSHFS*)ctx; + + delete p; +} + +int +sshfs_mount(void *ctx){ + return ((SSHFS*)ctx)->do_mount(); +} + +void +sshfs_umount(void *ctx){ +// return ((SSHFS*)ctx)->do_umount(); +} + +int +sshfs_readdir(void *ctx, char *dir_name, struct directory *dir){ + return ((SSHFS*)ctx)->do_readdir(dir_name, dir); +} + +int +sshfs_stat(void *ctx, char *name, struct lufs_fattr *fattr){ + return ((SSHFS*)ctx)->do_stat(name, fattr); +} + +int +sshfs_mkdir(void *ctx, char *dir, int mode){ + return ((SSHFS*)ctx)->do_mkdir(dir, mode); +} + +int +sshfs_rmdir(void *ctx, char *dir){ + return ((SSHFS*)ctx)->do_rmdir(dir); +} + +int +sshfs_create(void *ctx, char *file, int mode){ + return ((SSHFS*)ctx)->do_create(file, mode); +} + +int +sshfs_unlink(void *ctx, char *file){ + return ((SSHFS*)ctx)->do_unlink(file); +} + +int +sshfs_rename(void *ctx, char *old_name, char *new_name){ + return ((SSHFS*)ctx)->do_rename(old_name, new_name); +} + +int +sshfs_open(void *ctx, char *file, unsigned mode){ + return ((SSHFS*)ctx)->do_open(file, mode); +} + +int +sshfs_release(void *ctx, char *file){ + return ((SSHFS*)ctx)->do_release(file); +} + +int +sshfs_read(void *ctx, char *file, long long offset, unsigned long count, char *buf){ + return ((SSHFS*)ctx)->do_read(file, offset, count, buf); +} + +int +sshfs_write(void *ctx, char *file, long long offset, unsigned long count, char *buf){ + return ((SSHFS*)ctx)->do_write(file, offset, count, buf); +} + +int +sshfs_readlink(void *ctx, char *link, char *buf, int buflen){ + return ((SSHFS*)ctx)->do_readlink(link, buf, buflen); +} + +int +sshfs_link(void *ctx, char *target, char *link){ + return -1; +// return ((SSHFS*)ctx)->do_link(target, link); +} + +int +sshfs_symlink(void *ctx, char *target, char *link){ + return ((SSHFS*)ctx)->do_symlink(target, link); +} + +int +sshfs_setattr(void *ctx, char *file, struct lufs_fattr *fattr){ + return ((SSHFS*)ctx)->do_setattr(file, fattr); +} + +} /* extern "C" */ + +SSHFS::SSHFS(struct list_head *c, struct dir_cache *cache, struct credentials *cred){ + TRACE("in constructor"); + + cfg = c; + this->cache = cache; + this->cred = cred; + + conn = new SConnection(); + seq = 0; +} + +SSHFS::~SSHFS(){ + TRACE("in destructor"); + delete conn; +} + +struct atbl* +SSHFS::find_handle(char *name, unsigned mode, vector *vec){ + TRACE("looking for " << name << ", size=" << vec->size()); + + for(vector::iterator i = vec->begin(); i != vec->end();){ + TRACE("name: " << i->name); + + if(((time(NULL) - i->stamp) > HANDLES_TTL) || ((mode != 0xffff) && (i->name == name) && ((i->mode & O_ACCMODE) != O_RDWR) && ((i->mode & O_ACCMODE) != (mode & O_ACCMODE)))){ + TRACE("invalid handle found..."); + conn->close(i->handle); + vec->erase(i); + + /* damn iterators, they break on erase */ + i = vec->begin(); + }else if(i->name == name){ + TRACE("handle found"); + i->stamp = time(NULL); + return &*i; + }else + i++; + } + + return NULL; +} + +int +SSHFS::do_mount(){ + long int port; + + TRACE("do_mount"); + + if(lu_opt_getint(cfg, "MOUNT", "port", &port, 10) < 0) + port = 22; + + if(conn->connect((char*)lu_opt_getchar(cfg, "MOUNT", "host"), (char*)lu_opt_getchar(cfg, "MOUNT", "username"), port) < 0) + return 0; + + return 1; +} + +void +SSHFS::do_umount(){ + TRACE("do_umount"); + + conn->disconnect(); +} + +int +SSHFS::do_readdir(char *dir, struct directory *d){ + string handle, fname, lname; + int res; + char *buf; + uint32_t count; + struct lufs_fattr fattr; + + TRACE("do_readdir"); + + handle = conn->opendir(dir); + if(!handle.size()){ + ERROR("opendir failed!"); + return -1; + } + + do{ + res = conn->readdir(handle); + buf = conn->buf; + if(res == SSH2_FXP_NAME){ + ntoh(buf, 4, 4, 0); + TRACE("got " << *((uint32_t*)&buf[4]) << " names"); + for(count = *((uint32_t*)&buf[4]), buf = conn->buf + 8; count > 0; count--){ + memset(&fattr, 0, sizeof(struct lufs_fattr)); + + fname = string(&buf[4], ntohl(*((uint32_t*)buf))); + buf += 4 + fname.size(); + lname = string(&buf[4], ntohl(*((uint32_t*)buf))); + buf += 4 + lname.size(); + + buf = conn->attr2fattr(buf, &fattr); + if(conn->lname2fattr(lname, &fattr) < 0) + ERROR("couldn't parse long name:\n" << lname <<"\nerror:"); + + fattr.f_uid = ((int)fattr.f_uid == (int)cred->uid) ? 1 : 0; + fattr.f_gid = ((int)fattr.f_gid == (int)cred->gid) ? 1 : 0; + + + lu_cache_add2dir(d, (char*)fname.c_str(), NULL, &fattr); + + TRACE("fname: " << fname); + TRACE("laname: " << lname); + } + + } + }while(res == SSH2_FXP_NAME); + + if(res != SSH2_FXP_STATUS){ + ERROR("unexpected response (" << res << ")!"); + res = -1; + goto out; + } + + ntoh(buf, 4, 4, 0); + + if(*((uint32_t*)&buf[4]) != SSH2_FX_EOF){ + conn->show_error(0); + res = -1; + goto out; + } + + TRACE("done reading dir"); + res = 0; + + out: + if(conn->close(handle) < 0) + ERROR("close failed!"); + + return res; +} + +int +SSHFS::do_stat(char *file, struct lufs_fattr *fattr){ + int res; + + TRACE("do_stat " << file); + + if((res = conn->stat(file, fattr)) < 0) + return res; + + fattr->f_uid = ((int)fattr->f_uid == (int)cred->uid) ? 1 : 0; + fattr->f_gid = ((int)fattr->f_gid == (int)cred->gid) ? 1 : 0; + + return res; +} + +int +SSHFS::do_readlink(char *link, char *buf, int buflen){ + int res; + char *b; + + TRACE("do_readlink:" << link); + + if((res = conn->readlink(link)) < 0){ + ERROR("readlink failed!"); + return -1; + } + + if(res == SSH2_FXP_STATUS){ + conn->show_error(1); + return -1; + } + + if(res != SSH2_FXP_NAME){ + ERROR("unexpected response (" << res << ")!"); + return -1; + } + + b = conn->buf; + + ntoh(b, 4, 4, 4, 0); + + if(*(uint32_t*)&b[4] != 1){ + ERROR("multiple names returned!"); + return -1; + } + + if(*(uint32_t*)&b[8] >= (unsigned)buflen){ + ERROR("filename too long!"); + return -1; + } + + strncpy(buf, &b[12], *(uint32_t*)&b[8]); + + return *(uint32_t*)&b[8]; +} + +int +SSHFS::do_open(char *file, unsigned mode){ + TRACE("do_open"); + + if(find_handle(file, mode, &handles)){ + TRACE("file already opened."); + return 0; + } + + string handle = conn->open(file, mode); + + if(!handle.size()) + return -1; + + handles.push_back((struct atbl){string(file), handle, time(NULL), mode}); + + TRACE(handles.size() << " files still opened."); + + return 0; +} + +int +SSHFS::do_release(char *file){ + struct atbl *tbl; + + TRACE("do_release"); + + if(!(tbl = find_handle(file, 0xffff, &handles))){ + ERROR("file not opened!"); + return -1; + } + + if(conn->close(tbl->handle) >= 0){ + TRACE("file closed."); + handles.erase((vector::iterator)tbl); + }else + return -1; + + TRACE(handles.size() << " files still opened."); + + return 0; +} + +int +SSHFS::do_read(char *file, long long offset, unsigned long count, char *b){ + struct atbl *tbl; + + TRACE("do_read"); + + if(!(tbl = find_handle(file, O_RDONLY, &handles))){ + TRACE("file not opened for reading..."); + if(do_open(file, O_RDONLY) < 0){ + ERROR("could not open file for reading!"); + return -1; + } + + if(!(tbl = find_handle(file, O_RDONLY, &handles))){ + ERROR("file handle still not available?!"); + return -1; + } + } + + return conn->read(tbl->handle, offset, count, b); +} + +int +SSHFS::do_mkdir(char *dir, int mode){ + + TRACE("do_mkdir"); + + return conn->mkdir(dir, mode); +} + +int +SSHFS::do_rmdir(char *dir){ + + TRACE("do_rmdir"); + + return conn->rmdir(dir); +} + +int +SSHFS::do_unlink(char *file){ + + TRACE("do_release"); + + return conn->remove(file); +} + +int +SSHFS::do_create(char *file, int mode){ + + TRACE("do_create"); + + return conn->create(file, mode); +} + +int +SSHFS::do_rename(char *old, char *nnew){ + + TRACE("do_rename"); + + return conn->rename(old, nnew); +} + +int +SSHFS::do_setattr(char *file, struct lufs_fattr *fattr){ + + TRACE("do_setattr"); + + return conn->setattr(file, fattr); +} + +int +SSHFS::do_write(char *file, long long offset, unsigned long count, char *b){ + struct atbl *tbl; + + TRACE("do_write"); + + if(!(tbl = find_handle(file, O_WRONLY, &handles))){ + TRACE("file not opened for writing..."); + if(do_open(file, O_WRONLY) < 0){ + ERROR("could not open file for writing!"); + return -1; + } + + if(!(tbl = find_handle(file, O_WRONLY, &handles))){ + ERROR("file handle still not available?!"); + return -1; + } + } + + return conn->write(tbl->handle, offset, count, b); +} + +int +SSHFS::do_symlink(char *file, char *link){ + + TRACE("do_symlink"); + + return conn->symlink(file, link); +} diff --git a/filesystems/sshfs/sshfs.h b/filesystems/sshfs/sshfs.h new file mode 100644 index 0000000..81a8576 --- /dev/null +++ b/filesystems/sshfs/sshfs.h @@ -0,0 +1,79 @@ +/* + * sshfs.h + * Copyright (C) 2002 Florin Malita + * + * This file is part of LUFS, a free userspace filesystem implementation. + * See http://lufs.sourceforge.net/ for updates. + * + * LUFS 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. + * + * LUFS 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 _SSHFS_H_ +#define _SSHFS_H_ + +using namespace std; + +struct directory; +struct dir_cache; + +#ifdef DEBUGGING +#define HANDLES_TTL 30 +#else +#define HANDLES_TTL 300 +#endif + +struct atbl{ + string name; + string handle; + time_t stamp; + unsigned mode; +}; + +class SConnection; + +class SSHFS{ + private: + struct credentials *cred; + struct dir_cache *cache; + struct list_head *cfg; + unsigned seq; + SConnection *conn; + vector handles; + + struct atbl* find_handle(char*, unsigned, vector*); + + public: + SSHFS(struct list_head*, struct dir_cache*, struct credentials*); + ~SSHFS(); + + int do_mount(); + void do_umount(); + int do_readdir(char*, struct directory*); + int do_stat(char*, struct lufs_fattr*); + int do_readlink(char*, char*, int); + int do_open(char*, unsigned); + int do_release(char*); + int do_read(char*, long long, unsigned long, char*); + int do_write(char*, long long, unsigned long, char*); + int do_mkdir(char*, int); + int do_rmdir(char*); + int do_unlink(char*); + int do_create(char*, int); + int do_rename(char*, char*); + int do_setattr(char*, struct lufs_fattr*); + int do_symlink(char*, char*); +}; + +#endif diff --git a/filesystems/wavfs/Makefile.am b/filesystems/wavfs/Makefile.am new file mode 100644 index 0000000..a0de010 --- /dev/null +++ b/filesystems/wavfs/Makefile.am @@ -0,0 +1,6 @@ +INCLUDES=-I../ @all_includes@ +lib_LTLIBRARIES=liblufs-wavfs.la + +noinst_HEADERS=handlefs.h fs_modules.h tools.h file_handle.h +liblufs_wavfs_la_SOURCES=handlefs.cpp fs_modules.cpp glue.cpp tools.cpp file_handle.cpp +liblufs_wavfs_la_LDFLAGS=-version-info 2:0:0 diff --git a/filesystems/wavfs/Makefile.in b/filesystems/wavfs/Makefile.in new file mode 100644 index 0000000..80fa710 --- /dev/null +++ b/filesystems/wavfs/Makefile.in @@ -0,0 +1,465 @@ +# Makefile.in generated by automake 1.7.5 from Makefile.am. +# @configure_input@ + +# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003 +# Free Software Foundation, Inc. +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ + +srcdir = @srcdir@ +top_srcdir = @top_srcdir@ +VPATH = @srcdir@ +pkgdatadir = $(datadir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +top_builddir = ../.. + +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +INSTALL = @INSTALL@ +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = @build@ +host_triplet = @host@ +target_triplet = @target@ +ACLOCAL = @ACLOCAL@ +AMDEP_FALSE = @AMDEP_FALSE@ +AMDEP_TRUE = @AMDEP_TRUE@ +AMTAR = @AMTAR@ +AUTOCONF = @AUTOCONF@ +AUTOFS_INSTALL = @AUTOFS_INSTALL@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CXX = @CXX@ +CXXDEPMODE = @CXXDEPMODE@ +CXXFLAGS = @CXXFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DEBUG_FLAGS = @DEBUG_FLAGS@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +ECHO = @ECHO@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +EXEEXT = @EXEEXT@ +GCONF = @GCONF@ +GVFSCONF = @GVFSCONF@ +GVFS_CFLAGS = @GVFS_CFLAGS@ +GVFS_LDADD = @GVFS_LDADD@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +KDEBUG_FLAGS = @KDEBUG_FLAGS@ +KERNEL_DIR = @KERNEL_DIR@ +KERNEL_HDR = @KERNEL_HDR@ +LDFLAGS = @LDFLAGS@ +LIBCHIPCARD_INCLUDES = @LIBCHIPCARD_INCLUDES@ +LIBCHIPCARD_LIB = @LIBCHIPCARD_LIB@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LIBTOOL = @LIBTOOL@ +LN_S = @LN_S@ +LTLIBOBJS = @LTLIBOBJS@ +LUFS_SUID = @LUFS_SUID@ +MAKEINFO = @MAKEINFO@ +MODULES_DIR = @MODULES_DIR@ +MODV_FLAGS = @MODV_FLAGS@ +OBJEXT = @OBJEXT@ +OS_DIR = @OS_DIR@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +RANLIB = @RANLIB@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +SSHPROG = @SSHPROG@ +STRIP = @STRIP@ +VERSION = @VERSION@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_CXX = @ac_ct_CXX@ +ac_ct_RANLIB = @ac_ct_RANLIB@ +ac_ct_STRIP = @ac_ct_STRIP@ +all_includes = @all_includes@ +all_libraries = @all_libraries@ +am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ +am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ +am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@ +am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +datadir = @datadir@ +define_has_libchipcard = @define_has_libchipcard@ +exec_prefix = @exec_prefix@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localstatedir = @localstatedir@ +mandir = @mandir@ +oldincludedir = @oldincludedir@ +opt_fs = @opt_fs@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +sysconfdir = @sysconfdir@ +target = @target@ +target_alias = @target_alias@ +target_cpu = @target_cpu@ +target_os = @target_os@ +target_vendor = @target_vendor@ +INCLUDES = -I../ @all_includes@ +lib_LTLIBRARIES = liblufs-wavfs.la + +noinst_HEADERS = handlefs.h fs_modules.h tools.h file_handle.h +liblufs_wavfs_la_SOURCES = handlefs.cpp fs_modules.cpp glue.cpp tools.cpp file_handle.cpp +liblufs_wavfs_la_LDFLAGS = -version-info 2:0:0 +subdir = filesystems/wavfs +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +mkinstalldirs = $(SHELL) $(top_srcdir)/config/mkinstalldirs +CONFIG_HEADER = $(top_builddir)/config.h +CONFIG_CLEAN_FILES = +LTLIBRARIES = $(lib_LTLIBRARIES) + +liblufs_wavfs_la_LIBADD = +am_liblufs_wavfs_la_OBJECTS = handlefs.lo fs_modules.lo glue.lo tools.lo \ + file_handle.lo +liblufs_wavfs_la_OBJECTS = $(am_liblufs_wavfs_la_OBJECTS) + +DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir) +depcomp = $(SHELL) $(top_srcdir)/config/depcomp +am__depfiles_maybe = depfiles +@AMDEP_TRUE@DEP_FILES = ./$(DEPDIR)/file_handle.Plo \ +@AMDEP_TRUE@ ./$(DEPDIR)/fs_modules.Plo ./$(DEPDIR)/glue.Plo \ +@AMDEP_TRUE@ ./$(DEPDIR)/handlefs.Plo ./$(DEPDIR)/tools.Plo +CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ + $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) +LTCXXCOMPILE = $(LIBTOOL) --mode=compile $(CXX) $(DEFS) \ + $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ + $(AM_CXXFLAGS) $(CXXFLAGS) +CXXLD = $(CXX) +CXXLINK = $(LIBTOOL) --mode=link $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) \ + $(AM_LDFLAGS) $(LDFLAGS) -o $@ +DIST_SOURCES = $(liblufs_wavfs_la_SOURCES) +HEADERS = $(noinst_HEADERS) + +DIST_COMMON = $(noinst_HEADERS) Makefile.am Makefile.in +SOURCES = $(liblufs_wavfs_la_SOURCES) + +all: all-am + +.SUFFIXES: +.SUFFIXES: .cpp .lo .o .obj +$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4) + cd $(top_srcdir) && \ + $(AUTOMAKE) --gnu filesystems/wavfs/Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe) +libLTLIBRARIES_INSTALL = $(INSTALL) +install-libLTLIBRARIES: $(lib_LTLIBRARIES) + @$(NORMAL_INSTALL) + $(mkinstalldirs) $(DESTDIR)$(libdir) + @list='$(lib_LTLIBRARIES)'; for p in $$list; do \ + if test -f $$p; then \ + f="`echo $$p | sed -e 's|^.*/||'`"; \ + echo " $(LIBTOOL) --mode=install $(libLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) $$p $(DESTDIR)$(libdir)/$$f"; \ + $(LIBTOOL) --mode=install $(libLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) $$p $(DESTDIR)$(libdir)/$$f; \ + else :; fi; \ + done + +uninstall-libLTLIBRARIES: + @$(NORMAL_UNINSTALL) + @list='$(lib_LTLIBRARIES)'; for p in $$list; do \ + p="`echo $$p | sed -e 's|^.*/||'`"; \ + echo " $(LIBTOOL) --mode=uninstall rm -f $(DESTDIR)$(libdir)/$$p"; \ + $(LIBTOOL) --mode=uninstall rm -f $(DESTDIR)$(libdir)/$$p; \ + done + +clean-libLTLIBRARIES: + -test -z "$(lib_LTLIBRARIES)" || rm -f $(lib_LTLIBRARIES) + @list='$(lib_LTLIBRARIES)'; for p in $$list; do \ + dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \ + test "$$dir" = "$$p" && dir=.; \ + echo "rm -f \"$${dir}/so_locations\""; \ + rm -f "$${dir}/so_locations"; \ + done +liblufs-wavfs.la: $(liblufs_wavfs_la_OBJECTS) $(liblufs_wavfs_la_DEPENDENCIES) + $(CXXLINK) -rpath $(libdir) $(liblufs_wavfs_la_LDFLAGS) $(liblufs_wavfs_la_OBJECTS) $(liblufs_wavfs_la_LIBADD) $(LIBS) + +mostlyclean-compile: + -rm -f *.$(OBJEXT) core *.core + +distclean-compile: + -rm -f *.tab.c + +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/file_handle.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fs_modules.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/glue.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/handlefs.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tools.Plo@am__quote@ + +distclean-depend: + -rm -rf ./$(DEPDIR) + +.cpp.o: +@am__fastdepCXX_TRUE@ if $(CXXCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" \ +@am__fastdepCXX_TRUE@ -c -o $@ `test -f '$<' || echo '$(srcdir)/'`$<; \ +@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; \ +@am__fastdepCXX_TRUE@ else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; \ +@am__fastdepCXX_TRUE@ fi +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ `test -f '$<' || echo '$(srcdir)/'`$< + +.cpp.obj: +@am__fastdepCXX_TRUE@ if $(CXXCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" \ +@am__fastdepCXX_TRUE@ -c -o $@ `if test -f '$<'; then $(CYGPATH_W) '$<'; else $(CYGPATH_W) '$(srcdir)/$<'; fi`; \ +@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; \ +@am__fastdepCXX_TRUE@ else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; \ +@am__fastdepCXX_TRUE@ fi +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ `if test -f '$<'; then $(CYGPATH_W) '$<'; else $(CYGPATH_W) '$(srcdir)/$<'; fi` + +.cpp.lo: +@am__fastdepCXX_TRUE@ if $(LTCXXCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" \ +@am__fastdepCXX_TRUE@ -c -o $@ `test -f '$<' || echo '$(srcdir)/'`$<; \ +@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Plo"; \ +@am__fastdepCXX_TRUE@ else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; \ +@am__fastdepCXX_TRUE@ fi +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ depfile='$(DEPDIR)/$*.Plo' tmpdepfile='$(DEPDIR)/$*.TPlo' @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(LTCXXCOMPILE) -c -o $@ `test -f '$<' || echo '$(srcdir)/'`$< + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs + +distclean-libtool: + -rm -f libtool +uninstall-info-am: + +ETAGS = etags +ETAGSFLAGS = + +CTAGS = ctags +CTAGSFLAGS = + +tags: TAGS + +ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + mkid -fID $$unique + +TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + tags=; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + test -z "$(ETAGS_ARGS)$$tags$$unique" \ + || $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$tags $$unique + +ctags: CTAGS +CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + tags=; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + test -z "$(CTAGS_ARGS)$$tags$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$tags $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && cd $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) $$here + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) + +top_distdir = ../.. +distdir = $(top_distdir)/$(PACKAGE)-$(VERSION) + +distdir: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \ + list='$(DISTFILES)'; for file in $$list; do \ + case $$file in \ + $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ + $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ + esac; \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test "$$dir" != "$$file" && test "$$dir" != "."; then \ + dir="/$$dir"; \ + $(mkinstalldirs) "$(distdir)$$dir"; \ + else \ + dir=''; \ + fi; \ + if test -d $$d/$$file; then \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ + fi; \ + cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ + else \ + test -f $(distdir)/$$file \ + || cp -p $$d/$$file $(distdir)/$$file \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-am +all-am: Makefile $(LTLIBRARIES) $(HEADERS) + +installdirs: + $(mkinstalldirs) $(DESTDIR)$(libdir) +install: install-am +install-exec: install-exec-am +install-data: install-data-am +uninstall: uninstall-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-am +install-strip: + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + INSTALL_STRIP_FLAG=-s \ + `test -z '$(STRIP)' || \ + echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -rm -f Makefile $(CONFIG_CLEAN_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +clean: clean-am + +clean-am: clean-generic clean-libLTLIBRARIES clean-libtool \ + mostlyclean-am + +distclean: distclean-am + +distclean-am: clean-am distclean-compile distclean-depend \ + distclean-generic distclean-libtool distclean-tags + +dvi: dvi-am + +dvi-am: + +info: info-am + +info-am: + +install-data-am: + +install-exec-am: install-libLTLIBRARIES + +install-info: install-info-am + +install-man: + +installcheck-am: + +maintainer-clean: maintainer-clean-am + +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-compile mostlyclean-generic \ + mostlyclean-libtool + +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + +uninstall-am: uninstall-info-am uninstall-libLTLIBRARIES + +.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ + clean-libLTLIBRARIES clean-libtool ctags distclean \ + distclean-compile distclean-depend distclean-generic \ + distclean-libtool distclean-tags distdir dvi dvi-am info \ + info-am install install-am install-data install-data-am \ + install-exec install-exec-am install-info install-info-am \ + install-libLTLIBRARIES install-man install-strip installcheck \ + installcheck-am installdirs maintainer-clean \ + maintainer-clean-generic mostlyclean mostlyclean-compile \ + mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ + tags uninstall uninstall-am uninstall-info-am \ + uninstall-libLTLIBRARIES + +# 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/filesystems/wavfs/file_handle.cpp b/filesystems/wavfs/file_handle.cpp new file mode 100644 index 0000000..eeaf870 --- /dev/null +++ b/filesystems/wavfs/file_handle.cpp @@ -0,0 +1,382 @@ +#include +#include + +#include +#include + +#include +#include + +using namespace std; + +#include "tools.h" +#include "file_handle.h" +#include "fs_modules.h" + +/******************************************************************************** + Helper Classes +********************************************************************************/ + +FileHandle* FileHandleArray::Find( const char* name ) +{ + FileHandle *p; + TRACE("looking for " << name << ", size=" << size()); + + for(iterator i = begin(); i != end(); i++ ) + { + p = *i; + if(p && p->name == name) + { + TRACE("handle found"); + return p; + } + } + return NULL; +} + +int FileHandleArray::Delete( const char* name ) +{ + FileHandle *p; + int r; + TRACE("closing for " << name << ", size=" << size()); + for(iterator i = begin(); i != end(); i++ ) + { + p = *i; + if(p && p->name == name) + { + TRACE("handle found"); + erase(i); + r = p->Close(); + delete p; + return r; + } + } + return 0; +} + +void FileHandleArray::Insert( FileHandle* handle ) +{ + TRACE("Inserting : "<name); + FileHandle *p; + int r; + for(iterator i = begin(); i != end(); i++ ) + { + p = *i; + if(p && p->name == handle->name) + { + TRACE("handle found"); + if( p !=handle ) + { + erase(i); + r = p->Close(); + delete p; + push_back(handle); + } + return; + } + } + + push_back( handle ); +} + +void FileHandleArray::Cleanup() +{ + TRACE("Cleanup. "); + time_t now = time(0); + FileHandle *p; + bool more = false; + do + { + more = false; + for(iterator i = begin(); i != end(); i++ ) + { + p = *i; + if(p && p->IsTimedOut(now)) + { + fprintf(stderr,"deleting %s",p->name.c_str()); + //TRACE("deleting "<name.c_str()); + erase(i); + delete p; + more = true; + break; // stupid STL iterators break on erase() + } + } + } while( more ); +} + +/********* FileHandle methods **************/ + +FileHandle::FileHandle(const char* _name, const char* _real_name ) +{ + name = _name; + real_name = _real_name; + KeepAlive(); +} + +FileHandle::~FileHandle() +{ +} + +void FileHandle::KeepAlive() +{ + timeout = time(0) + file_handle_timeout; +} + +bool FileHandle::IsTimedOut(time_t t) +{ + return t>timeout; +} + +/********* FileHandle_Default methods **************/ + +FileHandle_Default::FileHandle_Default(const char* name, const char* real_name) : FileHandle(name,real_name) +{ + handle = -1; +} + +FileHandle_Default::~FileHandle_Default() +{ + Close(); +} + +int FileHandle_Default::Open() +{ + TRACE(Identity()<<" tries to open "<f_mode = stat.st_mode; + fattr->f_nlink = stat.st_nlink; + fattr->f_uid = (getuid() == stat.st_uid) ? 1 : 0; + fattr->f_gid = (getgid() == stat.st_gid) ? 1 : 0; + fattr->f_size = stat.st_size; + fattr->f_atime = stat.st_atime; + fattr->f_mtime = stat.st_mtime; + fattr->f_ctime = stat.st_ctime; + + return 0; +} + +int FileHandle_Default::Read(long long pos, unsigned long length, char* buf) +{ + if(Open()<0) + return -1; + + if(lseek(handle, pos, SEEK_SET) < 0) + { + TRACE("seek failed"); + return -1; + } + + int res = read(handle, buf, length); + TRACE("read: "<< res); + return res; +} + + +/********* FileHandle_XWav methods **************/ + +FileHandle_XWav::FileHandle_XWav(const char* name, const char* real_name, const char* cmd) : + SeekablePipe(name, real_name, cmd) +{ +} + +FileHandle_XWav::~FileHandle_XWav() +{ + Close(); +} + +typedef struct +{ + char riff[4]; + unsigned long file_length; + char wave[4]; +} wav_header_t; + +// stats original file instead. +int FileHandle_XWav::Stat(struct lufs_fattr *fattr) +{ + struct stat st; + + TRACE("Statting : " << real_name); + + if(stat(real_name.c_str(), &st) < 0) + return -1; + + wav_header_t header; + if( Read(0,sizeof(header),(char*)&header) != sizeof(header) ) + return -1; + + TRACE(header.riff); + TRACE(header.wave); + + if(memcmp(header.riff,"RIFF",4)) + { + ERROR("No RIFF!"); + return -1; + } + if(memcmp(header.wave,"WAVE",4)) + { + ERROR("No WAVE!"); + return -1; + } + + fattr->f_mode = st.st_mode; + fattr->f_nlink = st.st_nlink; + fattr->f_uid = (getuid() == st.st_uid) ? 1 : 0; + fattr->f_gid = (getgid() == st.st_gid) ? 1 : 0; + fattr->f_size = header.file_length+8; + fattr->f_atime = st.st_atime; + fattr->f_mtime = st.st_mtime; + fattr->f_ctime = st.st_ctime; + + TRACE("Stat : Success ! : "< Array; + + string name; // virtual name + string real_name; // name of the real file on disk + + // don't close this before time(0)>timeout + void KeepAlive(); + bool IsTimedOut(time_t t); +protected: + time_t timeout; +}; + +class FileHandleArray : public FileHandle::Array +{ +public: + FileHandleArray() {} + virtual ~FileHandleArray() {} + + // finds handle by name, returns 0 if no handle in stock + FileHandle* Find( const char* name ); + + // Deletes a named handle, does nothing fi it does not exist + int Delete( const char* name ); + + // Inserts a named handle + void Insert( FileHandle* handle ); + + // removes timed out handles + void Cleanup(); +}; + + +class FileHandle_Default : public FileHandle +{ +public: + FileHandle_Default(const char* name, const char* real_name); + ~FileHandle_Default(); + + int Open(); + int Stat(struct lufs_fattr *fattr); + int Read(long long pos, unsigned long length, char* buf); + int Close(); + virtual const char* Identity() { return "FileHandle_Default"; } + +protected: + int handle; +}; + +// pipes the output from a command (typically a decompressor) and caches it +// so that we can seek it afterwards. +class SeekablePipe: public FileHandle +{ +public: + // name and real_name are inherited from FileHandle + SeekablePipe(const char* name, const char* real_name, const char* cmd); + ~SeekablePipe(); + + int Open(); + int Stat(struct lufs_fattr *fattr); + int Read(long long pos, unsigned long length, char* buf); + int Close(); + virtual const char* Identity() { return "SeekablePipe"; } + +protected: + int Cache(long long upto); + + long long already_read; + bool eof; + FILE *pipe; + FILE *tmp_file; + + string command; +}; + +// handles a compressed wave file +class FileHandle_XWav : public SeekablePipe +{ +public: + FileHandle_XWav(const char* name, const char* real_name, const char* cmd); + ~FileHandle_XWav(); + int Stat(struct lufs_fattr *fattr); + virtual const char* Identity() { return "FileHandle_XWav"; } + +protected: +}; + +class FileHandle_Flac : public FileHandle_XWav +{ +public: + FileHandle_Flac(const char* name, const char* real_name); + virtual const char* Identity() { return "FileHandle_Flac"; } + +protected: +}; + +/* +class FileHandle_Ogg : public FileHandle_XWav +{ +public: + FileHandle_Ogg(const char* name, const char* real_name); + virtual const char* Identity() { return "FileHandle_Ogg"; } + +protected: +}; + +class FileHandle_MP3 : public FileHandle_XWav +{ +public: + FileHandle_MP3(const char* name, const char* real_name); + virtual const char* Identity() { return "FileHandle_MP3"; } + +protected: +}; +*/ diff --git a/filesystems/wavfs/fs_modules.cpp b/filesystems/wavfs/fs_modules.cpp new file mode 100644 index 0000000..aaab905 --- /dev/null +++ b/filesystems/wavfs/fs_modules.cpp @@ -0,0 +1,81 @@ +#include +#include + +#include +#include + +#include +#include + +using namespace std; + +#include "tools.h" +#include "file_handle.h" +#include "fs_modules.h" + + +/********* FSModule methods **************/ + +string FSModule::GetVirtualFilename(const char* fname) +{ + if(endswith(fname, GetRealExtension())) + return string(fname)+GetVirtualExtension(); + else + return string(); +} + +bool FSModule::IsMyVirtualFilename(const char* fname) +{ + // ends with virtual extension ? + string real_candidate = removeend( fname, GetVirtualExtension() ); + if( real_candidate.size() == 0 ) + return false; + + // real filename ends with real extension corresponding to the compression we use ? + return endswith(real_candidate.c_str(),GetRealExtension()); +} + +string FSModule::GetRealFilename( const char* virtuel ) +{ + return removeend( virtuel, GetVirtualExtension() ); +} + +FileHandle* FSModule::Open( const char* path ) +{ + TRACE(Identity()<<" tries to open "< name matches, i'll look closer at "<Open()<0 ) + { + delete handle; + return 0; + } + else + return handle; +} + + +/********* FSModule_Default methods **************/ + +string FSModule_Default::GetVirtualFilename(const char* fname) +{ + return string(fname); +} + +bool FSModule_Default::IsMyVirtualFilename(const char* fname) +{ + return true; +} + +string FSModule_Default::GetRealFilename( const char* virtuel ) +{ + return virtuel; +} + +/********* FSModule_Flac methods **************/ diff --git a/filesystems/wavfs/fs_modules.h b/filesystems/wavfs/fs_modules.h new file mode 100644 index 0000000..452f3ce --- /dev/null +++ b/filesystems/wavfs/fs_modules.h @@ -0,0 +1,76 @@ +// Base class for a filesystem hook module which depends on filename. +// default behaviour filters on extension. +class FSModule +{ +public: + // call this function with true it the file we are looking at has already been processed by another + // filter. Returns true if this filter wants to process it too. + virtual bool CanAdd( bool already_added ) { return !already_added; }; + + /* If this module can process this file, this method will return a "virtual" + file name for the processed file. Else, returns empty string. + example : fname = "music.flac" => returns "music.flac$.wav" */ + virtual string GetVirtualFilename(const char* fname); + + // returns true if it is this module which generated this virtual filename + virtual bool IsMyVirtualFilename(const char* fname); + + // returns real filename from virtual filename, or empty string if impossible + virtual string GetRealFilename( const char* virtuel ); + + // Opens a file and returns a handle to it. NULL if error. + virtual FileHandle* Open( const char* path ); + + // this is ".flac" + virtual const char* GetRealExtension() { return ""; } + + // this is "$.wav" + virtual const char* GetVirtualExtension() { return ""; } + + typedef vector Array; + + virtual const char* Identity() { return "FSModule"; } +protected: + // instanciate handle + virtual FileHandle* CreateHandle(const char* name, const char* real_name) =0; + +}; + +class FSModule_Default : public FSModule +{ +public: + virtual string GetVirtualFilename(const char* fname); + bool IsMyVirtualFilename(const char* fname); + string GetRealFilename( const char* virtuel ); + FileHandle* CreateHandle(const char* name, const char* real_name) { return new FileHandle_Default(name,real_name); } + virtual const char* Identity() { return "FSModule_Default"; } +}; + +class FSModule_Flac : public FSModule +{ +public: + const char* GetRealExtension() { return ".flac"; } + const char* GetVirtualExtension() { return ".wav"; } + FileHandle* CreateHandle(const char* name, const char* real_name) { return new FileHandle_Flac(name,real_name); } + virtual const char* Identity() { return "FSModule_Flac"; } +}; + +/* +class FSModule_Ogg : public FSModule +{ +public: + const char* GetRealExtension() { return ".ogg"; } + const char* GetVirtualExtension() { return ".wav"; } + FileHandle* CreateHandle(const char* name, const char* real_name) { return new FileHandle_Ogg(name,real_name); } + virtual const char* Identity() { return "FSModule_Ogg"; } +}; + +class FSModule_MP3 : public FSModule +{ +public: + const char* GetRealExtension() { return ".mp3"; } + const char* GetVirtualExtension() { return ".wav"; } + FileHandle* CreateHandle(const char* name, const char* real_name) { return new FileHandle_MP3(name,real_name); } + virtual const char* Identity() { return "FSModule_MP3"; } +}; +*/ diff --git a/filesystems/wavfs/glue.cpp b/filesystems/wavfs/glue.cpp new file mode 100644 index 0000000..b644d95 --- /dev/null +++ b/filesystems/wavfs/glue.cpp @@ -0,0 +1,108 @@ +/* + */ + +#include +#include +#include + +#include + +#include +#include + +#include +#include + +using namespace std; + +#include "file_handle.h" +#include "fs_modules.h" +#include "handlefs.h" + +extern "C"{ + +/******************************************************************************** + C Wrappers +********************************************************************************/ + +void* wavfs_init(struct list_head *cfg, struct dir_cache *cache, struct credentials *cred, void **global_ctx) +{ +/* if(!lu_opt_getchar(cfg, "MOUNT", "username") || !lu_opt_getchar(cfg, "MOUNT", "host")){ + ERROR("you must specify at least a host and an username!"); + return NULL; + } + */ + return (void*)new HandleFS(cfg, cache, cred); +} + +void wavfs_free(void *ctx) +{ + HandleFS *p = (HandleFS*)ctx; + delete p; +} + +int wavfs_mount(void *ctx) +{ + return ((HandleFS*)ctx)->do_mount(); +} + +void wavfs_umount(void *ctx) +{ + ((HandleFS*)ctx)->do_umount(); +} + +int wavfs_readdir(void *ctx, char *dir_name, struct directory *dir) +{ + return ((HandleFS*)ctx)->do_readdir(dir_name, dir); +} + +int wavfs_stat(void *ctx, char *name, struct lufs_fattr *fattr) +{ + return ((HandleFS*)ctx)->do_stat(name, fattr); +} + +int wavfs_open(void *ctx, char *file, unsigned mode) +{ + return ((HandleFS*)ctx)->do_open(file); +} + +int wavfs_release(void *ctx, char *file) +{ + return ((HandleFS*)ctx)->do_release(file); +} + +int wavfs_read(void *ctx, char *file, long long offset, unsigned long count, char *buf) +{ + return ((HandleFS*)ctx)->do_read(file, offset, count, buf); +} + +/******************************************************************************** + Default OS Implementation +********************************************************************************/ + +int wavfs_readlink(void *ctx, char *link, char *buf, int buflen) +{ + return readlink(link, buf, buflen); +} + +/******************************************************************************** + Write operations are not implemented +********************************************************************************/ + +int read_only_error() +{ + ERROR("This filesystem is read-only."); + return -1; +} + +int wavfs_mkdir(void *ctx, char *dir, int mode) { return read_only_error(); } +int wavfs_rmdir(void *ctx, char *dir) { return read_only_error(); } +int wavfs_create(void *ctx, char *file, int mode) { return read_only_error(); } +int wavfs_unlink(void *ctx, char *file) { return read_only_error(); } +int wavfs_rename(void *ctx, char *old_name, char *new_name) { return read_only_error(); } +int wavfs_write(void *ctx, char *file, long long offset, unsigned long count, char *buf) { return read_only_error(); } +int wavfs_link(void *ctx, char *target, char *link) { return read_only_error(); } +int wavfs_symlink(void *ctx, char *target, char *link) { return read_only_error(); } +int wavfs_setattr(void *ctx, char *file, struct lufs_fattr *fattr) { return read_only_error(); } + +} /* extern "C" */ diff --git a/filesystems/wavfs/handlefs.cpp b/filesystems/wavfs/handlefs.cpp new file mode 100644 index 0000000..6b45046 --- /dev/null +++ b/filesystems/wavfs/handlefs.cpp @@ -0,0 +1,239 @@ +/* + */ + +#include +#include +#include + +#include +#include + +#include +#include + +using namespace std; + +#include "tools.h" +#include "file_handle.h" +#include "fs_modules.h" +#include "handlefs.h" + + +/******************************************************************************** + Inits, mount, umount... +********************************************************************************/ + +HandleFS::HandleFS(struct list_head *_cfg, struct dir_cache *_cache, struct credentials *_cred) +{ + TRACE("in constructor"); + + cfg = _cfg; + cache = _cache; + cred = _cred; + + // Create modules in parsing order. + modules.push_back( new FSModule_Flac() ); +// modules.push_back( new FSModule_Ogg() ); +// modules.push_back( new FSModule_MP3() ); + // insert new module here + + // this module catches all remaining files. + modules.push_back( new FSModule_Default() ); +} + +HandleFS::~HandleFS() +{ + TRACE("in destructor"); +} + + +int HandleFS::do_mount() +{ + TRACE("do_mount"); + return 1; +} + +void HandleFS::do_umount() +{ + TRACE("do_umount"); +} + +/******************************************************************************** + readdir +********************************************************************************/ + +int HandleFS::do_readdir(const char *dir_name, struct directory *ddir) +{ + DIR *dir; + struct lufs_fattr fattr; + struct dirent *dent; + bool already_added; + + TRACE("readdir " << dir_name); + + if(chdir(dir_name) < 0) + { + WARN("chdir failed: "<d_name); + + if( do_stat(dent->d_name, &fattr) < 0) + { + WARN("could not stat file!"); + closedir(dir); + return -1; + } + + if( S_ISDIR(fattr.f_mode) ) + lu_cache_add2dir(ddir, dent->d_name, NULL, &fattr); + else + { + // add virtual files + already_added = false; + for(FSModule::Array::iterator i = modules.begin(); i != modules.end(); i++ ) + { + if( !(*i)->CanAdd( already_added )) + continue; + + string xlat( (*i)->GetVirtualFilename(dent->d_name) ); + if(!xlat.size()) + continue; + + string full_xlat( string(dir_name)+"/"+xlat ); + if(do_stat(full_xlat.c_str(), &fattr)==0) + { + TRACE("adding virtual direntry "<d_name); + lu_cache_add2dir(ddir, (char*)xlat.c_str(), NULL, &fattr); + already_added = true; + } + } + } + } + + closedir(dir); + + return 0; +} + +/******************************************************************************** + stat +********************************************************************************/ + +int HandleFS::do_stat(const char *file, struct lufs_fattr *fattr) +{ + int res; + bool created_here; + + // check if it is a directory first... + TRACE("*** do_stat " << file); + struct stat stat; + if(lstat(file, &stat) == 0) + { + if( S_ISDIR(stat.st_mode) ) + { + fattr->f_mode = stat.st_mode; + fattr->f_nlink = stat.st_nlink; + fattr->f_uid = (getuid() == stat.st_uid) ? 1 : 0; + fattr->f_gid = (getgid() == stat.st_gid) ? 1 : 0; + fattr->f_size = stat.st_size; + fattr->f_atime = stat.st_atime; + fattr->f_mtime = stat.st_mtime; + fattr->f_ctime = stat.st_ctime; + return 0; + } + } + + FileHandle *handle = handles.Find(file); + if(handle) + { + created_here = false; + handle->KeepAlive(); + } + else + { + handle = Open(file); + if( !handle ) + return -1; + created_here = true; + } + + res = handle->Stat(fattr); + fattr->f_uid = ((int)fattr->f_uid == (int)cred->uid) ? 1 : 0; + fattr->f_gid = ((int)fattr->f_gid == (int)cred->gid) ? 1 : 0; + +// deleting will be done by timeout... +// if(created_here) +// handles.Delete(handle->name.c_str()); + + return res; +} + +/******************************************************************************** + open/close +********************************************************************************/ + +int HandleFS::do_open(const char *file) +{ + TRACE("do_open"); + FileHandle *handle = Open(file); + if( !handle ) + return -1; + return 0; +} + +int HandleFS::do_release(const char *file) +{ + int ret=0; + TRACE("do_release"); + + handles.Cleanup(); + TRACE(handles.size() << " files still opened."); + return ret; +} + +FileHandle* HandleFS::Open( const char* path ) +{ + FileHandle *handle = handles.Find(path); + if(handle) + { + handle->KeepAlive(); + return handle; + } + + for(FSModule::Array::iterator i = modules.begin(); i != modules.end(); i++ ) + { + handle = (*i)->Open(path); + if(handle) + { + TRACE("Opened with "<<(*i)->Identity()); + handle->KeepAlive(); + handles.Insert( handle ); + return handle; + } + } + + return 0; +} + +/******************************************************************************** + read +********************************************************************************/ + +int HandleFS::do_read(const char *file, long long offset, unsigned long count, char *b) +{ + TRACE("do_read"); + FileHandle *handle = Open(file); + if( !handle ) + return -1; + return handle->Read(offset,count,b); +} diff --git a/filesystems/wavfs/handlefs.h b/filesystems/wavfs/handlefs.h new file mode 100644 index 0000000..8364db7 --- /dev/null +++ b/filesystems/wavfs/handlefs.h @@ -0,0 +1,48 @@ +/* + Adds a file handle abstraction on top of LUFS +*/ + +#ifndef _HANDLEFS_H_ +#define _HANDLEFS_H_ + +using namespace std; + +struct directory; +struct dir_cache; + +#ifdef DEBUGGING +#define HANDLES_TTL 30 +#else +#define HANDLES_TTL 300 +#endif + + +class HandleFS +{ +public: + HandleFS(struct list_head*, struct dir_cache*, struct credentials*); + ~HandleFS(); + + int do_mount(); + void do_umount(); + + int do_readdir(const char*, struct directory*); + int do_stat(const char*, struct lufs_fattr*); + int do_readlink(char*, char*, int); + int do_open(const char*); + int do_release(const char*); + int do_read(const char*, long long, unsigned long, char*); + +protected: + // returns a handle to an already opened file or opens the file. Returns NULL if error. + FileHandle *Open( const char* path ); + + struct dir_cache *cache; + struct list_head *cfg; + struct credentials *cred; + + FileHandleArray handles; + FSModule::Array modules; +}; + +#endif diff --git a/filesystems/wavfs/tools.cpp b/filesystems/wavfs/tools.cpp new file mode 100644 index 0000000..5fad83b --- /dev/null +++ b/filesystems/wavfs/tools.cpp @@ -0,0 +1,41 @@ +#include +#include + +#include +#include + +#include +#include + +using namespace std; + +#include "tools.h" + +bool endswith( const char* s, const char* end ) +{ + int ls = strlen(s); + int le = strlen(end); + if(le>ls) return false; + + return !strcmp(s+ls-le,end); +} + +string removeend( const char* s, const char* end) +{ + int ls = strlen(s); + int le = strlen(end); + if(le>ls) + return string(); + + if(strcmp(s+ls-le,end)) + return string(); + + return string(s, ls-le); +} + +string mktemp(const char* base) +{ + char buf[2048]; + sprintf(buf,"/var/tmp/lufs-%s-%d", base, rand()); + return buf; +} diff --git a/filesystems/wavfs/tools.h b/filesystems/wavfs/tools.h new file mode 100644 index 0000000..96ccbb9 --- /dev/null +++ b/filesystems/wavfs/tools.h @@ -0,0 +1,4 @@ + +bool endswith( const char* s, const char* end ); +string removeend( const char* s, const char* end) ; +string mktemp(const char* base); diff --git a/include/Makefile.am b/include/Makefile.am new file mode 100644 index 0000000..d9ab606 --- /dev/null +++ b/include/Makefile.am @@ -0,0 +1 @@ +nobase_include_HEADERS = lufs/proto.h lufs/fs.h \ No newline at end of file diff --git a/include/Makefile.in b/include/Makefile.in new file mode 100644 index 0000000..56762cc --- /dev/null +++ b/include/Makefile.in @@ -0,0 +1,373 @@ +# Makefile.in generated by automake 1.7.5 from Makefile.am. +# @configure_input@ + +# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003 +# Free Software Foundation, Inc. +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ + +srcdir = @srcdir@ +top_srcdir = @top_srcdir@ +VPATH = @srcdir@ +pkgdatadir = $(datadir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +top_builddir = .. + +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +INSTALL = @INSTALL@ +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = @build@ +host_triplet = @host@ +target_triplet = @target@ +ACLOCAL = @ACLOCAL@ +AMDEP_FALSE = @AMDEP_FALSE@ +AMDEP_TRUE = @AMDEP_TRUE@ +AMTAR = @AMTAR@ +AUTOCONF = @AUTOCONF@ +AUTOFS_INSTALL = @AUTOFS_INSTALL@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CXX = @CXX@ +CXXDEPMODE = @CXXDEPMODE@ +CXXFLAGS = @CXXFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DEBUG_FLAGS = @DEBUG_FLAGS@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +ECHO = @ECHO@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +EXEEXT = @EXEEXT@ +GCONF = @GCONF@ +GVFSCONF = @GVFSCONF@ +GVFS_CFLAGS = @GVFS_CFLAGS@ +GVFS_LDADD = @GVFS_LDADD@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +KDEBUG_FLAGS = @KDEBUG_FLAGS@ +KERNEL_DIR = @KERNEL_DIR@ +KERNEL_HDR = @KERNEL_HDR@ +LDFLAGS = @LDFLAGS@ +LIBCHIPCARD_INCLUDES = @LIBCHIPCARD_INCLUDES@ +LIBCHIPCARD_LIB = @LIBCHIPCARD_LIB@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LIBTOOL = @LIBTOOL@ +LN_S = @LN_S@ +LTLIBOBJS = @LTLIBOBJS@ +LUFS_SUID = @LUFS_SUID@ +MAKEINFO = @MAKEINFO@ +MODULES_DIR = @MODULES_DIR@ +MODV_FLAGS = @MODV_FLAGS@ +OBJEXT = @OBJEXT@ +OS_DIR = @OS_DIR@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +RANLIB = @RANLIB@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +SSHPROG = @SSHPROG@ +STRIP = @STRIP@ +VERSION = @VERSION@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_CXX = @ac_ct_CXX@ +ac_ct_RANLIB = @ac_ct_RANLIB@ +ac_ct_STRIP = @ac_ct_STRIP@ +all_includes = @all_includes@ +all_libraries = @all_libraries@ +am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ +am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ +am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@ +am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +datadir = @datadir@ +define_has_libchipcard = @define_has_libchipcard@ +exec_prefix = @exec_prefix@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localstatedir = @localstatedir@ +mandir = @mandir@ +oldincludedir = @oldincludedir@ +opt_fs = @opt_fs@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +sysconfdir = @sysconfdir@ +target = @target@ +target_alias = @target_alias@ +target_cpu = @target_cpu@ +target_os = @target_os@ +target_vendor = @target_vendor@ +nobase_include_HEADERS = lufs/proto.h lufs/fs.h +subdir = include +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +mkinstalldirs = $(SHELL) $(top_srcdir)/config/mkinstalldirs +CONFIG_HEADER = $(top_builddir)/config.h +CONFIG_CLEAN_FILES = +DIST_SOURCES = +HEADERS = $(nobase_include_HEADERS) + +DIST_COMMON = $(nobase_include_HEADERS) Makefile.am Makefile.in +all: all-am + +.SUFFIXES: +$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4) + cd $(top_srcdir) && \ + $(AUTOMAKE) --gnu include/Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe) + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs + +distclean-libtool: + -rm -f libtool +uninstall-info-am: +nobase_includeHEADERS_INSTALL = $(install_sh_DATA) +install-nobase_includeHEADERS: $(nobase_include_HEADERS) + @$(NORMAL_INSTALL) + $(mkinstalldirs) $(DESTDIR)$(includedir) + @list='$(nobase_include_HEADERS)'; for p in $$list; do \ + if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ + f="$$p"; \ + echo " $(nobase_includeHEADERS_INSTALL) $$d$$p $(DESTDIR)$(includedir)/$$f"; \ + $(nobase_includeHEADERS_INSTALL) $$d$$p $(DESTDIR)$(includedir)/$$f; \ + done + +uninstall-nobase_includeHEADERS: + @$(NORMAL_UNINSTALL) + @list='$(nobase_include_HEADERS)'; for p in $$list; do \ + f="$$p"; \ + echo " rm -f $(DESTDIR)$(includedir)/$$f"; \ + rm -f $(DESTDIR)$(includedir)/$$f; \ + done + +ETAGS = etags +ETAGSFLAGS = + +CTAGS = ctags +CTAGSFLAGS = + +tags: TAGS + +ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + mkid -fID $$unique + +TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + tags=; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + test -z "$(ETAGS_ARGS)$$tags$$unique" \ + || $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$tags $$unique + +ctags: CTAGS +CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + tags=; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + test -z "$(CTAGS_ARGS)$$tags$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$tags $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && cd $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) $$here + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) + +top_distdir = .. +distdir = $(top_distdir)/$(PACKAGE)-$(VERSION) + +distdir: $(DISTFILES) + $(mkinstalldirs) $(distdir)/lufs + @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \ + list='$(DISTFILES)'; for file in $$list; do \ + case $$file in \ + $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ + $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ + esac; \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test "$$dir" != "$$file" && test "$$dir" != "."; then \ + dir="/$$dir"; \ + $(mkinstalldirs) "$(distdir)$$dir"; \ + else \ + dir=''; \ + fi; \ + if test -d $$d/$$file; then \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ + fi; \ + cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ + else \ + test -f $(distdir)/$$file \ + || cp -p $$d/$$file $(distdir)/$$file \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-am +all-am: Makefile $(HEADERS) + +installdirs: + $(mkinstalldirs) $(DESTDIR)$(includedir) +install: install-am +install-exec: install-exec-am +install-data: install-data-am +uninstall: uninstall-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-am +install-strip: + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + INSTALL_STRIP_FLAG=-s \ + `test -z '$(STRIP)' || \ + echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -rm -f Makefile $(CONFIG_CLEAN_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +clean: clean-am + +clean-am: clean-generic clean-libtool mostlyclean-am + +distclean: distclean-am + +distclean-am: clean-am distclean-generic distclean-libtool \ + distclean-tags + +dvi: dvi-am + +dvi-am: + +info: info-am + +info-am: + +install-data-am: install-nobase_includeHEADERS + +install-exec-am: + +install-info: install-info-am + +install-man: + +installcheck-am: + +maintainer-clean: maintainer-clean-am + +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-generic mostlyclean-libtool + +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + +uninstall-am: uninstall-info-am uninstall-nobase_includeHEADERS + +.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ + clean-libtool ctags distclean distclean-generic \ + distclean-libtool distclean-tags distdir dvi dvi-am info \ + info-am install install-am install-data install-data-am \ + install-exec install-exec-am install-info install-info-am \ + install-man install-nobase_includeHEADERS install-strip \ + installcheck installcheck-am installdirs maintainer-clean \ + maintainer-clean-generic mostlyclean mostlyclean-generic \ + mostlyclean-libtool pdf pdf-am ps ps-am tags uninstall \ + uninstall-am uninstall-info-am uninstall-nobase_includeHEADERS + +# 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/include/lufs/fs.h b/include/lufs/fs.h new file mode 100644 index 0000000..6dd1274 --- /dev/null +++ b/include/lufs/fs.h @@ -0,0 +1,112 @@ +/* + * lufs.h + * Copyright (C) 2002 Florin Malita + * + * This file is part of LUFS, a free userspace filesystem implementation. + * See http://lufs.sourceforge.net/ for updates. + * + * LUFS 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. + * + * LUFS 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 _LUFS_FS_H_ +#define _LUFS_FS_H_ + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +struct dir_cache; +struct directory; +struct lufs_fattr; +struct file_system; +struct list_head; +struct dir_cache; + +#define MAX_LEN 64 + +struct credentials{ + char user[MAX_LEN]; + char group[MAX_LEN]; + uid_t uid; + gid_t gid; +}; + + +struct directory* lu_cache_mkdir(char*); +int lu_cache_add2dir(struct directory*, char*, char*, struct lufs_fattr*); +int lu_cache_lookup(struct dir_cache*, char*, char*, struct lufs_fattr*, char*, int); +void lu_cache_add_dir(struct dir_cache*, struct directory*); +void lu_cache_killdir(struct directory*); + +int lu_check_to(int, int, int); +int lu_atomic_read(int, char*, int, int); +int lu_atomic_write(int, char*, int, int); + +int lu_opt_loadcfg(struct list_head*, char*); +int lu_opt_parse(struct list_head*, char*, char*); +int lu_opt_getint(struct list_head*, char*, char*, long int*, int); +const char* lu_opt_getchar(struct list_head*, char*, char*); + + +#ifdef __cplusplus +} /* end of extern "C" { */ +#endif + +#ifdef TRACE +#undef TRACE +#endif +#ifdef WARN +#undef WARN +#endif +#ifdef ERROR +#undef ERROR +#endif + +#ifdef __cplusplus + +#include + +#ifdef DEBUG +#define TRACE(x) cout< + +#ifdef DEBUG +#define TRACE(x...) do{fprintf(stdout, "[%x](%s) ", getpid(), __func__); fprintf(stdout, x); fprintf(stdout, "\n");}while(0) +#define WARN(x...) do{fprintf(stdout, "[%x](%s) ", getpid(), __func__); fprintf(stdout, x); fprintf(stdout, "\n");}while(0) +#define ERROR(x...) do{fprintf(stderr, "[%x](%s) ", getpid(), __func__); fprintf(stdout, x); fprintf(stdout, "\n");}while(0) +#else +#define TRACE(x...) do{}while(0) +#define WARN(x...) do{}while(0) +#define ERROR(x...) do{fprintf(stderr, x); fprintf(stderr, "\n");}while(0) +#endif + +#endif + + + +#endif + diff --git a/include/lufs/proto.h b/include/lufs/proto.h new file mode 100644 index 0000000..3938430 --- /dev/null +++ b/include/lufs/proto.h @@ -0,0 +1,106 @@ +/* + * proto.h + * Copyright (C) 2002 Florin Malita + * + * This file is part of LUFS, a free userspace filesystem implementation. + * See http://lufs.sourceforge.net/ for updates. + * + * LUFS 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. + * + * LUFS 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 _LU_PROTO_H_ +#define _LU_PROTO_H_ + +#define LU_MAXDATA 4096 + +#define PVERSION 0x02 + +#define PTYPE_OK 0x00 +#define PTYPE_MOUNT 0x01 +#define PTYPE_READ 0x02 +#define PTYPE_WRITE 0x03 +#define PTYPE_READDIR 0x04 +#define PTYPE_STAT 0x05 +#define PTYPE_UMOUNT 0x06 +#define PTYPE_SETATTR 0x07 +#define PTYPE_MKDIR 0x08 +#define PTYPE_RMDIR 0x09 +#define PTYPE_CREATE 0x0A +#define PTYPE_UNLINK 0x0B +#define PTYPE_RENAME 0x0C +#define PTYPE_OPEN 0x0D +#define PTYPE_RELEASE 0x0E +#define PTYPE_READLINK 0x0F +#define PTYPE_LINK 0x10 +#define PTYPE_SYMLINK 0x11 + +#define PTYPE_MAX 0x11 + + +#define PTYPE_ERROR 0x100 + +#define PERROR(x) (-(x & (PTYPE_ERROR - 1)) - 1) +#define PIS_ERROR(x) (x & PTYPE_ERROR) + +struct lu_msg { + unsigned short msg_version; + unsigned short msg_type; + unsigned short msg_datalen; + unsigned short msg_pid; +}; + + +struct lufs_fattr{ + unsigned long f_ino; + unsigned long f_mode; + unsigned long f_nlink; + unsigned long f_uid; + unsigned long f_gid; + long long f_size; + unsigned long f_atime; + unsigned long f_mtime; + unsigned long f_ctime; + unsigned long f_blksize; + unsigned long f_blocks; +}; + + +struct lufs_req_readdir{ + unsigned short offset; + char dirname[0]; +}; + +struct lufs_req_mkdir{ + int mode; + char dirname[0]; +}; + +struct lufs_req_rw{ + long long offset; + unsigned long count; + char name[0]; +}; + +struct lufs_req_open{ + unsigned mode; + char name[0]; +}; + +struct lufs_req_setattr{ + struct lufs_fattr fattr; + char name[0]; +}; + +#endif diff --git a/kernel/Linux/2.4/Makefile.am b/kernel/Linux/2.4/Makefile.am new file mode 100644 index 0000000..2aa141b --- /dev/null +++ b/kernel/Linux/2.4/Makefile.am @@ -0,0 +1,19 @@ +INCLUDES=-I@KERNEL_HDR@ @all_includes@ + +LIBS= + +CFLAGS=@MODV_FLAGS@ @KDEBUG_FLAGS@ -O2 -pipe -fomit-frame-pointer -fno-strict-aliasing -mpreferred-stack-boundary=2 -Wall -D__KERNEL__ -DMODULE -DLINUX +LDFLAGS=-r + +moduledir=@MODULES_DIR@/kernel/fs/lufs + +module_PROGRAMS=lufs.o + +noinst_HEADERS=lufs.h proc.h +lufs_o_SOURCES=proc.c inode.c dir.c file.c symlink.c +lufs_o_LDADD= + +install-data-hook: + depmod -aq + if [ "`lsmod | grep lufs`" ]; then rmmod lufs; fi + modprobe lufs diff --git a/kernel/Linux/2.4/Makefile.in b/kernel/Linux/2.4/Makefile.in new file mode 100644 index 0000000..b00bf5d --- /dev/null +++ b/kernel/Linux/2.4/Makefile.in @@ -0,0 +1,480 @@ +# Makefile.in generated by automake 1.7.5 from Makefile.am. +# @configure_input@ + +# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003 +# Free Software Foundation, Inc. +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ + +srcdir = @srcdir@ +top_srcdir = @top_srcdir@ +VPATH = @srcdir@ +pkgdatadir = $(datadir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +top_builddir = ../../.. + +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +INSTALL = @INSTALL@ +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = @build@ +host_triplet = @host@ +target_triplet = @target@ +ACLOCAL = @ACLOCAL@ +AMDEP_FALSE = @AMDEP_FALSE@ +AMDEP_TRUE = @AMDEP_TRUE@ +AMTAR = @AMTAR@ +AUTOCONF = @AUTOCONF@ +AUTOFS_INSTALL = @AUTOFS_INSTALL@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ + +CFLAGS = @MODV_FLAGS@ @KDEBUG_FLAGS@ -O2 -pipe -fomit-frame-pointer -fno-strict-aliasing -mpreferred-stack-boundary=2 -Wall -D__KERNEL__ -DMODULE -DLINUX +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CXX = @CXX@ +CXXDEPMODE = @CXXDEPMODE@ +CXXFLAGS = @CXXFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DEBUG_FLAGS = @DEBUG_FLAGS@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +ECHO = @ECHO@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +EXEEXT = @EXEEXT@ +GCONF = @GCONF@ +GVFSCONF = @GVFSCONF@ +GVFS_CFLAGS = @GVFS_CFLAGS@ +GVFS_LDADD = @GVFS_LDADD@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +KDEBUG_FLAGS = @KDEBUG_FLAGS@ +KERNEL_DIR = @KERNEL_DIR@ +KERNEL_HDR = @KERNEL_HDR@ +LDFLAGS = -r +LIBCHIPCARD_INCLUDES = @LIBCHIPCARD_INCLUDES@ +LIBCHIPCARD_LIB = @LIBCHIPCARD_LIB@ +LIBOBJS = @LIBOBJS@ + +LIBS = +LIBTOOL = @LIBTOOL@ +LN_S = @LN_S@ +LTLIBOBJS = @LTLIBOBJS@ +LUFS_SUID = @LUFS_SUID@ +MAKEINFO = @MAKEINFO@ +MODULES_DIR = @MODULES_DIR@ +MODV_FLAGS = @MODV_FLAGS@ +OBJEXT = @OBJEXT@ +OS_DIR = @OS_DIR@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +RANLIB = @RANLIB@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +SSHPROG = @SSHPROG@ +STRIP = @STRIP@ +VERSION = @VERSION@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_CXX = @ac_ct_CXX@ +ac_ct_RANLIB = @ac_ct_RANLIB@ +ac_ct_STRIP = @ac_ct_STRIP@ +all_includes = @all_includes@ +all_libraries = @all_libraries@ +am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ +am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ +am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@ +am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +datadir = @datadir@ +define_has_libchipcard = @define_has_libchipcard@ +exec_prefix = @exec_prefix@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localstatedir = @localstatedir@ +mandir = @mandir@ +oldincludedir = @oldincludedir@ +opt_fs = @opt_fs@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +sysconfdir = @sysconfdir@ +target = @target@ +target_alias = @target_alias@ +target_cpu = @target_cpu@ +target_os = @target_os@ +target_vendor = @target_vendor@ +INCLUDES = -I@KERNEL_HDR@ @all_includes@ + +moduledir = @MODULES_DIR@/kernel/fs/lufs + +module_PROGRAMS = lufs.o + +noinst_HEADERS = lufs.h proc.h +lufs_o_SOURCES = proc.c inode.c dir.c file.c symlink.c +lufs_o_LDADD = +subdir = kernel/Linux/2.4 +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +mkinstalldirs = $(SHELL) $(top_srcdir)/config/mkinstalldirs +CONFIG_HEADER = $(top_builddir)/config.h +CONFIG_CLEAN_FILES = +module_PROGRAMS = lufs.o$(EXEEXT) +PROGRAMS = $(module_PROGRAMS) + +am_lufs_o_OBJECTS = proc.$(OBJEXT) inode.$(OBJEXT) dir.$(OBJEXT) \ + file.$(OBJEXT) symlink.$(OBJEXT) +lufs_o_OBJECTS = $(am_lufs_o_OBJECTS) +lufs_o_DEPENDENCIES = +lufs_o_LDFLAGS = + +DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir) +depcomp = $(SHELL) $(top_srcdir)/config/depcomp +am__depfiles_maybe = depfiles +@AMDEP_TRUE@DEP_FILES = ./$(DEPDIR)/dir.Po ./$(DEPDIR)/file.Po \ +@AMDEP_TRUE@ ./$(DEPDIR)/inode.Po ./$(DEPDIR)/proc.Po \ +@AMDEP_TRUE@ ./$(DEPDIR)/symlink.Po +COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ + $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +LTCOMPILE = $(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) \ + $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +CCLD = $(CC) +LINK = $(LIBTOOL) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ + $(AM_LDFLAGS) $(LDFLAGS) -o $@ +DIST_SOURCES = $(lufs_o_SOURCES) +HEADERS = $(noinst_HEADERS) + +DIST_COMMON = $(noinst_HEADERS) Makefile.am Makefile.in +SOURCES = $(lufs_o_SOURCES) + +all: all-am + +.SUFFIXES: +.SUFFIXES: .c .lo .o .obj +$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4) + cd $(top_srcdir) && \ + $(AUTOMAKE) --gnu kernel/Linux/2.4/Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe) +modulePROGRAMS_INSTALL = $(INSTALL_PROGRAM) +install-modulePROGRAMS: $(module_PROGRAMS) + @$(NORMAL_INSTALL) + $(mkinstalldirs) $(DESTDIR)$(moduledir) + @list='$(module_PROGRAMS)'; for p in $$list; do \ + p1=`echo $$p|sed 's/$(EXEEXT)$$//'`; \ + if test -f $$p \ + || test -f $$p1 \ + ; then \ + f=`echo "$$p1" | sed 's,^.*/,,;$(transform);s/$$/$(EXEEXT)/'`; \ + echo " $(INSTALL_PROGRAM_ENV) $(LIBTOOL) --mode=install $(modulePROGRAMS_INSTALL) $$p $(DESTDIR)$(moduledir)/$$f"; \ + $(INSTALL_PROGRAM_ENV) $(LIBTOOL) --mode=install $(modulePROGRAMS_INSTALL) $$p $(DESTDIR)$(moduledir)/$$f || exit 1; \ + else :; fi; \ + done + +uninstall-modulePROGRAMS: + @$(NORMAL_UNINSTALL) + @list='$(module_PROGRAMS)'; for p in $$list; do \ + f=`echo "$$p" | sed 's,^.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/'`; \ + echo " rm -f $(DESTDIR)$(moduledir)/$$f"; \ + rm -f $(DESTDIR)$(moduledir)/$$f; \ + done + +clean-modulePROGRAMS: + @list='$(module_PROGRAMS)'; for p in $$list; do \ + f=`echo $$p|sed 's/$(EXEEXT)$$//'`; \ + echo " rm -f $$p $$f"; \ + rm -f $$p $$f ; \ + done +lufs.o$(EXEEXT): $(lufs_o_OBJECTS) $(lufs_o_DEPENDENCIES) + @rm -f lufs.o$(EXEEXT) + $(LINK) $(lufs_o_LDFLAGS) $(lufs_o_OBJECTS) $(lufs_o_LDADD) $(LIBS) + +mostlyclean-compile: + -rm -f *.$(OBJEXT) core *.core + +distclean-compile: + -rm -f *.tab.c + +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dir.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/file.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/inode.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/proc.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/symlink.Po@am__quote@ + +distclean-depend: + -rm -rf ./$(DEPDIR) + +.c.o: +@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" \ +@am__fastdepCC_TRUE@ -c -o $@ `test -f '$<' || echo '$(srcdir)/'`$<; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; \ +@am__fastdepCC_TRUE@ else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; \ +@am__fastdepCC_TRUE@ fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(COMPILE) -c `test -f '$<' || echo '$(srcdir)/'`$< + +.c.obj: +@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" \ +@am__fastdepCC_TRUE@ -c -o $@ `if test -f '$<'; then $(CYGPATH_W) '$<'; else $(CYGPATH_W) '$(srcdir)/$<'; fi`; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; \ +@am__fastdepCC_TRUE@ else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; \ +@am__fastdepCC_TRUE@ fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(COMPILE) -c `if test -f '$<'; then $(CYGPATH_W) '$<'; else $(CYGPATH_W) '$(srcdir)/$<'; fi` + +.c.lo: +@am__fastdepCC_TRUE@ if $(LTCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" \ +@am__fastdepCC_TRUE@ -c -o $@ `test -f '$<' || echo '$(srcdir)/'`$<; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Plo"; \ +@am__fastdepCC_TRUE@ else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; \ +@am__fastdepCC_TRUE@ fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/$*.Plo' tmpdepfile='$(DEPDIR)/$*.TPlo' @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ `test -f '$<' || echo '$(srcdir)/'`$< + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs + +distclean-libtool: + -rm -f libtool +uninstall-info-am: + +ETAGS = etags +ETAGSFLAGS = + +CTAGS = ctags +CTAGSFLAGS = + +tags: TAGS + +ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + mkid -fID $$unique + +TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + tags=; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + test -z "$(ETAGS_ARGS)$$tags$$unique" \ + || $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$tags $$unique + +ctags: CTAGS +CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + tags=; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + test -z "$(CTAGS_ARGS)$$tags$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$tags $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && cd $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) $$here + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) + +top_distdir = ../../.. +distdir = $(top_distdir)/$(PACKAGE)-$(VERSION) + +distdir: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \ + list='$(DISTFILES)'; for file in $$list; do \ + case $$file in \ + $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ + $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ + esac; \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test "$$dir" != "$$file" && test "$$dir" != "."; then \ + dir="/$$dir"; \ + $(mkinstalldirs) "$(distdir)$$dir"; \ + else \ + dir=''; \ + fi; \ + if test -d $$d/$$file; then \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ + fi; \ + cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ + else \ + test -f $(distdir)/$$file \ + || cp -p $$d/$$file $(distdir)/$$file \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-am +all-am: Makefile $(PROGRAMS) $(HEADERS) + +installdirs: + $(mkinstalldirs) $(DESTDIR)$(moduledir) +install: install-am +install-exec: install-exec-am +install-data: install-data-am +uninstall: uninstall-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-am +install-strip: + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + INSTALL_STRIP_FLAG=-s \ + `test -z '$(STRIP)' || \ + echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -rm -f Makefile $(CONFIG_CLEAN_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +clean: clean-am + +clean-am: clean-generic clean-libtool clean-modulePROGRAMS \ + mostlyclean-am + +distclean: distclean-am + +distclean-am: clean-am distclean-compile distclean-depend \ + distclean-generic distclean-libtool distclean-tags + +dvi: dvi-am + +dvi-am: + +info: info-am + +info-am: + +install-data-am: install-modulePROGRAMS + @$(NORMAL_INSTALL) + $(MAKE) $(AM_MAKEFLAGS) install-data-hook + +install-exec-am: + +install-info: install-info-am + +install-man: + +installcheck-am: + +maintainer-clean: maintainer-clean-am + +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-compile mostlyclean-generic \ + mostlyclean-libtool + +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + +uninstall-am: uninstall-info-am uninstall-modulePROGRAMS + +.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ + clean-libtool clean-modulePROGRAMS ctags distclean \ + distclean-compile distclean-depend distclean-generic \ + distclean-libtool distclean-tags distdir dvi dvi-am info \ + info-am install install-am install-data install-data-am \ + install-exec install-exec-am install-info install-info-am \ + install-man install-modulePROGRAMS install-strip installcheck \ + installcheck-am installdirs maintainer-clean \ + maintainer-clean-generic mostlyclean mostlyclean-compile \ + mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ + tags uninstall uninstall-am uninstall-info-am \ + uninstall-modulePROGRAMS + + +install-data-hook: + depmod -aq + if [ "`lsmod | grep lufs`" ]; then rmmod lufs; fi + modprobe lufs +# 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/kernel/Linux/2.4/dir.c b/kernel/Linux/2.4/dir.c new file mode 100644 index 0000000..3de1437 --- /dev/null +++ b/kernel/Linux/2.4/dir.c @@ -0,0 +1,579 @@ +/* + * dir.c + * Copyright (C) 2002 Florin Malita + * + * This file is part of LUFS, a free userspace filesystem implementation. + * See http://lufs.sourceforge.net/ for updates. + * + * LUFS 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. + * + * LUFS 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 "lufs.h" +#include "proc.h" + + +extern struct inode* lu_iget(struct super_block*, struct lufs_fattr*); +extern int lufs_notify_change(struct dentry*, struct iattr*); + +static int lu_readdir(struct file*, void*, filldir_t); + +static struct dentry *lu_lookup(struct inode*, struct dentry*); +static int lu_mkdir(struct inode*, struct dentry*, int); +static int lu_create(struct inode*, struct dentry*, int); +static int lu_rmdir(struct inode*, struct dentry*); +static int lu_rename(struct inode*, struct dentry*, struct inode*, struct dentry*); +static int lu_unlink(struct inode*, struct dentry*); +static int lu_link(struct dentry*, struct inode*, struct dentry*); +static int lu_symlink(struct inode*, struct dentry*, const char*); + +struct file_operations lu_dir_operations = { + read: generic_read_dir, + readdir: lu_readdir, +}; + +struct inode_operations lu_dir_inode_operations = { + create: lu_create, + lookup: lu_lookup, + link: lu_link, + unlink: lu_unlink, + symlink: lu_symlink, + mkdir: lu_mkdir, + rmdir: lu_rmdir, + rename: lu_rename, + setattr: lufs_notify_change, +}; + +static int lu_lookup_validate(struct dentry *dentry, int flags) +{ + struct inode *inode = dentry->d_inode; + unsigned long age = jiffies - dentry->d_time; + int res; + + TRACE("in\n"); + + res = (age <= LU_MAXAGE); + TRACE("age: %lu, valid: %d\n", age, res); + + if(!res) + res = (lu_revalidate_inode(dentry) == 0); + + + if(inode){ + lock_kernel(); + + if(is_bad_inode(inode)) + res = 0; + unlock_kernel(); + }else + TRACE("no inode?!\n"); + + TRACE("out(res=%d)\n", res); + + return res; +} + +static int lu_delete_dentry(struct dentry *dentry) +{ + int res = 0; + + TRACE("in\n"); + if(dentry->d_inode && is_bad_inode(dentry->d_inode)) + res = 1; + + TRACE("out\n"); + return res; +} + +struct dentry_operations lufs_dentry_operations = { + d_revalidate: lu_lookup_validate, + d_delete: lu_delete_dentry, +}; + +static int lu_readdir(struct file *f, void *dirent, filldir_t filldir) +{ + int res = -1; + char *c; + struct qstr qname; + unsigned long ino; + struct iovec siov[2], riov; + struct server_slot *slot; + unsigned short offset; + + TRACE("in\n"); + + if((slot = lu_getslot(GET_INFO(f->f_dentry->d_sb))) == NULL) + return -ERESTARTSYS; + + if(lu_getname(f->f_dentry, slot->s_buf, LU_MAXDATA) < 0){ + WARN("lu_getname failed!\n"); + goto out; + } + + TRACE("reading %s, offset %u...\n", slot->s_buf, (unsigned)f->f_pos); + res = 0; + + switch((unsigned int)f->f_pos){ + + case 0: + if(filldir(dirent, ".", 1, 0, f->f_dentry->d_inode->i_ino, DT_DIR) < 0) + goto out; + f->f_pos++; + + case 1: + if(filldir(dirent, "..", 2, 1, f->f_dentry->d_parent->d_inode->i_ino, DT_DIR) < 0) + goto out; + f->f_pos++; + + default: + offset = f->f_pos; + siov[0].iov_base = &offset; + siov[0].iov_len = sizeof(unsigned short); + siov[1].iov_base = slot->s_buf; + siov[1].iov_len = strlen(slot->s_buf) + 1; + riov.iov_base = slot->s_buf; + riov.iov_len = LU_MAXDATA; + + if((res = lu_execute(GET_INFO(f->f_dentry->d_inode->i_sb), slot, PTYPE_READDIR, siov, 2, &riov, 1)) < 0){ + WARN("could not read directory content!\n"); + if(res == -ERESTARTSYS) + res = -EINTR; + goto out; + } + if(PIS_ERROR(res)){ + WARN("server failure!\n"); + res = PERROR(res); + goto out; + } + for(qname.name = slot->s_buf, c = strchr(slot->s_buf, '\n'); c != NULL; qname.name = c+1, c = strchr(c+1, '\n')){ + *c = 0; + TRACE("direntry: %s.\n", qname.name); + qname.len = strlen(qname.name); + if((ino = find_inode_number(f->f_dentry, &qname)) == 0) + ino = iunique(f->f_dentry->d_sb, 2); + if(filldir(dirent, qname.name, qname.len, f->f_pos, ino, DT_UNKNOWN) < 0) + break; + f->f_pos++; + } + } + + TRACE("out\n"); + out: + lu_putslot(slot); + return res; +} + +static struct dentry* lu_lookup(struct inode *dir, struct dentry *dentry) +{ + int res; + struct lufs_fattr fattr; + struct iovec siov, riov; + struct inode *inode; + struct server_slot *slot; + + TRACE("in\n"); + + if((slot = lu_getslot(GET_INFO(dir->i_sb))) == NULL) + return ERR_PTR(-ERESTARTSYS); + + if((res = lu_getname(dentry, slot->s_buf, LU_MAXDATA)) < 0){ + WARN("lu_getname failed!\n"); + goto out; + } + + TRACE("looking up %s\n", slot->s_buf); + + siov.iov_base = slot->s_buf; + siov.iov_len = strlen(slot->s_buf) + 1; + riov.iov_base = &fattr; + riov.iov_len = sizeof(struct lufs_fattr); + + if((res = lu_execute(GET_INFO(dir->i_sb), slot, PTYPE_STAT, &siov, 1, &riov, 1)) < 0) + goto out; + + if(PIS_ERROR(res)){ + TRACE("File not found...\n"); + dentry->d_op = &lufs_dentry_operations; + dentry->d_time = jiffies; + d_add(dentry, NULL); + lu_putslot(slot); + return NULL; + } + + lu_fixattrs(GET_INFO(dir->i_sb), &fattr); + + if(dentry == dentry->d_parent) + fattr.f_ino = 2; + else + fattr.f_ino = iunique(dentry->d_sb, 2); + + if((inode = lu_iget(dir->i_sb, &fattr))){ + dentry->d_op = &lufs_dentry_operations; + dentry->d_time = jiffies; + d_add(dentry, inode); + } + res = 0; + + out: + lu_putslot(slot); + + TRACE("out\n"); + return ERR_PTR(res); +} + +static int lu_instantiate(struct dentry *dentry, char *name, struct server_slot *slot) +{ + int res; + struct lufs_fattr fattr; + struct iovec siov, riov; + struct inode *inode; + + TRACE("in\n"); + + TRACE("instantiating %s\n", name); + + siov.iov_base = name; + siov.iov_len = strlen(name) + 1; + riov.iov_base = &fattr; + riov.iov_len = sizeof(struct lufs_fattr); + + if((res = lu_execute(GET_INFO(dentry->d_sb), slot, PTYPE_STAT, &siov, 1, &riov, 1)) < 0) + goto out; + + if(PIS_ERROR(res)){ + TRACE("File not found...\n"); + res = PERROR(res); + goto out; + } + + lu_fixattrs(GET_INFO(dentry->d_sb), &fattr); + + fattr.f_ino = iunique(dentry->d_sb, 2); + inode = lu_iget(dentry->d_sb, &fattr); + + if(!inode){ + res = -EACCES; + goto out; + } + + d_instantiate(dentry, inode); + res = 0; + + out: + TRACE("out\n"); + return res; +} + +static int lu_mkdir(struct inode *dir, struct dentry *dentry, int mode) +{ + int res; + struct server_slot *slot; + struct iovec iov[2]; + + TRACE("in\n"); + + if((slot = lu_getslot(GET_INFO(dentry->d_sb))) == NULL) + return -ERESTARTSYS; + + if((res = lu_getname(dentry, slot->s_buf, LU_MAXDATA)) < 0){ + WARN("lu_getname failed!\n"); + goto out; + } + + iov[0].iov_base = &mode; + iov[0].iov_len = sizeof(mode); + iov[1].iov_base = slot->s_buf; + iov[1].iov_len = strlen(slot->s_buf) + 1; + + if((res = lu_execute(GET_INFO(dentry->d_sb), slot, PTYPE_MKDIR, iov, 2, NULL, 0)) < 0) + goto out; + + if(PIS_ERROR(res)){ + TRACE("Could not create directory.\n"); + res = PERROR(res); + goto out; + } + + res = lu_instantiate(dentry, slot->s_buf, slot); + + out: + lu_putslot(slot); + + TRACE("out\n"); + return res; +} + +static int lu_create(struct inode *dir, struct dentry *dentry, int mode) +{ + int res; + struct server_slot *slot; + struct iovec iov[2]; + + TRACE("in\n"); + + if((slot = lu_getslot(GET_INFO(dentry->d_sb))) == NULL) + return -ERESTARTSYS; + + if((res = lu_getname(dentry, slot->s_buf, LU_MAXDATA)) < 0){ + WARN("lu_getname failed!\n"); + goto out; + } + + iov[0].iov_base = &mode; + iov[0].iov_len = sizeof(mode); + iov[1].iov_base = slot->s_buf; + iov[1].iov_len = strlen(slot->s_buf) + 1; + + if((res = lu_execute(GET_INFO(dentry->d_sb), slot, PTYPE_CREATE, iov, 2, NULL, 0)) < 0) + goto out; + + if(PIS_ERROR(res)){ + TRACE("Could not create file.\n"); + res = PERROR(res); + goto out; + } + + res = lu_instantiate(dentry, slot->s_buf, slot); + + out: + lu_putslot(slot); + + TRACE("out\n"); + return res; +} + +static int lu_rmdir(struct inode *dir, struct dentry *dentry) +{ + int res; + struct server_slot *slot; + struct iovec iov; + + if(!d_unhashed(dentry)) + return -EBUSY; + + TRACE("in\n"); + + if((slot = lu_getslot(GET_INFO(dentry->d_sb))) == NULL) + return -ERESTARTSYS; + + if((res = lu_getname(dentry, slot->s_buf, LU_MAXDATA)) < 0){ + WARN("lu_getname failed!"); + goto out; + } + + iov.iov_base = slot->s_buf; + iov.iov_len = strlen(slot->s_buf) + 1; + + if((res = lu_execute(GET_INFO(dentry->d_sb), slot, PTYPE_RMDIR, &iov, 1, NULL, 0)) < 0) + goto out; + + if(PIS_ERROR(res)){ + TRACE("rmdir failed!\n"); + res = PERROR(res); + goto out; + } + res = 0; + + out: + lu_putslot(slot); + + TRACE("out\n"); + return res; +} + +static int lu_rename(struct inode *old_dir, struct dentry *old_dentry, struct inode *new_dir, struct dentry *new_dentry) +{ + struct server_slot *slot; + int res; + struct iovec iov[2]; + + TRACE("in\n"); + + if((slot = lu_getslot(GET_INFO(old_dentry->d_sb))) == NULL) + return -ERESTARTSYS; + + if((res = lu_getname(old_dentry, slot->s_buf, LU_MAXPATHLEN)) < 0 || + (res = lu_getname(new_dentry, &(slot->s_buf[LU_MAXPATHLEN]), LU_MAXPATHLEN)) < 0){ + WARN("lu_getname failed!\n"); + goto out; + } + + iov[0].iov_base = slot->s_buf; + iov[0].iov_len = strlen(slot->s_buf) + 1; + iov[1].iov_base = &(slot->s_buf[LU_MAXPATHLEN]); + iov[1].iov_len = strlen(&(slot->s_buf[LU_MAXPATHLEN])) + 1; + + if((res = lu_execute(GET_INFO(old_dentry->d_sb), slot, PTYPE_RENAME, iov, 2, NULL, 0)) < 0) + goto out; + + if(PIS_ERROR(res)){ + TRACE("rename failed!\n"); + res = PERROR(res); + goto out; + } + res = 0; + + out: + lu_putslot(slot); + + TRACE("out\n"); + return res; +} + +static int lu_unlink(struct inode *dir, struct dentry *dentry) +{ + int res; + struct server_slot *slot; + struct iovec iov; + + TRACE("in\n"); + + if((slot = lu_getslot(GET_INFO(dentry->d_sb))) == NULL) + return -ERESTARTSYS; + + if((res = lu_getname(dentry, slot->s_buf, LU_MAXPATHLEN)) < 0){ + WARN("lu_getname failed!"); + goto out; + } + + iov.iov_base = slot->s_buf; + iov.iov_len = strlen(slot->s_buf) + 1; + + if((res = lu_execute(GET_INFO(dentry->d_sb), slot, PTYPE_UNLINK, &iov, 1, NULL, 0)) < 0) + goto out; + + if(PIS_ERROR(res)){ + TRACE("unlink failed!\n"); + res = PERROR(res); + goto out; + } + res = 0; + + out: + lu_putslot(slot); + + TRACE("out\n"); + return res; +} + + +static int lu_link(struct dentry *old_dentry, struct inode *dir, struct dentry *dentry) +{ + int res; + struct server_slot *slot; + struct iovec iov[2]; + + TRACE("in\n"); + + if(S_ISDIR(old_dentry->d_inode->i_mode)) + return -EPERM; + + if(!(slot = lu_getslot(GET_INFO(old_dentry->d_sb)))) + return -ERESTARTSYS; + + if((res = lu_getname(old_dentry, slot->s_buf, LU_MAXPATHLEN)) < 0){ + WARN("lu_getname failed!\n"); + goto out; + } + + if((res = lu_getname(dentry, &slot->s_buf[LU_MAXPATHLEN], LU_MAXPATHLEN)) < 0){ + WARN("lu_getname failed!\n"); + goto out; + } + + iov[0].iov_base = slot->s_buf; + iov[0].iov_len = strlen(slot->s_buf) + 1; + iov[1].iov_base = &slot->s_buf[LU_MAXPATHLEN]; + iov[1].iov_len = strlen(&slot->s_buf[LU_MAXPATHLEN]) + 1; + + d_drop(dentry); + + if((res = lu_execute(GET_INFO(old_dentry->d_sb), slot, PTYPE_LINK, iov, 2, NULL, 0)) < 0) + goto out; + + if(PIS_ERROR(res)){ + TRACE("link failed!\n"); + res = PERROR(res); + goto out; + } + + res = 0; + + out: + lu_putslot(slot); + TRACE("out\n"); + return res; +} + +static int lu_symlink(struct inode *dir, struct dentry *dentry, const char *symname) +{ + int res; + struct server_slot *slot; + struct iovec iov[2]; + + TRACE("in\n"); + TRACE("symlink: %s\n", symname); + + if(strlen(symname) > LU_MAXPATHLEN - 1) + return -ENAMETOOLONG; + + if(!(slot = lu_getslot(GET_INFO(dentry->d_sb)))) + return -ERESTARTSYS; + + if((res = lu_getname(dentry, slot->s_buf, LU_MAXPATHLEN)) < 0){ + WARN("lu_getname failed!\n"); + goto out; + } + + TRACE("fname: %s\n", slot->s_buf); + + strcpy(&slot->s_buf[LU_MAXPATHLEN], symname); + + iov[0].iov_base = slot->s_buf; + iov[0].iov_len = strlen(slot->s_buf) + 1; + iov[1].iov_base = &slot->s_buf[LU_MAXPATHLEN]; + iov[1].iov_len = strlen(&slot->s_buf[LU_MAXPATHLEN]) + 1; + + d_drop(dentry); + + if((res = lu_execute(GET_INFO(dentry->d_sb), slot, PTYPE_SYMLINK, iov, 2, NULL, 0)) < 0) + goto out; + + if(PIS_ERROR(res)){ + TRACE("symlink failed!\n"); + res = PERROR(res); + goto out; + } + + res = 0; + + out: + lu_putslot(slot); + TRACE("out\n"); + return res; +} + + + diff --git a/kernel/Linux/2.4/file.c b/kernel/Linux/2.4/file.c new file mode 100644 index 0000000..491196b --- /dev/null +++ b/kernel/Linux/2.4/file.c @@ -0,0 +1,338 @@ +/* + * file.c + * Copyright (C) 2002 Florin Malita + * + * This file is part of LUFS, a free userspace filesystem implementation. + * See http://lufs.sourceforge.net/ for updates. + * + * LUFS 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. + * + * LUFS 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 "lufs.h" +#include "proc.h" + +extern int lufs_notify_change(struct dentry*, struct iattr*); +extern int lu_revalidate_inode(struct dentry*); + +static int lu_file_open(struct inode *inode, struct file *file) +{ + int res, gres; + struct server_slot *slot; + struct iovec iov[2]; + unsigned flags; + + TRACE("in\n"); + + if((gres = generic_file_open(inode, file)) < 0) + return gres; + + TRACE("f_mode: %u, i_mode: %u\n", file->f_mode, inode->i_mode); + TRACE("f_flags: %u, i_flags: %u\n", file->f_flags, inode->i_flags); + + if((slot = lu_getslot(GET_INFO(file->f_dentry->d_sb))) == NULL) + return gres; + + if((res = lu_getname(file->f_dentry, slot->s_buf, LU_MAXDATA)) < 0){ + WARN("lu_getname failed!\n"); + goto out; + } + + flags = file->f_flags & O_ACCMODE; + iov[0].iov_base = &flags; + iov[0].iov_len = sizeof(flags); + iov[1].iov_base = slot->s_buf; + iov[1].iov_len = strlen(slot->s_buf) + 1; + + lu_execute(GET_INFO(file->f_dentry->d_sb), slot, PTYPE_OPEN, iov, 2, NULL, 0); + +out: + lu_putslot(slot); + + TRACE("out\n"); + return gres; +} + +static int lu_file_release(struct inode *inode, struct file *file) +{ + int res; + struct server_slot *slot; + struct iovec iov; + + TRACE("in\n"); + + if((slot = lu_getslot(GET_INFO(file->f_dentry->d_sb))) == NULL) + return -ERESTARTSYS; + + if((res = lu_getname(file->f_dentry, slot->s_buf, LU_MAXPATHLEN)) < 0){ + WARN("lu_getname failed!\n"); + goto out; + } + + iov.iov_base = slot->s_buf; + iov.iov_len = strlen(slot->s_buf) + 1; + + if((res = lu_execute(GET_INFO(file->f_dentry->d_sb), slot, PTYPE_RELEASE, &iov, 1, NULL, 0)) < 0) + goto out; + + if(PIS_ERROR(res)){ + TRACE("release failed\n"); + res = PERROR(res); + goto out; + } + + res = 0; + +out: + lu_putslot(slot); + + TRACE("out\n"); + return res; +} + +static int lu_file_read(struct file *filp, char *buf, size_t count, loff_t *ppos) +{ + struct dentry *dentry = filp->f_dentry; + int res; + + TRACE("in\n"); + + if(!(res = lu_revalidate_inode(dentry))) + res = generic_file_read(filp, buf, count, ppos); + + TRACE("out\n"); + + return res; +} + +static int lu_file_readpage(struct file *f, struct page *p) +{ + int res; + struct iovec siov[3], riov; + long long offset; + unsigned long count; + struct server_slot *slot; + + TRACE("in\n"); + + if((slot = lu_getslot(GET_INFO(f->f_dentry->d_sb))) == NULL) + return -ERESTARTSYS; + + get_page(p); + + if((res = lu_getname(f->f_dentry, slot->s_buf, LU_MAXDATA)) < 0){ + WARN("lu_getname failed!\n"); + goto out; + } + + offset = p->index << PAGE_CACHE_SHIFT; + count = PAGE_SIZE; + + siov[0].iov_base = &offset; + siov[0].iov_len = sizeof(offset); + siov[1].iov_base = &count; + siov[1].iov_len = sizeof(count); + siov[2].iov_base = slot->s_buf; + siov[2].iov_len = strlen(slot->s_buf) + 1; + + riov.iov_base = page_address(p); + riov.iov_len = count; + + if((res = lu_execute(GET_INFO(f->f_dentry->d_sb), slot, PTYPE_READ, siov, 3, &riov, 1)) < 0) + goto out; + + if(PIS_ERROR(res)){ + TRACE("read failed\n"); + res = PERROR(res); + goto out; + } + + flush_dcache_page(p); + SetPageUptodate(p); + res = 0; + + out: + lu_putslot(slot); + UnlockPage(p); + put_page(p); + + TRACE("out\n"); + return res; +} + +static int lu_file_writepage(struct page *p) +{ + TRACE("in\n"); + + TRACE("out\n"); + return -1; +} + +static int lu_file_preparewrite(struct file *f, struct page *p, unsigned offset, unsigned to) +{ + TRACE("in\n"); + + TRACE("out\n"); + + return 0; +} + +static int lu_file_commitwrite(struct file *f, struct page *p, unsigned offset, unsigned to) +{ + int res; + struct server_slot *slot; + struct iovec iov[4]; + char *buf; + long long off; + unsigned long cnt; + + TRACE("in\n"); + + if((slot = lu_getslot(GET_INFO(f->f_dentry->d_sb))) == NULL) + return -ERESTARTSYS; + + if((res = lu_getname(f->f_dentry, slot->s_buf, LU_MAXDATA)) < 0){ + WARN("lu_getname failed!\n"); + goto out2; + } + + lock_kernel(); + + buf = kmap(p) + offset; + cnt = to - offset; + off = offset + (((long long)p->index) << PAGE_CACHE_SHIFT); + + iov[0].iov_base = &off; + iov[0].iov_len = sizeof(off); + iov[1].iov_base = &cnt; + iov[1].iov_len = sizeof(cnt); + iov[2].iov_base = slot->s_buf; + iov[2].iov_len = strlen(slot->s_buf) + 1; + iov[3].iov_base = buf; + iov[3].iov_len = cnt; + + TRACE("write %s, offset %Ld, count %d\n", slot->s_buf, off, (int)cnt); + + if((res = lu_execute(GET_INFO(f->f_dentry->d_sb), slot, PTYPE_WRITE, iov, 4, NULL, 0)) < 0) + goto out1; + + + if(PIS_ERROR(res)){ + TRACE("write failed\n"); + res = PERROR(res); + goto out1; + } + + f->f_dentry->d_inode->i_mtime = f->f_dentry->d_inode->i_atime = CURRENT_TIME; + if(off + cnt > f->f_dentry->d_inode->i_size) + f->f_dentry->d_inode->i_size = off + cnt; + + res = cnt; + + out1: + kunmap(p); + unlock_kernel(); + out2: + lu_putslot(slot); + TRACE("out\n"); + return res; +} + +static int lu_file_mmap(struct file *filp, struct vm_area_struct *vma) +{ + struct dentry *dentry = filp->f_dentry; + int res; + + TRACE("in\n"); + + if(!(res = lu_revalidate_inode(dentry))) + res = generic_file_mmap(filp, vma); + + TRACE("out\n"); + + return res; +} + +static ssize_t lu_file_write(struct file *filp, const char *buf, size_t count, loff_t *ppos) +{ + struct dentry *dentry = filp->f_dentry; + ssize_t res; + + TRACE("in\n"); + + if(!(res = lu_revalidate_inode(dentry)) && (count > 0)) + res = generic_file_write(filp, buf, count, ppos); + + TRACE("out\n"); + + return res; +} + +/* + * Without this function, fsync() returns EINVAL indicating that the + * file is special (eg pipe or socket) and does not support + * synchronization. + * + * This causes, for example, Emacs to report "Writing file: Invalid + * argument, " when saving a file to a lufs file system. + * + * The opengroup spec states "It is explicitly intended that a null + * implementation is permitted." This is therefore a quick but valid + * hack to avoid this problem. + * + * See http://www.moses.uklinux.net/patches/lki-3.html#ss3.4 + * http://www.opengroup.org/onlinepubs/007904975/functions/fsync.html + * + * James Marsh 22-Apr-2003 + */ +static int lu_file_fsync(struct file *filp, struct dentry *dentryp, int datasync) +{ + return 0; +} + +struct file_operations lu_file_operations = { + llseek: generic_file_llseek, + read: lu_file_read, + write: lu_file_write, + mmap: lu_file_mmap, + open: lu_file_open, + release: lu_file_release, + fsync: lu_file_fsync +}; + +struct inode_operations lu_file_inode_operations = { + revalidate: lu_revalidate_inode, + setattr: lufs_notify_change, +}; + +struct address_space_operations lu_file_aops = { + readpage: lu_file_readpage, + writepage: lu_file_writepage, + prepare_write: lu_file_preparewrite, + commit_write: lu_file_commitwrite, +}; + + + diff --git a/kernel/Linux/2.4/inode.c b/kernel/Linux/2.4/inode.c new file mode 100644 index 0000000..ce8e165 --- /dev/null +++ b/kernel/Linux/2.4/inode.c @@ -0,0 +1,519 @@ +/* + * inode.c + * Copyright (C) 2002 Florin Malita + * + * This file is part of LUFS, a free userspace filesystem implementation. + * See http://lufs.sourceforge.net/ for updates. + * + * LUFS 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. + * + * LUFS 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 "lufs.h" +#include "proc.h" + +MODULE_AUTHOR("Florin Malita "); +MODULE_DESCRIPTION("Linux Userland Filesystem"); +#ifdef MODULE_LICENSE +MODULE_LICENSE("GPL"); +#endif + +extern struct file_operations lu_dir_operations, lu_file_operations; +extern struct inode_operations lu_dir_inode_operations, lu_file_inode_operations, lu_symlink_inode_operations; +extern struct address_space_operations lu_file_aops; +extern struct dentry_operations lufs_dentry_operations; + +static void lu_delete_inode(struct inode*); +static void lu_put_super(struct super_block*); +static int lu_statfs(struct super_block*, struct statfs*); + +static struct super_operations lu_sops = { + put_inode: force_delete, + delete_inode: lu_delete_inode, + put_super: lu_put_super, + statfs: lu_statfs, +}; + +static void parse_options(struct lufs_sb_info *server, char *opts) +{ + char *p, *q; + int len, i; + + if(!opts) + return; + + len = strlen(opts); + + for(p = strtok(opts, ","); p; p = strtok(NULL, ",")){ + if(strncmp(p, "server_socket=", 14) == 0){ + if(strlen(p+14) > UNIX_PATH_MAX) + goto ugly_opts; + strcpy(server->server_socket, p+14); + TRACE("server_socket: %s\n", server->server_socket); + }else + if(strncmp(p, "uid=", 4) == 0){ + if(current->uid) + ERROR("only root can use uid option!\n"); + else{ + if(strlen(p+4) > 5) + goto ugly_opts; + q = p + 4; + server->config.uid = simple_strtoul(q, &q, 0); + TRACE("uid: %d\n", server->config.uid); + } + }else + if(strncmp(p, "gid=", 4) == 0){ + if(current->uid) + ERROR("only root can use gid option!\n"); + else{ + if(strlen(p+4) > 5) + goto ugly_opts; + q = p + 4; + server->config.gid = simple_strtoul(q, &q, 0); + TRACE("gid: %d\n", server->config.gid); + } + }else + if(strncmp(p, "fmask=", 6) == 0){ + if(strlen(p + 6) > 3) + goto ugly_opts; + q = p + 6; + server->config.fmode = (((q[0] - '0') << 6) + ((q[1] - '0') << 3) + (q[2] - '0')) & (S_IRWXU | S_IRWXG | S_IRWXO); + TRACE("fmode: %d\n", server->config.fmode); + }else + if(strncmp(p, "dmask=", 6) == 0){ + if(strlen(p + 6) > 3) + goto ugly_opts; + q = p + 6; + server->config.dmode = (((q[0] - '0') << 6) + ((q[1] - '0') << 3) + (q[2] - '0')) & (S_IRWXU | S_IRWXG | S_IRWXO); + TRACE("dmode: %d\n", server->config.dmode); + }else + if(strncmp(p, "root=", 5) == 0){ + if(strlen(p+5) >= UNIX_PATH_MAX - 1) + goto ugly_opts; + strcpy(server->root, p+5); + server->rootlen = strlen(server->root); + + if(server->root[server->rootlen - 1] == '/'){ + server->root[server->rootlen - 1] = 0; + server->rootlen--; + } + + TRACE("remote root: %s, len: %u\n", server->root, server->rootlen); + }else + if(strncmp(p, "channels=", 9) == 0){ + if(strlen(p+9) > 5) + goto ugly_opts; + q = p + 9; + server->config.channels = simple_strtoul(q, &q, 0); + + TRACE("channels: %u\n", server->config.channels); + }else + if(strncmp(p, "own_fs", 6) == 0){ + server->config.own_fs = 1; + TRACE("forcing ownership\n"); + }else + if(strncmp(p, "server_pid=", 11) == 0){ + if(strlen(p+11) > 7) + goto ugly_opts; + q = p + 11; + server->server_pid = simple_strtoul(q, &q, 0); + + TRACE("server_pid: %u\n", server->server_pid); + } + + } + + for(i = 0; i < len; i++) + if(!opts[i]) + opts[i] = ','; + + return; + + ugly_opts: + WARN("evil options!\n"); +} + +static void set_inode_attr(struct inode *inode, struct lufs_fattr *fattr) +{ + time_t last_time = inode->i_mtime; + loff_t last_sz = inode->i_size; + + TRACE("in\n"); + + inode->i_mode = fattr->f_mode; + inode->i_nlink = fattr->f_nlink; + inode->i_uid = fattr->f_uid; + inode->i_gid = fattr->f_gid; + inode->i_ctime = fattr->f_ctime; + inode->i_mtime = fattr->f_mtime; + inode->i_atime = fattr->f_atime; + inode->i_blksize = fattr->f_blksize; + inode->i_blocks = fattr->f_blocks; + inode->i_size = fattr->f_size; + + inode->i_rdev = 0; + + if(inode->i_mtime != last_time || inode->i_size != last_sz){ + TRACE("inode changed...\n"); + if(!S_ISDIR(inode->i_mode)) + invalidate_inode_pages(inode); + } + + TRACE("out\n"); +} + +static int lu_do_stat(struct dentry *dentry, struct lufs_fattr *fattr) +{ + struct server_slot *slot; + struct iovec siov, riov; + int res; + + TRACE("in\n"); + + if((slot = lu_getslot(GET_INFO(dentry->d_sb))) == NULL) + return -ERESTARTSYS; + + if((res = lu_getname(dentry, slot->s_buf, LU_MAXDATA)) < 0){ + WARN("lu_getname failed!\n"); + goto out; + } + + TRACE("stating %s...\n", slot->s_buf); + + siov.iov_base = slot->s_buf; + siov.iov_len = strlen(slot->s_buf) + 1; + riov.iov_base = fattr; + riov.iov_len = sizeof(struct lufs_fattr); + + if((res = lu_execute(GET_INFO(dentry->d_sb), slot, PTYPE_STAT, &siov, 1, &riov, 1)) < 0) + goto out; + + if(PIS_ERROR(res)){ + WARN("stat failed!\n"); + res = PERROR(res); + goto out; + } + + lu_fixattrs(GET_INFO(dentry->d_sb), fattr); + + res = 0; + + out: + TRACE("out\n"); + lu_putslot(slot); + return res; +} + +static int lu_refresh_inode(struct dentry *dentry) +{ + struct inode *inode = dentry->d_inode; + struct lufs_fattr fattr; + int res; + + TRACE("in\n"); + + if((res = lu_do_stat(dentry, &fattr)) < 0) + return res; + + dentry->d_time = jiffies; + + if(!inode) + return 0; + + if((inode->i_mode & S_IFMT) == (fattr.f_mode & S_IFMT)) + set_inode_attr(inode, &fattr); + else{ + WARN("inode changed mode, %x to %x\n", inode->i_mode, (unsigned int)fattr.f_mode); + TRACE("oops!\n"); + + fattr.f_mode = inode->i_mode; + make_bad_inode(inode); + inode->i_mode = fattr.f_mode; + + if(!S_ISDIR(inode->i_mode)) + invalidate_inode_pages(inode); + + return -EIO; + } + + TRACE("out\n"); + return 0; +} + +int lu_revalidate_inode(struct dentry *dentry) +{ + int res = 0; + + TRACE("in\n"); + + lock_kernel(); + + if(time_before(jiffies, dentry->d_time + LU_MAXAGE)){ + TRACE("up-to-date, age=%lu\n", jiffies - dentry->d_time); + goto out; + } + + res = lu_refresh_inode(dentry); + + out: + unlock_kernel(); + return res; +} + +int lufs_notify_change(struct dentry *dentry, struct iattr *iattr) +{ + struct server_slot *slot; + struct iovec iov[2]; + struct lufs_fattr fattr; + int res; + + TRACE("in\n"); + + if((res = lu_do_stat(dentry, &fattr)) < 0) + return res; + + if((slot = lu_getslot(GET_INFO(dentry->d_sb))) == NULL) + return -ERESTARTSYS; + + if((res = lu_getname(dentry, slot->s_buf, LU_MAXDATA)) < 0){ + WARN("lu_getname failed!\n"); + goto out; + } + + if(iattr->ia_valid & ATTR_MODE) + fattr.f_mode = iattr->ia_mode; + if(iattr->ia_valid & ATTR_UID) + fattr.f_uid = iattr->ia_uid; + if(iattr->ia_valid & ATTR_GID) + fattr.f_gid = iattr->ia_gid; + if(iattr->ia_valid & ATTR_SIZE) + fattr.f_size = iattr->ia_size; + if(iattr->ia_valid & ATTR_ATIME) + fattr.f_atime= iattr->ia_atime; + if(iattr->ia_valid & ATTR_MTIME) + fattr.f_mtime= iattr->ia_mtime; + if(iattr->ia_valid & ATTR_CTIME) + fattr.f_ctime= iattr->ia_ctime; + + iov[0].iov_base = &fattr; + iov[0].iov_len = sizeof(struct lufs_fattr); + iov[1].iov_base = slot->s_buf; + iov[1].iov_len = strlen(slot->s_buf) + 1; + + if((res = lu_execute(GET_INFO(dentry->d_sb), slot, PTYPE_SETATTR, iov, 2, NULL, 0)) < 0) + goto out; + + if(PIS_ERROR(res)){ + WARN("setattr failed!\n"); + res = PERROR(res); + goto out; + } + + res = 0; + + lu_refresh_inode(dentry); + + out: + TRACE("out\n"); + lu_putslot(slot); + return res; +} + + +struct inode* lu_iget(struct super_block *sb, struct lufs_fattr *fattr) +{ + struct inode *res; + + TRACE("in\n"); + + res = new_inode(sb); + if(!res) + return NULL; + res->i_ino = fattr->f_ino; + set_inode_attr(res, fattr); + + if(S_ISDIR(res->i_mode)){ + TRACE("it's a dir.\n"); + res->i_op = &lu_dir_inode_operations; + res->i_fop = &lu_dir_operations; + }else if(S_ISLNK(res->i_mode)){ + TRACE("it's a link.\n"); + res->i_op = &lu_symlink_inode_operations; + }else{ + TRACE("it's a file.\n"); + res->i_op = &lu_file_inode_operations; + res->i_fop = &lu_file_operations; + res->i_data.a_ops = &lu_file_aops; + } + + insert_inode_hash(res); + return res; +} + +static int lu_statfs(struct super_block *sb, struct statfs *attr) +{ + TRACE("in\n"); + + attr->f_type = LU_MAGIC; + attr->f_bsize = LU_BLOCKSIZE; + attr->f_blocks = 0; + attr->f_namelen = LU_MAXPATHLEN; + attr->f_files = -1; + attr->f_bavail = -1; + + TRACE("out\n"); + return 0; +} + +static void lu_put_super(struct super_block *sb) +{ + struct siginfo info; + + TRACE("in\n"); + + info.si_signo = SIGUSR1; + info.si_errno = 0; + info.si_code = SI_USER; + info.si_pid = current->pid; + info.si_uid = current->uid; + + kill_proc_info(SIGUSR1, &info, GET_INFO(sb)->server_pid); + + lu_empty_slots(GET_INFO(sb)); + kfree(GET_INFO(sb)); + TRACE("out\n"); +} + +static void lu_delete_inode(struct inode *in) +{ + TRACE("in\n"); + clear_inode(in); + TRACE("out\n"); +} + +static struct super_block* lu_read_super(struct super_block *sb, void *opts, int silent) +{ + struct lufs_sb_info *info; + struct server_slot *slot; + struct lufs_fattr root_attr; + struct inode *root_inode; + + int i; + + TRACE("in\n"); + + if(!opts){ + ERROR("need some options here!\n"); + goto out; + } + + if((info = (struct lufs_sb_info*)kmalloc(sizeof(struct lufs_sb_info), GFP_KERNEL)) == NULL){ + ERROR("kmalloc error!\n"); + goto out; + } + memset(info, 0, sizeof(struct lufs_sb_info)); + info->lock = RW_LOCK_UNLOCKED; + INIT_LIST_HEAD(&info->slots); + + info->config.uid = current->uid; + info->config.gid = current->gid; + info->config.channels = LU_NRSLOTS; + + parse_options(info, opts); + + if(!info->server_socket[0]){ + ERROR("no server_socket specified!\n"); + goto out_info; + } + + for(i = 0; i < info->config.channels; i++){ + if((slot = kmalloc(sizeof(struct server_slot), GFP_KERNEL)) == NULL){ + ERROR("kmalloc error!\n"); + goto out_slots; + } + memset(slot, 0, sizeof(struct server_slot)); + init_MUTEX(&slot->s_lock); + if((slot->s_buf = kmalloc(LU_MAXDATA, GFP_KERNEL)) == NULL){ + ERROR("kmalloc error!\n"); + goto out_slots; + } + list_add(&slot->s_list, &info->slots); + } + + sb->u.generic_sbp = info; + sb->s_blocksize = LU_BLOCKSIZE; + sb->s_blocksize_bits = LU_BLOCKSIZEBITS; + sb->s_magic = LU_MAGIC; + sb->s_op = &lu_sops; + sb->s_flags = 0; + sb->s_maxbytes = ((((unsigned long long)1) << 32) << LU_BLOCKSIZEBITS) - 1; + + TRACE("sb->s_maxbytes=%Ld\n",sb->s_maxbytes); + + lu_lookup_root(info, &root_attr); + root_inode = lu_iget(sb, &root_attr); + if(!root_inode) + goto out_slots; + sb->s_root = d_alloc_root(root_inode); + if(!sb->s_root) + goto out_slots; + + sb->s_root->d_op = &lufs_dentry_operations; + sb->s_root->d_time = jiffies; + + TRACE("mount succeded: %s\n", info->server_socket); + return sb; + + out_slots: + lu_empty_slots(info); + out_info: + kfree(info); + out: + ERROR("mount failed!\n"); + return NULL; +} + +static DECLARE_FSTYPE(lu_fs_type, "lufs", lu_read_super, 0); + +static int __init lu_init(void) +{ + EXPORT_NO_SYMBOLS; + + VERBOSE("UserLand File System\n"); + VERBOSE("Copyright (c) 2002, Florin Malita\n"); + return register_filesystem(&lu_fs_type); +} + +static void __exit lu_release(void) +{ + VERBOSE("Unregistering lufs...\n"); + unregister_filesystem(&lu_fs_type); +} + +module_init(lu_init); +module_exit(lu_release); diff --git a/kernel/Linux/2.4/lufs.h b/kernel/Linux/2.4/lufs.h new file mode 100644 index 0000000..ca8e01e --- /dev/null +++ b/kernel/Linux/2.4/lufs.h @@ -0,0 +1,87 @@ +/* + * lufs.h + * Copyright (C) 2002 Florin Malita + * + * This file is part of LUFS, a free userspace filesystem implementation. + * See http://lufs.sourceforge.net/ for updates. + * + * LUFS 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. + * + * LUFS 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 _LUFS_H_ +#define _LUFS_H_ + +#include +#include +#include + +#include "lufs/proto.h" + +#undef TRACE +#undef WARN +#undef VERBOSE +#undef ERROR + +#ifdef LUFS_DEBUG +#define TRACE(x...) do { printk(KERN_INFO "(%s) - ", __func__); printk(x); } while(0) +#define WARN(x...) do { printk(KERN_ERR "(%s) - ", __func__); printk(x); } while(0) +#else +#define TRACE(x...) do {} while(0) +#define WARN(x...) do {} while(0) +#endif + +#ifdef LUFS_VERBOSE +#define VERBOSE(x...) do { printk(KERN_INFO "(%s) - ", __func__); printk(x); } while(0) +#else +#define VERBOSE(x...) do {} while(0) +#endif + +#define ERROR(x...) do { printk(KERN_ERR "(%s) - ", __func__); printk(x); } while(0) + +#define GET_INFO(sb) ((struct lufs_sb_info*)sb->u.generic_sbp) + +#define LU_MAXPATHLEN 1024 +#define LU_MAXTRIES 10 +#define LU_MAXIOVEC 5 +#define LU_NRSLOTS 3 +#define LU_MAGIC 0xfade +#define LU_MAXAGE HZ*5 + +#define LU_DEF_UID 2 +#define LU_DEF_GID 2 + +#define LU_BLOCKSIZE 512 +#define LU_BLOCKSIZEBITS 9 + +struct lufs_config{ + __kernel_uid_t uid; + __kernel_gid_t gid; + __kernel_mode_t fmode; + __kernel_mode_t dmode; + unsigned channels; + int own_fs; +}; + +struct lufs_sb_info{ + struct list_head slots; + struct lufs_config config; + rwlock_t lock; + char server_socket[UNIX_PATH_MAX]; + pid_t server_pid; + char root[UNIX_PATH_MAX]; + unsigned rootlen; +}; + +#endif diff --git a/kernel/Linux/2.4/proc.c b/kernel/Linux/2.4/proc.c new file mode 100644 index 0000000..99fc8bc --- /dev/null +++ b/kernel/Linux/2.4/proc.c @@ -0,0 +1,517 @@ +/* + * proc.c + * Copyright (C) 2002 Florin Malita + * + * This file is part of LUFS, a free userspace filesystem implementation. + * See http://lufs.sourceforge.net/ for updates. + * + * LUFS 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. + * + * LUFS 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 + +#include "lufs.h" +#include "proc.h" + +static int sock_send(struct socket *sock, struct iovec *iov, int len) +{ + struct msghdr msg = { + msg_name: NULL, + msg_namelen: 0, + msg_iov: iov, + msg_iovlen: len, + msg_control: NULL, + msg_controllen: 0, + msg_flags: 0 + }; + struct scm_cookie scm; + int res, i, size; + mm_segment_t fs; + + for(i = 0, size = 0; i < len; i++) + size += iov[i].iov_len; + + fs = get_fs(); + set_fs(get_ds()); + + if((res = scm_send(sock, &msg, &scm)) >= 0){ + res = sock->ops->sendmsg(sock, &msg, size, &scm); + scm_destroy(&scm); + } + set_fs(fs); + return res; +} + +static int sock_recv(struct socket *sock, struct iovec *iov, int len, int rsize, unsigned flags) +{ + struct msghdr msg = { + msg_name: NULL, + msg_namelen: 0, + msg_iov: iov, + msg_iovlen: len, + msg_control: NULL, + msg_controllen: 0 + }; + struct scm_cookie scm; + mm_segment_t fs; + int res, i, size; + + for(i = 0, size = 0; i < len; i++) + size += iov[i].iov_len; + + if(size < rsize){ + VERBOSE("Trying to overflow old me?! Truncating...\n"); + rsize = size; + } + + fs = get_fs(); + set_fs(get_ds()); + + memset(&scm, 0, sizeof(scm)); + + if((res = sock->ops->recvmsg(sock, &msg, rsize, flags, &scm)) >= 0){ + scm_recv(sock, &msg, &scm, flags); + } + + set_fs(fs); + return res; +} + +static int sock_connect(char *path, struct socket **s) +{ + struct sockaddr_un addr; + int res; + + if(strlen(path) > UNIX_PATH_MAX - 1){ + WARN("unix domain path too long: %s", path); + return -1; + } + + addr.sun_family = AF_UNIX; + strcpy(addr.sun_path, path); + + if((res = sock_create(PF_UNIX, SOCK_STREAM, 0, s)) < 0){ + WARN("failed to create a unix domain socket!\n"); + return res; + } + + if((res = (*s)->ops->connect(*s, (struct sockaddr*)&addr, sizeof(addr), 0)) < 0){ + WARN("failed to connect the socket: %d!\n", res); + return res; + } + return 0; +} + +static int slot_reconnect(struct lufs_sb_info *info, struct server_slot *slot) +{ + int res = 0, tries = 0; + + if(slot->s_sock){ + TRACE("closing socket.\n"); + sock_release(slot->s_sock); + slot->s_sock = NULL; + } + + while(tries++ < LU_MAXTRIES && (res = sock_connect(info->server_socket, &slot->s_sock)) < 0){ + TRACE("retrying...\n"); + sock_release(slot->s_sock); + slot->s_sock = NULL; + } + + if(res >= 0){ + TRACE("successfully reconnected.\n"); + } + + return res; +} + +void lu_empty_slots(struct lufs_sb_info *info) +{ + struct server_slot *slot; + + while(!list_empty(&info->slots)){ + slot = list_entry(info->slots.next, struct server_slot, s_list); + if(slot->s_sock) + sock_release(slot->s_sock); + list_del(&slot->s_list); + if(slot->s_buf) + kfree(slot->s_buf); + kfree(slot); + } +} + +static int do_execute(struct socket *sock, unsigned short cmd, unsigned short msglen, struct iovec *siov, unsigned short slen, struct iovec *riov, unsigned short rlen) +{ + struct lu_msg msg; + struct iovec iov; + int res; + + TRACE("msg_len: %d\n", msglen); + + msg.msg_version = PVERSION; + msg.msg_type = cmd; + msg.msg_datalen = msglen; + msg.msg_pid = current->pid; + + iov.iov_base = &msg; + iov.iov_len = sizeof(struct lu_msg); + + if((res = sock_send(sock, &iov, 1)) < 0){ + WARN("sock_send failed!\n"); + return res; + } + + if((res = sock_send(sock, siov, slen)) < 0){ + WARN("sock_send failed!\n"); + return res; + } + + iov.iov_base = &msg; + iov.iov_len = sizeof(struct lu_msg); + if((res = sock_recv(sock, &iov, 1, sizeof(struct lu_msg), 0)) < 0){ + WARN("sock_recv failed!\n"); + return res; + } + if(res != sizeof(struct lu_msg)){ + WARN("Ayeeee, didn't read a whole header!\n"); + return -EBUSY; + } + + if((msg.msg_datalen == 0)) + return msg.msg_type; + + if(riov == NULL){ + WARN("Unexpected data!!! Getting out of sync...\n"); + return -1; + } + + if((res = sock_recv(sock, riov, rlen, msg.msg_datalen, 0)) < 0){ + WARN("sock_recv failed!\n"); + return res; + } + + return msg.msg_type; +} + +struct server_slot* lu_getslot(struct lufs_sb_info *info) +{ + struct list_head *p, *nd_best = NULL; + struct server_slot *slot; + int gotlock = 0; + + /* Look for a slot used by this process before */ + read_lock(&info->lock); + list_for_each(p, &info->slots) + if(list_entry(p, struct server_slot, s_list)->s_lastpid == current->pid){ + TRACE("found a previous used slot for %u.\n", current->pid); + if(down_trylock(&list_entry(p, struct server_slot, s_list)->s_lock) == 0){ + gotlock = 1; + break; + } + TRACE("oops! I still hold the lock! forget this one...\n"); + }else + if(!nd_best){ + nd_best = p; + } + + /* if we couldn't find one, take the first not locked by us */ + if(p == &info->slots){ + if(!nd_best){ + ERROR("deadlock: all locks owned by us!\n"); + read_unlock(&info->lock); + return NULL; + }else + p = nd_best; + + } + read_unlock(&info->lock); + + slot = list_entry(p, struct server_slot, s_list); + + /* Get the lock on that slot */ + if(!gotlock) + if(down_interruptible(&slot->s_lock)) + return NULL; + + slot->s_lastpid = current->pid; + + /* Move it to the tail */ + write_lock(&info->lock); + list_del(p); + list_add_tail(p, &info->slots); + write_unlock(&info->lock); + + return slot; +} + +void lu_putslot(struct server_slot *slot) +{ + up(&slot->s_lock); +} + +int lu_execute(struct lufs_sb_info *info, struct server_slot *slot, unsigned short cmd, struct iovec *siov, unsigned short slen, struct iovec *riov, unsigned short rlen) +{ + int res, i, msglen; + struct iovec bkup[LU_MAXIOVEC]; + + for(i = 0, msglen = 0; i < slen; i++){ + bkup[i] = siov[i]; + msglen += siov[i].iov_len; + } + + if(slot->s_sock == NULL){ + TRACE("slot not connected.\n"); + if((res = slot_reconnect(info, slot)) < 0){ + ERROR("failed to connect!\n"); + goto out; + } + } + + if((res = do_execute(slot->s_sock, cmd, msglen, siov, slen, riov, rlen)) < 0){ + TRACE("do_execute failed!\n"); + + if(signal_pending(current) && (!sigismember(¤t->pending.signal, SIGPIPE))){ + TRACE("interrupted by a signal. disconnecting this slot...\n"); + sock_release(slot->s_sock); + slot->s_sock = NULL; + goto out; + } + + if(sigismember(¤t->pending.signal, SIGPIPE)){ + TRACE("got a SIGPIPE\n"); + sigdelset(¤t->pending.signal, SIGPIPE); + current->sigpending--; + } + + if((res = slot_reconnect(info, slot)) < 0){ + ERROR("could't reconnect!\n"); + goto out; + } + + for(i = 0; i < slen; i++) + siov[i] = bkup[i]; + + if((res = do_execute(slot->s_sock, cmd, msglen, siov, slen, riov, rlen)) < 0){ + ERROR("error executing command!\n"); + goto out; + } + } + + out: + return res; +} + +int lu_getname(struct dentry *d, char *name, int max) +{ + int len = 0; + struct dentry *p; + struct lufs_sb_info *info = GET_INFO(d->d_sb); + + for(p = d; p != p->d_parent; p = p->d_parent) + len += p->d_name.len + 1; + + TRACE("root: %s, rootlen: %d, namelen: %d\n", info->root, info->rootlen, len); + + if(len + info->rootlen > max) + return -1; + + strcpy(name, info->root); + + if(len + info->rootlen == 0){ + strcat(name, "/"); + goto out; + } + + len += info->rootlen; + + name[len] = 0; + for(p = d; p != p->d_parent; p = p->d_parent){ + len -= p->d_name.len; + strncpy(&(name[len]), p->d_name.name, p->d_name.len); + name[--len] = '/'; + } + +out: + TRACE("name resolved to %s\n", name); + return 0; +} + +int lu_getname_dumb(struct dentry *d, char *name, int max) +{ + int len = 0; + struct dentry *p; + + for(p = d; p != p->d_parent; p = p->d_parent) + len += p->d_name.len + 1; + + if(len > max) + return -1; + + if(len == 0){ + name[0] = '/'; + name[1] = 0; + goto out; + } + + name[len] = 0; + for(p = d; p != p->d_parent; p = p->d_parent){ + len -= p->d_name.len; + strncpy(&(name[len]), p->d_name.name, p->d_name.len); + name[--len] = '/'; + } + +out: + return 0; +} + +static void init_root_dirent(struct lufs_sb_info *server, struct lufs_fattr *fattr) +{ + memset(fattr, 0, sizeof(struct lufs_fattr)); + fattr->f_nlink = 1; + fattr->f_uid = server->config.uid; + fattr->f_gid = server->config.gid; + fattr->f_blksize = 512; + fattr->f_ino = 2; + fattr->f_mtime = CURRENT_TIME; + fattr->f_mode = S_IRUSR | S_IRGRP | S_IROTH | S_IXUSR | S_IXGRP | S_IXOTH | S_IFDIR | server->config.dmode; + fattr->f_size = 512; + fattr->f_blocks = 1; +} + +void lu_lookup_root(struct lufs_sb_info *server, struct lufs_fattr *fattr) +{ + struct server_slot *slot; + struct iovec siov, riov; + int res; + + TRACE("in\n"); + + if((slot = lu_getslot(server)) == NULL){ + init_root_dirent(server, fattr); + return; + } + + if(server->rootlen) + strcpy(slot->s_buf, server->root); + else + strcpy(slot->s_buf, "/"); + + TRACE("stating root %s\n", slot->s_buf); + + siov.iov_base = slot->s_buf; + siov.iov_len = strlen(slot->s_buf) + 1; + riov.iov_base = fattr; + riov.iov_len = sizeof(struct lufs_fattr); + + if((res = lu_execute(server, slot, PTYPE_STAT, &siov, 1, &riov, 1)) < 0){ + init_root_dirent(server, fattr); + goto out; + } + + if(PIS_ERROR(res)){ + WARN("stat failed!\n"); + init_root_dirent(server, fattr); + goto out; + } + + lu_fixattrs(server, fattr); + + fattr->f_ino = 2; + + out: + TRACE("out\n"); + lu_putslot(slot); +} + +void lu_fixattrs(struct lufs_sb_info *info, struct lufs_fattr *fattr) +{ + + fattr->f_blksize = LU_BLOCKSIZE; + + if(S_ISREG(fattr->f_mode) || S_ISDIR(fattr->f_mode)) + fattr->f_blocks = (fattr->f_size + LU_BLOCKSIZE - 1) / LU_BLOCKSIZE; + else + fattr->f_blocks = 0; + + if(info->config.own_fs){ + + if(!fattr->f_uid) + fattr->f_mode = (fattr->f_mode & ~S_IRWXU) | ((fattr->f_mode & S_IRWXO)*(S_IRWXU/S_IRWXO)); + + if(!fattr->f_gid) + fattr->f_mode = (fattr->f_mode & ~S_IRWXG) | ((fattr->f_mode & S_IRWXO)*(S_IRWXG/S_IRWXO)); + + fattr->f_uid = info->config.uid; + fattr->f_gid = info->config.gid; + + }else{ + + if(fattr->f_uid) + fattr->f_uid = info->config.uid; + else + fattr->f_uid = LU_DEF_UID; + + if(fattr->f_gid) + fattr->f_gid = info->config.gid; + else + fattr->f_gid = LU_DEF_GID; + } + + if(fattr->f_mode & S_IFDIR) + fattr->f_mode |= info->config.dmode; + else + fattr->f_mode |= info->config.fmode; +} + +void lu_xlate_symlink(char *link, char *target, char *buf) +{ + int i; + char *c1, *c2 = link; + + TRACE("translating %s->%s\n", link, target); + + for(c1 = strchr(link, '/'); c1 && !strncmp(link, target, c1 - link); c2 = c1, c1 = strchr(c1 + 1, '/')); + + TRACE("disjoint paths: %s, %s\n", c2, target + (c2 - link)); + + for(i = 0, c1 = c2; (c1 = strchr(c1 + 1, '/')); i++); + + strcpy(buf, "./"); + + for(; i > 0; i--) + strcat(buf, "../"); + + strcat(buf, target + (c2 - link) + 1); + + TRACE("absolute link resolved to %s\n", buf); + +} + diff --git a/kernel/Linux/2.4/proc.h b/kernel/Linux/2.4/proc.h new file mode 100644 index 0000000..83a598d --- /dev/null +++ b/kernel/Linux/2.4/proc.h @@ -0,0 +1,51 @@ +/* + * proc.h + * Copyright (C) 2002 Florin Malita + * + * This file is part of LUFS, a free userspace filesystem implementation. + * See http://lufs.sourceforge.net/ for updates. + * + * LUFS 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. + * + * LUFS 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 _LU_PROC_H_ +#define _LU_PROC_H_ + +#include +#include +#include + +struct server_slot{ + struct socket *s_sock; + struct semaphore s_lock; + struct list_head s_list; + pid_t s_lastpid; + char *s_buf; +}; + +struct lufs_fattr; + +int lu_execute(struct lufs_sb_info*, struct server_slot*, unsigned short, struct iovec*, unsigned short, struct iovec*, unsigned short); +void lu_empty_slots(struct lufs_sb_info*); +int lu_getname(struct dentry*, char*, int); +int lu_getname_dumb(struct dentry*, char*, int); +struct server_slot* lu_getslot(struct lufs_sb_info*); +void lu_putslot(struct server_slot*); +int lu_revalidate_inode(struct dentry*); +void lu_lookup_root(struct lufs_sb_info*, struct lufs_fattr*); +void lu_fixattrs(struct lufs_sb_info*, struct lufs_fattr*); +void lu_xlate_symlink(char*, char*, char*); + +#endif diff --git a/kernel/Linux/2.4/symlink.c b/kernel/Linux/2.4/symlink.c new file mode 100644 index 0000000..b80562c --- /dev/null +++ b/kernel/Linux/2.4/symlink.c @@ -0,0 +1,185 @@ +/* + * symlink.c + * Copyright (C) 2002 Florin Malita + * + * This file is part of LUFS, a free userspace filesystem implementation. + * See http://lufs.sourceforge.net/ for updates. + * + * LUFS 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. + * + * LUFS 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 "lufs.h" +#include "proc.h" + +extern int lufs_notify_change(struct dentry*, struct iattr*); + +static char failed_link[] = "invalid"; + +static int lu_readlink(struct dentry *dentry, char *buffer, int bufflen) +{ + struct server_slot *slot; + struct iovec siov, riov; + int res; + char *cc = failed_link; + + TRACE("in\n"); + + if((slot = lu_getslot(GET_INFO(dentry->d_sb))) == NULL) + return vfs_readlink(dentry, buffer, bufflen, cc); + + if((res = lu_getname(dentry, slot->s_buf, LU_MAXDATA)) < 0){ + WARN("lu_getname failed!\n"); + goto out; + } + + siov.iov_base = slot->s_buf; + siov.iov_len = strlen(slot->s_buf) + 1; + riov.iov_base = &slot->s_buf[LU_MAXPATHLEN]; + riov.iov_len = LU_MAXPATHLEN; + + if((res = lu_execute(GET_INFO(dentry->d_sb), slot, PTYPE_READLINK, &siov, 1, &riov, 1)) < 0) + goto out; + + if(PIS_ERROR(res)){ + TRACE("read_link failed.\n"); + res = PERROR(res); + goto out; + } + + cc = &slot->s_buf[LU_MAXPATHLEN]; + + TRACE("response: %s\n", cc); + + if(*cc == '/'){ + if(GET_INFO(dentry->d_sb)->rootlen){ + if(strncmp(GET_INFO(dentry->d_sb)->root, cc, GET_INFO(dentry->d_sb)->rootlen)){ + WARN("symlink outside mounted root!"); + cc = failed_link; + goto out; + } + cc += GET_INFO(dentry->d_sb)->rootlen; + } + + lu_xlate_symlink(slot->s_buf, slot->s_buf + LU_MAXPATHLEN, slot->s_buf); + + cc = slot->s_buf; + + } + + + + out: + res = vfs_readlink(dentry, buffer, bufflen, cc); + + lu_putslot(slot); + + TRACE("out\n"); + return res; +} + +static int lu_followlink(struct dentry *dentry, struct nameidata *nd) +{ + struct server_slot *slot; + struct iovec siov, riov; + int res; + char *cc = failed_link; + char *tmp; + + TRACE("in\n"); + + if((slot = lu_getslot(GET_INFO(dentry->d_sb))) == NULL) + return vfs_follow_link(nd, cc); + + + if((res = lu_getname(dentry, slot->s_buf, LU_MAXDATA)) < 0){ + WARN("lu_getname failed!\n"); + goto out; + } + + siov.iov_base = slot->s_buf; + siov.iov_len = strlen(slot->s_buf) + 1; + riov.iov_base = &slot->s_buf[LU_MAXPATHLEN]; + riov.iov_len = LU_MAXPATHLEN; + + if((res = lu_execute(GET_INFO(dentry->d_sb), slot, PTYPE_READLINK, &siov, 1, &riov, 1)) < 0) + goto out; + + if(PIS_ERROR(res)){ + TRACE("read_link failed.\n"); + res = PERROR(res); + goto out; + } + + cc = &slot->s_buf[LU_MAXPATHLEN]; + + if(*cc == '/'){ + if(GET_INFO(dentry->d_sb)->rootlen){ + if(strncmp(GET_INFO(dentry->d_sb)->root, cc, GET_INFO(dentry->d_sb)->rootlen)){ + WARN("symlink outside mounted root!"); + cc = failed_link; + goto out; + } + cc += GET_INFO(dentry->d_sb)->rootlen; + } + + lu_xlate_symlink(slot->s_buf, slot->s_buf + LU_MAXPATHLEN, slot->s_buf); + + cc = slot->s_buf; + + } + + out: + + /* vfs_follow_link somehow manages to call lookup_validate, so we need to + release the slot, in case it's the only one, otherwise lu_lookup will + fail (avoid a deadlock). bad, bad vfs_follow_link! you break the overall + beauty of no kmallocs... */ + + if((tmp = kmalloc(strlen(cc) + 1, GFP_KERNEL)) == NULL){ + WARN("out of mem!\n"); + tmp = failed_link; + }else + strcpy(tmp, cc); + + lu_putslot(slot); + res = vfs_follow_link(nd, tmp); + + if(tmp != failed_link) + kfree(tmp); + + TRACE("out\n"); + return res; +} + +struct inode_operations lu_symlink_inode_operations = { + readlink: lu_readlink, + follow_link: lu_followlink, + setattr: lufs_notify_change, +}; + + + + + diff --git a/kernel/Linux/2.5/Makefile.am b/kernel/Linux/2.5/Makefile.am new file mode 100644 index 0000000..db1b1b8 --- /dev/null +++ b/kernel/Linux/2.5/Makefile.am @@ -0,0 +1,19 @@ +INCLUDES=-I@KERNEL_HDR@ -I@KERNEL_HDR@/asm-i386/mach-default @all_includes@ + +LIBS= + +CFLAGS=@MODV_FLAGS@ @KDEBUG_FLAGS@ -DKBUILD_MODNAME=lufs -O2 -pipe -fomit-frame-pointer -fno-strict-aliasing -mpreferred-stack-boundary=2 -Wall -D__KERNEL__ -DMODULE -DLINUX +LDFLAGS=-r + +moduledir=@MODULES_DIR@/kernel/fs/lufs + +module_PROGRAMS=lufs.o + +noinst_HEADERS=lufs.h proc.h +lufs_o_SOURCES=proc.c inode.c dir.c file.c symlink.c +lufs_o_LDADD= + +install-data-hook: + depmod -aq + if [ "`lsmod | grep lufs`" ]; then rmmod lufs; fi + modprobe lufs diff --git a/kernel/Linux/2.5/Makefile.in b/kernel/Linux/2.5/Makefile.in new file mode 100644 index 0000000..70e162d --- /dev/null +++ b/kernel/Linux/2.5/Makefile.in @@ -0,0 +1,480 @@ +# Makefile.in generated by automake 1.7.5 from Makefile.am. +# @configure_input@ + +# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003 +# Free Software Foundation, Inc. +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ + +srcdir = @srcdir@ +top_srcdir = @top_srcdir@ +VPATH = @srcdir@ +pkgdatadir = $(datadir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +top_builddir = ../../.. + +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +INSTALL = @INSTALL@ +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = @build@ +host_triplet = @host@ +target_triplet = @target@ +ACLOCAL = @ACLOCAL@ +AMDEP_FALSE = @AMDEP_FALSE@ +AMDEP_TRUE = @AMDEP_TRUE@ +AMTAR = @AMTAR@ +AUTOCONF = @AUTOCONF@ +AUTOFS_INSTALL = @AUTOFS_INSTALL@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ + +CFLAGS = @MODV_FLAGS@ @KDEBUG_FLAGS@ -DKBUILD_MODNAME=lufs -O2 -pipe -fomit-frame-pointer -fno-strict-aliasing -mpreferred-stack-boundary=2 -Wall -D__KERNEL__ -DMODULE -DLINUX +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CXX = @CXX@ +CXXDEPMODE = @CXXDEPMODE@ +CXXFLAGS = @CXXFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DEBUG_FLAGS = @DEBUG_FLAGS@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +ECHO = @ECHO@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +EXEEXT = @EXEEXT@ +GCONF = @GCONF@ +GVFSCONF = @GVFSCONF@ +GVFS_CFLAGS = @GVFS_CFLAGS@ +GVFS_LDADD = @GVFS_LDADD@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +KDEBUG_FLAGS = @KDEBUG_FLAGS@ +KERNEL_DIR = @KERNEL_DIR@ +KERNEL_HDR = @KERNEL_HDR@ +LDFLAGS = -r +LIBCHIPCARD_INCLUDES = @LIBCHIPCARD_INCLUDES@ +LIBCHIPCARD_LIB = @LIBCHIPCARD_LIB@ +LIBOBJS = @LIBOBJS@ + +LIBS = +LIBTOOL = @LIBTOOL@ +LN_S = @LN_S@ +LTLIBOBJS = @LTLIBOBJS@ +LUFS_SUID = @LUFS_SUID@ +MAKEINFO = @MAKEINFO@ +MODULES_DIR = @MODULES_DIR@ +MODV_FLAGS = @MODV_FLAGS@ +OBJEXT = @OBJEXT@ +OS_DIR = @OS_DIR@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +RANLIB = @RANLIB@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +SSHPROG = @SSHPROG@ +STRIP = @STRIP@ +VERSION = @VERSION@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_CXX = @ac_ct_CXX@ +ac_ct_RANLIB = @ac_ct_RANLIB@ +ac_ct_STRIP = @ac_ct_STRIP@ +all_includes = @all_includes@ +all_libraries = @all_libraries@ +am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ +am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ +am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@ +am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +datadir = @datadir@ +define_has_libchipcard = @define_has_libchipcard@ +exec_prefix = @exec_prefix@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localstatedir = @localstatedir@ +mandir = @mandir@ +oldincludedir = @oldincludedir@ +opt_fs = @opt_fs@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +sysconfdir = @sysconfdir@ +target = @target@ +target_alias = @target_alias@ +target_cpu = @target_cpu@ +target_os = @target_os@ +target_vendor = @target_vendor@ +INCLUDES = -I@KERNEL_HDR@ -I@KERNEL_HDR@/asm-i386/mach-default @all_includes@ + +moduledir = @MODULES_DIR@/kernel/fs/lufs + +module_PROGRAMS = lufs.o + +noinst_HEADERS = lufs.h proc.h +lufs_o_SOURCES = proc.c inode.c dir.c file.c symlink.c +lufs_o_LDADD = +subdir = kernel/Linux/2.5 +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +mkinstalldirs = $(SHELL) $(top_srcdir)/config/mkinstalldirs +CONFIG_HEADER = $(top_builddir)/config.h +CONFIG_CLEAN_FILES = +module_PROGRAMS = lufs.o$(EXEEXT) +PROGRAMS = $(module_PROGRAMS) + +am_lufs_o_OBJECTS = proc.$(OBJEXT) inode.$(OBJEXT) dir.$(OBJEXT) \ + file.$(OBJEXT) symlink.$(OBJEXT) +lufs_o_OBJECTS = $(am_lufs_o_OBJECTS) +lufs_o_DEPENDENCIES = +lufs_o_LDFLAGS = + +DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir) +depcomp = $(SHELL) $(top_srcdir)/config/depcomp +am__depfiles_maybe = depfiles +@AMDEP_TRUE@DEP_FILES = ./$(DEPDIR)/dir.Po ./$(DEPDIR)/file.Po \ +@AMDEP_TRUE@ ./$(DEPDIR)/inode.Po ./$(DEPDIR)/proc.Po \ +@AMDEP_TRUE@ ./$(DEPDIR)/symlink.Po +COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ + $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +LTCOMPILE = $(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) \ + $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +CCLD = $(CC) +LINK = $(LIBTOOL) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ + $(AM_LDFLAGS) $(LDFLAGS) -o $@ +DIST_SOURCES = $(lufs_o_SOURCES) +HEADERS = $(noinst_HEADERS) + +DIST_COMMON = $(noinst_HEADERS) Makefile.am Makefile.in +SOURCES = $(lufs_o_SOURCES) + +all: all-am + +.SUFFIXES: +.SUFFIXES: .c .lo .o .obj +$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4) + cd $(top_srcdir) && \ + $(AUTOMAKE) --gnu kernel/Linux/2.5/Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe) +modulePROGRAMS_INSTALL = $(INSTALL_PROGRAM) +install-modulePROGRAMS: $(module_PROGRAMS) + @$(NORMAL_INSTALL) + $(mkinstalldirs) $(DESTDIR)$(moduledir) + @list='$(module_PROGRAMS)'; for p in $$list; do \ + p1=`echo $$p|sed 's/$(EXEEXT)$$//'`; \ + if test -f $$p \ + || test -f $$p1 \ + ; then \ + f=`echo "$$p1" | sed 's,^.*/,,;$(transform);s/$$/$(EXEEXT)/'`; \ + echo " $(INSTALL_PROGRAM_ENV) $(LIBTOOL) --mode=install $(modulePROGRAMS_INSTALL) $$p $(DESTDIR)$(moduledir)/$$f"; \ + $(INSTALL_PROGRAM_ENV) $(LIBTOOL) --mode=install $(modulePROGRAMS_INSTALL) $$p $(DESTDIR)$(moduledir)/$$f || exit 1; \ + else :; fi; \ + done + +uninstall-modulePROGRAMS: + @$(NORMAL_UNINSTALL) + @list='$(module_PROGRAMS)'; for p in $$list; do \ + f=`echo "$$p" | sed 's,^.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/'`; \ + echo " rm -f $(DESTDIR)$(moduledir)/$$f"; \ + rm -f $(DESTDIR)$(moduledir)/$$f; \ + done + +clean-modulePROGRAMS: + @list='$(module_PROGRAMS)'; for p in $$list; do \ + f=`echo $$p|sed 's/$(EXEEXT)$$//'`; \ + echo " rm -f $$p $$f"; \ + rm -f $$p $$f ; \ + done +lufs.o$(EXEEXT): $(lufs_o_OBJECTS) $(lufs_o_DEPENDENCIES) + @rm -f lufs.o$(EXEEXT) + $(LINK) $(lufs_o_LDFLAGS) $(lufs_o_OBJECTS) $(lufs_o_LDADD) $(LIBS) + +mostlyclean-compile: + -rm -f *.$(OBJEXT) core *.core + +distclean-compile: + -rm -f *.tab.c + +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dir.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/file.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/inode.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/proc.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/symlink.Po@am__quote@ + +distclean-depend: + -rm -rf ./$(DEPDIR) + +.c.o: +@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" \ +@am__fastdepCC_TRUE@ -c -o $@ `test -f '$<' || echo '$(srcdir)/'`$<; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; \ +@am__fastdepCC_TRUE@ else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; \ +@am__fastdepCC_TRUE@ fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(COMPILE) -c `test -f '$<' || echo '$(srcdir)/'`$< + +.c.obj: +@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" \ +@am__fastdepCC_TRUE@ -c -o $@ `if test -f '$<'; then $(CYGPATH_W) '$<'; else $(CYGPATH_W) '$(srcdir)/$<'; fi`; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; \ +@am__fastdepCC_TRUE@ else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; \ +@am__fastdepCC_TRUE@ fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(COMPILE) -c `if test -f '$<'; then $(CYGPATH_W) '$<'; else $(CYGPATH_W) '$(srcdir)/$<'; fi` + +.c.lo: +@am__fastdepCC_TRUE@ if $(LTCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" \ +@am__fastdepCC_TRUE@ -c -o $@ `test -f '$<' || echo '$(srcdir)/'`$<; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Plo"; \ +@am__fastdepCC_TRUE@ else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; \ +@am__fastdepCC_TRUE@ fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/$*.Plo' tmpdepfile='$(DEPDIR)/$*.TPlo' @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ `test -f '$<' || echo '$(srcdir)/'`$< + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs + +distclean-libtool: + -rm -f libtool +uninstall-info-am: + +ETAGS = etags +ETAGSFLAGS = + +CTAGS = ctags +CTAGSFLAGS = + +tags: TAGS + +ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + mkid -fID $$unique + +TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + tags=; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + test -z "$(ETAGS_ARGS)$$tags$$unique" \ + || $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$tags $$unique + +ctags: CTAGS +CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + tags=; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + test -z "$(CTAGS_ARGS)$$tags$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$tags $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && cd $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) $$here + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) + +top_distdir = ../../.. +distdir = $(top_distdir)/$(PACKAGE)-$(VERSION) + +distdir: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \ + list='$(DISTFILES)'; for file in $$list; do \ + case $$file in \ + $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ + $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ + esac; \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test "$$dir" != "$$file" && test "$$dir" != "."; then \ + dir="/$$dir"; \ + $(mkinstalldirs) "$(distdir)$$dir"; \ + else \ + dir=''; \ + fi; \ + if test -d $$d/$$file; then \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ + fi; \ + cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ + else \ + test -f $(distdir)/$$file \ + || cp -p $$d/$$file $(distdir)/$$file \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-am +all-am: Makefile $(PROGRAMS) $(HEADERS) + +installdirs: + $(mkinstalldirs) $(DESTDIR)$(moduledir) +install: install-am +install-exec: install-exec-am +install-data: install-data-am +uninstall: uninstall-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-am +install-strip: + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + INSTALL_STRIP_FLAG=-s \ + `test -z '$(STRIP)' || \ + echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -rm -f Makefile $(CONFIG_CLEAN_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +clean: clean-am + +clean-am: clean-generic clean-libtool clean-modulePROGRAMS \ + mostlyclean-am + +distclean: distclean-am + +distclean-am: clean-am distclean-compile distclean-depend \ + distclean-generic distclean-libtool distclean-tags + +dvi: dvi-am + +dvi-am: + +info: info-am + +info-am: + +install-data-am: install-modulePROGRAMS + @$(NORMAL_INSTALL) + $(MAKE) $(AM_MAKEFLAGS) install-data-hook + +install-exec-am: + +install-info: install-info-am + +install-man: + +installcheck-am: + +maintainer-clean: maintainer-clean-am + +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-compile mostlyclean-generic \ + mostlyclean-libtool + +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + +uninstall-am: uninstall-info-am uninstall-modulePROGRAMS + +.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ + clean-libtool clean-modulePROGRAMS ctags distclean \ + distclean-compile distclean-depend distclean-generic \ + distclean-libtool distclean-tags distdir dvi dvi-am info \ + info-am install install-am install-data install-data-am \ + install-exec install-exec-am install-info install-info-am \ + install-man install-modulePROGRAMS install-strip installcheck \ + installcheck-am installdirs maintainer-clean \ + maintainer-clean-generic mostlyclean mostlyclean-compile \ + mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ + tags uninstall uninstall-am uninstall-info-am \ + uninstall-modulePROGRAMS + + +install-data-hook: + depmod -aq + if [ "`lsmod | grep lufs`" ]; then rmmod lufs; fi + modprobe lufs +# 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/kernel/Linux/2.5/dir.c b/kernel/Linux/2.5/dir.c new file mode 100644 index 0000000..0835ad8 --- /dev/null +++ b/kernel/Linux/2.5/dir.c @@ -0,0 +1,582 @@ +/* + * dir.c + * Copyright (C) 2002 Florin Malita + * + * This file is part of LUFS, a free userspace filesystem implementation. + * See http://lufs.sourceforge.net/ for updates. + * + * LUFS 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. + * + * LUFS 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 "lufs.h" +#include "proc.h" + + +extern struct inode* lu_iget(struct super_block*, struct lufs_fattr*); +extern int lufs_notify_change(struct dentry*, struct iattr*); + +static int lu_readdir(struct file*, void*, filldir_t); + +static struct dentry *lu_lookup(struct inode*, struct dentry*); +static int lu_mkdir(struct inode*, struct dentry*, int); +static int lu_create(struct inode*, struct dentry*, int); +static int lu_rmdir(struct inode*, struct dentry*); +static int lu_rename(struct inode*, struct dentry*, struct inode*, struct dentry*); +static int lu_unlink(struct inode*, struct dentry*); +static int lu_link(struct dentry*, struct inode*, struct dentry*); +static int lu_symlink(struct inode*, struct dentry*, const char*); + +struct file_operations lu_dir_operations = { + .read = generic_read_dir, + .readdir = lu_readdir, +}; + +struct inode_operations lu_dir_inode_operations = { + .create = lu_create, + .lookup = lu_lookup, + .link = lu_link, + .unlink = lu_unlink, + .symlink = lu_symlink, + .mkdir = lu_mkdir, + .rmdir = lu_rmdir, + .rename = lu_rename, + .setattr = lufs_notify_change, +}; + +static int lu_lookup_validate(struct dentry *dentry, int flags) +{ + struct inode *inode = dentry->d_inode; + unsigned long age = jiffies - dentry->d_time; + int res; + + TRACE("in\n"); + + res = (age <= LU_MAXAGE); + TRACE("age: %lu, valid: %d\n", age, res); + + if(!res) + res = (lu_revalidate_inode(dentry) == 0); + + + if(inode){ + lock_kernel(); + + if(is_bad_inode(inode)) + res = 0; + unlock_kernel(); + }else + TRACE("no inode?!\n"); + + TRACE("out(res=%d)\n", res); + + return res; +} + +static int lu_delete_dentry(struct dentry *dentry) +{ + + TRACE("in\n"); + if(dentry->d_inode && is_bad_inode(dentry->d_inode)){ + WARN("bad inode, unhashing \n"); + return 1; + } + + TRACE("out\n"); + return 0; +} + +struct dentry_operations lufs_dentry_operations = { + .d_revalidate = lu_lookup_validate, + .d_delete = lu_delete_dentry, +}; + +static int lu_readdir(struct file *f, void *dirent, filldir_t filldir) +{ + int res = -1; + char *c; + struct qstr qname; + unsigned long ino; + struct iovec siov[2], riov; + struct server_slot *slot; + unsigned short offset; + + TRACE("in\n"); + + if((slot = lu_getslot(GET_INFO(f->f_dentry->d_sb))) == NULL) + return -ERESTARTSYS; + + if(lu_getname(f->f_dentry, slot->s_buf, LU_MAXDATA) < 0){ + WARN("lu_getname failed!\n"); + goto out; + } + + TRACE("reading %s, offset %u...\n", slot->s_buf, (unsigned)f->f_pos); + res = 0; + + switch((unsigned int)f->f_pos){ + + case 0: + if(filldir(dirent, ".", 1, 0, f->f_dentry->d_inode->i_ino, DT_DIR) < 0) + goto out; + f->f_pos++; + + case 1: + if(filldir(dirent, "..", 2, 1, f->f_dentry->d_parent->d_inode->i_ino, DT_DIR) < 0) + goto out; + f->f_pos++; + + default: + offset = f->f_pos; + siov[0].iov_base = &offset; + siov[0].iov_len = sizeof(unsigned short); + siov[1].iov_base = slot->s_buf; + siov[1].iov_len = strlen(slot->s_buf) + 1; + riov.iov_base = slot->s_buf; + riov.iov_len = LU_MAXDATA; + + if((res = lu_execute(GET_INFO(f->f_dentry->d_inode->i_sb), slot, PTYPE_READDIR, siov, 2, &riov, 1)) < 0){ + WARN("could not read directory content!\n"); + if(res == -ERESTARTSYS) + res = -EINTR; + goto out; + } + if(PIS_ERROR(res)){ + WARN("server failure!\n"); + res = PERROR(res); + goto out; + } + for(qname.name = slot->s_buf, c = strchr(slot->s_buf, '\n'); c != NULL; qname.name = c+1, c = strchr(c+1, '\n')){ + *c = 0; + TRACE("direntry: %s.\n", qname.name); + qname.len = strlen(qname.name); + if((ino = find_inode_number(f->f_dentry, &qname)) == 0) + ino = iunique(f->f_dentry->d_sb, 2); + if(filldir(dirent, qname.name, qname.len, f->f_pos, ino, DT_UNKNOWN) < 0) + break; + f->f_pos++; + } + } + + TRACE("out\n"); + out: + lu_putslot(slot); + return res; +} + +static struct dentry* lu_lookup(struct inode *dir, struct dentry *dentry) +{ + int res; + struct lufs_fattr fattr; + struct iovec siov, riov; + struct inode *inode; + struct server_slot *slot; + + TRACE("in\n"); + + if((slot = lu_getslot(GET_INFO(dir->i_sb))) == NULL) + return ERR_PTR(-ERESTARTSYS); + + if((res = lu_getname(dentry, slot->s_buf, LU_MAXDATA)) < 0){ + WARN("lu_getname failed!\n"); + goto out; + } + + TRACE("looking up %s\n", slot->s_buf); + + siov.iov_base = slot->s_buf; + siov.iov_len = strlen(slot->s_buf) + 1; + riov.iov_base = &fattr; + riov.iov_len = sizeof(struct lufs_fattr); + + if((res = lu_execute(GET_INFO(dir->i_sb), slot, PTYPE_STAT, &siov, 1, &riov, 1)) < 0) + goto out; + + if(PIS_ERROR(res)){ + TRACE("File not found...\n"); + dentry->d_op = &lufs_dentry_operations; + dentry->d_time = jiffies; + d_add(dentry, NULL); + lu_putslot(slot); + return NULL; + } + + lu_fixattrs(GET_INFO(dir->i_sb), &fattr); + + if(dentry == dentry->d_parent) + fattr.f_ino = 2; + else + fattr.f_ino = iunique(dentry->d_sb, 2); + + if((inode = lu_iget(dir->i_sb, &fattr))){ + dentry->d_op = &lufs_dentry_operations; + dentry->d_time = jiffies; + d_add(dentry, inode); + } + res = 0; + + out: + lu_putslot(slot); + + TRACE("out\n"); + return ERR_PTR(res); +} + +static int lu_instantiate(struct dentry *dentry, char *name, struct server_slot *slot) +{ + int res; + struct lufs_fattr fattr; + struct iovec siov, riov; + struct inode *inode; + + TRACE("in\n"); + + TRACE("instantiating %s\n", name); + + siov.iov_base = name; + siov.iov_len = strlen(name) + 1; + riov.iov_base = &fattr; + riov.iov_len = sizeof(struct lufs_fattr); + + if((res = lu_execute(GET_INFO(dentry->d_sb), slot, PTYPE_STAT, &siov, 1, &riov, 1)) < 0) + goto out; + + if(PIS_ERROR(res)){ + TRACE("File not found...\n"); + res = PERROR(res); + goto out; + } + + lu_fixattrs(GET_INFO(dentry->d_sb), &fattr); + + fattr.f_ino = iunique(dentry->d_sb, 2); + inode = lu_iget(dentry->d_sb, &fattr); + + if(!inode){ + res = -EACCES; + goto out; + } + + d_instantiate(dentry, inode); + res = 0; + + out: + TRACE("out\n"); + return res; +} + +static int lu_mkdir(struct inode *dir, struct dentry *dentry, int mode) +{ + int res; + struct server_slot *slot; + struct iovec iov[2]; + + TRACE("in\n"); + + if((slot = lu_getslot(GET_INFO(dentry->d_sb))) == NULL) + return -ERESTARTSYS; + + if((res = lu_getname(dentry, slot->s_buf, LU_MAXDATA)) < 0){ + WARN("lu_getname failed!\n"); + goto out; + } + + iov[0].iov_base = &mode; + iov[0].iov_len = sizeof(mode); + iov[1].iov_base = slot->s_buf; + iov[1].iov_len = strlen(slot->s_buf) + 1; + + if((res = lu_execute(GET_INFO(dentry->d_sb), slot, PTYPE_MKDIR, iov, 2, NULL, 0)) < 0) + goto out; + + if(PIS_ERROR(res)){ + TRACE("Could not create directory.\n"); + res = PERROR(res); + goto out; + } + + res = lu_instantiate(dentry, slot->s_buf, slot); + + out: + lu_putslot(slot); + + TRACE("out\n"); + return res; +} + +static int lu_create(struct inode *dir, struct dentry *dentry, int mode) +{ + int res; + struct server_slot *slot; + struct iovec iov[2]; + + TRACE("in\n"); + + if((slot = lu_getslot(GET_INFO(dentry->d_sb))) == NULL) + return -ERESTARTSYS; + + if((res = lu_getname(dentry, slot->s_buf, LU_MAXDATA)) < 0){ + WARN("lu_getname failed!\n"); + goto out; + } + + iov[0].iov_base = &mode; + iov[0].iov_len = sizeof(mode); + iov[1].iov_base = slot->s_buf; + iov[1].iov_len = strlen(slot->s_buf) + 1; + + if((res = lu_execute(GET_INFO(dentry->d_sb), slot, PTYPE_CREATE, iov, 2, NULL, 0)) < 0) + goto out; + + if(PIS_ERROR(res)){ + TRACE("Could not create file.\n"); + res = PERROR(res); + goto out; + } + + res = lu_instantiate(dentry, slot->s_buf, slot); + + out: + lu_putslot(slot); + + TRACE("out\n"); + return res; +} + +static int lu_rmdir(struct inode *dir, struct dentry *dentry) +{ + int res; + struct server_slot *slot; + struct iovec iov; + + if(!d_unhashed(dentry)) + return -EBUSY; + + TRACE("in\n"); + + if((slot = lu_getslot(GET_INFO(dentry->d_sb))) == NULL) + return -ERESTARTSYS; + + if((res = lu_getname(dentry, slot->s_buf, LU_MAXDATA)) < 0){ + WARN("lu_getname failed!"); + goto out; + } + + iov.iov_base = slot->s_buf; + iov.iov_len = strlen(slot->s_buf) + 1; + + if((res = lu_execute(GET_INFO(dentry->d_sb), slot, PTYPE_RMDIR, &iov, 1, NULL, 0)) < 0) + goto out; + + if(PIS_ERROR(res)){ + TRACE("rmdir failed!\n"); + res = PERROR(res); + goto out; + } + res = 0; + + out: + lu_putslot(slot); + + TRACE("out\n"); + return res; +} + +static int lu_rename(struct inode *old_dir, struct dentry *old_dentry, struct inode *new_dir, struct dentry *new_dentry) +{ + struct server_slot *slot; + int res; + struct iovec iov[2]; + + TRACE("in\n"); + + if((slot = lu_getslot(GET_INFO(old_dentry->d_sb))) == NULL) + return -ERESTARTSYS; + + if((res = lu_getname(old_dentry, slot->s_buf, LU_MAXPATHLEN)) < 0 || + (res = lu_getname(new_dentry, &(slot->s_buf[LU_MAXPATHLEN]), LU_MAXPATHLEN)) < 0){ + WARN("lu_getname failed!\n"); + goto out; + } + + iov[0].iov_base = slot->s_buf; + iov[0].iov_len = strlen(slot->s_buf) + 1; + iov[1].iov_base = &(slot->s_buf[LU_MAXPATHLEN]); + iov[1].iov_len = strlen(&(slot->s_buf[LU_MAXPATHLEN])) + 1; + + if((res = lu_execute(GET_INFO(old_dentry->d_sb), slot, PTYPE_RENAME, iov, 2, NULL, 0)) < 0) + goto out; + + if(PIS_ERROR(res)){ + TRACE("rename failed!\n"); + res = PERROR(res); + goto out; + } + res = 0; + + out: + lu_putslot(slot); + + TRACE("out\n"); + return res; +} + +static int lu_unlink(struct inode *dir, struct dentry *dentry) +{ + int res; + struct server_slot *slot; + struct iovec iov; + + TRACE("in\n"); + + if((slot = lu_getslot(GET_INFO(dentry->d_sb))) == NULL) + return -ERESTARTSYS; + + if((res = lu_getname(dentry, slot->s_buf, LU_MAXPATHLEN)) < 0){ + WARN("lu_getname failed!"); + goto out; + } + + iov.iov_base = slot->s_buf; + iov.iov_len = strlen(slot->s_buf) + 1; + + if((res = lu_execute(GET_INFO(dentry->d_sb), slot, PTYPE_UNLINK, &iov, 1, NULL, 0)) < 0) + goto out; + + if(PIS_ERROR(res)){ + TRACE("unlink failed!\n"); + res = PERROR(res); + goto out; + } + res = 0; + + out: + lu_putslot(slot); + + TRACE("out\n"); + return res; +} + + +static int lu_link(struct dentry *old_dentry, struct inode *dir, struct dentry *dentry) +{ + int res; + struct server_slot *slot; + struct iovec iov[2]; + + TRACE("in\n"); + + if(S_ISDIR(old_dentry->d_inode->i_mode)) + return -EPERM; + + if(!(slot = lu_getslot(GET_INFO(old_dentry->d_sb)))) + return -ERESTARTSYS; + + if((res = lu_getname(old_dentry, slot->s_buf, LU_MAXPATHLEN)) < 0){ + WARN("lu_getname failed!\n"); + goto out; + } + + if((res = lu_getname(dentry, &slot->s_buf[LU_MAXPATHLEN], LU_MAXPATHLEN)) < 0){ + WARN("lu_getname failed!\n"); + goto out; + } + + iov[0].iov_base = slot->s_buf; + iov[0].iov_len = strlen(slot->s_buf) + 1; + iov[1].iov_base = &slot->s_buf[LU_MAXPATHLEN]; + iov[1].iov_len = strlen(&slot->s_buf[LU_MAXPATHLEN]) + 1; + + d_drop(dentry); + + if((res = lu_execute(GET_INFO(old_dentry->d_sb), slot, PTYPE_LINK, iov, 2, NULL, 0)) < 0) + goto out; + + if(PIS_ERROR(res)){ + TRACE("link failed!\n"); + res = PERROR(res); + goto out; + } + + res = 0; + + out: + lu_putslot(slot); + TRACE("out\n"); + return res; +} + +static int lu_symlink(struct inode *dir, struct dentry *dentry, const char *symname) +{ + int res; + struct server_slot *slot; + struct iovec iov[2]; + + TRACE("in\n"); + TRACE("symlink: %s\n", symname); + + if(strlen(symname) > LU_MAXPATHLEN - 1) + return -ENAMETOOLONG; + + if(!(slot = lu_getslot(GET_INFO(dentry->d_sb)))) + return -ERESTARTSYS; + + if((res = lu_getname(dentry, slot->s_buf, LU_MAXPATHLEN)) < 0){ + WARN("lu_getname failed!\n"); + goto out; + } + + TRACE("fname: %s\n", slot->s_buf); + + strcpy(&slot->s_buf[LU_MAXPATHLEN], symname); + + iov[0].iov_base = slot->s_buf; + iov[0].iov_len = strlen(slot->s_buf) + 1; + iov[1].iov_base = &slot->s_buf[LU_MAXPATHLEN]; + iov[1].iov_len = strlen(&slot->s_buf[LU_MAXPATHLEN]) + 1; + + d_drop(dentry); + + if((res = lu_execute(GET_INFO(dentry->d_sb), slot, PTYPE_SYMLINK, iov, 2, NULL, 0)) < 0) + goto out; + + if(PIS_ERROR(res)){ + TRACE("symlink failed!\n"); + res = PERROR(res); + goto out; + } + + res = 0; + + out: + lu_putslot(slot); + TRACE("out\n"); + return res; +} + + + diff --git a/kernel/Linux/2.5/file.c b/kernel/Linux/2.5/file.c new file mode 100644 index 0000000..074a2ff --- /dev/null +++ b/kernel/Linux/2.5/file.c @@ -0,0 +1,321 @@ +/* + * file.c + * Copyright (C) 2002 Florin Malita + * + * This file is part of LUFS, a free userspace filesystem implementation. + * See http://lufs.sourceforge.net/ for updates. + * + * LUFS 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. + * + * LUFS 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 "lufs.h" +#include "proc.h" + +extern int lufs_notify_change(struct dentry*, struct iattr*); +extern int lu_revalidate_inode(struct dentry*); + +static int lu_file_open(struct inode *inode, struct file *file) +{ + int res, gres; + struct server_slot *slot; + struct iovec iov[2]; + unsigned flags; + + TRACE("in\n"); + + if((gres = generic_file_open(inode, file)) < 0) + return gres; + + TRACE("f_mode: %u, i_mode: %u\n", file->f_mode, inode->i_mode); + TRACE("f_flags: %u, i_flags: %u\n", file->f_flags, inode->i_flags); + + if((slot = lu_getslot(GET_INFO(file->f_dentry->d_sb))) == NULL) + return gres; + + if((res = lu_getname(file->f_dentry, slot->s_buf, LU_MAXDATA)) < 0){ + WARN("lu_getname failed!\n"); + goto out; + } + + flags = file->f_flags & O_ACCMODE; + iov[0].iov_base = &flags; + iov[0].iov_len = sizeof(flags); + iov[1].iov_base = slot->s_buf; + iov[1].iov_len = strlen(slot->s_buf) + 1; + + lu_execute(GET_INFO(file->f_dentry->d_sb), slot, PTYPE_OPEN, iov, 2, NULL, 0); + +out: + lu_putslot(slot); + + TRACE("out\n"); + return gres; +} + +static int lu_file_release(struct inode *inode, struct file *file) +{ + int res; + struct server_slot *slot; + struct iovec iov; + + TRACE("in\n"); + + if((slot = lu_getslot(GET_INFO(file->f_dentry->d_sb))) == NULL) + return -ERESTARTSYS; + + if((res = lu_getname(file->f_dentry, slot->s_buf, LU_MAXPATHLEN)) < 0){ + WARN("lu_getname failed!\n"); + goto out; + } + + iov.iov_base = slot->s_buf; + iov.iov_len = strlen(slot->s_buf) + 1; + + if((res = lu_execute(GET_INFO(file->f_dentry->d_sb), slot, PTYPE_RELEASE, &iov, 1, NULL, 0)) < 0) + goto out; + + if(PIS_ERROR(res)){ + TRACE("release failed\n"); + res = PERROR(res); + goto out; + } + + res = 0; + +out: + lu_putslot(slot); + + TRACE("out\n"); + return res; +} + +static int lu_file_readpage(struct file *f, struct page *p) +{ + int res; + struct iovec siov[3], riov; + long long offset; + unsigned long count; + struct server_slot *slot; + + TRACE("in\n"); + + if((slot = lu_getslot(GET_INFO(f->f_dentry->d_sb))) == NULL) + return -ERESTARTSYS; + + get_page(p); + + if((res = lu_getname(f->f_dentry, slot->s_buf, LU_MAXDATA)) < 0){ + WARN("lu_getname failed!\n"); + goto out; + } + + offset = p->index << PAGE_CACHE_SHIFT; + count = PAGE_SIZE; + + siov[0].iov_base = &offset; + siov[0].iov_len = sizeof(offset); + siov[1].iov_base = &count; + siov[1].iov_len = sizeof(count); + siov[2].iov_base = slot->s_buf; + siov[2].iov_len = strlen(slot->s_buf) + 1; + + riov.iov_base = page_address(p); + riov.iov_len = count; + + if((res = lu_execute(GET_INFO(f->f_dentry->d_sb), slot, PTYPE_READ, siov, 3, &riov, 1)) < 0) + goto out; + + if(PIS_ERROR(res)){ + TRACE("read failed\n"); + res = PERROR(res); + goto out; + } + + flush_dcache_page(p); + SetPageUptodate(p); + res = 0; + + out: + lu_putslot(slot); + unlock_page(p); + put_page(p); + + TRACE("out\n"); + return res; +} + +static int lu_file_writepage(struct page *p, struct writeback_control *wbc) +{ + TRACE("in\n"); + + TRACE("out\n"); + return -1; +} + +static int lu_file_preparewrite(struct file *f, struct page *p, unsigned offset, unsigned to) +{ + TRACE("in\n"); + + TRACE("out\n"); + + return 0; +} + +static int lu_file_commitwrite(struct file *f, struct page *p, unsigned offset, unsigned to) +{ + int res; + struct server_slot *slot; + struct iovec iov[4]; + char *buf; + long long off; + unsigned long cnt; + + TRACE("in\n"); + + if((slot = lu_getslot(GET_INFO(f->f_dentry->d_sb))) == NULL) + return -ERESTARTSYS; + + if((res = lu_getname(f->f_dentry, slot->s_buf, LU_MAXDATA)) < 0){ + WARN("lu_getname failed!\n"); + goto out2; + } + + lock_kernel(); + + buf = kmap(p) + offset; + cnt = to - offset; + off = offset + (((long long)p->index) << PAGE_CACHE_SHIFT); + + iov[0].iov_base = &off; + iov[0].iov_len = sizeof(off); + iov[1].iov_base = &cnt; + iov[1].iov_len = sizeof(cnt); + iov[2].iov_base = slot->s_buf; + iov[2].iov_len = strlen(slot->s_buf) + 1; + iov[3].iov_base = buf; + iov[3].iov_len = cnt; + + TRACE("write %s, offset %Ld, count %d\n", slot->s_buf, off, (int)cnt); + + if((res = lu_execute(GET_INFO(f->f_dentry->d_sb), slot, PTYPE_WRITE, iov, 4, NULL, 0)) < 0) + goto out1; + + + if(PIS_ERROR(res)){ + TRACE("write failed\n"); + res = PERROR(res); + goto out1; + } + + f->f_dentry->d_inode->i_mtime = f->f_dentry->d_inode->i_atime = CURRENT_TIME; + if(off + cnt > f->f_dentry->d_inode->i_size) + f->f_dentry->d_inode->i_size = off + cnt; + + res = cnt; + + out1: + kunmap(p); + unlock_kernel(); + out2: + lu_putslot(slot); + TRACE("out\n"); + return res; +} + +static int lu_file_read(struct file *filp, char *buf, size_t count, loff_t *ppos) +{ + struct dentry *dentry = filp->f_dentry; + int res; + + TRACE("in\n"); + + if(!(res = lu_revalidate_inode(dentry))) + res = generic_file_read(filp, buf, count, ppos); + + TRACE("out\n"); + + return res; +} + +static int lu_file_mmap(struct file *filp, struct vm_area_struct *vma) +{ + struct dentry *dentry = filp->f_dentry; + int res; + + TRACE("in\n"); + + if(!(res = lu_revalidate_inode(dentry))) + res = generic_file_mmap(filp, vma); + + TRACE("out\n"); + + return res; +} + +static ssize_t lu_file_write(struct file *filp, const char *buf, size_t count, loff_t *ppos) +{ + struct dentry *dentry = filp->f_dentry; + ssize_t res; + + TRACE("in\n"); + + if(!(res = lu_revalidate_inode(dentry)) && (count > 0)) + res = generic_file_write(filp, buf, count, ppos); + + TRACE("out\n"); + + return res; +} + +static int lu_file_fsync(struct file *filp, struct dentry *dentryp, int datasync) +{ + return 0; +} + +struct file_operations lu_file_operations = { + .llseek = generic_file_llseek, + .read = lu_file_read, + .write = lu_file_write, + .mmap = lu_file_mmap, + .open = lu_file_open, + .release = lu_file_release, + :fsync = lu_file_fsync, +}; + +struct inode_operations lu_file_inode_operations = { + .setattr = lufs_notify_change, +}; + +struct address_space_operations lu_file_aops = { + .readpage = lu_file_readpage, + .writepage = lu_file_writepage, + .prepare_write = lu_file_preparewrite, + .commit_write = lu_file_commitwrite, +}; + + + diff --git a/kernel/Linux/2.5/inode.c b/kernel/Linux/2.5/inode.c new file mode 100644 index 0000000..ee4f13f --- /dev/null +++ b/kernel/Linux/2.5/inode.c @@ -0,0 +1,535 @@ +/* + * inode.c + * Copyright (C) 2002-2003 Florin Malita + * + * This file is part of LUFS, a free userspace filesystem implementation. + * See http://lufs.sourceforge.net/ for updates. + * + * LUFS 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. + * + * LUFS 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 +#include + +#include "lufs.h" +#include "proc.h" + +MODULE_AUTHOR("Florin Malita "); +MODULE_DESCRIPTION("Linux Userland Filesystem"); +#ifdef MODULE_LICENSE +MODULE_LICENSE("GPL"); +#endif + +extern struct file_operations lu_dir_operations, lu_file_operations; +extern struct inode_operations lu_dir_inode_operations, lu_file_inode_operations, lu_symlink_inode_operations; +extern struct address_space_operations lu_file_aops; +extern struct dentry_operations lufs_dentry_operations; + +static void lu_delete_inode(struct inode*); +static void lu_put_super(struct super_block*); +static int lu_statfs(struct super_block*, struct statfs*); + +static struct super_operations lu_sops = { + .drop_inode = generic_delete_inode, + .delete_inode = lu_delete_inode, + .put_super = lu_put_super, + .statfs = lu_statfs, +}; + + +/* + * Ignore unknown options, they're probably for the userspace daemon. + */ +static void parse_options(struct lufs_sb_info *server, char *opts) +{ + char *p, *q; + int len; + + if(!opts) + return; + + len = strlen(opts); + + while((p = strsep(&opts, ","))){ + if(strncmp(p, "server_socket=", 14) == 0){ + if(strlen(p+14) > UNIX_PATH_MAX) + goto ugly_opts; + strcpy(server->server_socket, p+14); + TRACE("server_socket: %s\n", server->server_socket); + }else + if(strncmp(p, "uid=", 4) == 0){ + if(current->uid) + ERROR("only root can use uid option!\n"); + else{ + if(strlen(p+4) > 5) + goto ugly_opts; + q = p + 4; + server->config.uid = simple_strtoul(q, &q, 0); + TRACE("uid: %d\n", server->config.uid); + } + }else + if(strncmp(p, "gid=", 4) == 0){ + if(current->uid) + ERROR("only root can use gid option!\n"); + else{ + if(strlen(p+4) > 5) + goto ugly_opts; + q = p + 4; + server->config.gid = simple_strtoul(q, &q, 0); + TRACE("gid: %d\n", server->config.gid); + } + }else + if(strncmp(p, "fmask=", 6) == 0){ + if(strlen(p + 6) > 3) + goto ugly_opts; + q = p + 6; + server->config.fmode = (((q[0] - '0') << 6) + ((q[1] - '0') << 3) + (q[2] - '0')) & (S_IRWXU | S_IRWXG | S_IRWXO); + TRACE("fmode: %d\n", server->config.fmode); + }else + if(strncmp(p, "dmask=", 6) == 0){ + if(strlen(p + 6) > 3) + goto ugly_opts; + q = p + 6; + server->config.dmode = (((q[0] - '0') << 6) + ((q[1] - '0') << 3) + (q[2] - '0')) & (S_IRWXU | S_IRWXG | S_IRWXO); + TRACE("dmode: %d\n", server->config.dmode); + }else + if(strncmp(p, "root=", 5) == 0){ + if(strlen(p+5) >= UNIX_PATH_MAX - 1) + goto ugly_opts; + strcpy(server->root, p+5); + server->rootlen = strlen(server->root); + + if(server->root[server->rootlen - 1] == '/'){ + server->root[server->rootlen - 1] = 0; + server->rootlen--; + } + + TRACE("remote root: %s, len: %u\n", server->root, server->rootlen); + }else + if(strncmp(p, "channels=", 9) == 0){ + if(strlen(p+9) > 5) + goto ugly_opts; + q = p + 9; + server->config.channels = simple_strtoul(q, &q, 0); + + TRACE("channels: %u\n", server->config.channels); + }else + if(strncmp(p, "own_fs", 6) == 0){ + server->config.own_fs = 1; + TRACE("forcing ownership\n"); + }else + if(strncmp(p, "server_pid=", 11) == 0){ + if(strlen(p+11) > 7) + goto ugly_opts; + q = p + 11; + server->server_pid = simple_strtoul(q, &q, 0); + + TRACE("server_pid: %u\n", server->server_pid); + } + } + + return; + + ugly_opts: + WARN("evil options!\n"); +} + +/* + * Fill in inode attributes. + * Ivalidate the page_cache pages if the inode has been modified. + */ +static void set_inode_attr(struct inode *inode, struct lufs_fattr *fattr) +{ + time_t last_time = inode->i_mtime.tv_sec; + loff_t last_sz = inode->i_size; + + TRACE("in\n"); + + inode->i_mode = fattr->f_mode; + inode->i_nlink = fattr->f_nlink; + inode->i_uid = fattr->f_uid; + inode->i_gid = fattr->f_gid; + inode->i_ctime.tv_sec = fattr->f_ctime; + inode->i_mtime.tv_sec = fattr->f_mtime; + inode->i_atime.tv_sec = fattr->f_atime; + inode->i_blksize = fattr->f_blksize; + inode->i_blocks = fattr->f_blocks; + inode->i_size = fattr->f_size; + + if(inode->i_mtime.tv_sec != last_time || inode->i_size != last_sz){ + TRACE("inode changed...\n"); + if(!S_ISDIR(inode->i_mode)) + invalidate_inode_pages(inode->i_mapping); + } + + TRACE("out\n"); +} + +static int lu_do_stat(struct dentry *dentry, struct lufs_fattr *fattr) +{ + struct server_slot *slot; + struct iovec siov, riov; + int res; + + TRACE("in\n"); + + if((slot = lu_getslot(GET_INFO(dentry->d_sb))) == NULL) + return -ERESTARTSYS; + + if((res = lu_getname(dentry, slot->s_buf, LU_MAXDATA)) < 0){ + WARN("lu_getname failed!\n"); + goto out; + } + + TRACE("stating %s...\n", slot->s_buf); + + siov.iov_base = slot->s_buf; + siov.iov_len = strlen(slot->s_buf) + 1; + riov.iov_base = fattr; + riov.iov_len = sizeof(struct lufs_fattr); + + if((res = lu_execute(GET_INFO(dentry->d_sb), slot, PTYPE_STAT, &siov, 1, &riov, 1)) < 0) + goto out; + + if(PIS_ERROR(res)){ + WARN("stat failed!\n"); + res = PERROR(res); + goto out; + } + + lu_fixattrs(GET_INFO(dentry->d_sb), fattr); + + res = 0; + + out: + TRACE("out\n"); + lu_putslot(slot); + return res; +} + +/* + * Reload inode attributes. + */ +static int lu_refresh_inode(struct dentry *dentry) +{ + struct inode *inode = dentry->d_inode; + struct lufs_fattr fattr; + int res; + + TRACE("in\n"); + + if((res = lu_do_stat(dentry, &fattr)) < 0) + return res; + + dentry->d_time = jiffies; + + if(!inode) + return 0; + + if((inode->i_mode & S_IFMT) == (fattr.f_mode & S_IFMT)) + set_inode_attr(inode, &fattr); + else{ + WARN("inode changed mode, %x to %x\n", inode->i_mode, (unsigned int)fattr.f_mode); + TRACE("oops!\n"); + + fattr.f_mode = inode->i_mode; + make_bad_inode(inode); + inode->i_mode = fattr.f_mode; + + if(!S_ISDIR(inode->i_mode)) + invalidate_inode_pages(inode->i_mapping); + + return -EIO; + } + + TRACE("out\n"); + return 0; +} + +int lu_revalidate_inode(struct dentry *dentry) +{ + int res = 0; + + TRACE("in\n"); + + lock_kernel(); + + if(time_before(jiffies, dentry->d_time + LU_MAXAGE)) + goto out; + + res = lu_refresh_inode(dentry); + + out: + TRACE("out\n"); + unlock_kernel(); + return res; +} + +int lufs_notify_change(struct dentry *dentry, struct iattr *iattr) +{ + struct server_slot *slot; + struct iovec iov[2]; + struct lufs_fattr fattr; + int res; + + TRACE("in\n"); + + if((res = lu_do_stat(dentry, &fattr)) < 0) + return res; + + if((slot = lu_getslot(GET_INFO(dentry->d_sb))) == NULL) + return -ERESTARTSYS; + + if((res = lu_getname(dentry, slot->s_buf, LU_MAXDATA)) < 0){ + WARN("lu_getname failed!\n"); + goto out; + } + + if(iattr->ia_valid & ATTR_MODE) + fattr.f_mode = iattr->ia_mode; + if(iattr->ia_valid & ATTR_UID) + fattr.f_uid = iattr->ia_uid; + if(iattr->ia_valid & ATTR_GID) + fattr.f_gid = iattr->ia_gid; + if(iattr->ia_valid & ATTR_SIZE) + fattr.f_size = iattr->ia_size; + if(iattr->ia_valid & ATTR_ATIME) + fattr.f_atime= iattr->ia_atime.tv_sec; + if(iattr->ia_valid & ATTR_MTIME) + fattr.f_mtime= iattr->ia_mtime.tv_sec; + if(iattr->ia_valid & ATTR_CTIME) + fattr.f_ctime= iattr->ia_ctime.tv_sec; + + iov[0].iov_base = &fattr; + iov[0].iov_len = sizeof(struct lufs_fattr); + iov[1].iov_base = slot->s_buf; + iov[1].iov_len = strlen(slot->s_buf) + 1; + + if((res = lu_execute(GET_INFO(dentry->d_sb), slot, PTYPE_SETATTR, iov, 2, NULL, 0)) < 0) + goto out; + + if(PIS_ERROR(res)){ + WARN("setattr failed!\n"); + res = PERROR(res); + goto out; + } + + res = 0; + + lu_refresh_inode(dentry); + + out: + TRACE("out\n"); + lu_putslot(slot); + return res; +} + +/* + * We always create a new inode here. + */ +struct inode* lu_iget(struct super_block *sb, struct lufs_fattr *fattr) +{ + struct inode *res; + + TRACE("in\n"); + + res = new_inode(sb); + if(!res) + return NULL; + res->i_ino = fattr->f_ino; + set_inode_attr(res, fattr); + + if(S_ISDIR(res->i_mode)){ + TRACE("it's a dir.\n"); + res->i_op = &lu_dir_inode_operations; + res->i_fop = &lu_dir_operations; + }else if(S_ISLNK(res->i_mode)){ + TRACE("it's a link.\n"); + res->i_op = &lu_symlink_inode_operations; + }else{ + TRACE("it's a file.\n"); + res->i_op = &lu_file_inode_operations; + res->i_fop = &lu_file_operations; + res->i_data.a_ops = &lu_file_aops; + } + + insert_inode_hash(res); + return res; +} + +static int lu_statfs(struct super_block *sb, struct statfs *attr) +{ + TRACE("in\n"); + + attr->f_type = LU_MAGIC; + attr->f_bsize = LU_BLOCKSIZE; + attr->f_blocks = 0; + attr->f_namelen = LU_MAXPATHLEN; + attr->f_files = -1; + attr->f_bavail = -1; + + TRACE("out\n"); + return 0; +} + +static void lu_put_super(struct super_block *sb) +{ + struct siginfo info; + + TRACE("in\n"); + + info.si_signo = SIGUSR1; + info.si_errno = 0; + info.si_code = SI_USER; + info.si_pid = current->pid; + info.si_uid = current->uid; + + /* notify the daemon that we're going bye-bye */ + kill_proc_info(SIGUSR1, &info, GET_INFO(sb)->server_pid); + + lu_empty_slots(GET_INFO(sb)); + kfree(GET_INFO(sb)); + TRACE("out\n"); +} + +static void lu_delete_inode(struct inode *in) +{ + TRACE("in\n"); + clear_inode(in); + TRACE("out\n"); +} + +static int lu_fill_super(struct super_block *sb, void *opts, int silent) +{ + struct lufs_sb_info *info; + struct server_slot *slot; + struct lufs_fattr root_attr; + struct inode *root_inode; + + int i; + + TRACE("in\n"); + + if(!opts){ + ERROR("need some options here!\n"); + goto out; + } + + if((info = (struct lufs_sb_info*)kmalloc(sizeof(struct lufs_sb_info), GFP_KERNEL)) == NULL){ + ERROR("kmalloc error!\n"); + goto out; + } + memset(info, 0, sizeof(struct lufs_sb_info)); + info->lock = RW_LOCK_UNLOCKED; + INIT_LIST_HEAD(&info->slots); + + info->config.uid = current->uid; + info->config.gid = current->gid; + info->config.channels = LU_NRSLOTS; + + parse_options(info, opts); + + if(!info->server_socket[0]){ + ERROR("no server_socket specified!\n"); + goto out_info; + } + + for(i = 0; i < info->config.channels; i++){ + if((slot = kmalloc(sizeof(struct server_slot), GFP_KERNEL)) == NULL){ + ERROR("kmalloc error!\n"); + goto out_slots; + } + memset(slot, 0, sizeof(struct server_slot)); + init_MUTEX(&slot->s_lock); + if((slot->s_buf = kmalloc(LU_MAXDATA, GFP_KERNEL)) == NULL){ + ERROR("kmalloc error!\n"); + goto out_slots; + } + list_add(&slot->s_list, &info->slots); + } + + sb->s_fs_info = info; + sb->s_blocksize = LU_BLOCKSIZE; + sb->s_blocksize_bits = LU_BLOCKSIZEBITS; + sb->s_magic = LU_MAGIC; + sb->s_op = &lu_sops; + sb->s_flags = 0; + sb->s_maxbytes = ((((long long)1) << 32) << LU_BLOCKSIZEBITS) - 1; + TRACE("sb->s_maxbytes=%Ld\n",sb->s_maxbytes); + + lu_lookup_root(info, &root_attr); + root_inode = lu_iget(sb, &root_attr); + if(!root_inode) + goto out_slots; + sb->s_root = d_alloc_root(root_inode); + if(!sb->s_root) + goto out_slots; + + sb->s_root->d_op = &lufs_dentry_operations; + sb->s_root->d_time = jiffies; + + TRACE("mount succeded: %s\n", info->server_socket); + return 0; + + out_slots: + lu_empty_slots(info); + out_info: + kfree(info); + out: + ERROR("mount failed!\n"); + return -EINVAL; +} + +static struct super_block *lu_get_sb(struct file_system_type *fs_type, int flags, char *dev_name, void *data) +{ + return get_sb_nodev(fs_type, flags, data, lu_fill_super); +} + +static struct file_system_type lu_fs_type = { + .owner = THIS_MODULE, + .name = "lufs", + .get_sb = lu_get_sb, + .kill_sb = kill_anon_super, +}; + +static int __init lu_init(void) +{ + VERBOSE("UserLand File System\n"); + VERBOSE("Copyright (c) 2002, Florin Malita\n"); + return register_filesystem(&lu_fs_type); +} + +static void __exit lu_release(void) +{ + VERBOSE("Unregistering lufs...\n"); + unregister_filesystem(&lu_fs_type); +} + +module_init(lu_init); +module_exit(lu_release); diff --git a/kernel/Linux/2.5/lufs.h b/kernel/Linux/2.5/lufs.h new file mode 100644 index 0000000..1275099 --- /dev/null +++ b/kernel/Linux/2.5/lufs.h @@ -0,0 +1,87 @@ +/* + * lufs.h + * Copyright (C) 2002 Florin Malita + * + * This file is part of LUFS, a free userspace filesystem implementation. + * See http://lufs.sourceforge.net/ for updates. + * + * LUFS 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. + * + * LUFS 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 _LUFS_H_ +#define _LUFS_H_ + +#include +#include +#include + +#include "../../../include/lufs/proto.h" + +#undef TRACE +#undef WARN +#undef VERBOSE +#undef ERROR + +#ifdef LUFS_DEBUG +#define TRACE(x...) do { printk(KERN_INFO "(%s) - ", __func__); printk(x); } while(0) +#define WARN(x...) do { printk(KERN_ERR "(%s) - ", __func__); printk(x); } while(0) +#else +#define TRACE(x...) do {} while(0) +#define WARN(x...) do {} while(0) +#endif + +#ifdef LUFS_VERBOSE +#define VERBOSE(x...) do { printk(KERN_INFO "(%s) - ", __func__); printk(x); } while(0) +#else +#define VERBOSE(x...) do {} while(0) +#endif + +#define ERROR(x...) do { printk(KERN_ERR "(%s) - ", __func__); printk(x); } while(0) + +#define GET_INFO(sb) ((struct lufs_sb_info*)sb->s_fs_info) + +#define LU_MAXPATHLEN 1024 +#define LU_MAXTRIES 10 +#define LU_MAXIOVEC 5 +#define LU_NRSLOTS 3 +#define LU_MAGIC 0xfade +#define LU_MAXAGE HZ*5 + +#define LU_DEF_UID 2 +#define LU_DEF_GID 2 + +#define LU_BLOCKSIZE 512 +#define LU_BLOCKSIZEBITS 9 + +struct lufs_config{ + __kernel_uid_t uid; + __kernel_gid_t gid; + __kernel_mode_t fmode; + __kernel_mode_t dmode; + unsigned channels; + int own_fs; +}; + +struct lufs_sb_info{ + struct list_head slots; + struct lufs_config config; + rwlock_t lock; + char server_socket[UNIX_PATH_MAX]; + pid_t server_pid; + char root[UNIX_PATH_MAX]; + unsigned rootlen; +}; + +#endif diff --git a/kernel/Linux/2.5/proc.c b/kernel/Linux/2.5/proc.c new file mode 100644 index 0000000..cb0b2e7 --- /dev/null +++ b/kernel/Linux/2.5/proc.c @@ -0,0 +1,505 @@ +/* + * proc.c + * Copyright (C) 2002 Florin Malita + * + * This file is part of LUFS, a free userspace filesystem implementation. + * See http://lufs.sourceforge.net/ for updates. + * + * LUFS 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. + * + * LUFS 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 +#include + +#include "lufs.h" +#include "proc.h" + +static int sock_send(struct socket *sock, struct iovec *iov, int len) +{ + struct msghdr msg = { + .msg_name = NULL, + .msg_namelen = 0, + .msg_iov = iov, + .msg_iovlen = len, + .msg_control = NULL, + .msg_controllen = 0, + .msg_flags = 0 + }; + int res, i, size; + mm_segment_t fs; + + for(i = 0, size = 0; i < len; i++) + size += iov[i].iov_len; + + fs = get_fs(); + set_fs(get_ds()); + res = sock_sendmsg(sock, &msg, size); + set_fs(fs); + + return res; +} + +static int sock_recv(struct socket *sock, struct iovec *iov, int len, int rsize, unsigned flags) +{ + struct msghdr msg = { + .msg_flags = flags, + .msg_name = NULL, + .msg_namelen = 0, + .msg_iov = iov, + .msg_iovlen = len, + .msg_control = NULL, + .msg_controllen = 0 + }; + mm_segment_t fs; + int res, i, size; + + for(i = 0, size = 0; i < len; i++) + size += iov[i].iov_len; + + if(size < rsize){ + VERBOSE("Trying to overflow old me?! Truncating...\n"); + rsize = size; + } + + fs = get_fs(); + set_fs(get_ds()); + res = sock_recvmsg(sock, &msg, rsize, flags); + set_fs(fs); + + return res; +} + +static int sock_connect(char *path, struct socket **s) +{ + struct sockaddr_un addr; + int res; + + if(strlen(path) > UNIX_PATH_MAX - 1){ + WARN("unix domain path too long: %s", path); + return -1; + } + + addr.sun_family = AF_UNIX; + strcpy(addr.sun_path, path); + + if((res = sock_create(PF_UNIX, SOCK_STREAM, 0, s)) < 0){ + WARN("failed to create a unix domain socket!\n"); + return res; + } + + if((res = (*s)->ops->connect(*s, (struct sockaddr*)&addr, sizeof(addr), 0)) < 0){ + WARN("failed to connect the socket: %d!\n", res); + return res; + } + return 0; +} + +static int slot_reconnect(struct lufs_sb_info *info, struct server_slot *slot) +{ + int res = 0, tries = 0; + + if(slot->s_sock){ + TRACE("closing socket.\n"); + sock_release(slot->s_sock); + slot->s_sock = NULL; + } + + while(tries++ < LU_MAXTRIES && (res = sock_connect(info->server_socket, &slot->s_sock)) < 0){ + TRACE("retrying...\n"); + sock_release(slot->s_sock); + slot->s_sock = NULL; + } + + if(res >= 0){ + TRACE("successfully reconnected.\n"); + } + + return res; +} + +void lu_empty_slots(struct lufs_sb_info *info) +{ + struct server_slot *slot; + + while(!list_empty(&info->slots)){ + slot = list_entry(info->slots.next, struct server_slot, s_list); + if(slot->s_sock) + sock_release(slot->s_sock); + list_del(&slot->s_list); + if(slot->s_buf) + kfree(slot->s_buf); + kfree(slot); + } +} + +static int do_execute(struct socket *sock, unsigned short cmd, unsigned short msglen, struct iovec *siov, unsigned short slen, struct iovec *riov, unsigned short rlen) +{ + struct lu_msg msg; + struct iovec iov; + int res; + + TRACE("msg_len: %d\n", msglen); + + msg.msg_version = PVERSION; + msg.msg_type = cmd; + msg.msg_datalen = msglen; + msg.msg_pid = current->pid; + + iov.iov_base = &msg; + iov.iov_len = sizeof(struct lu_msg); + + if((res = sock_send(sock, &iov, 1)) < 0){ + WARN("sock_send failed!\n"); + return res; + } + if((res = sock_send(sock, siov, slen)) < 0){ + WARN("sock_send failed!\n"); + return res; + } + + iov.iov_base = &msg; + iov.iov_len = sizeof(struct lu_msg); + if((res = sock_recv(sock, &iov, 1, sizeof(struct lu_msg), 0)) < 0){ + WARN("sock_recv failed!\n"); + return res; + } + if(res != sizeof(struct lu_msg)){ + WARN("Ayeeee, didn't read a whole header!\n"); + return -EBUSY; + } + + if((msg.msg_datalen == 0)) + return msg.msg_type; + + if(riov == NULL){ + WARN("Unexpected data!!! Getting out of sync...\n"); + return -1; + } + + if((res = sock_recv(sock, riov, rlen, msg.msg_datalen, 0)) < 0){ + WARN("sock_recv failed!\n"); + return res; + } + + return msg.msg_type; +} + +struct server_slot* lu_getslot(struct lufs_sb_info *info) +{ + struct list_head *p, *nd_best = NULL; + struct server_slot *slot; + int gotlock = 0; + + /* Look for a slot used by this process before */ + read_lock(&info->lock); + list_for_each(p, &info->slots) + if(list_entry(p, struct server_slot, s_list)->s_lastpid == current->pid){ + TRACE("found a previous used slot for %u.\n", current->pid); + if(down_trylock(&list_entry(p, struct server_slot, s_list)->s_lock) == 0){ + gotlock = 1; + break; + } + TRACE("oops! I still hold the lock! forget this one...\n"); + }else + if(!nd_best){ + nd_best = p; + } + + /* if we couldn't find one, take the first not locked by us */ + if(p == &info->slots){ + if(!nd_best){ + ERROR("deadlock: all locks owned by us!\n"); + read_unlock(&info->lock); + return NULL; + }else + p = nd_best; + + } + read_unlock(&info->lock); + + slot = list_entry(p, struct server_slot, s_list); + + /* Get the lock on that slot */ + if(!gotlock) + if(down_interruptible(&slot->s_lock)) + return NULL; + + slot->s_lastpid = current->pid; + + /* Move it to the tail */ + write_lock(&info->lock); + list_del(p); + list_add_tail(p, &info->slots); + write_unlock(&info->lock); + + return slot; +} + +void lu_putslot(struct server_slot *slot) +{ + up(&slot->s_lock); +} + +int lu_execute(struct lufs_sb_info *info, struct server_slot *slot, unsigned short cmd, struct iovec *siov, unsigned short slen, struct iovec *riov, unsigned short rlen) +{ + int res, i, msglen; + struct iovec bkup[LU_MAXIOVEC]; + + for(i = 0, msglen = 0; i < slen; i++){ + bkup[i] = siov[i]; + msglen += siov[i].iov_len; + } + + if(slot->s_sock == NULL){ + TRACE("slot not connected.\n"); + if((res = slot_reconnect(info, slot)) < 0){ + ERROR("failed to connect!\n"); + goto out; + } + } + + if((res = do_execute(slot->s_sock, cmd, msglen, siov, slen, riov, rlen)) < 0){ + TRACE("do_execute failed!\n"); + + if(signal_pending(current) && (!sigismember(¤t->pending.signal, SIGPIPE))){ + TRACE("interrupted by a signal. disconnecting this slot...\n"); + sock_release(slot->s_sock); + slot->s_sock = NULL; + goto out; + } + + if(sigismember(¤t->pending.signal, SIGPIPE)){ + TRACE("got a SIGPIPE\n"); + sigdelset(¤t->pending.signal, SIGPIPE); + } + + if((res = slot_reconnect(info, slot)) < 0){ + ERROR("could't reconnect!\n"); + goto out; + } + + for(i = 0; i < slen; i++) + siov[i] = bkup[i]; + + if((res = do_execute(slot->s_sock, cmd, msglen, siov, slen, riov, rlen)) < 0){ + ERROR("error executing command!\n"); + goto out; + } + } + + out: + return res; +} + +int lu_getname(struct dentry *d, char *name, int max) +{ + int len = 0; + struct dentry *p; + struct lufs_sb_info *info = GET_INFO(d->d_sb); + + for(p = d; p != p->d_parent; p = p->d_parent) + len += p->d_name.len + 1; + + TRACE("root: %s, rootlen: %d, namelen: %d\n", info->root, info->rootlen, len); + + if(len + info->rootlen > max) + return -1; + + strcpy(name, info->root); + + if(len + info->rootlen == 0){ + strcat(name, "/"); + goto out; + } + + len += info->rootlen; + + name[len] = 0; + for(p = d; p != p->d_parent; p = p->d_parent){ + len -= p->d_name.len; + strncpy(&(name[len]), p->d_name.name, p->d_name.len); + name[--len] = '/'; + } + +out: + TRACE("name resolved to %s\n", name); + return 0; +} + +int lu_getname_dumb(struct dentry *d, char *name, int max) +{ + int len = 0; + struct dentry *p; + + for(p = d; p != p->d_parent; p = p->d_parent) + len += p->d_name.len + 1; + + if(len > max) + return -1; + + if(len == 0){ + name[0] = '/'; + name[1] = 0; + goto out; + } + + name[len] = 0; + for(p = d; p != p->d_parent; p = p->d_parent){ + len -= p->d_name.len; + strncpy(&(name[len]), p->d_name.name, p->d_name.len); + name[--len] = '/'; + } + +out: + return 0; +} + +static void init_root_dirent(struct lufs_sb_info *server, struct lufs_fattr *fattr) +{ + memset(fattr, 0, sizeof(struct lufs_fattr)); + fattr->f_nlink = 1; + fattr->f_uid = server->config.uid; + fattr->f_gid = server->config.gid; + fattr->f_blksize = 512; + fattr->f_ino = 2; + fattr->f_mtime = CURRENT_TIME.tv_sec; + fattr->f_mode = S_IRUSR | S_IRGRP | S_IROTH | S_IXUSR | S_IXGRP | S_IXOTH | S_IFDIR | server->config.dmode; + fattr->f_size = 512; + fattr->f_blocks = 1; +} + +void lu_lookup_root(struct lufs_sb_info *server, struct lufs_fattr *fattr) +{ + struct server_slot *slot; + struct iovec siov, riov; + int res; + + TRACE("in\n"); + + if((slot = lu_getslot(server)) == NULL){ + init_root_dirent(server, fattr); + return; + } + + if(server->rootlen) + strcpy(slot->s_buf, server->root); + else + strcpy(slot->s_buf, "/"); + + TRACE("stating root %s\n", slot->s_buf); + + siov.iov_base = slot->s_buf; + siov.iov_len = strlen(slot->s_buf) + 1; + riov.iov_base = fattr; + riov.iov_len = sizeof(struct lufs_fattr); + + if((res = lu_execute(server, slot, PTYPE_STAT, &siov, 1, &riov, 1)) < 0){ + init_root_dirent(server, fattr); + goto out; + } + + if(PIS_ERROR(res)){ + WARN("stat failed!\n"); + init_root_dirent(server, fattr); + goto out; + } + + lu_fixattrs(server, fattr); + + fattr->f_ino = 2; + + out: + TRACE("out\n"); + lu_putslot(slot); +} + +void lu_fixattrs(struct lufs_sb_info *info, struct lufs_fattr *fattr) +{ + + fattr->f_blksize = LU_BLOCKSIZE; + + if(S_ISREG(fattr->f_mode) || S_ISDIR(fattr->f_mode)) + fattr->f_blocks = (fattr->f_size + LU_BLOCKSIZE - 1) / LU_BLOCKSIZE; + else + fattr->f_blocks = 0; + + if(info->config.own_fs){ + + if(!fattr->f_uid) + fattr->f_mode = (fattr->f_mode & ~S_IRWXU) | ((fattr->f_mode & S_IRWXO)*(S_IRWXU/S_IRWXO)); + + if(!fattr->f_gid) + fattr->f_mode = (fattr->f_mode & ~S_IRWXG) | ((fattr->f_mode & S_IRWXO)*(S_IRWXG/S_IRWXO)); + + fattr->f_uid = info->config.uid; + fattr->f_gid = info->config.gid; + + }else{ + + if(fattr->f_uid) + fattr->f_uid = info->config.uid; + else + fattr->f_uid = LU_DEF_UID; + + if(fattr->f_gid) + fattr->f_gid = info->config.gid; + else + fattr->f_gid = LU_DEF_GID; + } + + if(fattr->f_mode & S_IFDIR) + fattr->f_mode |= info->config.dmode; + else + fattr->f_mode |= info->config.fmode; +} + +void lu_xlate_symlink(char *link, char *target, char *buf) +{ + int i; + char *c1, *c2 = link; + + TRACE("translating %s->%s\n", link, target); + + for(c1 = strchr(link, '/'); c1 && !strncmp(link, target, c1 - link); c2 = c1, c1 = strchr(c1 + 1, '/')); + + TRACE("disjoint paths: %s, %s\n", c2, target + (c2 - link)); + + for(i = 0, c1 = c2; (c1 = strchr(c1 + 1, '/')); i++); + + strcpy(buf, "./"); + + for(; i > 0; i--) + strcat(buf, "../"); + + strcat(buf, target + (c2 - link) + 1); + + TRACE("absolute link resolved to %s\n", buf); + +} + diff --git a/kernel/Linux/2.5/proc.h b/kernel/Linux/2.5/proc.h new file mode 100644 index 0000000..83a598d --- /dev/null +++ b/kernel/Linux/2.5/proc.h @@ -0,0 +1,51 @@ +/* + * proc.h + * Copyright (C) 2002 Florin Malita + * + * This file is part of LUFS, a free userspace filesystem implementation. + * See http://lufs.sourceforge.net/ for updates. + * + * LUFS 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. + * + * LUFS 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 _LU_PROC_H_ +#define _LU_PROC_H_ + +#include +#include +#include + +struct server_slot{ + struct socket *s_sock; + struct semaphore s_lock; + struct list_head s_list; + pid_t s_lastpid; + char *s_buf; +}; + +struct lufs_fattr; + +int lu_execute(struct lufs_sb_info*, struct server_slot*, unsigned short, struct iovec*, unsigned short, struct iovec*, unsigned short); +void lu_empty_slots(struct lufs_sb_info*); +int lu_getname(struct dentry*, char*, int); +int lu_getname_dumb(struct dentry*, char*, int); +struct server_slot* lu_getslot(struct lufs_sb_info*); +void lu_putslot(struct server_slot*); +int lu_revalidate_inode(struct dentry*); +void lu_lookup_root(struct lufs_sb_info*, struct lufs_fattr*); +void lu_fixattrs(struct lufs_sb_info*, struct lufs_fattr*); +void lu_xlate_symlink(char*, char*, char*); + +#endif diff --git a/kernel/Linux/2.5/symlink.c b/kernel/Linux/2.5/symlink.c new file mode 100644 index 0000000..c60570b --- /dev/null +++ b/kernel/Linux/2.5/symlink.c @@ -0,0 +1,184 @@ +/* + * symlink.c + * Copyright (C) 2002 Florin Malita + * + * This file is part of LUFS, a free userspace filesystem implementation. + * See http://lufs.sourceforge.net/ for updates. + * + * LUFS 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. + * + * LUFS 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 "lufs.h" +#include "proc.h" + +static char failed_link[] = "invalid"; + +static int lu_readlink(struct dentry *dentry, char *buffer, int bufflen) +{ + struct server_slot *slot; + struct iovec siov, riov; + int res; + char *cc = failed_link; + + TRACE("in\n"); + + if((slot = lu_getslot(GET_INFO(dentry->d_sb))) == NULL) + return vfs_readlink(dentry, buffer, bufflen, cc); + + if((res = lu_getname(dentry, slot->s_buf, LU_MAXDATA)) < 0){ + WARN("lu_getname failed!\n"); + goto out; + } + + siov.iov_base = slot->s_buf; + siov.iov_len = strlen(slot->s_buf) + 1; + riov.iov_base = &slot->s_buf[LU_MAXPATHLEN]; + riov.iov_len = LU_MAXPATHLEN; + + if((res = lu_execute(GET_INFO(dentry->d_sb), slot, PTYPE_READLINK, &siov, 1, &riov, 1)) < 0) + goto out; + + if(PIS_ERROR(res)){ + TRACE("read_link failed.\n"); + res = PERROR(res); + goto out; + } + + cc = &slot->s_buf[LU_MAXPATHLEN]; + + TRACE("response: %s\n", cc); + + if(*cc == '/'){ + if(GET_INFO(dentry->d_sb)->rootlen){ + if(strncmp(GET_INFO(dentry->d_sb)->root, cc, GET_INFO(dentry->d_sb)->rootlen)){ + WARN("symlink outside mounted root!"); + cc = failed_link; + goto out; + } + cc += GET_INFO(dentry->d_sb)->rootlen; + } + + lu_xlate_symlink(slot->s_buf, slot->s_buf + LU_MAXPATHLEN, slot->s_buf); + + cc = slot->s_buf; + + } + + + + out: + res = vfs_readlink(dentry, buffer, bufflen, cc); + + lu_putslot(slot); + + TRACE("out\n"); + return res; +} + +static int lu_followlink(struct dentry *dentry, struct nameidata *nd) +{ + struct server_slot *slot; + struct iovec siov, riov; + int res; + char *cc = failed_link; + char *tmp; + + TRACE("in\n"); + + if((slot = lu_getslot(GET_INFO(dentry->d_sb))) == NULL) + return vfs_follow_link(nd, cc); + + + if((res = lu_getname(dentry, slot->s_buf, LU_MAXDATA)) < 0){ + WARN("lu_getname failed!\n"); + goto out; + } + + siov.iov_base = slot->s_buf; + siov.iov_len = strlen(slot->s_buf) + 1; + riov.iov_base = &slot->s_buf[LU_MAXPATHLEN]; + riov.iov_len = LU_MAXPATHLEN; + + if((res = lu_execute(GET_INFO(dentry->d_sb), slot, PTYPE_READLINK, &siov, 1, &riov, 1)) < 0) + goto out; + + if(PIS_ERROR(res)){ + TRACE("read_link failed.\n"); + res = PERROR(res); + goto out; + } + + cc = &slot->s_buf[LU_MAXPATHLEN]; + + if(*cc == '/'){ + if(GET_INFO(dentry->d_sb)->rootlen){ + if(strncmp(GET_INFO(dentry->d_sb)->root, cc, GET_INFO(dentry->d_sb)->rootlen)){ + WARN("symlink outside mounted root!"); + cc = failed_link; + goto out; + } + cc += GET_INFO(dentry->d_sb)->rootlen; + } + + lu_xlate_symlink(slot->s_buf, slot->s_buf + LU_MAXPATHLEN, slot->s_buf); + + cc = slot->s_buf; + + } + + out: + + /* vfs_follow_link somehow manages to call lookup_validate, so we need to + release the slot, in case it's the only one, otherwise lu_lookup will + fail (avoid a deadlock). bad, bad vfs_follow_link! you break the overall + beauty of no kmallocs... */ + + if((tmp = kmalloc(strlen(cc) + 1, GFP_KERNEL)) == NULL){ + WARN("out of mem!\n"); + tmp = failed_link; + }else + strcpy(tmp, cc); + + lu_putslot(slot); + res = vfs_follow_link(nd, tmp); + + if(tmp != failed_link) + kfree(tmp); + + TRACE("out\n"); + return res; +} + +struct inode_operations lu_symlink_inode_operations = { + .readlink = lu_readlink, + .follow_link = lu_followlink, +}; + + + + + diff --git a/kernel/Linux/Makefile.am b/kernel/Linux/Makefile.am new file mode 100644 index 0000000..6081b19 --- /dev/null +++ b/kernel/Linux/Makefile.am @@ -0,0 +1,2 @@ +SUBDIRS = @KERNEL_DIR@ +DIST_SUBDIRS = 2.4 2.5 diff --git a/kernel/Linux/Makefile.in b/kernel/Linux/Makefile.in new file mode 100644 index 0000000..4fbd0b0 --- /dev/null +++ b/kernel/Linux/Makefile.in @@ -0,0 +1,450 @@ +# Makefile.in generated by automake 1.7.5 from Makefile.am. +# @configure_input@ + +# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003 +# Free Software Foundation, Inc. +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ + +srcdir = @srcdir@ +top_srcdir = @top_srcdir@ +VPATH = @srcdir@ +pkgdatadir = $(datadir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +top_builddir = ../.. + +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +INSTALL = @INSTALL@ +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = @build@ +host_triplet = @host@ +target_triplet = @target@ +ACLOCAL = @ACLOCAL@ +AMDEP_FALSE = @AMDEP_FALSE@ +AMDEP_TRUE = @AMDEP_TRUE@ +AMTAR = @AMTAR@ +AUTOCONF = @AUTOCONF@ +AUTOFS_INSTALL = @AUTOFS_INSTALL@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CXX = @CXX@ +CXXDEPMODE = @CXXDEPMODE@ +CXXFLAGS = @CXXFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DEBUG_FLAGS = @DEBUG_FLAGS@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +ECHO = @ECHO@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +EXEEXT = @EXEEXT@ +GCONF = @GCONF@ +GVFSCONF = @GVFSCONF@ +GVFS_CFLAGS = @GVFS_CFLAGS@ +GVFS_LDADD = @GVFS_LDADD@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +KDEBUG_FLAGS = @KDEBUG_FLAGS@ +KERNEL_DIR = @KERNEL_DIR@ +KERNEL_HDR = @KERNEL_HDR@ +LDFLAGS = @LDFLAGS@ +LIBCHIPCARD_INCLUDES = @LIBCHIPCARD_INCLUDES@ +LIBCHIPCARD_LIB = @LIBCHIPCARD_LIB@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LIBTOOL = @LIBTOOL@ +LN_S = @LN_S@ +LTLIBOBJS = @LTLIBOBJS@ +LUFS_SUID = @LUFS_SUID@ +MAKEINFO = @MAKEINFO@ +MODULES_DIR = @MODULES_DIR@ +MODV_FLAGS = @MODV_FLAGS@ +OBJEXT = @OBJEXT@ +OS_DIR = @OS_DIR@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +RANLIB = @RANLIB@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +SSHPROG = @SSHPROG@ +STRIP = @STRIP@ +VERSION = @VERSION@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_CXX = @ac_ct_CXX@ +ac_ct_RANLIB = @ac_ct_RANLIB@ +ac_ct_STRIP = @ac_ct_STRIP@ +all_includes = @all_includes@ +all_libraries = @all_libraries@ +am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ +am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ +am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@ +am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +datadir = @datadir@ +define_has_libchipcard = @define_has_libchipcard@ +exec_prefix = @exec_prefix@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localstatedir = @localstatedir@ +mandir = @mandir@ +oldincludedir = @oldincludedir@ +opt_fs = @opt_fs@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +sysconfdir = @sysconfdir@ +target = @target@ +target_alias = @target_alias@ +target_cpu = @target_cpu@ +target_os = @target_os@ +target_vendor = @target_vendor@ +SUBDIRS = @KERNEL_DIR@ +DIST_SUBDIRS = 2.4 2.5 +subdir = kernel/Linux +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +mkinstalldirs = $(SHELL) $(top_srcdir)/config/mkinstalldirs +CONFIG_HEADER = $(top_builddir)/config.h +CONFIG_CLEAN_FILES = +DIST_SOURCES = + +RECURSIVE_TARGETS = info-recursive dvi-recursive pdf-recursive \ + ps-recursive install-info-recursive uninstall-info-recursive \ + all-recursive install-data-recursive install-exec-recursive \ + installdirs-recursive install-recursive uninstall-recursive \ + check-recursive installcheck-recursive +DIST_COMMON = Makefile.am Makefile.in +all: all-recursive + +.SUFFIXES: +$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4) + cd $(top_srcdir) && \ + $(AUTOMAKE) --gnu kernel/Linux/Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe) + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs + +distclean-libtool: + -rm -f libtool +uninstall-info-am: + +# This directory's subdirectories are mostly independent; you can cd +# into them and run `make' without going through this Makefile. +# To change the values of `make' variables: instead of editing Makefiles, +# (1) if the variable is set in `config.status', edit `config.status' +# (which will cause the Makefiles to be regenerated when you run `make'); +# (2) otherwise, pass the desired values on the `make' command line. +$(RECURSIVE_TARGETS): + @set fnord $$MAKEFLAGS; amf=$$2; \ + dot_seen=no; \ + target=`echo $@ | sed s/-recursive//`; \ + list='$(SUBDIRS)'; for subdir in $$list; do \ + echo "Making $$target in $$subdir"; \ + if test "$$subdir" = "."; then \ + dot_seen=yes; \ + local_target="$$target-am"; \ + else \ + local_target="$$target"; \ + fi; \ + (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ + || case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \ + done; \ + if test "$$dot_seen" = "no"; then \ + $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \ + fi; test -z "$$fail" + +mostlyclean-recursive clean-recursive distclean-recursive \ +maintainer-clean-recursive: + @set fnord $$MAKEFLAGS; amf=$$2; \ + dot_seen=no; \ + case "$@" in \ + distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ + *) list='$(SUBDIRS)' ;; \ + esac; \ + rev=''; for subdir in $$list; do \ + if test "$$subdir" = "."; then :; else \ + rev="$$subdir $$rev"; \ + fi; \ + done; \ + rev="$$rev ."; \ + target=`echo $@ | sed s/-recursive//`; \ + for subdir in $$rev; do \ + echo "Making $$target in $$subdir"; \ + if test "$$subdir" = "."; then \ + local_target="$$target-am"; \ + else \ + local_target="$$target"; \ + fi; \ + (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ + || case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \ + done && test -z "$$fail" +tags-recursive: + list='$(SUBDIRS)'; for subdir in $$list; do \ + test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \ + done +ctags-recursive: + list='$(SUBDIRS)'; for subdir in $$list; do \ + test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \ + done + +ETAGS = etags +ETAGSFLAGS = + +CTAGS = ctags +CTAGSFLAGS = + +tags: TAGS + +ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + mkid -fID $$unique + +TAGS: tags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + tags=; \ + here=`pwd`; \ + if (etags --etags-include --version) >/dev/null 2>&1; then \ + include_option=--etags-include; \ + else \ + include_option=--include; \ + fi; \ + list='$(SUBDIRS)'; for subdir in $$list; do \ + if test "$$subdir" = .; then :; else \ + test -f $$subdir/TAGS && \ + tags="$$tags $$include_option=$$here/$$subdir/TAGS"; \ + fi; \ + done; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + test -z "$(ETAGS_ARGS)$$tags$$unique" \ + || $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$tags $$unique + +ctags: CTAGS +CTAGS: ctags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + tags=; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + test -z "$(CTAGS_ARGS)$$tags$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$tags $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && cd $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) $$here + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) + +top_distdir = ../.. +distdir = $(top_distdir)/$(PACKAGE)-$(VERSION) + +distdir: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \ + list='$(DISTFILES)'; for file in $$list; do \ + case $$file in \ + $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ + $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ + esac; \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test "$$dir" != "$$file" && test "$$dir" != "."; then \ + dir="/$$dir"; \ + $(mkinstalldirs) "$(distdir)$$dir"; \ + else \ + dir=''; \ + fi; \ + if test -d $$d/$$file; then \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ + fi; \ + cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ + else \ + test -f $(distdir)/$$file \ + || cp -p $$d/$$file $(distdir)/$$file \ + || exit 1; \ + fi; \ + done + list='$(DIST_SUBDIRS)'; for subdir in $$list; do \ + if test "$$subdir" = .; then :; else \ + test -d $(distdir)/$$subdir \ + || mkdir $(distdir)/$$subdir \ + || exit 1; \ + (cd $$subdir && \ + $(MAKE) $(AM_MAKEFLAGS) \ + top_distdir="$(top_distdir)" \ + distdir=../$(distdir)/$$subdir \ + distdir) \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-recursive +all-am: Makefile +installdirs: installdirs-recursive +installdirs-am: + +install: install-recursive +install-exec: install-exec-recursive +install-data: install-data-recursive +uninstall: uninstall-recursive + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-recursive +install-strip: + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + INSTALL_STRIP_FLAG=-s \ + `test -z '$(STRIP)' || \ + echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -rm -f Makefile $(CONFIG_CLEAN_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +clean: clean-recursive + +clean-am: clean-generic clean-libtool mostlyclean-am + +distclean: distclean-recursive + +distclean-am: clean-am distclean-generic distclean-libtool \ + distclean-tags + +dvi: dvi-recursive + +dvi-am: + +info: info-recursive + +info-am: + +install-data-am: + +install-exec-am: + +install-info: install-info-recursive + +install-man: + +installcheck-am: + +maintainer-clean: maintainer-clean-recursive + +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-recursive + +mostlyclean-am: mostlyclean-generic mostlyclean-libtool + +pdf: pdf-recursive + +pdf-am: + +ps: ps-recursive + +ps-am: + +uninstall-am: uninstall-info-am + +uninstall-info: uninstall-info-recursive + +.PHONY: $(RECURSIVE_TARGETS) CTAGS GTAGS all all-am check check-am clean \ + clean-generic clean-libtool clean-recursive ctags \ + ctags-recursive distclean distclean-generic distclean-libtool \ + distclean-recursive distclean-tags distdir dvi dvi-am \ + dvi-recursive info info-am info-recursive install install-am \ + install-data install-data-am install-data-recursive \ + install-exec install-exec-am install-exec-recursive \ + install-info install-info-am install-info-recursive install-man \ + install-recursive install-strip installcheck installcheck-am \ + installdirs installdirs-am installdirs-recursive \ + maintainer-clean maintainer-clean-generic \ + maintainer-clean-recursive mostlyclean mostlyclean-generic \ + mostlyclean-libtool mostlyclean-recursive pdf pdf-am \ + pdf-recursive ps ps-am ps-recursive tags tags-recursive \ + uninstall uninstall-am uninstall-info-am \ + uninstall-info-recursive uninstall-recursive + +# 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/kernel/Makefile.am b/kernel/Makefile.am new file mode 100644 index 0000000..0351073 --- /dev/null +++ b/kernel/Makefile.am @@ -0,0 +1,2 @@ +SUBDIRS = @OS_DIR@ +DIST_SUBDIRS = Linux diff --git a/kernel/Makefile.in b/kernel/Makefile.in new file mode 100644 index 0000000..fb67653 --- /dev/null +++ b/kernel/Makefile.in @@ -0,0 +1,450 @@ +# Makefile.in generated by automake 1.7.5 from Makefile.am. +# @configure_input@ + +# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003 +# Free Software Foundation, Inc. +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ + +srcdir = @srcdir@ +top_srcdir = @top_srcdir@ +VPATH = @srcdir@ +pkgdatadir = $(datadir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +top_builddir = .. + +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +INSTALL = @INSTALL@ +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = @build@ +host_triplet = @host@ +target_triplet = @target@ +ACLOCAL = @ACLOCAL@ +AMDEP_FALSE = @AMDEP_FALSE@ +AMDEP_TRUE = @AMDEP_TRUE@ +AMTAR = @AMTAR@ +AUTOCONF = @AUTOCONF@ +AUTOFS_INSTALL = @AUTOFS_INSTALL@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CXX = @CXX@ +CXXDEPMODE = @CXXDEPMODE@ +CXXFLAGS = @CXXFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DEBUG_FLAGS = @DEBUG_FLAGS@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +ECHO = @ECHO@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +EXEEXT = @EXEEXT@ +GCONF = @GCONF@ +GVFSCONF = @GVFSCONF@ +GVFS_CFLAGS = @GVFS_CFLAGS@ +GVFS_LDADD = @GVFS_LDADD@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +KDEBUG_FLAGS = @KDEBUG_FLAGS@ +KERNEL_DIR = @KERNEL_DIR@ +KERNEL_HDR = @KERNEL_HDR@ +LDFLAGS = @LDFLAGS@ +LIBCHIPCARD_INCLUDES = @LIBCHIPCARD_INCLUDES@ +LIBCHIPCARD_LIB = @LIBCHIPCARD_LIB@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LIBTOOL = @LIBTOOL@ +LN_S = @LN_S@ +LTLIBOBJS = @LTLIBOBJS@ +LUFS_SUID = @LUFS_SUID@ +MAKEINFO = @MAKEINFO@ +MODULES_DIR = @MODULES_DIR@ +MODV_FLAGS = @MODV_FLAGS@ +OBJEXT = @OBJEXT@ +OS_DIR = @OS_DIR@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +RANLIB = @RANLIB@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +SSHPROG = @SSHPROG@ +STRIP = @STRIP@ +VERSION = @VERSION@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_CXX = @ac_ct_CXX@ +ac_ct_RANLIB = @ac_ct_RANLIB@ +ac_ct_STRIP = @ac_ct_STRIP@ +all_includes = @all_includes@ +all_libraries = @all_libraries@ +am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ +am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ +am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@ +am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +datadir = @datadir@ +define_has_libchipcard = @define_has_libchipcard@ +exec_prefix = @exec_prefix@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localstatedir = @localstatedir@ +mandir = @mandir@ +oldincludedir = @oldincludedir@ +opt_fs = @opt_fs@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +sysconfdir = @sysconfdir@ +target = @target@ +target_alias = @target_alias@ +target_cpu = @target_cpu@ +target_os = @target_os@ +target_vendor = @target_vendor@ +SUBDIRS = @OS_DIR@ +DIST_SUBDIRS = Linux +subdir = kernel +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +mkinstalldirs = $(SHELL) $(top_srcdir)/config/mkinstalldirs +CONFIG_HEADER = $(top_builddir)/config.h +CONFIG_CLEAN_FILES = +DIST_SOURCES = + +RECURSIVE_TARGETS = info-recursive dvi-recursive pdf-recursive \ + ps-recursive install-info-recursive uninstall-info-recursive \ + all-recursive install-data-recursive install-exec-recursive \ + installdirs-recursive install-recursive uninstall-recursive \ + check-recursive installcheck-recursive +DIST_COMMON = Makefile.am Makefile.in +all: all-recursive + +.SUFFIXES: +$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4) + cd $(top_srcdir) && \ + $(AUTOMAKE) --gnu kernel/Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe) + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs + +distclean-libtool: + -rm -f libtool +uninstall-info-am: + +# This directory's subdirectories are mostly independent; you can cd +# into them and run `make' without going through this Makefile. +# To change the values of `make' variables: instead of editing Makefiles, +# (1) if the variable is set in `config.status', edit `config.status' +# (which will cause the Makefiles to be regenerated when you run `make'); +# (2) otherwise, pass the desired values on the `make' command line. +$(RECURSIVE_TARGETS): + @set fnord $$MAKEFLAGS; amf=$$2; \ + dot_seen=no; \ + target=`echo $@ | sed s/-recursive//`; \ + list='$(SUBDIRS)'; for subdir in $$list; do \ + echo "Making $$target in $$subdir"; \ + if test "$$subdir" = "."; then \ + dot_seen=yes; \ + local_target="$$target-am"; \ + else \ + local_target="$$target"; \ + fi; \ + (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ + || case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \ + done; \ + if test "$$dot_seen" = "no"; then \ + $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \ + fi; test -z "$$fail" + +mostlyclean-recursive clean-recursive distclean-recursive \ +maintainer-clean-recursive: + @set fnord $$MAKEFLAGS; amf=$$2; \ + dot_seen=no; \ + case "$@" in \ + distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ + *) list='$(SUBDIRS)' ;; \ + esac; \ + rev=''; for subdir in $$list; do \ + if test "$$subdir" = "."; then :; else \ + rev="$$subdir $$rev"; \ + fi; \ + done; \ + rev="$$rev ."; \ + target=`echo $@ | sed s/-recursive//`; \ + for subdir in $$rev; do \ + echo "Making $$target in $$subdir"; \ + if test "$$subdir" = "."; then \ + local_target="$$target-am"; \ + else \ + local_target="$$target"; \ + fi; \ + (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ + || case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \ + done && test -z "$$fail" +tags-recursive: + list='$(SUBDIRS)'; for subdir in $$list; do \ + test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \ + done +ctags-recursive: + list='$(SUBDIRS)'; for subdir in $$list; do \ + test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \ + done + +ETAGS = etags +ETAGSFLAGS = + +CTAGS = ctags +CTAGSFLAGS = + +tags: TAGS + +ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + mkid -fID $$unique + +TAGS: tags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + tags=; \ + here=`pwd`; \ + if (etags --etags-include --version) >/dev/null 2>&1; then \ + include_option=--etags-include; \ + else \ + include_option=--include; \ + fi; \ + list='$(SUBDIRS)'; for subdir in $$list; do \ + if test "$$subdir" = .; then :; else \ + test -f $$subdir/TAGS && \ + tags="$$tags $$include_option=$$here/$$subdir/TAGS"; \ + fi; \ + done; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + test -z "$(ETAGS_ARGS)$$tags$$unique" \ + || $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$tags $$unique + +ctags: CTAGS +CTAGS: ctags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + tags=; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + test -z "$(CTAGS_ARGS)$$tags$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$tags $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && cd $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) $$here + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) + +top_distdir = .. +distdir = $(top_distdir)/$(PACKAGE)-$(VERSION) + +distdir: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \ + list='$(DISTFILES)'; for file in $$list; do \ + case $$file in \ + $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ + $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ + esac; \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test "$$dir" != "$$file" && test "$$dir" != "."; then \ + dir="/$$dir"; \ + $(mkinstalldirs) "$(distdir)$$dir"; \ + else \ + dir=''; \ + fi; \ + if test -d $$d/$$file; then \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ + fi; \ + cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ + else \ + test -f $(distdir)/$$file \ + || cp -p $$d/$$file $(distdir)/$$file \ + || exit 1; \ + fi; \ + done + list='$(DIST_SUBDIRS)'; for subdir in $$list; do \ + if test "$$subdir" = .; then :; else \ + test -d $(distdir)/$$subdir \ + || mkdir $(distdir)/$$subdir \ + || exit 1; \ + (cd $$subdir && \ + $(MAKE) $(AM_MAKEFLAGS) \ + top_distdir="$(top_distdir)" \ + distdir=../$(distdir)/$$subdir \ + distdir) \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-recursive +all-am: Makefile +installdirs: installdirs-recursive +installdirs-am: + +install: install-recursive +install-exec: install-exec-recursive +install-data: install-data-recursive +uninstall: uninstall-recursive + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-recursive +install-strip: + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + INSTALL_STRIP_FLAG=-s \ + `test -z '$(STRIP)' || \ + echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -rm -f Makefile $(CONFIG_CLEAN_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +clean: clean-recursive + +clean-am: clean-generic clean-libtool mostlyclean-am + +distclean: distclean-recursive + +distclean-am: clean-am distclean-generic distclean-libtool \ + distclean-tags + +dvi: dvi-recursive + +dvi-am: + +info: info-recursive + +info-am: + +install-data-am: + +install-exec-am: + +install-info: install-info-recursive + +install-man: + +installcheck-am: + +maintainer-clean: maintainer-clean-recursive + +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-recursive + +mostlyclean-am: mostlyclean-generic mostlyclean-libtool + +pdf: pdf-recursive + +pdf-am: + +ps: ps-recursive + +ps-am: + +uninstall-am: uninstall-info-am + +uninstall-info: uninstall-info-recursive + +.PHONY: $(RECURSIVE_TARGETS) CTAGS GTAGS all all-am check check-am clean \ + clean-generic clean-libtool clean-recursive ctags \ + ctags-recursive distclean distclean-generic distclean-libtool \ + distclean-recursive distclean-tags distdir dvi dvi-am \ + dvi-recursive info info-am info-recursive install install-am \ + install-data install-data-am install-data-recursive \ + install-exec install-exec-am install-exec-recursive \ + install-info install-info-am install-info-recursive install-man \ + install-recursive install-strip installcheck installcheck-am \ + installdirs installdirs-am installdirs-recursive \ + maintainer-clean maintainer-clean-generic \ + maintainer-clean-recursive mostlyclean mostlyclean-generic \ + mostlyclean-libtool mostlyclean-recursive pdf pdf-am \ + pdf-recursive ps ps-am ps-recursive tags tags-recursive \ + uninstall uninstall-am uninstall-info-am \ + uninstall-info-recursive uninstall-recursive + +# 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/lufs.spec b/lufs.spec new file mode 100644 index 0000000..feee862 --- /dev/null +++ b/lufs.spec @@ -0,0 +1,105 @@ +# Your kernel version, tries to auto-detect here +%define kernelversion %(uname -r) + +%define name lufs +%define version 0.8.2 + +Summary: lufs - Linux Userland File System +Name: %{name} +Version: %{version} +Release: 1 +License: GPL +Group: Base +Source0: %{name}-%{version}.tar.gz +Patch1: lufs-rpmbuild.patch + +BuildRequires: autoconf +BuildRequires: automake +BuildRequires: libtool +#BuildRequires: kernel-source = %{kernelversion} + +Requires: kernel = %{kernelversion} + +BuildRoot: /tmp/buildroot-%{name}-%{version} + +%description +LUFS is a hybrid userspace filesystem framework supporting many filesystems: +sshfs, ftpfs, localfs, locasefs, gvfs, cardfs, cefs, etc. Lots of other +"exotic" filesystems are in the planning phase: socketfs, httpfs, freenetfs +and others. + + +%prep +%setup -q + +%patch1 -p1 + +%build +%{__libtoolize} +aclocal +%{__autoconf} +%{__automake} +%configure \ + --with-kernel=%{kernelversion} \ + --with-kheaders=/lib/modules/%{kernelversion}/build/include +%{__make} + +%install +rm -rf $RPM_BUILD_ROOT + +%{__make} install \ + DESTDIR=$RPM_BUILD_ROOT + +%clean +rm -rf $RPM_BUILD_ROOT + +%post + +ln -s /usr/bin/auto.sshfs /etc/auto.sshfs +ln -s /usr/bin/auto.ftpfs /etc/auto.ftpfs +ln -s /usr/bin/lufsd /sbin/mount.lufs + +depmod -a + +if [ "`lsmod | grep lufs`" ]; then rmmod lufs; fi + +modprobe lufs + +%preun + +if [ "`lsmod | grep lufs`" ]; then rmmod lufs; fi + +%postun + +depmod -a + +rm -f /etc/auto.sshfs +rm -f /etc/auto.ftpfs +rm -f /sbin/mount.lufs + + +%files +%defattr(644,root,root) + +/lib/modules/%{kernelversion}/kernel/fs/lufs/lufs.o +/etc/lufsd.conf + +%defattr(755,root,root) + +/usr/bin/lufsd +/usr/bin/lussh +/usr/bin/lufsmount + +/usr/bin/auto.sshfs +/usr/bin/auto.ftpfs + +# These are SUID root... + +%defattr(4755,root,root) +/usr/bin/lufsmnt +/usr/bin/lufsumount + + +%changelog +* Sun Nov 24 2002 Dave Wilson +- initial version diff --git a/lufsd/Makefile.am b/lufsd/Makefile.am new file mode 100644 index 0000000..bc207cd --- /dev/null +++ b/lufsd/Makefile.am @@ -0,0 +1,21 @@ +INCLUDES=-I../ @all_includes@ + +EXTRA_DIST=lussh lufsd.conf + +configdir=/etc +config_DATA=lufsd.conf + +bin_PROGRAMS=lufsd +bin_SCRIPTS=lussh + +noinst_HEADERS=message.h fsctl.h filesystem.h dircache.h list.h + +lufsd_SOURCES=daemon.c message.c fsctl.c filesystem.c dircache.c options.c + +lufsd_LDADD= -ldl -lstdc++ @GVFS_LDADD@ +lufsd_LDFLAGS= -rdynamic -lpthread + +install-exec-hook: + @echo "lufsd post install configuration..." + $(mkinstalldirs) $(DESTDIR)/sbin + ln -fs $(DESTDIR)$(bindir)/lufsd $(DESTDIR)/sbin/mount.lufs diff --git a/lufsd/Makefile.in b/lufsd/Makefile.in new file mode 100644 index 0000000..ccbb3b5 --- /dev/null +++ b/lufsd/Makefile.in @@ -0,0 +1,528 @@ +# Makefile.in generated by automake 1.7.5 from Makefile.am. +# @configure_input@ + +# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003 +# Free Software Foundation, Inc. +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ + +srcdir = @srcdir@ +top_srcdir = @top_srcdir@ +VPATH = @srcdir@ +pkgdatadir = $(datadir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +top_builddir = .. + +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +INSTALL = @INSTALL@ +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = @build@ +host_triplet = @host@ +target_triplet = @target@ +ACLOCAL = @ACLOCAL@ +AMDEP_FALSE = @AMDEP_FALSE@ +AMDEP_TRUE = @AMDEP_TRUE@ +AMTAR = @AMTAR@ +AUTOCONF = @AUTOCONF@ +AUTOFS_INSTALL = @AUTOFS_INSTALL@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CXX = @CXX@ +CXXDEPMODE = @CXXDEPMODE@ +CXXFLAGS = @CXXFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DEBUG_FLAGS = @DEBUG_FLAGS@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +ECHO = @ECHO@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +EXEEXT = @EXEEXT@ +GCONF = @GCONF@ +GVFSCONF = @GVFSCONF@ +GVFS_CFLAGS = @GVFS_CFLAGS@ +GVFS_LDADD = @GVFS_LDADD@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +KDEBUG_FLAGS = @KDEBUG_FLAGS@ +KERNEL_DIR = @KERNEL_DIR@ +KERNEL_HDR = @KERNEL_HDR@ +LDFLAGS = @LDFLAGS@ +LIBCHIPCARD_INCLUDES = @LIBCHIPCARD_INCLUDES@ +LIBCHIPCARD_LIB = @LIBCHIPCARD_LIB@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LIBTOOL = @LIBTOOL@ +LN_S = @LN_S@ +LTLIBOBJS = @LTLIBOBJS@ +LUFS_SUID = @LUFS_SUID@ +MAKEINFO = @MAKEINFO@ +MODULES_DIR = @MODULES_DIR@ +MODV_FLAGS = @MODV_FLAGS@ +OBJEXT = @OBJEXT@ +OS_DIR = @OS_DIR@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +RANLIB = @RANLIB@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +SSHPROG = @SSHPROG@ +STRIP = @STRIP@ +VERSION = @VERSION@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_CXX = @ac_ct_CXX@ +ac_ct_RANLIB = @ac_ct_RANLIB@ +ac_ct_STRIP = @ac_ct_STRIP@ +all_includes = @all_includes@ +all_libraries = @all_libraries@ +am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ +am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ +am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@ +am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +datadir = @datadir@ +define_has_libchipcard = @define_has_libchipcard@ +exec_prefix = @exec_prefix@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localstatedir = @localstatedir@ +mandir = @mandir@ +oldincludedir = @oldincludedir@ +opt_fs = @opt_fs@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +sysconfdir = @sysconfdir@ +target = @target@ +target_alias = @target_alias@ +target_cpu = @target_cpu@ +target_os = @target_os@ +target_vendor = @target_vendor@ +INCLUDES = -I../ @all_includes@ + +EXTRA_DIST = lussh lufsd.conf + +configdir = /etc +config_DATA = lufsd.conf + +bin_PROGRAMS = lufsd +bin_SCRIPTS = lussh + +noinst_HEADERS = message.h fsctl.h filesystem.h dircache.h list.h + +lufsd_SOURCES = daemon.c message.c fsctl.c filesystem.c dircache.c options.c + +lufsd_LDADD = -ldl -lstdc++ @GVFS_LDADD@ +lufsd_LDFLAGS = -rdynamic -lpthread +subdir = lufsd +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +mkinstalldirs = $(SHELL) $(top_srcdir)/config/mkinstalldirs +CONFIG_HEADER = $(top_builddir)/config.h +CONFIG_CLEAN_FILES = +bin_PROGRAMS = lufsd$(EXEEXT) +PROGRAMS = $(bin_PROGRAMS) + +am_lufsd_OBJECTS = daemon.$(OBJEXT) message.$(OBJEXT) fsctl.$(OBJEXT) \ + filesystem.$(OBJEXT) dircache.$(OBJEXT) options.$(OBJEXT) +lufsd_OBJECTS = $(am_lufsd_OBJECTS) +lufsd_DEPENDENCIES = +SCRIPTS = $(bin_SCRIPTS) + + +DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir) +depcomp = $(SHELL) $(top_srcdir)/config/depcomp +am__depfiles_maybe = depfiles +@AMDEP_TRUE@DEP_FILES = ./$(DEPDIR)/daemon.Po ./$(DEPDIR)/dircache.Po \ +@AMDEP_TRUE@ ./$(DEPDIR)/filesystem.Po ./$(DEPDIR)/fsctl.Po \ +@AMDEP_TRUE@ ./$(DEPDIR)/message.Po ./$(DEPDIR)/options.Po +COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ + $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +LTCOMPILE = $(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) \ + $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +CCLD = $(CC) +LINK = $(LIBTOOL) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ + $(AM_LDFLAGS) $(LDFLAGS) -o $@ +DIST_SOURCES = $(lufsd_SOURCES) +DATA = $(config_DATA) + +HEADERS = $(noinst_HEADERS) + +DIST_COMMON = $(noinst_HEADERS) Makefile.am Makefile.in +SOURCES = $(lufsd_SOURCES) + +all: all-am + +.SUFFIXES: +.SUFFIXES: .c .lo .o .obj +$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4) + cd $(top_srcdir) && \ + $(AUTOMAKE) --gnu lufsd/Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe) +binPROGRAMS_INSTALL = $(INSTALL_PROGRAM) +install-binPROGRAMS: $(bin_PROGRAMS) + @$(NORMAL_INSTALL) + $(mkinstalldirs) $(DESTDIR)$(bindir) + @list='$(bin_PROGRAMS)'; for p in $$list; do \ + p1=`echo $$p|sed 's/$(EXEEXT)$$//'`; \ + if test -f $$p \ + || test -f $$p1 \ + ; then \ + f=`echo "$$p1" | sed 's,^.*/,,;$(transform);s/$$/$(EXEEXT)/'`; \ + echo " $(INSTALL_PROGRAM_ENV) $(LIBTOOL) --mode=install $(binPROGRAMS_INSTALL) $$p $(DESTDIR)$(bindir)/$$f"; \ + $(INSTALL_PROGRAM_ENV) $(LIBTOOL) --mode=install $(binPROGRAMS_INSTALL) $$p $(DESTDIR)$(bindir)/$$f || exit 1; \ + else :; fi; \ + done + +uninstall-binPROGRAMS: + @$(NORMAL_UNINSTALL) + @list='$(bin_PROGRAMS)'; for p in $$list; do \ + f=`echo "$$p" | sed 's,^.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/'`; \ + echo " rm -f $(DESTDIR)$(bindir)/$$f"; \ + rm -f $(DESTDIR)$(bindir)/$$f; \ + done + +clean-binPROGRAMS: + @list='$(bin_PROGRAMS)'; for p in $$list; do \ + f=`echo $$p|sed 's/$(EXEEXT)$$//'`; \ + echo " rm -f $$p $$f"; \ + rm -f $$p $$f ; \ + done +lufsd$(EXEEXT): $(lufsd_OBJECTS) $(lufsd_DEPENDENCIES) + @rm -f lufsd$(EXEEXT) + $(LINK) $(lufsd_LDFLAGS) $(lufsd_OBJECTS) $(lufsd_LDADD) $(LIBS) +binSCRIPT_INSTALL = $(INSTALL_SCRIPT) +install-binSCRIPTS: $(bin_SCRIPTS) + @$(NORMAL_INSTALL) + $(mkinstalldirs) $(DESTDIR)$(bindir) + @list='$(bin_SCRIPTS)'; for p in $$list; do \ + if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ + if test -f $$d$$p; then \ + f=`echo "$$p" | sed 's|^.*/||;$(transform)'`; \ + echo " $(binSCRIPT_INSTALL) $$d$$p $(DESTDIR)$(bindir)/$$f"; \ + $(binSCRIPT_INSTALL) $$d$$p $(DESTDIR)$(bindir)/$$f; \ + else :; fi; \ + done + +uninstall-binSCRIPTS: + @$(NORMAL_UNINSTALL) + @list='$(bin_SCRIPTS)'; for p in $$list; do \ + f=`echo "$$p" | sed 's|^.*/||;$(transform)'`; \ + echo " rm -f $(DESTDIR)$(bindir)/$$f"; \ + rm -f $(DESTDIR)$(bindir)/$$f; \ + done + +mostlyclean-compile: + -rm -f *.$(OBJEXT) core *.core + +distclean-compile: + -rm -f *.tab.c + +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/daemon.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dircache.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/filesystem.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fsctl.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/message.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/options.Po@am__quote@ + +distclean-depend: + -rm -rf ./$(DEPDIR) + +.c.o: +@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" \ +@am__fastdepCC_TRUE@ -c -o $@ `test -f '$<' || echo '$(srcdir)/'`$<; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; \ +@am__fastdepCC_TRUE@ else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; \ +@am__fastdepCC_TRUE@ fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(COMPILE) -c `test -f '$<' || echo '$(srcdir)/'`$< + +.c.obj: +@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" \ +@am__fastdepCC_TRUE@ -c -o $@ `if test -f '$<'; then $(CYGPATH_W) '$<'; else $(CYGPATH_W) '$(srcdir)/$<'; fi`; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; \ +@am__fastdepCC_TRUE@ else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; \ +@am__fastdepCC_TRUE@ fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(COMPILE) -c `if test -f '$<'; then $(CYGPATH_W) '$<'; else $(CYGPATH_W) '$(srcdir)/$<'; fi` + +.c.lo: +@am__fastdepCC_TRUE@ if $(LTCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" \ +@am__fastdepCC_TRUE@ -c -o $@ `test -f '$<' || echo '$(srcdir)/'`$<; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Plo"; \ +@am__fastdepCC_TRUE@ else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; \ +@am__fastdepCC_TRUE@ fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/$*.Plo' tmpdepfile='$(DEPDIR)/$*.TPlo' @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ `test -f '$<' || echo '$(srcdir)/'`$< + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs + +distclean-libtool: + -rm -f libtool +uninstall-info-am: +configDATA_INSTALL = $(INSTALL_DATA) +install-configDATA: $(config_DATA) + @$(NORMAL_INSTALL) + $(mkinstalldirs) $(DESTDIR)$(configdir) + @list='$(config_DATA)'; for p in $$list; do \ + if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ + f="`echo $$p | sed -e 's|^.*/||'`"; \ + echo " $(configDATA_INSTALL) $$d$$p $(DESTDIR)$(configdir)/$$f"; \ + $(configDATA_INSTALL) $$d$$p $(DESTDIR)$(configdir)/$$f; \ + done + +uninstall-configDATA: + @$(NORMAL_UNINSTALL) + @list='$(config_DATA)'; for p in $$list; do \ + f="`echo $$p | sed -e 's|^.*/||'`"; \ + echo " rm -f $(DESTDIR)$(configdir)/$$f"; \ + rm -f $(DESTDIR)$(configdir)/$$f; \ + done + +ETAGS = etags +ETAGSFLAGS = + +CTAGS = ctags +CTAGSFLAGS = + +tags: TAGS + +ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + mkid -fID $$unique + +TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + tags=; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + test -z "$(ETAGS_ARGS)$$tags$$unique" \ + || $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$tags $$unique + +ctags: CTAGS +CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + tags=; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + test -z "$(CTAGS_ARGS)$$tags$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$tags $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && cd $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) $$here + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) + +top_distdir = .. +distdir = $(top_distdir)/$(PACKAGE)-$(VERSION) + +distdir: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \ + list='$(DISTFILES)'; for file in $$list; do \ + case $$file in \ + $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ + $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ + esac; \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test "$$dir" != "$$file" && test "$$dir" != "."; then \ + dir="/$$dir"; \ + $(mkinstalldirs) "$(distdir)$$dir"; \ + else \ + dir=''; \ + fi; \ + if test -d $$d/$$file; then \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ + fi; \ + cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ + else \ + test -f $(distdir)/$$file \ + || cp -p $$d/$$file $(distdir)/$$file \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-am +all-am: Makefile $(PROGRAMS) $(SCRIPTS) $(DATA) $(HEADERS) + +installdirs: + $(mkinstalldirs) $(DESTDIR)$(bindir) $(DESTDIR)$(bindir) $(DESTDIR)$(configdir) +install: install-am +install-exec: install-exec-am +install-data: install-data-am +uninstall: uninstall-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-am +install-strip: + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + INSTALL_STRIP_FLAG=-s \ + `test -z '$(STRIP)' || \ + echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -rm -f Makefile $(CONFIG_CLEAN_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +clean: clean-am + +clean-am: clean-binPROGRAMS clean-generic clean-libtool mostlyclean-am + +distclean: distclean-am + +distclean-am: clean-am distclean-compile distclean-depend \ + distclean-generic distclean-libtool distclean-tags + +dvi: dvi-am + +dvi-am: + +info: info-am + +info-am: + +install-data-am: install-configDATA + +install-exec-am: install-binPROGRAMS install-binSCRIPTS + @$(NORMAL_INSTALL) + $(MAKE) $(AM_MAKEFLAGS) install-exec-hook + +install-info: install-info-am + +install-man: + +installcheck-am: + +maintainer-clean: maintainer-clean-am + +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-compile mostlyclean-generic \ + mostlyclean-libtool + +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + +uninstall-am: uninstall-binPROGRAMS uninstall-binSCRIPTS \ + uninstall-configDATA uninstall-info-am + +.PHONY: CTAGS GTAGS all all-am check check-am clean clean-binPROGRAMS \ + clean-generic clean-libtool ctags distclean distclean-compile \ + distclean-depend distclean-generic distclean-libtool \ + distclean-tags distdir dvi dvi-am info info-am install \ + install-am install-binPROGRAMS install-binSCRIPTS \ + install-configDATA install-data install-data-am install-exec \ + install-exec-am install-info install-info-am install-man \ + install-strip installcheck installcheck-am installdirs \ + maintainer-clean maintainer-clean-generic mostlyclean \ + mostlyclean-compile mostlyclean-generic mostlyclean-libtool pdf \ + pdf-am ps ps-am tags uninstall uninstall-am \ + uninstall-binPROGRAMS uninstall-binSCRIPTS uninstall-configDATA \ + uninstall-info-am + + +install-exec-hook: + @echo "lufsd post install configuration..." + $(mkinstalldirs) $(DESTDIR)/sbin + ln -fs $(DESTDIR)$(bindir)/lufsd $(DESTDIR)/sbin/mount.lufs +# 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/lufsd/daemon.c b/lufsd/daemon.c new file mode 100644 index 0000000..ec60609 --- /dev/null +++ b/lufsd/daemon.c @@ -0,0 +1,255 @@ +/* + * daemon.c + * Copyright (C) 2002 Florin Malita + * + * This file is part of LUFS, a free userspace filesystem implementation. + * See http://lufs.sourceforge.net/ for updates. + * + * LUFS 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. + * + * LUFS 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 +#include +#include +#include + + +#include +#include + +#include "list.h" +#include "message.h" +#include "filesystem.h" +#include "fsctl.h" + +#define CONFIG_FILE1 "/etc/lufsd.conf" +#define CONFIG_FILE2 "~/.lufs/lufsd.conf" + +const char *exec_paths[]={ + "/usr/local/bin/lufsmnt", + "/usr/bin/lufsmnt", + "/sbin/lufsmnt", + NULL +}; + +int +tempsock(char *base, char *name){ + struct sockaddr_un addr; + unsigned long rnd; + int sock, res; + + if((sock = socket(PF_UNIX, SOCK_STREAM, 0)) < 0){ + ERROR("socket error: %s", strerror(errno)); + return sock; + } + + addr.sun_family = AF_UNIX; + + do{ + rnd = random(); + sprintf(addr.sun_path, "%s%lu", base, rnd); + + TRACE("trying address %s", addr.sun_path); + + res = bind(sock, (struct sockaddr*)&addr, sizeof(addr)); + }while((res < 0) && (errno == EADDRINUSE)); + + if(res < 0){ + ERROR("bind error: %s", strerror(errno)); + return res; + } + + if((res = listen(sock, 10)) < 0){ + ERROR("listen error: %s", strerror(errno)); + return res; + } + + if(name) + strcpy(name, addr.sun_path); + + return sock; +} + +int +main(int argc, char **argv){ + char *service, *mountpoint, *odata; + struct list_head cfg; + struct fs_ctl *ctl; + char tmp[256], *nopts; + int ssock, pid, mpid, res; + + INIT_LIST_HEAD(&cfg); + + srandom(time(NULL)); + + if((argc < 5) || (strcmp(argv[3], "-o")) ){ + ERROR("Usage: %s none -o [options, ...]", argv[0]); + exit(1); + } + + if(argc > 5){ + TRACE("more options than expected..."); + } + + service = argv[1]; + mountpoint = argv[2]; + odata = argv[4]; + + + nopts = malloc(strlen(odata) + 100); + if(!nopts){ + ERROR("out of memory!"); + exit(1); + } + + strcpy(nopts, odata); + + if(lu_opt_parse(&cfg, "MOUNT", odata) < 0){ + ERROR("could not parse options!"); + exit(1); + } + + if((lu_opt_loadcfg(&cfg, CONFIG_FILE1) < 0)) + lu_opt_loadcfg(&cfg, CONFIG_FILE2); + + if(!(ctl = lu_fsctl_create(&cfg))){ + WARN("could not create fs_ctl!"); + exit(1); + } + + if(!lu_fsctl_mount(ctl)){ + ERROR("could not mount filesystem!"); + lu_fsctl_destroy(ctl); + exit(1); + } + + if((ssock = tempsock("/tmp/lufsd", tmp)) < 0) + exit(1); + + TRACE("starting filesystem master at %s", tmp); + + chmod(tmp, S_IRWXU | S_IRWXG | S_IRWXO); + + /* detach & launch FSCtl */ + + if((pid = fork()) < 0){ + ERROR("fork failed!"); + exit(1); + }else + if(pid == 0){ + int fd; + const char *quiet; + + quiet = lu_opt_getchar(&cfg, "MOUNT", "quiet"); + + if((fd = open("/dev/tty", O_RDWR, 0)) < 0){ + WARN("couldn't open tty, assuming still ok..."); + fflush(stdout); + }else{ + ioctl(fd, TIOCNOTTY, 0); + close(fd); + setsid(); + } + + free(nopts); + + if(quiet){ + int stdfd; + + TRACE("going dumb..."); + if((stdfd = open("/dev/null", O_RDWR, 0)) < 0){ + WARN("couldn't open /dev/null!"); + }else{ + dup2(stdfd, 0); + dup2(stdfd, 1); + dup2(stdfd, 2); + close(stdfd); + } + } + + /* launching FSCtl... */ + lu_fsctl_run(ctl, ssock, tmp); + exit(1); + } + + + sprintf(nopts, "%s,server_socket=%s,server_pid=%d", nopts, tmp, pid); + + /* execute lufsmnt and wait for it. */ + + if((mpid = fork()) < 0){ + ERROR("fork failed!"); + kill(pid, SIGUSR1); + exit(1); + }else + if(mpid == 0){ + char *args[4]; + const char *p; + + args[0] = "lufsmnt"; + args[1] = mountpoint; + args[2] = nopts; + args[3] = NULL; + + TRACE("executing %s %s %s", args[0], args[1], args[2]); + execvp("lufsmnt", args); + WARN("execvp of lufsmnt failed: %s", strerror(errno)); + WARN("you don't seem to have lufsmnt in your path. trying regular locations..."); + + for(p = exec_paths[0]; p; p++){ + TRACE("trying %s %s %s", p, args[1], args[2]); + execv(p, args); + } + + ERROR("could not launch lufsmnt!\n"); + exit(1); + } + + if(waitpid(mpid, &res, 0) < 0){ + ERROR("waitpid failed!"); + kill(pid, SIGUSR1); + exit(1); + } + + if(WIFEXITED(res) && WEXITSTATUS(res) != 0){ + kill(pid, SIGUSR1); + exit(1); + } + + TRACE("mount succeded"); + + return 0; +} + + + + + + + diff --git a/lufsd/dircache.c b/lufsd/dircache.c new file mode 100644 index 0000000..ae0a323 --- /dev/null +++ b/lufsd/dircache.c @@ -0,0 +1,490 @@ +/* + * dircache.c + * Copyright (C) 2002 Florin Malita + * + * This file is part of LUFS, a free userspace filesystem implementation. + * See http://lufs.sourceforge.net/ for updates. + * + * LUFS 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. + * + * LUFS 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 "list.h" +#include "dircache.h" + +static char root_dir[]="/"; +static char current_dir[]="."; + +static unsigned long +hash(char *name){ + unsigned long res = 0; + int i; + + for(i = 0; i < strlen(name); i++) + if(name[i] != '/') + res = 0x21413 * (res + name[i]); + + return res % NBUCKETS; +} + +static void +delete_dir(struct directory *d){ + struct list_head *p, *tmp; + struct direntry *de; + + TRACE("in"); + list_for_each_safe(p, tmp, &d->d_entries){ + de = list_entry(p, struct direntry, e_list); + list_del(&de->e_list); + free(de->e_name); + if(de->e_link) + free(de->e_link); + free(de); + } + + list_del(&d->d_list); + free(d->d_name); + free(d); + + TRACE("out"); +} + +struct dir_cache* +lu_cache_create(struct list_head *cfg){ + struct dir_cache *cache; + int i; + const char *c; + + TRACE("creating dir cache..."); + + if(!(cache = malloc(sizeof(struct dir_cache)))) + return NULL; + + memset(cache, 0, sizeof(struct dir_cache)); + + for(i = 0; i < NBUCKETS; i++) + INIT_LIST_HEAD(&cache->buckets[i]); + + pthread_mutex_init(&cache->lock, NULL); + + cache->ttl = DEF_TTL; + if((c = lu_opt_getchar(cfg, "LUFSD", "DirCacheTTL")) && atoi(c)) + cache->ttl = atoi(c); + if((c = lu_opt_getchar(cfg, "MOUNT", "dir_cache_ttl")) && atoi(c)) + cache->ttl = atoi(c); + + cache->entries = DEF_NENTRIES; + if((c = lu_opt_getchar(cfg, "LUFSD", "DirCacheEntries")) && atoi(c)) + cache->entries = atoi(c); + if((c = lu_opt_getchar(cfg, "MOUNT", "dir_cache_entries")) && atoi(c)) + cache->entries = atoi(c); + + TRACE("entries: %d, ttl: %d", cache->entries, cache->ttl); + + return cache; +} + +void +lu_cache_destroy(struct dir_cache *cache){ + struct list_head *p, *tmp; + int i; + + for(i = 0; i < NBUCKETS; i++){ + list_for_each_safe(p, tmp, &cache->buckets[i]){ + delete_dir(list_entry(p, struct directory, d_list)); + } + } + + free(cache); +} + +static struct directory* +search(struct dir_cache *cache, char *dir){ + struct list_head *p, *tmp; + struct directory *d; + int hsh; + + hsh = hash(dir); + + TRACE("search %s in bucket %u, size=%u", dir, hsh, cache->lengths[hsh]); + + list_for_each_safe(p, tmp, &cache->buckets[hsh]){ + d = list_entry(p, struct directory, d_list); + + if(time(NULL) - d->d_stamp >= cache->ttl){ + TRACE("%s expired...", d->d_name); + delete_dir(d); + cache->lengths[hsh]--; + TRACE("directory deleted"); + }else if(!strcmp(dir, d->d_name)){ + TRACE("%s found", dir); + d->d_stamp = time(NULL); + return d; + } + } + + TRACE("dir not found"); + return NULL; +} + +int +lu_cache_lookup(struct dir_cache *cache, char *dir, char *file, struct lufs_fattr *fattr, char *link, int buflen){ + struct directory *d; + struct direntry *de; + struct list_head *p; + int res = -1; + + TRACE("looking up %s in dir %s", file, dir); + + pthread_mutex_lock(&cache->lock); + + if(!(d = search(cache, dir))) + goto out; + + list_for_each(p, &d->d_entries){ + de = list_entry(p, struct direntry, e_list); + if(!strcmp(file, de->e_name)){ + TRACE("file found"); + + memcpy(fattr, &de->e_attr, sizeof(struct lufs_fattr)); + if(link){ + if(de->e_link){ + if(snprintf(link, buflen, "%s", de->e_link) >= buflen){ + WARN("link too long!"); + link[buflen - 1] =0; + } + }else{ + link[0] = 0; + } + } + + res = 0; + goto out; + } + } + + TRACE("file not found!"); + + out: + pthread_mutex_unlock(&cache->lock); + return res; +} + +static void +shrink(struct dir_cache *cache, int hsh){ + struct directory *dir; + + TRACE("shrinking bucket %u, len=%u", hsh, cache->lengths[hsh]); + + if(list_empty(&cache->buckets[hsh])) + return; + + dir = list_entry(cache->buckets[hsh].prev, struct directory, d_list); + + TRACE("deleting dir %s", dir->d_name); + + delete_dir(dir); + cache->lengths[hsh]--; +} + +static void +check_dir(struct directory *d){ + struct list_head *p, *tmp; + struct direntry *e; + struct lufs_fattr dummy; + int dot = 0, dotdot = 0; + + memset(&dummy, 0, sizeof(struct lufs_fattr)); + dummy.f_nlink = 1; + dummy.f_uid = dummy.f_gid = 1; + dummy.f_mode = S_IFDIR | S_IRWXU | S_IRGRP | S_IXGRP; + dummy.f_mtime = dummy.f_atime = dummy.f_ctime = time(NULL); + dummy.f_size = 512; + + do{ + list_for_each_safe(p, tmp, &d->d_entries){ + e = list_entry(p, struct direntry, e_list); + + if(!strcmp(e->e_name, ".")){ + TRACE("'.' entry found"); + list_del(&e->e_list); + list_add(&e->e_list, &d->d_entries); + dot = 1; + continue; + } + + if(!strcmp(e->e_name, "..")){ + TRACE("'..' entry found"); + list_del(&e->e_list); + if(!dot) + list_add(&e->e_list, &d->d_entries); + else + list_add(&e->e_list, d->d_entries.next); + + dotdot = 1; + } + } + + if(!dot) + lu_cache_add2dir(d, ".", NULL, &dummy); + + if(!dotdot) + lu_cache_add2dir(d, "..", NULL, &dummy); + + }while((!dot) || (!dotdot)); + +} + +void +lu_cache_add_dir(struct dir_cache *cache, struct directory *d){ + struct directory *dir; + int hsh; + + hsh = hash(d->d_name); + + TRACE("adding dir %s to bucket %i", d->d_name, hsh); + + check_dir(d); + + pthread_mutex_lock(&cache->lock); + + if((dir = search(cache, d->d_name))){ + TRACE("directory already in cache, deleting..."); + delete_dir(dir); + cache->lengths[hsh]--; + } + + d->d_stamp = time(NULL); + + list_add(&d->d_list, &cache->buckets[hsh]); + cache->lengths[hsh]++; + + while(cache->lengths[hsh] > cache->entries) + shrink(cache, hsh); + + pthread_mutex_unlock(&cache->lock); + + TRACE("out"); +} + +int +lu_cache_readdir(struct dir_cache *cache, char *dir, int offset, char *buf, int buflen){ + struct directory *d; + struct direntry *de; + struct list_head *p; + int slen, res = -1; + unsigned len = 0, off = 0; + + TRACE("reading directory %s", dir); + + pthread_mutex_lock(&cache->lock); + + if(!(d = search(cache, dir))) + goto out; + + buf[0] = 0; + + list_for_each(p, &d->d_entries){ + if(off >= offset){ + de = list_entry(p, struct direntry, e_list); + slen = strlen(de->e_name); + + if(len + slen + 2 >= buflen){ + TRACE("buffer filled up"); + break; + } + + strcat(buf, de->e_name); + strcat(buf, "\n"); + + len += slen + 1; + } + + off++; + } + + d->d_stamp = time(NULL); + + res = len; + + out: + pthread_mutex_unlock(&cache->lock); + TRACE("out"); + return res; +} + +int +lu_cache_lookup_file(struct dir_cache *cache, char *file, struct lufs_fattr *fattr, char *link, int buflen){ + int res; + + char *sep, *dir; + + if(!(sep = strrchr(file, '/'))){ + WARN("separator not present!"); + return -1; + } + + *sep = 0; + + if(sep == file) + dir = root_dir; + else + dir = file; + + if(*(sep+1)) + file = sep + 1; + else + file = current_dir; + + TRACE("dir: %s, file: %s", dir, file); + + res = lu_cache_lookup(cache, dir, file, fattr, link, buflen); + *sep = '/'; + + return res; +} + +int +lu_cache_invalidate(struct dir_cache *cache, char *file){ + struct directory *d; + char *sep, *dir; + + if(!(sep = strrchr(file, '/'))){ + WARN("separator not present!"); + return -1; + } + + *sep = 0; + + if(sep == file) + dir = root_dir; + else + dir = file; + + TRACE("invalidating dir %s", dir); + + pthread_mutex_lock(&cache->lock); + + if(!(d = search(cache, dir))){ + *sep = '/'; + pthread_mutex_unlock(&cache->lock); + return -1; + } + + d->d_stamp = 0; + + pthread_mutex_unlock(&cache->lock); + *sep = '/'; + + return 0; +} + +struct directory* +lu_cache_mkdir(char *dir){ + struct directory *res; + + TRACE("create dir %s", dir); + + if(!(res = malloc(sizeof(struct directory)))){ + WARN("out of mem!"); + return NULL; + } + + memset(res, 0, sizeof(struct directory)); + + if(!(res->d_name = malloc(strlen(dir) + 1))){ + WARN("out of mem!"); + free(res); + return NULL; + } + + INIT_LIST_HEAD(&res->d_entries); + res->d_stamp = time(NULL); + strcpy(res->d_name, dir); + + return res; +} + +int +lu_cache_add2dir(struct directory *d, char *fname, char *link, struct lufs_fattr *fattr){ + struct direntry *de; + + TRACE("adding %s->%s to %s", fname, link, d->d_name); + + if(!(de = malloc(sizeof(struct direntry)))) + goto fail; + + + if(!(de->e_name = malloc(strlen(fname) + 1))) + goto fail_de; + + + if(link) + de->e_link = malloc(strlen(link) + 1); + else + de->e_link = malloc(2); + + if(!de->e_link) + goto fail_ename; + + memcpy(&de->e_attr, fattr, sizeof(struct lufs_fattr)); + strcpy(de->e_name, fname); + if(link) + strcpy(de->e_link, link); + else + strcpy(de->e_link, ""); + + list_add_tail(&de->e_list, &d->d_entries); + + return 0; + + fail_ename: + free(de->e_name); + fail_de: + free(de); + fail: + WARN("out of mem!"); + return -1; +} + +void +lu_cache_killdir(struct directory *d){ + struct list_head *p, *tmp; + struct direntry *de; + + TRACE("in"); + + list_for_each_safe(p, tmp, &d->d_entries){ + de = list_entry(p, struct direntry, e_list); + list_del(&de->e_list); + free(de->e_name); + if(de->e_link) + free(de->e_link); + free(de); + } + + free(d->d_name); + free(d); + +} diff --git a/lufsd/dircache.h b/lufsd/dircache.h new file mode 100644 index 0000000..dae2056 --- /dev/null +++ b/lufsd/dircache.h @@ -0,0 +1,71 @@ +/* + * dircache.h + * Copyright (C) 2002 Florin Malita + * + * This file is part of LUFS, a free userspace filesystem implementation. + * See http://lufs.sourceforge.net/ for updates. + * + * LUFS 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. + * + * LUFS 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 _DIRCACHE_H_ +#define _DIRCACHE_H_ + +#ifdef __cplusplus +extern "C" { +#endif + + +#define NBUCKETS 7 +#define DEF_NENTRIES 6 +#define DEF_TTL 20 + +struct list_head; + +struct direntry{ + char *e_name; + char *e_link; + struct list_head e_list; + struct lufs_fattr e_attr; +}; + +struct directory{ + char *d_name; + struct list_head d_entries; + struct list_head d_list; + unsigned long d_stamp; +}; + +struct dir_cache{ + int ttl; + int entries; + pthread_mutex_t lock; + struct list_head buckets[NBUCKETS]; + int lengths[NBUCKETS]; +}; + +struct dir_cache* lu_cache_create(struct list_head*); +void lu_cache_destroy(struct dir_cache*); + +int lu_cache_lookup_file(struct dir_cache*, char*, struct lufs_fattr*, char*, int); +void lu_cache_add(struct dir_cache*, char*, char*, struct lufs_fattr*, char*); +int lu_cache_readdir(struct dir_cache*, char*, int, char*, int); +int lu_cache_invalidate(struct dir_cache*, char*); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/lufsd/filesystem.c b/lufsd/filesystem.c new file mode 100644 index 0000000..3836f17 --- /dev/null +++ b/lufsd/filesystem.c @@ -0,0 +1,457 @@ +/* + * filesystem.c + * Copyright (C) 2002 Florin Malita + * + * This file is part of LUFS, a free userspace filesystem implementation. + * See http://lufs.sourceforge.net/ for updates. + * + * LUFS 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. + * + * LUFS 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 +#include + +#include "list.h" +#include "message.h" +#include "dircache.h" +#include "filesystem.h" + + + +static struct message* +generic_umount(struct file_system *fs, struct message *msg){ + TRACE("unmounting this filesystem"); + + if(!fs->fs_ops->umount) + return NULL; + + fs->fs_ops->umount(fs->fs_context); + return lu_makemsg(&fs->fs_msg, PTYPE_OK, NULL, 0); +} + +static struct message* +generic_readdir(struct file_system *fs, struct message *msg){ + struct lufs_req_readdir *req; + struct directory *dir; + struct message *res; + + if(!fs->fs_ops->readdir) + return NULL; + + req = (struct lufs_req_readdir*)msg->m_data; + + TRACE("readdir %s, offset %d",req->dirname, req->offset); + + if(lu_cache_readdir(fs->fs_cache, req->dirname, req->offset, fs->fs_buf, LU_MAXDATA) < 0){ + if(!(dir = lu_cache_mkdir(req->dirname))) + return NULL; + + if(fs->fs_ops->readdir(fs->fs_context, req->dirname, dir) < 0){ + lu_cache_killdir(dir); + return NULL; + } + + lu_cache_add_dir(fs->fs_cache, dir); + + if(lu_cache_readdir(fs->fs_cache, req->dirname, req->offset, fs->fs_buf, LU_MAXDATA) < 0){ + WARN("could not read directory!"); + return NULL; + } + + } + + res = lu_makemsg(&fs->fs_msg, PTYPE_OK, fs->fs_buf, strlen(fs->fs_buf) + 1); + return res; +} + +static struct message* +generic_illegal(struct file_system *fs, struct message *msg){ + WARN("Illegal message type: %d", msg->m_hdr.msg_type); + return NULL; +} + +static struct message* +generic_read(struct file_system *fs, struct message *msg){ + struct lufs_req_rw *req; + struct message *res; + int r; + + if(!fs->fs_ops->read) + return NULL; + + req = (struct lufs_req_rw*)msg->m_data; + TRACE("read"); + TRACE("read %s, offset= %Ld, count= %d", req->name, req->offset, (int)req->count); + + if((r = fs->fs_ops->read(fs->fs_context, req->name, req->offset, req->count, fs->fs_buf)) < 0){ + TRACE("read failed\n"); + res = NULL; + }else{ + if((unsigned)r < req->count) + memset(fs->fs_buf + r, 0, req->count - r); + res = lu_makemsg(&fs->fs_msg, PTYPE_OK, fs->fs_buf, req->count); + } + return res; +} + +static struct message* +generic_write(struct file_system *fs, struct message *msg){ + struct lufs_req_rw *req; + char *buf; + struct message *res; + + if(!fs->fs_ops->write) + return NULL; + + req = (struct lufs_req_rw*)msg->m_data; + buf = req->name + strlen(req->name) + 1; + + TRACE("write %s, offset=%Ld, count=%d", req->name, req->offset, (int)req->count); + + if(fs->fs_ops->write(fs->fs_context, req->name, req->offset, req->count, buf) < 0){ + TRACE("write failed\n"); + res = NULL; + }else + res = lu_makemsg(&fs->fs_msg, PTYPE_OK, NULL, 0); + + return res; +} + +static struct message* +generic_stat(struct file_system *fs, struct message *msg){ + struct lufs_fattr *fattr = (struct lufs_fattr*)fs->fs_buf; + + if(!fs->fs_ops->stat) + return NULL; + + TRACE("stat %s", msg->m_data); + + memset(fattr, 0, sizeof(struct lufs_fattr)); + + if(lu_cache_lookup_file(fs->fs_cache, msg->m_data, fattr, NULL, 0) < 0){ + TRACE("lookup failed on master"); + + if(strlen(msg->m_data) <= 1) + sprintf(msg->m_data, "/."); + + if(fs->fs_ops->stat(fs->fs_context, msg->m_data , fattr) < 0){ + TRACE("do_stat failed too"); + return NULL; + } + } + + return lu_makemsg(&fs->fs_msg, PTYPE_OK, (char*)fattr, sizeof(struct lufs_fattr)); +} + +static struct message* +generic_mkdir(struct file_system *fs, struct message *msg){ + struct lufs_req_mkdir *req; + + + if(!fs->fs_ops->mkdir) + return NULL; + + TRACE("mkdir"); + + req = (struct lufs_req_mkdir*)msg->m_data; + + if(fs->fs_ops->mkdir(fs->fs_context, req->dirname, req->mode) < 0){ + TRACE("mkdir failed!"); + return NULL; + } + + lu_cache_invalidate(fs->fs_cache, req->dirname); + + return lu_makemsg(&fs->fs_msg, PTYPE_OK, NULL, 0); +} + +static struct message* +generic_rmdir(struct file_system *fs, struct message *msg){ + + if(!fs->fs_ops->rmdir) + return NULL; + + TRACE("rmdir"); + + if(fs->fs_ops->rmdir(fs->fs_context, msg->m_data) < 0){ + TRACE("rmdir failed!"); + return NULL; + } + + lu_cache_invalidate(fs->fs_cache, msg->m_data); + + return lu_makemsg(&fs->fs_msg, PTYPE_OK, NULL, 0); +} + +static struct message* +generic_create(struct file_system *fs, struct message *msg){ + struct lufs_req_mkdir *req; + + if(!fs->fs_ops->create) + return NULL; + + TRACE("create"); + + req = (struct lufs_req_mkdir*)msg->m_data; + + if(fs->fs_ops->create(fs->fs_context, req->dirname, req->mode) < 0){ + TRACE("create failed!"); + return NULL; + } + + lu_cache_invalidate(fs->fs_cache, req->dirname); + + return lu_makemsg(&fs->fs_msg, PTYPE_OK, NULL, 0); +} + +static struct message* +generic_unlink(struct file_system *fs, struct message *msg){ + + if(!fs->fs_ops->unlink) + return NULL; + + TRACE("unlink"); + + if(fs->fs_ops->unlink(fs->fs_context, msg->m_data) < 0){ + TRACE("unlink failed!"); + return NULL; + } + + lu_cache_invalidate(fs->fs_cache, msg->m_data); + + return lu_makemsg(&fs->fs_msg, PTYPE_OK, NULL, 0); +} + +static struct message* +generic_rename(struct file_system *fs, struct message *msg){ + + if(!fs->fs_ops->rename) + return NULL; + + TRACE("old: %s, new: %s", msg->m_data, msg->m_data + strlen(msg->m_data) + 1); + + if(fs->fs_ops->rename(fs->fs_context, msg->m_data, msg->m_data + strlen(msg->m_data) + 1) < 0){ + TRACE("rename failed!"); + return NULL; + } + + lu_cache_invalidate(fs->fs_cache, msg->m_data); + lu_cache_invalidate(fs->fs_cache, msg->m_data + strlen(msg->m_data) + 1); + + return lu_makemsg(&fs->fs_msg, PTYPE_OK, NULL, 0); +} + +static struct message* +generic_open(struct file_system *fs, struct message *msg){ + struct lufs_req_open *req; + + if(!fs->fs_ops->open) + return NULL; + + TRACE("open"); + + req = (struct lufs_req_open*)msg->m_data; + + if(fs->fs_ops->open(fs->fs_context, req->name, req->mode) < 0){ + TRACE("open failed!"); + return NULL; + } + + return lu_makemsg(&fs->fs_msg, PTYPE_OK, NULL, 0); +} + +static struct message* +generic_release(struct file_system *fs, struct message *msg){ + + if(!fs->fs_ops->release) + return NULL; + + TRACE("release"); + + if(fs->fs_ops->release(fs->fs_context, msg->m_data) < 0){ + TRACE("release failed!"); + return NULL; + } + + return lu_makemsg(&fs->fs_msg, PTYPE_OK, NULL, 0); +} + + +static struct message* +generic_readlink(struct file_system *fs, struct message *msg){ + struct lufs_fattr fattr; + int len; + + if(!fs->fs_ops->readlink) + return NULL; + + TRACE("readlink %s", msg->m_data); + + /* try to get the link target from dircache first */ + if(lu_cache_lookup_file(fs->fs_cache, msg->m_data, &fattr, fs->fs_buf, LU_MAXDATA) < 0) + goto def; + + if(strcmp(fs->fs_buf, "")){ + TRACE("link target found in dircache."); + return lu_makemsg(&fs->fs_msg, PTYPE_OK, fs->fs_buf, strlen(fs->fs_buf) + 1); + } + + +def: + + if((len = fs->fs_ops->readlink(fs->fs_context, msg->m_data, fs->fs_buf, LU_MAXDATA)) < 0){ + TRACE("readlink failed!"); + return NULL; + } + + fs->fs_buf[len++] = 0; + + return lu_makemsg(&fs->fs_msg, PTYPE_OK, fs->fs_buf, len); +} + +static struct message* +generic_link(struct file_system *fs, struct message *msg){ + + if(!fs->fs_ops->link) + return NULL; + + TRACE("link %s %s", msg->m_data, &msg->m_data[strlen(msg->m_data)+1]); + + if(fs->fs_ops->link(fs->fs_context, msg->m_data, &msg->m_data[strlen(msg->m_data) + 1]) < 0){ + TRACE("link failed!"); + return NULL; + } + + lu_cache_invalidate(fs->fs_cache, msg->m_data); + lu_cache_invalidate(fs->fs_cache, &msg->m_data[strlen(msg->m_data) + 1]); + + return lu_makemsg(&fs->fs_msg, PTYPE_OK, NULL, 0); +} + +static struct message* +generic_symlink(struct file_system *fs, struct message *msg){ + + if(!fs->fs_ops->symlink) + return NULL; + + TRACE("symlink %s %s", msg->m_data, &msg->m_data[strlen(msg->m_data)+1]); + + if(fs->fs_ops->symlink(fs->fs_context, &msg->m_data[strlen(msg->m_data) + 1], msg->m_data) < 0){ + TRACE("symlink failed!"); + return NULL; + } + + lu_cache_invalidate(fs->fs_cache, msg->m_data); + + return lu_makemsg(&fs->fs_msg, PTYPE_OK, NULL, 0); +} + +static struct message* +generic_setattr(struct file_system *fs, struct message *msg){ + struct lufs_req_setattr *req = (struct lufs_req_setattr*)msg->m_data; + + if(!fs->fs_ops->setattr) + return NULL; + + TRACE("setattr %s", req->name); + + if(fs->fs_ops->setattr(fs->fs_context, req->name, &req->fattr) < 0){ + TRACE("setattr failed!"); + return NULL; + } + + lu_cache_invalidate(fs->fs_cache, req->name); + + return lu_makemsg(&fs->fs_msg, PTYPE_OK, NULL, 0); +} + + +void +handle_fs(struct file_system *fs, int sock, pid_t pid){ + struct message *msg, *rep; + struct message* (*handlers[PTYPE_MAX + 1])(struct file_system*, struct message*); + + handlers[0] = generic_illegal; // PTYPE_OK + handlers[1] = generic_illegal; // PTYPE_MOUNT + handlers[2] = generic_read; // PTYPE_READ + handlers[3] = generic_write; // PTYPE_WRITE + handlers[4] = generic_readdir; // PTYPE_READDIR + handlers[5] = generic_stat; // PTYPE_STAT + handlers[6] = generic_umount; // PTYPE_UMOUNT + handlers[7] = generic_setattr; // PTYPE_SETATTR + handlers[8] = generic_mkdir; // PTYPE_MKDIR + handlers[9] = generic_rmdir; // PTYPE_RMDIR + handlers[10] = generic_create; // PTYPE_CREATE + handlers[11] = generic_unlink; // PTYPE_UNLINK + handlers[12] = generic_rename; // PTYPE_RENAME + handlers[13] = generic_open; // PTYPE_OPEN + handlers[14] = generic_release; // PTYPE_RELEASE + handlers[15] = generic_readlink; // PTYPE_READLINK + handlers[16] = generic_link; // PTYPE_LINK + handlers[17] = generic_symlink; // PTYPE_SYMLINK + + if(!fs->fs_mounted){ + TRACE("connecting the slot..."); + + if(!fs->fs_ops->mount(fs->fs_context)){ + WARN("couldn't connect!"); + return; + } + } + + signal(SIGPIPE, SIG_IGN); + + TRACE("entering I/O loop..."); + + for(;;){ + msg = lu_recvmsg(&fs->fs_msg, sock); + + if(!msg){ + TRACE("oops, my kernel pair disconnected"); + return; + } + + rep = NULL; + if(msg->m_hdr.msg_type <= PTYPE_MAX){ + rep = (handlers[msg->m_hdr.msg_type])(fs, msg); + } + + if(!rep){ + TRACE("operation failed, sending error reply..."); + rep = lu_makemsg(&fs->fs_msg, PTYPE_ERROR, NULL, 0); + } + + lu_sendmsg(rep, sock); + } + +} + + + diff --git a/lufsd/filesystem.h b/lufsd/filesystem.h new file mode 100644 index 0000000..ba8d02c --- /dev/null +++ b/lufsd/filesystem.h @@ -0,0 +1,63 @@ +/* + * filesystem.h + * Copyright (C) 2002 Florin Malita + * + * This file is part of LUFS, a free userspace filesystem implementation. + * See http://lufs.sourceforge.net/ for updates. + * + * LUFS 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. + * + * LUFS 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 _FILESYSTEM_H_ +#define _FILESYSTEM_H_ + +struct fs_operations{ + void *(*init)(struct list_head*, struct dir_cache*, struct credentials*, void**); + void (*free)(void*); + int (*mount)(void*); + void (*umount)(void*); + int (*readdir)(void*, char*, struct directory*); + int (*stat)(void*, char*, struct lufs_fattr*); + int (*mkdir)(void*, char*, int); + int (*rmdir)(void*, char*); + int (*create)(void*, char*, int); + int (*unlink)(void*, char*); + int (*rename)(void*, char*, char*); + int (*open)(void*, char*, unsigned); + int (*release)(void*, char*); + int (*read)(void*, char*, long long, unsigned long, char*); + int (*write)(void*, char*, long long, unsigned long, char*); + int (*readlink)(void*, char*, char*, int); + int (*link)(void*, char*, char*); + int (*symlink)(void*, char*, char*); + int (*setattr)(void*, char*, struct lufs_fattr*); +}; + +struct file_system{ + struct message fs_msg; + struct fs_operations *fs_ops; + struct credentials *fs_credentials; + struct list_head *fs_config; + struct dir_cache *fs_cache; + void *fs_context; + int fs_mounted; + char fs_buf[LU_MAXDATA]; +}; + + +void handle_fs(struct file_system*, int, pid_t); + +#endif + diff --git a/lufsd/fsctl.c b/lufsd/fsctl.c new file mode 100644 index 0000000..e9301a1 --- /dev/null +++ b/lufsd/fsctl.c @@ -0,0 +1,505 @@ +/* + * fsctl.c + * Copyright (C) 2002 Florin Malita + * + * This file is part of LUFS, a free userspace filesystem implementation. + * See http://lufs.sourceforge.net/ for updates. + * + * LUFS 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. + * + * LUFS 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 + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#ifndef __USE_GNU +#define __USE_GNU +#endif +#include + +#include +#include +#include +#include +#include +#include +#include + +#include +#include + +#include "list.h" +#include "message.h" +#include "fsctl.h" +#include "filesystem.h" +#include "dircache.h" + +char sock_name[MAX_LEN]; + +static void +usr1Handler(int sig){ + + TRACE("unmounting filesystem..."); + TRACE("socket name: %s", sock_name); + unlink(sock_name); + + exit(0); +} + +static void +sig_handler(int sig){ + TRACE("got a signal: %d", sig); + + signal(sig, sig_handler); +} + +static void* +thread_launcher(void *params){ + struct thread_info *p = (struct thread_info*)params; + struct file_system *fs = p->fs; + int sock = p->sock; + pid_t ppid = p->ppid; + + TRACE("thread created"); + + free(p); + + if(fs) { + handle_fs(fs, sock, ppid); + + if(fs->fs_ops->umount) + fs->fs_ops->umount(fs->fs_context); + fs->fs_ops->free(fs->fs_context); + + free(fs); + }else{ + WARN("could not instantiate filesystem (out of mem?) !"); + } + + close(sock); + TRACE("thread exiting..."); + + return NULL; +} + +#define BUF_SIZE 1024 +#define PASSWD "/etc/passwd" +#define GROUP "/etc/group" + +static int +load_credentials(struct fs_ctl *ctl, struct file_system *fs){ + static char buf[BUF_SIZE]; + char srch_str[MAX_LEN + 4]; + long int uid, gid; + int res, offset, chunk, readlen; + char *c; + + TRACE("loading remote credentials for %s", ctl->cred.user); + + if((!ctl->fs_ops->open) || (!ctl->fs_ops->read) || (!ctl->fs_ops->release)){ + WARN("unsupported operation"); + return -1;; + } + + ctl->cred.uid = ctl->cred.gid = -1; + + if(ctl->fs_ops->open(fs->fs_context, PASSWD, O_RDONLY) < 0){ + TRACE("could not open %s", PASSWD); + return -1; + } + + sprintf(srch_str, "\n%s:", ctl->cred.user); + chunk = strlen(srch_str) + 64; + readlen = BUF_SIZE - chunk - 1; + + memset(buf, 32, chunk); + offset = 0; + + do{ + res = ctl->fs_ops->read(fs->fs_context, PASSWD, offset, readlen, (buf + chunk)); + if(res > 0){ + *(buf + chunk + res) = 0; + + if((c = strstr(buf, srch_str))){ + TRACE("username found!"); + if(!(c = strchr(c + strlen(srch_str), ':'))){ + TRACE("separator not found!"); + }else{ + if(sscanf(c , ":%li:%li:", &uid, &gid) != 2){ + TRACE("uid/gid not found!"); + }else{ + TRACE("uid: %li, gid: %li", uid, gid); + + ctl->cred.uid = uid; + ctl->cred.gid = gid; + + break; + } + } + } + + memcpy(buf, buf + BUF_SIZE - chunk - 1, chunk); + offset += res; + } + }while(res == readlen); + + ctl->fs_ops->release(fs->fs_context, PASSWD); + + if(res <= 0){ + TRACE("read failed"); + return -1; + } + + + if(ctl->fs_ops->open(fs->fs_context, GROUP, O_RDONLY) < 0){ + TRACE("could not open %s", GROUP); + return -1; + } + + sprintf(srch_str, ":%li:", (long)ctl->cred.gid); + chunk = strlen(srch_str) + 64; + readlen = BUF_SIZE - chunk - 1; + + memset(buf, 32, chunk); + offset = 0; + + do{ + res = ctl->fs_ops->read(fs->fs_context, GROUP, offset, readlen, (buf + chunk)); + if(res > 0){ + *(buf + chunk + res) = 0; + + if((c = strstr(buf, srch_str))){ + TRACE("group found!"); + if(!(c = (char*)memrchr(buf, '\n', (c - buf)))){ + TRACE("separator not found!"); + }else{ + *(strchr(c, ':')) = 0; + if(strlen(c + 1) >= MAX_LEN){ + TRACE("groupname too long"); + }else{ + strcpy(ctl->cred.group, c + 1); + TRACE("group: %s", ctl->cred.group); + break; + } + } + } + + memcpy(buf, buf + BUF_SIZE - chunk - 1, chunk); + offset += res; + } + }while(res == readlen); + + ctl->fs_ops->release(fs->fs_context, GROUP); + + if(res <= 0){ + TRACE("read failed"); + return -1; + } + + return 0; +} + + +static struct fs_operations* +get_filesystem(struct fs_ctl *ctl, char *fs){ + struct fs_operations *fops; + char *buf; + void *dlhandle; + + if(!(buf = (char*)malloc(strlen(fs) + 32))) + return NULL; + + sprintf(buf, "liblufs-%s.so", fs); + TRACE("trying to load %s", buf); + + if(!(dlhandle = dlopen(buf, RTLD_LAZY))){ + ERROR(dlerror()); + goto fail; + } + + TRACE("lib opened"); + + if(!(fops = (struct fs_operations*)malloc(sizeof(struct fs_operations)))) + goto fail_dl; + + memset(fops, 0, sizeof(struct fs_operations)); + + sprintf(buf, "%s_init", fs); + if(!(fops->init = (void*(*)(struct list_head*, struct dir_cache*, struct credentials*, void**))dlsym(dlhandle, buf))){ + ERROR(dlerror()); + goto fail_fops; + } + + sprintf(buf, "%s_free", fs); + if(!(fops->free = (void(*)(void*))dlsym(dlhandle, buf))){ + ERROR(dlerror()); + goto fail_fops; + } + + sprintf(buf, "%s_mount", fs); + if(!(fops->mount = (int(*)(void*))dlsym(dlhandle, buf))){ + ERROR(dlerror()); + goto fail_fops; + } + + sprintf(buf, "%s_umount", fs); + if(!(fops->umount = (void(*)(void*))dlsym(dlhandle, buf))) + ERROR(dlerror()); + + sprintf(buf, "%s_readdir", fs); + if(!(fops->readdir = (int(*)(void*, char*, struct directory*))dlsym(dlhandle, buf))) + ERROR(dlerror()); + + sprintf(buf, "%s_stat", fs); + if(!(fops->stat = (int(*)(void*, char*, struct lufs_fattr*))dlsym(dlhandle, buf))) + ERROR(dlerror()); + + sprintf(buf, "%s_mkdir", fs); + if(!(fops->mkdir = (int(*)(void*, char*, int))dlsym(dlhandle, buf))) + ERROR(dlerror()); + + sprintf(buf, "%s_rmdir", fs); + if(!(fops->rmdir = (int(*)(void*, char*))dlsym(dlhandle, buf))) + ERROR(dlerror()); + + sprintf(buf, "%s_create", fs); + if(!(fops->create = (int(*)(void*, char*, int))dlsym(dlhandle, buf))) + ERROR(dlerror()); + + sprintf(buf, "%s_unlink", fs); + if(!(fops->unlink = (int(*)(void*, char*))dlsym(dlhandle, buf))) + ERROR(dlerror()); + + sprintf(buf, "%s_rename", fs); + if(!(fops->rename = (int(*)(void*, char*, char*))dlsym(dlhandle, buf))) + ERROR(dlerror()); + + sprintf(buf, "%s_open", fs); + if(!(fops->open = (int(*)(void*, char*, unsigned))dlsym(dlhandle, buf))) + ERROR(dlerror()); + + sprintf(buf, "%s_release", fs); + if(!(fops->release = (int(*)(void*, char*))dlsym(dlhandle, buf))) + ERROR(dlerror()); + + sprintf(buf, "%s_read", fs); + if(!(fops->read = (int(*)(void*, char*, long long, unsigned long, char*))dlsym(dlhandle, buf))) + ERROR(dlerror()); + + sprintf(buf, "%s_write", fs); + if(!(fops->write = (int(*)(void*, char*, long long, unsigned long, char*))dlsym(dlhandle, buf))) + ERROR(dlerror()); + + sprintf(buf, "%s_readlink", fs); + if(!(fops->readlink = (int(*)(void*, char*, char*, int))dlsym(dlhandle, buf))) + ERROR(dlerror()); + + sprintf(buf, "%s_link", fs); + if(!(fops->link = (int(*)(void*, char*, char*))dlsym(dlhandle, buf))) + ERROR(dlerror()); + + sprintf(buf, "%s_symlink", fs); + if(!(fops->symlink = (int(*)(void*, char*, char*))dlsym(dlhandle, buf))) + ERROR(dlerror()); + + sprintf(buf, "%s_setattr", fs); + if(!(fops->setattr = (int(*)(void*, char*, struct lufs_fattr*))dlsym(dlhandle, buf))) + ERROR(dlerror()); + + TRACE("file system loaded"); + + ctl->dlhandle = dlhandle; + free(buf); + return fops; + + fail_fops: + free(fops); + fail_dl: + dlclose(dlhandle); + dlhandle = NULL; + fail: + free(buf); + return NULL; +} + +static struct file_system* +new_fsinstance(struct fs_ctl *ctl){ + struct file_system *fs; + + if(!(fs = (struct file_system*)malloc(sizeof(struct file_system)))) + return NULL; + + memset(fs, 0, sizeof(struct file_system)); + + fs->fs_ops = ctl->fs_ops; + fs->fs_credentials = &ctl->cred; + fs->fs_cache = ctl->cache; + fs->fs_config = ctl->cfg; + + if(!(fs->fs_context = ctl->fs_ops->init(ctl->cfg, ctl->cache, fs->fs_credentials, &ctl->global_ctx))){ + ERROR("could not initialize file system!"); + free(fs); + return NULL; + } + + return fs; +} + +int +lu_fsctl_mount(struct fs_ctl *ctl){ + int res; + struct file_system *fs; + + if(!ctl->fs_ops) + return 0; + + if(!(fs = new_fsinstance(ctl))) + return 0; + + res = ctl->fs_ops->mount(fs->fs_context); + + if(res){ + ctl->fs_available = fs; + fs->fs_mounted = 1; + if(load_credentials(ctl, fs) < 0) + TRACE("could not load credentials."); + else + TRACE("credentials loaded."); + + }else{ + WARN("fs mount failed..."); + free(fs); + } + + return res; +} + + +void +lu_fsctl_run(struct fs_ctl *ctl, int ssock, char *sn){ + pthread_t th_id; + socklen_t len; + struct sockaddr_un addr; + int sock; + struct thread_info *info; + + if(strlen(sn) >= MAX_LEN){ + WARN("socket name too long!"); + return; + } + + strcpy(sock_name, sn); + + signal(SIGUSR1, usr1Handler); + + signal(SIGPIPE, sig_handler); + signal(SIGTERM, sig_handler); + signal(SIGINT, sig_handler); + + while(1){ + len = sizeof(struct sockaddr_un); + + if((sock = accept(ssock, (struct sockaddr*)&addr, &len)) < 0){ + if(errno != EINTR){ + WARN("accept failed: %d(%s)", errno, strerror(errno)); + } + }else{ + TRACE("a client process connected."); + + if((info = (struct thread_info*)malloc(sizeof(struct thread_info)))){ + + if(ctl->fs_available){ + TRACE("using already mounted filesystem..."); + info->fs = ctl->fs_available; + ctl->fs_available = NULL; + }else + info->fs = new_fsinstance(ctl); + + info->sock = sock; + info->ppid = getpid(); + if(!pthread_create(&th_id, NULL, &thread_launcher, (void*)info)){ + pthread_detach(th_id); + }else{ + WARN("could not create thread!"); + free(info); + } + }else{ + WARN("out of memory?!"); + } + } + } + +} + +struct fs_ctl* +lu_fsctl_create(struct list_head *conf){ + struct fs_ctl *ctl; + const char *fs_name, *user_name; + + TRACE("creating fs_ctl"); + + if(!(ctl = (struct fs_ctl*)malloc(sizeof(struct fs_ctl)))) + return NULL; + + memset(ctl, 0, sizeof(struct fs_ctl)); + + ctl->cache = lu_cache_create(conf); + ctl->cfg = conf; + + if(!(fs_name = lu_opt_getchar(conf, "MOUNT", "fs"))){ + ERROR("you need to specify a file system!"); + free(ctl); + return NULL; + } + + if(!(ctl->fs_ops = get_filesystem(ctl, (char*)fs_name))){ + ERROR("unsupported file system: %s", fs_name); + free(ctl); + return NULL; + } + + if((user_name = lu_opt_getchar(conf, "MOUNT", "username"))) + strcpy(ctl->cred.user, user_name); + + return ctl; +} + +void +lu_fsctl_destroy(struct fs_ctl *ctl){ + TRACE("destroying fs_ctl"); + + lu_cache_destroy(ctl->cache); + + if(ctl->dlhandle) + dlclose(ctl->dlhandle); + + if(ctl->fs_available) + free(ctl->fs_available); + + free(ctl); +} + + + + diff --git a/lufsd/fsctl.h b/lufsd/fsctl.h new file mode 100644 index 0000000..0bfc909 --- /dev/null +++ b/lufsd/fsctl.h @@ -0,0 +1,54 @@ +/* + * fsctl.h + * Copyright (C) 2002 Florin Malita + * + * This file is part of LUFS, a free userspace filesystem implementation. + * See http://lufs.sourceforge.net/ for updates. + * + * LUFS 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. + * + * LUFS 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 _FSCTL_H_ +#define _FSCTL_H_ + +struct fs_operations; +struct file_system; + +struct thread_info{ + struct file_system *fs; + int sock; + pid_t ppid; +}; + +struct fs_ctl{ + struct credentials cred; + struct fs_operations *fs_ops; + struct file_system *fs_available; + struct dir_cache *cache; + struct list_head *cfg; + void *dlhandle; + void *global_ctx; +}; + + +struct fs_ctl *lu_fsctl_create(struct list_head*); +void lu_fsctl_destroy(struct fs_ctl*); +void lu_fsctl_run(struct fs_ctl*, int, char*); +int lu_fsctl_mount(struct fs_ctl*); + +#endif + + + diff --git a/lufsd/list.h b/lufsd/list.h new file mode 100644 index 0000000..f3cb6f5 --- /dev/null +++ b/lufsd/list.h @@ -0,0 +1,171 @@ +#ifndef _LINUX_LIST_H +#define _LINUX_LIST_H + +/* + * Simple doubly linked list implementation. + * + * Some of the internal functions ("__xxx") are useful when + * manipulating whole lists rather than single entries, as + * sometimes we already know the next/prev entries and we can + * generate better code by using them directly rather than + * using the generic single-entry routines. + */ + +struct list_head { + struct list_head *next, *prev; +}; + +#define LIST_HEAD_INIT(name) { &(name), &(name) } + +#define LIST_HEAD(name) \ + struct list_head name = LIST_HEAD_INIT(name) + +#define INIT_LIST_HEAD(ptr) do { \ + (ptr)->next = (ptr); (ptr)->prev = (ptr); \ +} while (0) + +/* + * Insert a new entry between two known consecutive entries. + * + * This is only for internal list manipulation where we know + * the prev/next entries already! + */ +static __inline__ void __list_add(struct list_head * nnew, + struct list_head * prev, + struct list_head * next) +{ + next->prev = nnew; + nnew->next = next; + nnew->prev = prev; + prev->next = nnew; +} + +/** + * list_add - add a new entry + * @new: new entry to be added + * @head: list head to add it after + * + * Insert a new entry after the specified head. + * This is good for implementing stacks. + */ +static __inline__ void list_add(struct list_head *nnew, struct list_head *head) +{ + __list_add(nnew, head, head->next); +} + +/** + * list_add_tail - add a new entry + * @nnew: new entry to be added + * @head: list head to add it before + * + * Insert a new entry before the specified head. + * This is useful for implementing queues. + */ +static __inline__ void list_add_tail(struct list_head *nnew, struct list_head *head) +{ + __list_add(nnew, head->prev, head); +} + +/* + * Delete a list entry by making the prev/next entries + * point to each other. + * + * This is only for internal list manipulation where we know + * the prev/next entries already! + */ +static __inline__ void __list_del(struct list_head * prev, + struct list_head * next) +{ + next->prev = prev; + prev->next = next; +} + +/** + * list_del - deletes entry from list. + * @entry: the element to delete from the list. + * Note: list_empty on entry does not return true after this, the entry is in an undefined state. + */ +static __inline__ void list_del(struct list_head *entry) +{ + __list_del(entry->prev, entry->next); +} + +/** + * list_del_init - deletes entry from list and reinitialize it. + * @entry: the element to delete from the list. + */ +static __inline__ void list_del_init(struct list_head *entry) +{ + __list_del(entry->prev, entry->next); + INIT_LIST_HEAD(entry); +} + +/** + * list_empty - tests whether a list is empty + * @head: the list to test. + */ +static __inline__ int list_empty(struct list_head *head) +{ + return head->next == head; +} + +/** + * list_splice - join two lists + * @list: the new list to add. + * @head: the place to add it in the first list. + */ +static __inline__ void list_splice(struct list_head *list, struct list_head *head) +{ + struct list_head *first = list->next; + + if (first != list) { + struct list_head *last = list->prev; + struct list_head *at = head->next; + + first->prev = head; + head->next = first; + + last->next = at; + at->prev = last; + } +} + +/** + * list_entry - get the struct for this entry + * @ptr: the &struct list_head pointer. + * @type: the type of the struct this is embedded in. + * @member: the name of the list_struct within the struct. + */ +#define list_entry(ptr, type, member) \ + ((type *)((char *)(ptr)-(unsigned long)(&((type *)0)->member))) + +/** + * list_for_each - iterate over a list + * @pos: the &struct list_head to use as a loop counter. + * @head: the head for your list. + */ +#define list_for_each(pos, head) \ + for (pos = (head)->next; pos != (head); \ + pos = pos->next) + +/** + * list_for_each_safe - iterate over a list safe against removal of list entry + * @pos: the &struct list_head to use as a loop counter. + * @n: another &struct list_head to use as temporary storage + * @head: the head for your list. + */ +#define list_for_each_safe(pos, n, head) \ + for (pos = (head)->next, n = pos->next; pos != (head); \ + pos = n, n = pos->next) + +/** + * list_for_each_prev - iterate over a list in reverse order + * @pos: the &struct list_head to use as a loop counter. + * @head: the head for your list. + */ +#define list_for_each_prev(pos, head) \ + for (pos = (head)->prev; pos != (head); \ + pos = pos->prev) + + +#endif diff --git a/lufsd/lufsd.conf b/lufsd/lufsd.conf new file mode 100644 index 0000000..399cf0c --- /dev/null +++ b/lufsd/lufsd.conf @@ -0,0 +1,45 @@ +# /etc/lufsd.conf +# +# lufsd configuration file +# +# lines preceded by '#' are comments +# +# anything not recognized is ignored... + + + +######################## +# LUFSD global options # +######################## + +# Dircache entries life span: +LUFSD::DirCacheTTL = 20 + +# Number of dircache entries per cache bucket: +LUFSD::DirCacheEntries = 6 + + + +################# +# FTPFS options # +################# + +# Data connection type: [Active] [Passive] +FTPFS::DataConnectionMode = Passive + +# Read/Write timeout: +FTPFS::RWTimeout = 10 + +################## +# GNETFS options # +################## + +# Max number of known hosts: +GNETFS::KnownPeers = 10 + +# The known hosts: +GNETFS::Host1 = connect1.gnutellanet.com:6346 +GNETFS::Host2 = connect2.gnutellanet.com:6346 +GNETFS::Host3 = connect3.gnutellanet.com:6346 +GNETFS::Host4 = connect4.gnutellanet.com:6346 + diff --git a/lufsd/lussh b/lufsd/lussh new file mode 100755 index 0000000..f717023 --- /dev/null +++ b/lufsd/lussh @@ -0,0 +1,46 @@ +#!/bin/sh + +echo +echo This script will help you setup ssh public key authentication. + + + +host=dummy + +while [ -n "$host" ]; do +echo -n "SSH server: " +read host +if [ -n "$host" ]; then + echo -n "user[$USER]: " + read usr + if [ -z "$usr" ]; then + usr=$USER + fi + + echo "Setting up RSA authentication for ${usr}@${host}..." + if [ -f ~/.ssh/id_rsa.pub ]; then + echo "RSA public key OK." + else + ssh-keygen -t rsa -f ~/.ssh/id_rsa -N "" + fi + scp ~/.ssh/id_rsa.pub ${usr}@${host}:~/ + ssh ${usr}@${host} "if [ ! -d ~/.ssh ]; then + mkdir ~/.ssh + fi + cat ~/id_rsa.pub >> ~/.ssh/authorized_keys + chmod 0600 ~/.ssh/authorized_keys + rm ~/id_rsa.pub" + echo + echo "You should see the following message without being prompted for anything now..." + echo + ssh ${usr}@${host} "echo !!! Congratulations, you are now logged in as ${usr}@${host} !!!" + echo + echo "If you were prompted, public key authentication could not be configured..." + + echo + echo "Enter a blank servername when done." + echo +fi +done + +echo "End of configuration." diff --git a/lufsd/message.c b/lufsd/message.c new file mode 100644 index 0000000..def1af0 --- /dev/null +++ b/lufsd/message.c @@ -0,0 +1,180 @@ +/* + * message.c + * Copyright (C) 2002 Florin Malita + * + * This file is part of LUFS, a free userspace filesystem implementation. + * See http://lufs.sourceforge.net/ for updates. + * + * LUFS 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. + * + * LUFS 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 "message.h" + +int +lu_check_to(int rd_fd, int wr_fd, int time_out){ + fd_set rd, wr; + int res, maxfd = 0; + struct timeval tv; + + FD_ZERO(&rd); + FD_ZERO(&wr); + + if(rd_fd){ + FD_SET(rd_fd, &rd); + maxfd = rd_fd > maxfd ? rd_fd : maxfd; + } + + if(wr_fd){ + FD_SET(wr_fd, &wr); + maxfd = wr_fd > maxfd ? wr_fd : maxfd; + } + + tv.tv_sec = time_out; + tv.tv_usec = 0; + + do{ + res = select(maxfd + 1, &rd, &wr, NULL, &tv); + + }while((res < 0) && (errno == EINTR)); + + if(res > 0) + return 0; + + if(res < 0){ + WARN("select call failed: %s", strerror(errno)); + return -errno; + } + + WARN("operation timed out!"); + + return -ETIMEDOUT; +} + +int +lu_atomic_read(int fd, char *buf, int len, int time_out){ + int res, offset = 0; + + do{ + if((time_out) && ((res = lu_check_to(fd, 0, time_out)) < 0)) + return res; + + do{ + res = read(fd, buf + offset, len - offset); + }while((res < 0) && (errno == EINTR)); + + if(res <= 0){ + WARN("read call failed: %s", strerror(errno)); + return (res < 0) ? -errno : (offset > 0 ? offset : -EPIPE); + } + + offset += res; + + }while(offset < len); + + return offset; +} + +int +lu_atomic_write(int fd, char *buf, int len, int time_out){ + int res, offset = 0; + + do{ + if((time_out) && ((res = lu_check_to(0, fd, time_out)) < 0)) + return res; + + do{ + res = write(fd, buf + offset, len - offset); + }while((res < 0) && (errno == EINTR)); + + if(res <= 0){ + WARN("write call failed: %s", strerror(errno)); + return (res < 0) ? -errno : (offset > 0 ? offset : -EPIPE); + } + + offset += res; + + }while(offset < len); + + return offset; +} + +struct message* +lu_recvmsg(struct message *msg, int sock){ + + msg->m_data = msg->m_buffer; + + if(lu_atomic_read(sock, (char*)&msg->m_hdr, sizeof(struct lu_msg), 0) < 0){ + WARN("recv failed"); + return NULL; + } + + if(msg->m_hdr.msg_datalen){ + if(msg->m_hdr.msg_datalen > MAX_DATA){ + ERROR("message too long: %u bytes", msg->m_hdr.msg_datalen); + return NULL; + } + + if(lu_atomic_read(sock, msg->m_data, msg->m_hdr.msg_datalen, 0) < 0){ + WARN("recv failed"); + return NULL; + } + } + + return msg; +} + +int +lu_sendmsg(struct message *msg, int sock){ + + if(lu_atomic_write(sock, (char*)&msg->m_hdr, sizeof(struct lu_msg), 0) < 0){ + WARN("send failed"); + return -1; + } + + if((msg->m_hdr.msg_datalen) && (lu_atomic_write(sock, msg->m_data, msg->m_hdr.msg_datalen, 0) < 0)){ + WARN("send failed"); + return -1; + } + + return 0; +} + +struct message* +lu_makemsg(struct message *msg, unsigned short type, char *data, unsigned short len){ + + msg->m_hdr.msg_type = type; + msg->m_hdr.msg_version = PVERSION; + msg->m_hdr.msg_datalen = len; + msg->m_hdr.msg_pid = getpid(); + + if(data) + msg->m_data = data; + else + msg->m_data = msg->m_buffer; + + return msg; +} + diff --git a/lufsd/message.h b/lufsd/message.h new file mode 100644 index 0000000..907fe73 --- /dev/null +++ b/lufsd/message.h @@ -0,0 +1,41 @@ +/* + * message.h + * Copyright (C) 2002 Florin Malita + * + * This file is part of LUFS, a free userspace filesystem implementation. + * See http://lufs.sourceforge.net/ for updates. + * + * LUFS 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. + * + * LUFS 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 _MESSAGE_H_ +#define _MESSAGE_H_ + +#define MAX_DATA LU_MAXDATA*2 + +struct lu_msg; + +struct message{ + struct lu_msg m_hdr; + char *m_data; + char m_buffer[MAX_DATA]; +}; + + +int lu_sendmsg(struct message*, int); +struct message* lu_recvmsg(struct message*, int); +struct message* lu_makemsg(struct message*, unsigned short, char*, unsigned short); + +#endif diff --git a/lufsd/options.c b/lufsd/options.c new file mode 100644 index 0000000..44f3663 --- /dev/null +++ b/lufsd/options.c @@ -0,0 +1,301 @@ +/* + * options.c + * Copyright (C) 2002 Florin Malita + * + * This file is part of LUFS, a free userspace filesystem implementation. + * See http://lufs.sourceforge.net/ for updates. + * + * LUFS 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. + * + * LUFS 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 "list.h" + +struct option { + char *key; + char *value; + struct list_head list; +}; + +struct domain { + char *name; + struct list_head properties; + struct list_head list; +}; + + +static void +trim(char *buf){ + int b,e; + + if(!buf[0]) + return; + + for(b = 0; (buf[b] == ' ') || (buf[b] == '\t'); b++); + for(e = strlen(buf) - 1; (e >= 0) && ((buf[e] == ' ') || (buf[e] == '\t')); e--); + if(e < 0) + e = strlen(buf) - 1; + + buf[e + 1] = 0; + + if(b) + strcpy(buf, &buf[b]); + +} + +static struct domain* +find_domain(struct list_head *conf, char *name){ + struct list_head *p; + struct domain *cls; + + list_for_each(p, conf){ + cls = list_entry(p, struct domain, list); + if(!strcmp(name, cls->name)){ + TRACE("domain found"); + return cls; + } + } + + return NULL; +} + +int +lu_opt_loadcfg(struct list_head *conf, char *file){ + struct domain *class; + struct option *prop; + FILE *f; + static char buf[1024]; + char *i, *j; + char *cls, *key, *val; + + TRACE("loading config from %s", file); + + if(!(f = fopen(file, "r"))){ + WARN("could not open file for reading!"); + return -1; + } + + while(fgets(buf, 1024, f)){ + + buf[strlen(buf) - 1] = 0; + + if((i = strchr(buf, '#'))) + *i = 0; + + if((i = strchr(buf, '='))){ + if((j = strstr(buf, "::"))){ + cls = buf; + key = j + 2; + val = i + 1; + + *i = 0; + *j = 0; + + trim(cls); + trim(key); + trim(val); + + TRACE("class: #%s#", cls); + TRACE("key: #%s#", key); + TRACE("val: #%s#", val); + + if(!(class = find_domain(conf, cls))){ + TRACE("class not found, creating..."); + + if(!(class = malloc(sizeof(struct domain)))){ + WARN("out of mem!"); + break; + } + + memset(class, 0, sizeof(struct domain)); + + if(!(class->name = malloc(strlen(cls) + 1))){ + WARN("out of mem!"); + free(class); + break; + } + + strcpy(class->name, cls); + INIT_LIST_HEAD(&class->properties); + + list_add(&class->list, conf); + } + + if(!(prop = malloc(sizeof(struct option)))){ + WARN("out of mem!"); + break; + } + + if(!(prop->key = malloc(strlen(key) + 1))){ + WARN("out of mem!"); + free(prop); + break; + } + + if(!(prop->value = malloc(strlen(val) + 1))){ + WARN("out of mem!"); + free(prop->key); + free(prop); + break; + } + + strcpy(prop->key, key); + strcpy(prop->value, val); + + list_add(&prop->list, &class->properties); + } + } + + } + + + fclose(f); + + return 0; +} + + +const char* +lu_opt_getchar(struct list_head *conf, char *cls, char *key){ + struct domain *class; + struct option *prop; + struct list_head *p; + + TRACE("retrieving %s::%s", cls, key); + + if(!(class = find_domain(conf, cls))) + return NULL; + + list_for_each(p, &class->properties){ + prop = list_entry(p, struct option, list); + + if(!strcmp(key, prop->key)){ + TRACE("key found"); + return prop->value; + } + } + + TRACE("key not found"); + + return NULL; +} + +int +lu_opt_getint(struct list_head *conf, char *domain, char *key, long int *result, int base){ + char *end; + const char *val; + long int res; + + if(!(val = lu_opt_getchar(conf, domain, key))) + return -1; + + res = strtol(val, &end, base); + + if(*end) + return -1; + + *result = res; + return 0; +} + +int +lu_opt_parse(struct list_head *conf, char *domain, char *opts){ + struct domain *class; + struct option *prop; + char *p, *sep; + + if(!(class = find_domain(conf, domain))){ + TRACE("domain not found, creating..."); + + if(!(class = malloc(sizeof(struct domain)))){ + WARN("out of mem!"); + return -1; + } + + memset(class, 0, sizeof(struct domain)); + + if(!(class->name = malloc(strlen(domain) + 1))){ + WARN("out of mem!"); + free(class); + return -1; + } + + strcpy(class->name, domain); + INIT_LIST_HEAD(&class->properties); + + list_add(&class->list, conf); + } + + for(p = strtok(opts, ","); p; p = strtok(NULL, ",")){ + if(!strstr(p, "password")) + TRACE("option: %s", p); + + if(!(prop = malloc(sizeof(struct option)))){ + WARN("out of mem!"); + return -1; + } + + if((sep = strchr(p, '='))) + *sep = 0; + + if(!(prop->key = malloc(strlen(p) + 1))){ + WARN("out of mem!"); + free(prop); + return -1; + } + strcpy(prop->key, p); + + if(sep){ + TRACE("option with parameter"); + + if((strlen(sep + 1) >= MAX_LEN) || !(prop->value = malloc(strlen(sep + 1) + 1))){ + WARN("out of mem!"); + free(prop->key); + free(prop); + return -1; + } + strcpy(prop->value, sep + 1); + + if(strstr(p, "password")){ + TRACE("hiding password..."); + memset(sep + 1, ' ', strlen(sep + 1)); + } + }else{ + TRACE("flag"); + + if(!(prop->value = malloc(2))){ + WARN("out of mem!"); + free(prop->key); + free(prop); + return -1; + } + strcpy(prop->value, ""); + + } + + list_add(&prop->list, &class->properties); + + } + + return 0; +} + + diff --git a/man/Makefile.am b/man/Makefile.am new file mode 100644 index 0000000..1f52e24 --- /dev/null +++ b/man/Makefile.am @@ -0,0 +1,2 @@ +man1_MANS=lufsmount.1 lufsumount.1 +EXTRA_DIST=lufsmount.1 lufsumount.1 diff --git a/man/Makefile.in b/man/Makefile.in new file mode 100644 index 0000000..c87afae --- /dev/null +++ b/man/Makefile.in @@ -0,0 +1,355 @@ +# Makefile.in generated by automake 1.7.5 from Makefile.am. +# @configure_input@ + +# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003 +# Free Software Foundation, Inc. +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ + +srcdir = @srcdir@ +top_srcdir = @top_srcdir@ +VPATH = @srcdir@ +pkgdatadir = $(datadir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +top_builddir = .. + +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +INSTALL = @INSTALL@ +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = @build@ +host_triplet = @host@ +target_triplet = @target@ +ACLOCAL = @ACLOCAL@ +AMDEP_FALSE = @AMDEP_FALSE@ +AMDEP_TRUE = @AMDEP_TRUE@ +AMTAR = @AMTAR@ +AUTOCONF = @AUTOCONF@ +AUTOFS_INSTALL = @AUTOFS_INSTALL@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CXX = @CXX@ +CXXDEPMODE = @CXXDEPMODE@ +CXXFLAGS = @CXXFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DEBUG_FLAGS = @DEBUG_FLAGS@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +ECHO = @ECHO@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +EXEEXT = @EXEEXT@ +GCONF = @GCONF@ +GVFSCONF = @GVFSCONF@ +GVFS_CFLAGS = @GVFS_CFLAGS@ +GVFS_LDADD = @GVFS_LDADD@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +KDEBUG_FLAGS = @KDEBUG_FLAGS@ +KERNEL_DIR = @KERNEL_DIR@ +KERNEL_HDR = @KERNEL_HDR@ +LDFLAGS = @LDFLAGS@ +LIBCHIPCARD_INCLUDES = @LIBCHIPCARD_INCLUDES@ +LIBCHIPCARD_LIB = @LIBCHIPCARD_LIB@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LIBTOOL = @LIBTOOL@ +LN_S = @LN_S@ +LTLIBOBJS = @LTLIBOBJS@ +LUFS_SUID = @LUFS_SUID@ +MAKEINFO = @MAKEINFO@ +MODULES_DIR = @MODULES_DIR@ +MODV_FLAGS = @MODV_FLAGS@ +OBJEXT = @OBJEXT@ +OS_DIR = @OS_DIR@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +RANLIB = @RANLIB@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +SSHPROG = @SSHPROG@ +STRIP = @STRIP@ +VERSION = @VERSION@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_CXX = @ac_ct_CXX@ +ac_ct_RANLIB = @ac_ct_RANLIB@ +ac_ct_STRIP = @ac_ct_STRIP@ +all_includes = @all_includes@ +all_libraries = @all_libraries@ +am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ +am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ +am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@ +am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +datadir = @datadir@ +define_has_libchipcard = @define_has_libchipcard@ +exec_prefix = @exec_prefix@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localstatedir = @localstatedir@ +mandir = @mandir@ +oldincludedir = @oldincludedir@ +opt_fs = @opt_fs@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +sysconfdir = @sysconfdir@ +target = @target@ +target_alias = @target_alias@ +target_cpu = @target_cpu@ +target_os = @target_os@ +target_vendor = @target_vendor@ +man1_MANS = lufsmount.1 lufsumount.1 +EXTRA_DIST = lufsmount.1 lufsumount.1 +subdir = man +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +mkinstalldirs = $(SHELL) $(top_srcdir)/config/mkinstalldirs +CONFIG_HEADER = $(top_builddir)/config.h +CONFIG_CLEAN_FILES = +DIST_SOURCES = + +NROFF = nroff +MANS = $(man1_MANS) +DIST_COMMON = Makefile.am Makefile.in +all: all-am + +.SUFFIXES: +$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4) + cd $(top_srcdir) && \ + $(AUTOMAKE) --gnu man/Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe) + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs + +distclean-libtool: + -rm -f libtool +uninstall-info-am: + +man1dir = $(mandir)/man1 +install-man1: $(man1_MANS) $(man_MANS) + @$(NORMAL_INSTALL) + $(mkinstalldirs) $(DESTDIR)$(man1dir) + @list='$(man1_MANS) $(dist_man1_MANS) $(nodist_man1_MANS)'; \ + l2='$(man_MANS) $(dist_man_MANS) $(nodist_man_MANS)'; \ + for i in $$l2; do \ + case "$$i" in \ + *.1*) list="$$list $$i" ;; \ + esac; \ + done; \ + for i in $$list; do \ + if test -f $(srcdir)/$$i; then file=$(srcdir)/$$i; \ + else file=$$i; fi; \ + ext=`echo $$i | sed -e 's/^.*\\.//'`; \ + case "$$ext" in \ + 1*) ;; \ + *) ext='1' ;; \ + esac; \ + inst=`echo $$i | sed -e 's/\\.[0-9a-z]*$$//'`; \ + inst=`echo $$inst | sed -e 's/^.*\///'`; \ + inst=`echo $$inst | sed '$(transform)'`.$$ext; \ + echo " $(INSTALL_DATA) $$file $(DESTDIR)$(man1dir)/$$inst"; \ + $(INSTALL_DATA) $$file $(DESTDIR)$(man1dir)/$$inst; \ + done +uninstall-man1: + @$(NORMAL_UNINSTALL) + @list='$(man1_MANS) $(dist_man1_MANS) $(nodist_man1_MANS)'; \ + l2='$(man_MANS) $(dist_man_MANS) $(nodist_man_MANS)'; \ + for i in $$l2; do \ + case "$$i" in \ + *.1*) list="$$list $$i" ;; \ + esac; \ + done; \ + for i in $$list; do \ + ext=`echo $$i | sed -e 's/^.*\\.//'`; \ + case "$$ext" in \ + 1*) ;; \ + *) ext='1' ;; \ + esac; \ + inst=`echo $$i | sed -e 's/\\.[0-9a-z]*$$//'`; \ + inst=`echo $$inst | sed -e 's/^.*\///'`; \ + inst=`echo $$inst | sed '$(transform)'`.$$ext; \ + echo " rm -f $(DESTDIR)$(man1dir)/$$inst"; \ + rm -f $(DESTDIR)$(man1dir)/$$inst; \ + done +tags: TAGS +TAGS: + +ctags: CTAGS +CTAGS: + +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) + +top_distdir = .. +distdir = $(top_distdir)/$(PACKAGE)-$(VERSION) + +distdir: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \ + list='$(DISTFILES)'; for file in $$list; do \ + case $$file in \ + $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ + $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ + esac; \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test "$$dir" != "$$file" && test "$$dir" != "."; then \ + dir="/$$dir"; \ + $(mkinstalldirs) "$(distdir)$$dir"; \ + else \ + dir=''; \ + fi; \ + if test -d $$d/$$file; then \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ + fi; \ + cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ + else \ + test -f $(distdir)/$$file \ + || cp -p $$d/$$file $(distdir)/$$file \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-am +all-am: Makefile $(MANS) + +installdirs: + $(mkinstalldirs) $(DESTDIR)$(man1dir) +install: install-am +install-exec: install-exec-am +install-data: install-data-am +uninstall: uninstall-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-am +install-strip: + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + INSTALL_STRIP_FLAG=-s \ + `test -z '$(STRIP)' || \ + echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -rm -f Makefile $(CONFIG_CLEAN_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +clean: clean-am + +clean-am: clean-generic clean-libtool mostlyclean-am + +distclean: distclean-am + +distclean-am: clean-am distclean-generic distclean-libtool + +dvi: dvi-am + +dvi-am: + +info: info-am + +info-am: + +install-data-am: install-man + +install-exec-am: + +install-info: install-info-am + +install-man: install-man1 + +installcheck-am: + +maintainer-clean: maintainer-clean-am + +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-generic mostlyclean-libtool + +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + +uninstall-am: uninstall-info-am uninstall-man + +uninstall-man: uninstall-man1 + +.PHONY: all all-am check check-am clean clean-generic clean-libtool \ + distclean distclean-generic distclean-libtool distdir dvi \ + dvi-am info info-am install install-am install-data \ + install-data-am install-exec install-exec-am install-info \ + install-info-am install-man install-man1 install-strip \ + installcheck installcheck-am installdirs maintainer-clean \ + maintainer-clean-generic mostlyclean mostlyclean-generic \ + mostlyclean-libtool pdf pdf-am ps ps-am uninstall uninstall-am \ + uninstall-info-am uninstall-man uninstall-man1 + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/man/lufsmount.1 b/man/lufsmount.1 new file mode 100644 index 0000000..1276f39 --- /dev/null +++ b/man/lufsmount.1 @@ -0,0 +1,89 @@ +.\" Process this file with +.\" groff -man -Tascii foo.1 +.\" +.TH LUFSMOUNT "1" "January 2003" LUFS "User Commands" +.SH NAME +lufsmount \- mount an LUFS file system +.SH SYNOPSIS +.BI "lufsmount " file_system ://[ "user" [: "pass" ]@] "host" [: "port" ][/ "remote_root" "] [-cdfghoOpquv]" +.SH DESCRIPTION +The +.B lufsmount +command is a convenience wrapper for mounting LUFS filesystems. +It provides a more natural syntax and allows regular users to take +advantage of it, provided that the LUFS mount/umount utilities +(lufsmnt & lufsumount) have been installed suid root. Conversely, the +.BR lufsumount (1) +command will detach the mounted file system. +.SH OPTIONS +Options available for the +.B lufsmount +command: +.TP +.BI \-c " CHAN" ", \-\-channels=" CHAN +Specify the number of communication channels per LUFS file system. +.TP +.BI \-d " MASK" ", \-\-dmask=" MASK +Octal mask to be OR-ed on directory permissions (minimum dir permissions). +.TP +.BI \-f " MASK" ", \-\-fmask=" MASK +Octal mask to be OR-ed on file permissions (minimum file permissions). +.TP +.BI \-g " GID" ", \-\-gid=" GID +Set +.I GID +as the owning +.B gid +on all the file system entries. +.TP +.B \-h, \-\-help +Display a help message. +.TP +.BI \-o " OPT=VAL[,...]" ", \-\-opts " OPT=VAL[,...] +File system specific options. These options will be passed unparsed to the +file system module. +.TP +.B \-O, \-\-own_fs +The mounting user will be the owner of the whole mounted file system. +Permissions on the file system entries will be tweaked to reflect +actual remote access rights. +.TP +.B \-p, \-\-password +Prompt for a password, if none specified. +.TP +.B \-q, \-\-quiet +Disable logging from the +.B lufsd +daemon. All file descriptors are closed. +.TP +.BI \-u " UID" ", \-\-uid=" UID +Set +.I UID +as the owning +.B uid +on all the file system entries. +.TP +.B \-v, \-\-verbose +Print the mount command before executing. +.SH FILES +.I /etc/lufs.conf +.RS +The LUFS configuration file. See +.BR lufs (8) +for further details. +.RE +.I /etc/mtab +.RS +Table of mounted file systems +.SH BUGS +The +.B lufsmount +utility cannot handle LUFS filesystems which require a special/different +URL syntax. +.SH AUTHOR +Florin Malita +.SH "SEE ALSO" +.BR lufsumount (1), +.BR mount (8), +.BR umount (8) + diff --git a/man/lufsumount.1 b/man/lufsumount.1 new file mode 100644 index 0000000..17ce9f7 --- /dev/null +++ b/man/lufsumount.1 @@ -0,0 +1,28 @@ +.\" Process this file with +.\" groff -man -Tascii foo.1 +.\" +.TH LUFSUMOUNT "1" "January 2003" LUFS "User Commands" +.SH NAME +lufsumount \- unmount an LUFS file system +.SH SYNOPSIS +.BI "lufsumount " dir +.SH DESCRIPTION +The +.B lufsumount +command detaches an LUFS file system mounted in the given dir from the +file hierachy. It will only work for file systems mounted via +.B lufsmount +(1). If installed as suid root, will enable regular users to operate LUFS +file systems. +.SH FILES +.I /etc/mtab +.RS +Table of mounted file systems +.RE +.SH AUTHOR +Florin Malita +.SH "SEE ALSO" +.BR lufsmount (1), +.BR mount (8), +.BR umount (8) + diff --git a/util/Makefile.am b/util/Makefile.am new file mode 100644 index 0000000..d684828 --- /dev/null +++ b/util/Makefile.am @@ -0,0 +1,19 @@ +INCLUDES=-I../ +LSUID:= @LUFS_SUID@ + +bin_PROGRAMS=lufsmount lufsumount lufsmnt auto.sshfs auto.ftpfs + +lufsmount_SOURCES=lufsmount.c +lufsumount_SOURCES=lufsumount.c +lufsmnt_SOURCES=lufsmnt.c +auto_sshfs_SOURCES=auto.sshfs.c +auto_ftpfs_SOURCES=auto.ftpfs.c + +install-exec-hook: + @echo postinstall configuration + $(mkinstalldirs) $(DESTDIR)/etc + ln -fs $(DESTDIR)$(bindir)/auto.sshfs $(DESTDIR)/etc/auto.sshfs + ln -fs $(DESTDIR)$(bindir)/auto.ftpfs $(DESTDIR)/etc/auto.ftpfs + if [ "$(LSUID)" ]; then chmod a+s $(DESTDIR)$(bindir)/lufsmnt $(DESTDIR)$(bindir)/lufsumount; fi + if [ -f /etc/auto.master -a "$(AUTOFS_INSTALL)" -a ! "`cat $(DESTDIR)/etc/auto.master | grep \"auto.ftpfs\"`" ]; then mkdir -p $(DESTDIR)/mnt/net/ssh $(DESTDIR)/mnt/net/ftp; echo -e "/mnt/net/ssh\t/etc/auto.sshfs\t--timeout=60\n/mnt/net/ftp\t/etc/auto.ftpfs\t--timeout=60\n" >> $(DESTDIR)/etc/auto.master; $(DESTDIR)/etc/init.d/autofs restart; fi + diff --git a/util/Makefile.in b/util/Makefile.in new file mode 100644 index 0000000..f51f7d7 --- /dev/null +++ b/util/Makefile.in @@ -0,0 +1,512 @@ +# Makefile.in generated by automake 1.7.5 from Makefile.am. +# @configure_input@ + +# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003 +# Free Software Foundation, Inc. +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ + +srcdir = @srcdir@ +top_srcdir = @top_srcdir@ +VPATH = @srcdir@ +pkgdatadir = $(datadir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +top_builddir = .. + +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +INSTALL = @INSTALL@ +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = @build@ +host_triplet = @host@ +target_triplet = @target@ +ACLOCAL = @ACLOCAL@ +AMDEP_FALSE = @AMDEP_FALSE@ +AMDEP_TRUE = @AMDEP_TRUE@ +AMTAR = @AMTAR@ +AUTOCONF = @AUTOCONF@ +AUTOFS_INSTALL = @AUTOFS_INSTALL@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CXX = @CXX@ +CXXDEPMODE = @CXXDEPMODE@ +CXXFLAGS = @CXXFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DEBUG_FLAGS = @DEBUG_FLAGS@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +ECHO = @ECHO@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +EXEEXT = @EXEEXT@ +GCONF = @GCONF@ +GVFSCONF = @GVFSCONF@ +GVFS_CFLAGS = @GVFS_CFLAGS@ +GVFS_LDADD = @GVFS_LDADD@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +KDEBUG_FLAGS = @KDEBUG_FLAGS@ +KERNEL_DIR = @KERNEL_DIR@ +KERNEL_HDR = @KERNEL_HDR@ +LDFLAGS = @LDFLAGS@ +LIBCHIPCARD_INCLUDES = @LIBCHIPCARD_INCLUDES@ +LIBCHIPCARD_LIB = @LIBCHIPCARD_LIB@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LIBTOOL = @LIBTOOL@ +LN_S = @LN_S@ +LTLIBOBJS = @LTLIBOBJS@ +LUFS_SUID = @LUFS_SUID@ +MAKEINFO = @MAKEINFO@ +MODULES_DIR = @MODULES_DIR@ +MODV_FLAGS = @MODV_FLAGS@ +OBJEXT = @OBJEXT@ +OS_DIR = @OS_DIR@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +RANLIB = @RANLIB@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +SSHPROG = @SSHPROG@ +STRIP = @STRIP@ +VERSION = @VERSION@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_CXX = @ac_ct_CXX@ +ac_ct_RANLIB = @ac_ct_RANLIB@ +ac_ct_STRIP = @ac_ct_STRIP@ +all_includes = @all_includes@ +all_libraries = @all_libraries@ +am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ +am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ +am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@ +am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +datadir = @datadir@ +define_has_libchipcard = @define_has_libchipcard@ +exec_prefix = @exec_prefix@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localstatedir = @localstatedir@ +mandir = @mandir@ +oldincludedir = @oldincludedir@ +opt_fs = @opt_fs@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +sysconfdir = @sysconfdir@ +target = @target@ +target_alias = @target_alias@ +target_cpu = @target_cpu@ +target_os = @target_os@ +target_vendor = @target_vendor@ +INCLUDES = -I../ +LSUID := @LUFS_SUID@ + +bin_PROGRAMS = lufsmount lufsumount lufsmnt auto.sshfs auto.ftpfs + +lufsmount_SOURCES = lufsmount.c +lufsumount_SOURCES = lufsumount.c +lufsmnt_SOURCES = lufsmnt.c +auto_sshfs_SOURCES = auto.sshfs.c +auto_ftpfs_SOURCES = auto.ftpfs.c +subdir = util +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +mkinstalldirs = $(SHELL) $(top_srcdir)/config/mkinstalldirs +CONFIG_HEADER = $(top_builddir)/config.h +CONFIG_CLEAN_FILES = +bin_PROGRAMS = lufsmount$(EXEEXT) lufsumount$(EXEEXT) lufsmnt$(EXEEXT) \ + auto.sshfs$(EXEEXT) auto.ftpfs$(EXEEXT) +PROGRAMS = $(bin_PROGRAMS) + +am_auto_ftpfs_OBJECTS = auto.ftpfs.$(OBJEXT) +auto_ftpfs_OBJECTS = $(am_auto_ftpfs_OBJECTS) +auto_ftpfs_LDADD = $(LDADD) +auto_ftpfs_DEPENDENCIES = +auto_ftpfs_LDFLAGS = +am_auto_sshfs_OBJECTS = auto.sshfs.$(OBJEXT) +auto_sshfs_OBJECTS = $(am_auto_sshfs_OBJECTS) +auto_sshfs_LDADD = $(LDADD) +auto_sshfs_DEPENDENCIES = +auto_sshfs_LDFLAGS = +am_lufsmnt_OBJECTS = lufsmnt.$(OBJEXT) +lufsmnt_OBJECTS = $(am_lufsmnt_OBJECTS) +lufsmnt_LDADD = $(LDADD) +lufsmnt_DEPENDENCIES = +lufsmnt_LDFLAGS = +am_lufsmount_OBJECTS = lufsmount.$(OBJEXT) +lufsmount_OBJECTS = $(am_lufsmount_OBJECTS) +lufsmount_LDADD = $(LDADD) +lufsmount_DEPENDENCIES = +lufsmount_LDFLAGS = +am_lufsumount_OBJECTS = lufsumount.$(OBJEXT) +lufsumount_OBJECTS = $(am_lufsumount_OBJECTS) +lufsumount_LDADD = $(LDADD) +lufsumount_DEPENDENCIES = +lufsumount_LDFLAGS = + +DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir) +depcomp = $(SHELL) $(top_srcdir)/config/depcomp +am__depfiles_maybe = depfiles +@AMDEP_TRUE@DEP_FILES = ./$(DEPDIR)/auto.ftpfs.Po \ +@AMDEP_TRUE@ ./$(DEPDIR)/auto.sshfs.Po ./$(DEPDIR)/lufsmnt.Po \ +@AMDEP_TRUE@ ./$(DEPDIR)/lufsmount.Po ./$(DEPDIR)/lufsumount.Po +COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ + $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +LTCOMPILE = $(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) \ + $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +CCLD = $(CC) +LINK = $(LIBTOOL) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ + $(AM_LDFLAGS) $(LDFLAGS) -o $@ +DIST_SOURCES = $(auto_ftpfs_SOURCES) $(auto_sshfs_SOURCES) \ + $(lufsmnt_SOURCES) $(lufsmount_SOURCES) $(lufsumount_SOURCES) +DIST_COMMON = Makefile.am Makefile.in +SOURCES = $(auto_ftpfs_SOURCES) $(auto_sshfs_SOURCES) $(lufsmnt_SOURCES) $(lufsmount_SOURCES) $(lufsumount_SOURCES) + +all: all-am + +.SUFFIXES: +.SUFFIXES: .c .lo .o .obj +$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4) + cd $(top_srcdir) && \ + $(AUTOMAKE) --gnu util/Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe) +binPROGRAMS_INSTALL = $(INSTALL_PROGRAM) +install-binPROGRAMS: $(bin_PROGRAMS) + @$(NORMAL_INSTALL) + $(mkinstalldirs) $(DESTDIR)$(bindir) + @list='$(bin_PROGRAMS)'; for p in $$list; do \ + p1=`echo $$p|sed 's/$(EXEEXT)$$//'`; \ + if test -f $$p \ + || test -f $$p1 \ + ; then \ + f=`echo "$$p1" | sed 's,^.*/,,;$(transform);s/$$/$(EXEEXT)/'`; \ + echo " $(INSTALL_PROGRAM_ENV) $(LIBTOOL) --mode=install $(binPROGRAMS_INSTALL) $$p $(DESTDIR)$(bindir)/$$f"; \ + $(INSTALL_PROGRAM_ENV) $(LIBTOOL) --mode=install $(binPROGRAMS_INSTALL) $$p $(DESTDIR)$(bindir)/$$f || exit 1; \ + else :; fi; \ + done + +uninstall-binPROGRAMS: + @$(NORMAL_UNINSTALL) + @list='$(bin_PROGRAMS)'; for p in $$list; do \ + f=`echo "$$p" | sed 's,^.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/'`; \ + echo " rm -f $(DESTDIR)$(bindir)/$$f"; \ + rm -f $(DESTDIR)$(bindir)/$$f; \ + done + +clean-binPROGRAMS: + @list='$(bin_PROGRAMS)'; for p in $$list; do \ + f=`echo $$p|sed 's/$(EXEEXT)$$//'`; \ + echo " rm -f $$p $$f"; \ + rm -f $$p $$f ; \ + done +auto.ftpfs$(EXEEXT): $(auto_ftpfs_OBJECTS) $(auto_ftpfs_DEPENDENCIES) + @rm -f auto.ftpfs$(EXEEXT) + $(LINK) $(auto_ftpfs_LDFLAGS) $(auto_ftpfs_OBJECTS) $(auto_ftpfs_LDADD) $(LIBS) +auto.sshfs$(EXEEXT): $(auto_sshfs_OBJECTS) $(auto_sshfs_DEPENDENCIES) + @rm -f auto.sshfs$(EXEEXT) + $(LINK) $(auto_sshfs_LDFLAGS) $(auto_sshfs_OBJECTS) $(auto_sshfs_LDADD) $(LIBS) +lufsmnt$(EXEEXT): $(lufsmnt_OBJECTS) $(lufsmnt_DEPENDENCIES) + @rm -f lufsmnt$(EXEEXT) + $(LINK) $(lufsmnt_LDFLAGS) $(lufsmnt_OBJECTS) $(lufsmnt_LDADD) $(LIBS) +lufsmount$(EXEEXT): $(lufsmount_OBJECTS) $(lufsmount_DEPENDENCIES) + @rm -f lufsmount$(EXEEXT) + $(LINK) $(lufsmount_LDFLAGS) $(lufsmount_OBJECTS) $(lufsmount_LDADD) $(LIBS) +lufsumount$(EXEEXT): $(lufsumount_OBJECTS) $(lufsumount_DEPENDENCIES) + @rm -f lufsumount$(EXEEXT) + $(LINK) $(lufsumount_LDFLAGS) $(lufsumount_OBJECTS) $(lufsumount_LDADD) $(LIBS) + +mostlyclean-compile: + -rm -f *.$(OBJEXT) core *.core + +distclean-compile: + -rm -f *.tab.c + +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/auto.ftpfs.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/auto.sshfs.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lufsmnt.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lufsmount.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lufsumount.Po@am__quote@ + +distclean-depend: + -rm -rf ./$(DEPDIR) + +.c.o: +@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" \ +@am__fastdepCC_TRUE@ -c -o $@ `test -f '$<' || echo '$(srcdir)/'`$<; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; \ +@am__fastdepCC_TRUE@ else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; \ +@am__fastdepCC_TRUE@ fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(COMPILE) -c `test -f '$<' || echo '$(srcdir)/'`$< + +.c.obj: +@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" \ +@am__fastdepCC_TRUE@ -c -o $@ `if test -f '$<'; then $(CYGPATH_W) '$<'; else $(CYGPATH_W) '$(srcdir)/$<'; fi`; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; \ +@am__fastdepCC_TRUE@ else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; \ +@am__fastdepCC_TRUE@ fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(COMPILE) -c `if test -f '$<'; then $(CYGPATH_W) '$<'; else $(CYGPATH_W) '$(srcdir)/$<'; fi` + +.c.lo: +@am__fastdepCC_TRUE@ if $(LTCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" \ +@am__fastdepCC_TRUE@ -c -o $@ `test -f '$<' || echo '$(srcdir)/'`$<; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Plo"; \ +@am__fastdepCC_TRUE@ else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; \ +@am__fastdepCC_TRUE@ fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/$*.Plo' tmpdepfile='$(DEPDIR)/$*.TPlo' @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ `test -f '$<' || echo '$(srcdir)/'`$< + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs + +distclean-libtool: + -rm -f libtool +uninstall-info-am: + +ETAGS = etags +ETAGSFLAGS = + +CTAGS = ctags +CTAGSFLAGS = + +tags: TAGS + +ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + mkid -fID $$unique + +TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + tags=; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + test -z "$(ETAGS_ARGS)$$tags$$unique" \ + || $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$tags $$unique + +ctags: CTAGS +CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + tags=; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + test -z "$(CTAGS_ARGS)$$tags$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$tags $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && cd $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) $$here + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) + +top_distdir = .. +distdir = $(top_distdir)/$(PACKAGE)-$(VERSION) + +distdir: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \ + list='$(DISTFILES)'; for file in $$list; do \ + case $$file in \ + $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ + $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ + esac; \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test "$$dir" != "$$file" && test "$$dir" != "."; then \ + dir="/$$dir"; \ + $(mkinstalldirs) "$(distdir)$$dir"; \ + else \ + dir=''; \ + fi; \ + if test -d $$d/$$file; then \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ + fi; \ + cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ + else \ + test -f $(distdir)/$$file \ + || cp -p $$d/$$file $(distdir)/$$file \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-am +all-am: Makefile $(PROGRAMS) + +installdirs: + $(mkinstalldirs) $(DESTDIR)$(bindir) +install: install-am +install-exec: install-exec-am +install-data: install-data-am +uninstall: uninstall-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-am +install-strip: + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + INSTALL_STRIP_FLAG=-s \ + `test -z '$(STRIP)' || \ + echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -rm -f Makefile $(CONFIG_CLEAN_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +clean: clean-am + +clean-am: clean-binPROGRAMS clean-generic clean-libtool mostlyclean-am + +distclean: distclean-am + +distclean-am: clean-am distclean-compile distclean-depend \ + distclean-generic distclean-libtool distclean-tags + +dvi: dvi-am + +dvi-am: + +info: info-am + +info-am: + +install-data-am: + +install-exec-am: install-binPROGRAMS + @$(NORMAL_INSTALL) + $(MAKE) $(AM_MAKEFLAGS) install-exec-hook + +install-info: install-info-am + +install-man: + +installcheck-am: + +maintainer-clean: maintainer-clean-am + +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-compile mostlyclean-generic \ + mostlyclean-libtool + +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + +uninstall-am: uninstall-binPROGRAMS uninstall-info-am + +.PHONY: CTAGS GTAGS all all-am check check-am clean clean-binPROGRAMS \ + clean-generic clean-libtool ctags distclean distclean-compile \ + distclean-depend distclean-generic distclean-libtool \ + distclean-tags distdir dvi dvi-am info info-am install \ + install-am install-binPROGRAMS install-data install-data-am \ + install-exec install-exec-am install-info install-info-am \ + install-man install-strip installcheck installcheck-am \ + installdirs maintainer-clean maintainer-clean-generic \ + mostlyclean mostlyclean-compile mostlyclean-generic \ + mostlyclean-libtool pdf pdf-am ps ps-am tags uninstall \ + uninstall-am uninstall-binPROGRAMS uninstall-info-am + + +install-exec-hook: + @echo postinstall configuration + $(mkinstalldirs) $(DESTDIR)/etc + ln -fs $(DESTDIR)$(bindir)/auto.sshfs $(DESTDIR)/etc/auto.sshfs + ln -fs $(DESTDIR)$(bindir)/auto.ftpfs $(DESTDIR)/etc/auto.ftpfs + if [ "$(LSUID)" ]; then chmod a+s $(DESTDIR)$(bindir)/lufsmnt $(DESTDIR)$(bindir)/lufsumount; fi + if [ -f /etc/auto.master -a "$(AUTOFS_INSTALL)" -a ! "`cat $(DESTDIR)/etc/auto.master | grep \"auto.ftpfs\"`" ]; then mkdir -p $(DESTDIR)/mnt/net/ssh $(DESTDIR)/mnt/net/ftp; echo -e "/mnt/net/ssh\t/etc/auto.sshfs\t--timeout=60\n/mnt/net/ftp\t/etc/auto.ftpfs\t--timeout=60\n" >> $(DESTDIR)/etc/auto.master; $(DESTDIR)/etc/init.d/autofs restart; fi +# 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/util/auto.ftpfs.c b/util/auto.ftpfs.c new file mode 100644 index 0000000..e769b14 --- /dev/null +++ b/util/auto.ftpfs.c @@ -0,0 +1,65 @@ +/* + * lufsmount.c + * Copyright (C) 2002 Florin Malita + * + * This file is part of LUFS, a free userspace filesystem implementation. + * See http://lufs.sourceforge.net/ for updates. + * + * LUFS 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. + * + * LUFS 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 + +int +main(int argc, char **argv){ + char *host, *user = NULL, *pass = NULL, *port = NULL; + char *c; + + if(argc < 2) + return 1; + + if(!(c = strchr(argv[1], '@'))){ + host = argv[1]; + }else{ + *c = 0; + host = c + 1; + user = argv[1]; + + if((c = strchr(user, ':'))){ + *c = 0; + pass = c + 1; + } + } + + if((c = strchr(host, ':'))){ + *c = 0; + port = c + 1; + } + + printf("-fstype=lufs,fs=ftpfs,quiet,host=%s", host); + + if(user) + printf(",username=%s", user); + if(pass) + printf(",password=%s", pass); + if(port) + printf(",port=%s", port); + + printf(" none\n"); + + return 0; +} + diff --git a/util/auto.sshfs.c b/util/auto.sshfs.c new file mode 100644 index 0000000..4028dbd --- /dev/null +++ b/util/auto.sshfs.c @@ -0,0 +1,41 @@ +/* + * lufsmount.c + * Copyright (C) 2002 Florin Malita + * + * This file is part of LUFS, a free userspace filesystem implementation. + * See http://lufs.sourceforge.net/ for updates. + * + * LUFS 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. + * + * LUFS 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 + +int +main(int argc, char **argv){ + char *c; + + if(argc < 2) + return 1; + + if(!(c = strchr(argv[1], '@'))) + return 1; + + *c = 0; + + printf("-fstype=lufs,fs=sshfs,quiet,host=%s,username=%s none\n", c + 1, argv[1]); + + return 0; +} diff --git a/util/lufsmnt.c b/util/lufsmnt.c new file mode 100644 index 0000000..6167827 --- /dev/null +++ b/util/lufsmnt.c @@ -0,0 +1,180 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include + +#define ERROR(x...) fprintf(stderr, x) + +static void +help(){ + printf("\n"); + printf("Usage: lufsmnt mount-point [options]\n"); + printf("This is a suid wrapper called by lufsd.\n"); + +} + +static int +fullpath(char *path, char *full){ + + full[0] = 0; + + if(strlen(path) >= PATH_MAX - 1) + return -1; + + if(!realpath(path, full)) + return -1; + else + return 0; +} + +static int +mount_ok(char *mp){ + struct stat st; + + if(chdir(mp)){ + ERROR("cannot chdir %s\n", mp); + return -1; + } + + if(stat(".", &st)){ + ERROR("cannot stat %s\n", mp); + return -1; + } + + if(!S_ISDIR(st.st_mode)){ + ERROR("%s is not a directory\n", mp); + return -1; + } + + if((getuid()) && ((getuid() != st.st_uid) || ((st.st_mode & S_IRWXU) != S_IRWXU))){ + ERROR("you don't have proper permissions to mount on %s\n", mp); + return -1; + } + + return 0; +} + +void +hide_pass(char *opts){ + char *c; + + if((c = strstr(opts, "password="))){ + for(c = c + 9; (*c != 0) && (*c != ','); c++) + *c = '*'; + } +} + +void +get_fs(char *opts, char *buf, int buflen){ + char *begin, *end; + + buf[0] = 0; + buf[buflen - 1] = 0; + + if((begin = strstr(opts, "fs="))){ + begin += 3; + + if(!(end = strchr(begin, ','))){ + end = begin + strlen(begin); + } + + if( end - begin >= buflen) + end = begin + buflen - 1; + + strncpy(buf, begin, end - begin); + } +} + +int +main(int argc, char **argv){ + char *mountpoint, *opts; + static char fpath[PATH_MAX]; + static char mfs[PATH_MAX]; + static char mopts[PATH_MAX]; + struct mntent ment; + int fd; + FILE *mtab; + + if(argc != 3){ + help(); + exit(1); + } + + if(geteuid()){ + ERROR("%s needs to be installed suid root in order to be used by unprivileged users\n", argv[0]); + exit(1); + } + + mountpoint = argv[1]; + opts = argv[2]; + + fullpath(mountpoint, fpath); + + if(mount_ok(fpath)){ + exit(1); + } + + if (mount("none", fpath, "lufs", MS_NOSUID | MS_NODEV, opts) < 0){ + ERROR("mount failed: %s\n", strerror(errno)); + switch(errno){ + case ENODEV: + ERROR("you don't have kernel lufs support (check whether the lufs module is available/loaded)\n"); + break; + } + return errno; + } + + sprintf(mopts, "owner=%d,", getuid()); + hide_pass(opts); + if(strlen(mopts) + strlen(opts) < PATH_MAX) + strcat(mopts, opts); + get_fs(opts, mfs, PATH_MAX); + + ment.mnt_fsname = mfs; + ment.mnt_dir = fpath; + ment.mnt_type = "lufs"; + ment.mnt_opts = mopts; + ment.mnt_freq = 0; + ment.mnt_passno = 0; + + if((fd = open(_PATH_MOUNTED"~", O_RDWR|O_CREAT|O_EXCL, 0600)) < 0){ + ERROR("can't get "_PATH_MOUNTED"~ lock file\n"); + return 1; + } + close(fd); + + if((mtab = setmntent(_PATH_MOUNTED, "a+")) == NULL){ + ERROR("can't open "_PATH_MOUNTED"\n"); + return 1; + } + + if(addmntent(mtab, &ment)){ + ERROR("can't write mount entry\n"); + return 1; + } + + if(fchmod(fileno(mtab), 0644) < 0){ + ERROR("can't set [erms on "_PATH_MOUNTED"\n"); + return 1; + } + + endmntent(mtab); + + if(unlink(_PATH_MOUNTED"~") < 0){ + ERROR("can't remove "_PATH_MOUNTED"~\n"); + return 1; + } + + return 0; +} + diff --git a/util/lufsmount.c b/util/lufsmount.c new file mode 100644 index 0000000..7718110 --- /dev/null +++ b/util/lufsmount.c @@ -0,0 +1,316 @@ +/* + * lufsmount.c + * Copyright (C) 2002 Florin Malita + * + * This file is part of LUFS, a free userspace filesystem implementation. + * See http://lufs.sourceforge.net/ for updates. + * + * LUFS 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. + * + * LUFS 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 + +#ifndef _GNU_SOURCE +#define _GNU_SOURCE +#endif +#include + +#ifdef DEBUGGING +#define TRACE(x...) fprintf(stdout, x) +#else +#define TRACE(x...) do{}while(0); +#endif + +#define ERROR(x...) fprintf(stderr, x) + +#define MAX_LEN 1024 + +char *short_opts = "hvu:g:f:d:c:o:Opq"; +struct option long_opts[] = { + {"help", 0, NULL, 'h'}, + {"uid", 1, NULL, 'u'}, + {"gid", 1, NULL, 'g'}, + {"fmask", 1, NULL, 'f'}, + {"dmask", 1, NULL, 'd'}, + {"channels",1, NULL, 'c'}, + {"opts", 1, NULL, 'o'}, + {"own_fs", 0, NULL, 'O'}, + {"verbose", 0, NULL, 'v'}, + {"password",0, NULL, 'p'}, + {"quiet", 0, NULL, 'q'}, + {NULL, 0, NULL, 0} +}; +char buf[MAX_LEN]; + + +void +usage(FILE *fp, char *prgname){ + fprintf(fp, "Usage: %s ://[[:]@][:][/] [options]\n", prgname); + fprintf(fp, " -c, --channels=NR_CHAN the number of transfer channels per filesystem\n"); + fprintf(fp, " -d, --dmask=MASK minimum dir permissions\n"); + fprintf(fp, " -f, --fmask=MASK minimum file permissions\n"); + fprintf(fp, " -g, --gid=GID the gid to own the mounted filesystem\n"); + fprintf(fp, " -h, --help display this help and exit\n"); + fprintf(fp, " -o, --opts opt=val[,...] file system specific options\n"); + fprintf(fp, " -O, --own_fs force fs ownership of the mounting user\n"); + fprintf(fp, " -p, --password interactively prompt for password if not specified\n"); + fprintf(fp, " -q --quiet disable all logging from daemon (close all fds)\n"); + fprintf(fp, " -u, --uid=UID the uid to own the mounted filesystem\n"); + fprintf(fp, " -v, --verbose print the mount command before executing\n"); +} + +int +main(int argc, char **argv){ + int res, verbose = 0, own_fs = 0, ask_pass = 0, quiet = 0; + char *uid = NULL, *gid = NULL; + char *options = NULL, *chan = NULL; + char *fmask = NULL, *dmask = NULL; + char *url, *mpoint, *fs; + char *user = NULL, *pass = NULL, *root = NULL, *port = NULL; + char *i, *j; + + do{ + res = getopt_long(argc, argv, short_opts, long_opts, NULL); + + switch(res){ + case 'h': + usage(stdout, argv[0]); + return 0; + + case 'u': + uid = optarg; + break; + + case 'g': + gid = optarg; + break; + + case 'v': + verbose = 1; + break; + + case 'f': + fmask = optarg; + break; + + case 'd': + dmask = optarg; + break; + + case 'c': + chan = optarg; + break; + + case 'p': + ask_pass = 1; + break; + + case 'q': + quiet = 1; + break; + + case 'o': + options = optarg; + break; + + case 'O': + own_fs=1; + break; + + default: + case '?': + TRACE("wrong option\n"); + usage(stderr, argv[0]); + return 1; + + case -1: + break; + }; + }while(res != -1); + + if(optind > argc - 2){ + usage(stderr, argv[0]); + return 1; + } + + url = argv[optind++]; + mpoint = argv[optind++]; + + TRACE("url: %s\n", url); + TRACE("mountpoint: %s\n", mpoint); + + if(!(i = strstr(url, "://"))){ + ERROR("invalid URL (%s): protocol delimiter not found\n", url); + return 1; + } + + *i = 0; + fs = url; + url = i + 3; + TRACE("fs: %s\n", fs); + + i = strchr(url, '@'); + j = strchr(url, '/'); + + if((i) && ((i < j) || (j == NULL))){ + *i = 0; + user = url; + url = i + 1; + + if((i = strchr(user, ':'))){ + *i = 0; + pass = i + 1; + TRACE("pass: %s\n", pass); + } + TRACE("user: %s\n", user); + } + + if((i = strchr(url, '/'))){ + *i = 0; + root = i + 1; + TRACE("root: %s\n", root); + } + + if((i = strchr(url, ':'))){ + *i = 0; + port = i + 1; + TRACE("port: %s\n", port); + } + + TRACE("host: %s\n", url); + + if(!pass && ask_pass) + pass = getpass("password:"); + + + if(snprintf(buf, MAX_LEN, "lufsd none %s -o fs=%s", mpoint, fs) >= MAX_LEN) + goto too_long; + + if(strcmp(url, "")){ + if(strlen(buf) + strlen(",host=") + strlen(url) >= MAX_LEN) + goto too_long; + + strcat(buf, ",host="); + strcat(buf, url); + } + + if(user){ + if(strlen(buf) + strlen(",username=") + strlen(user) >= MAX_LEN) + goto too_long; + + strcat(buf, ",username="); + strcat(buf, user); + } + + if(pass){ + if(strlen(buf) + strlen(",password=") + strlen(pass) >= MAX_LEN) + goto too_long; + + strcat(buf, ",password="); + strcat(buf, pass); + } + + if(port){ + if(strlen(buf) + strlen(",port=") + strlen(port) >= MAX_LEN) + goto too_long; + + strcat(buf, ",port="); + strcat(buf, port); + } + + if(root){ + if(strlen(buf) + strlen(",root=/") + strlen(root) >= MAX_LEN) + goto too_long; + + strcat(buf, ",root=/"); + strcat(buf, root); + } + + if(uid){ + if(strlen(buf) + strlen(",uid=") + strlen(uid) >= MAX_LEN) + goto too_long; + + strcat(buf, ",uid="); + strcat(buf, uid); + } + + if(gid){ + if(strlen(buf) + strlen(",gid=") + strlen(gid) >= MAX_LEN) + goto too_long; + + strcat(buf, ",gid="); + strcat(buf, gid); + } + + if(fmask){ + if(strlen(buf) + strlen(",fmask=") + strlen(fmask) >= MAX_LEN) + goto too_long; + + strcat(buf, ",fmask="); + strcat(buf, fmask); + } + + if(dmask){ + if(strlen(buf) + strlen(",dmask=") + strlen(dmask) >= MAX_LEN) + goto too_long; + + strcat(buf, ",dmask="); + strcat(buf, dmask); + } + + if(chan){ + if(strlen(buf) + strlen(",channels=") + strlen(chan) >= MAX_LEN) + goto too_long; + + strcat(buf, ",channels="); + strcat(buf, chan); + } + + if(options){ + if(strlen(buf) + strlen(",") + strlen(options) >= MAX_LEN) + goto too_long; + + strcat(buf, ","); + strcat(buf, options); + } + + if(own_fs){ + if(strlen(buf) + strlen(",own_fs") >= MAX_LEN) + goto too_long; + + strcat(buf, ",own_fs"); + } + + if(quiet){ + if(strlen(buf) + strlen(",quiet") >= MAX_LEN) + goto too_long; + + strcat(buf, ",quiet"); + } + + TRACE("cmd: %s\n", buf); + + if(verbose) + printf("executing command: %s\n", buf); + + return system(buf); + + too_long: + ERROR("options too long!\n"); + return 1; +} diff --git a/util/lufsumount.c b/util/lufsumount.c new file mode 100644 index 0000000..366cba3 --- /dev/null +++ b/util/lufsumount.c @@ -0,0 +1,128 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include + +#define MTAB_TMP _PATH_MOUNTED".tmp" + +static void +help(){ + printf("\n"); + printf("Usage: lufsumount mount-point\n"); + +} + +static int +fullpath(char *path, char *full){ + + full[0] = 0; + + if(strlen(path) >= PATH_MAX - 1) + return -1; + + if(!realpath(path, full)) + return -1; + else + return 0; +} + +int +main(int argc, char **argv){ + char *mountpoint; + static char fpath[PATH_MAX]; + struct mntent *ment; + int fd, muid = -1; + FILE *mtab, *new_mtab; + + if(argc != 2){ + help(); + return 1; + } + + if(geteuid()){ + fprintf(stderr, "lufsumount should be installed suid root\n"); + return 1; + } + + mountpoint = argv[1]; + + fullpath(mountpoint, fpath); + + if((fd = open(_PATH_MOUNTED"~", O_RDWR|O_CREAT|O_EXCL, 0600)) < 0){ + fprintf(stderr, "can't get "_PATH_MOUNTED"~ lock file"); + return 1; + } + + close(fd); + + if((mtab = setmntent(_PATH_MOUNTED, "r")) == NULL){ + fprintf(stderr, "can't open "_PATH_MOUNTED ":%s\n", strerror(errno)); + goto err; + } + + if((new_mtab = setmntent(MTAB_TMP, "w")) == NULL){ + fprintf(stderr, "can't open "MTAB_TMP": %s\n", strerror(errno)); + endmntent(mtab); + goto err; + } + + while((ment = getmntent(mtab))){ + if(!strcmp(ment->mnt_dir, fpath)){ + sscanf(ment->mnt_opts, "owner=%u,", &muid); + }else + addmntent(new_mtab, ment); + } + + endmntent(mtab); + + if(fchmod(fileno(new_mtab), 0644) < 0){ + fprintf(stderr, "can't change mode for "MTAB_TMP"\n"); + goto err; + } + + endmntent(new_mtab); + + if(muid == -1){ + fprintf(stderr, "mtab entry for %s not found\n", fpath); + goto err_mtab; + } + + if((getuid()) && (getuid() != muid)){ + fprintf(stderr, "you are not allowed to umount this filesystem.\n"); + goto err_mtab; + } + + if(umount(fpath)){ + fprintf(stderr, "could not umount %s: %s\n", fpath, strerror(errno)); + goto err_mtab; + } + + if(rename(MTAB_TMP, _PATH_MOUNTED) < 0){ + fprintf(stderr, "can't rename %s to %s: %s\n", MTAB_TMP, _PATH_MOUNTED, strerror(errno)); + goto err_mtab; + } + + if(unlink(_PATH_MOUNTED"~") < 0){ + fprintf(stderr, "can't remove "_PATH_MOUNTED"~\n"); + return 1; + } + + return 0; + +err_mtab: + unlink(MTAB_TMP); +err: + unlink(_PATH_MOUNTED"~"); + return 1; +} + -- 1.8.3.1