├── AUTHORS ├── COPYING ├── ChangeLog ├── Doxyfile ├── INSTALL ├── Makefile.am ├── Makefile.cvs ├── NEWS ├── README ├── TODO ├── aclocal.m4 ├── config.guess ├── config.sub ├── configure.in ├── depcomp ├── install-sh ├── ltmain.sh ├── missing ├── mkinstalldirs └── src ├── Makefile.am ├── libs3.c ├── libs3.h └── s3nbd.c /AUTHORS: -------------------------------------------------------------------------------- 1 | Sound 2 | -------------------------------------------------------------------------------- /COPYING: -------------------------------------------------------------------------------- 1 | GNU GENERAL PUBLIC LICENSE 2 | Version 2, June 1991 3 | 4 | Copyright (C) 1989, 1991 Free Software Foundation, Inc. 5 | 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 6 | Everyone is permitted to copy and distribute verbatim copies 7 | of this license document, but changing it is not allowed. 8 | 9 | Preamble 10 | 11 | The licenses for most software are designed to take away your 12 | freedom to share and change it. By contrast, the GNU General Public 13 | License is intended to guarantee your freedom to share and change free 14 | software--to make sure the software is free for all its users. This 15 | General Public License applies to most of the Free Software 16 | Foundation's software and to any other program whose authors commit to 17 | using it. (Some other Free Software Foundation software is covered by 18 | the GNU Library General Public License instead.) You can apply it to 19 | your programs, too. 20 | 21 | When we speak of free software, we are referring to freedom, not 22 | price. Our General Public Licenses are designed to make sure that you 23 | have the freedom to distribute copies of free software (and charge for 24 | this service if you wish), that you receive source code or can get it 25 | if you want it, that you can change the software or use pieces of it 26 | in new free programs; and that you know you can do these things. 27 | 28 | To protect your rights, we need to make restrictions that forbid 29 | anyone to deny you these rights or to ask you to surrender the rights. 30 | These restrictions translate to certain responsibilities for you if you 31 | distribute copies of the software, or if you modify it. 32 | 33 | For example, if you distribute copies of such a program, whether 34 | gratis or for a fee, you must give the recipients all the rights that 35 | you have. You must make sure that they, too, receive or can get the 36 | source code. And you must show them these terms so they know their 37 | rights. 38 | 39 | We protect your rights with two steps: (1) copyright the software, and 40 | (2) offer you this license which gives you legal permission to copy, 41 | distribute and/or modify the software. 42 | 43 | Also, for each author's protection and ours, we want to make certain 44 | that everyone understands that there is no warranty for this free 45 | software. If the software is modified by someone else and passed on, we 46 | want its recipients to know that what they have is not the original, so 47 | that any problems introduced by others will not reflect on the original 48 | authors' reputations. 49 | 50 | Finally, any free program is threatened constantly by software 51 | patents. We wish to avoid the danger that redistributors of a free 52 | program will individually obtain patent licenses, in effect making the 53 | program proprietary. To prevent this, we have made it clear that any 54 | patent must be licensed for everyone's free use or not licensed at all. 55 | 56 | The precise terms and conditions for copying, distribution and 57 | modification follow. 58 | 59 | GNU GENERAL PUBLIC LICENSE 60 | TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 61 | 62 | 0. This License applies to any program or other work which contains 63 | a notice placed by the copyright holder saying it may be distributed 64 | under the terms of this General Public License. The "Program", below, 65 | refers to any such program or work, and a "work based on the Program" 66 | means either the Program or any derivative work under copyright law: 67 | that is to say, a work containing the Program or a portion of it, 68 | either verbatim or with modifications and/or translated into another 69 | language. (Hereinafter, translation is included without limitation in 70 | the term "modification".) Each licensee is addressed as "you". 71 | 72 | Activities other than copying, distribution and modification are not 73 | covered by this License; they are outside its scope. The act of 74 | running the Program is not restricted, and the output from the Program 75 | is covered only if its contents constitute a work based on the 76 | Program (independent of having been made by running the Program). 77 | Whether that is true depends on what the Program does. 78 | 79 | 1. You may copy and distribute verbatim copies of the Program's 80 | source code as you receive it, in any medium, provided that you 81 | conspicuously and appropriately publish on each copy an appropriate 82 | copyright notice and disclaimer of warranty; keep intact all the 83 | notices that refer to this License and to the absence of any warranty; 84 | and give any other recipients of the Program a copy of this License 85 | along with the Program. 86 | 87 | You may charge a fee for the physical act of transferring a copy, and 88 | you may at your option offer warranty protection in exchange for a fee. 89 | 90 | 2. You may modify your copy or copies of the Program or any portion 91 | of it, thus forming a work based on the Program, and copy and 92 | distribute such modifications or work under the terms of Section 1 93 | above, provided that you also meet all of these conditions: 94 | 95 | a) You must cause the modified files to carry prominent notices 96 | stating that you changed the files and the date of any change. 97 | 98 | b) You must cause any work that you distribute or publish, that in 99 | whole or in part contains or is derived from the Program or any 100 | part thereof, to be licensed as a whole at no charge to all third 101 | parties under the terms of this License. 102 | 103 | c) If the modified program normally reads commands interactively 104 | when run, you must cause it, when started running for such 105 | interactive use in the most ordinary way, to print or display an 106 | announcement including an appropriate copyright notice and a 107 | notice that there is no warranty (or else, saying that you provide 108 | a warranty) and that users may redistribute the program under 109 | these conditions, and telling the user how to view a copy of this 110 | License. (Exception: if the Program itself is interactive but 111 | does not normally print such an announcement, your work based on 112 | the Program is not required to print an announcement.) 113 | 114 | These requirements apply to the modified work as a whole. If 115 | identifiable sections of that work are not derived from the Program, 116 | and can be reasonably considered independent and separate works in 117 | themselves, then this License, and its terms, do not apply to those 118 | sections when you distribute them as separate works. But when you 119 | distribute the same sections as part of a whole which is a work based 120 | on the Program, the distribution of the whole must be on the terms of 121 | this License, whose permissions for other licensees extend to the 122 | entire whole, and thus to each and every part regardless of who wrote it. 123 | 124 | Thus, it is not the intent of this section to claim rights or contest 125 | your rights to work written entirely by you; rather, the intent is to 126 | exercise the right to control the distribution of derivative or 127 | collective works based on the Program. 128 | 129 | In addition, mere aggregation of another work not based on the Program 130 | with the Program (or with a work based on the Program) on a volume of 131 | a storage or distribution medium does not bring the other work under 132 | the scope of this License. 133 | 134 | 3. You may copy and distribute the Program (or a work based on it, 135 | under Section 2) in object code or executable form under the terms of 136 | Sections 1 and 2 above provided that you also do one of the following: 137 | 138 | a) Accompany it with the complete corresponding machine-readable 139 | source code, which must be distributed under the terms of Sections 140 | 1 and 2 above on a medium customarily used for software interchange; or, 141 | 142 | b) Accompany it with a written offer, valid for at least three 143 | years, to give any third party, for a charge no more than your 144 | cost of physically performing source distribution, a complete 145 | machine-readable copy of the corresponding source code, to be 146 | distributed under the terms of Sections 1 and 2 above on a medium 147 | customarily used for software interchange; or, 148 | 149 | c) Accompany it with the information you received as to the offer 150 | to distribute corresponding source code. (This alternative is 151 | allowed only for noncommercial distribution and only if you 152 | received the program in object code or executable form with such 153 | an offer, in accord with Subsection b above.) 154 | 155 | The source code for a work means the preferred form of the work for 156 | making modifications to it. For an executable work, complete source 157 | code means all the source code for all modules it contains, plus any 158 | associated interface definition files, plus the scripts used to 159 | control compilation and installation of the executable. However, as a 160 | special exception, the source code distributed need not include 161 | anything that is normally distributed (in either source or binary 162 | form) with the major components (compiler, kernel, and so on) of the 163 | operating system on which the executable runs, unless that component 164 | itself accompanies the executable. 165 | 166 | If distribution of executable or object code is made by offering 167 | access to copy from a designated place, then offering equivalent 168 | access to copy the source code from the same place counts as 169 | distribution of the source code, even though third parties are not 170 | compelled to copy the source along with the object code. 171 | 172 | 4. You may not copy, modify, sublicense, or distribute the Program 173 | except as expressly provided under this License. Any attempt 174 | otherwise to copy, modify, sublicense or distribute the Program is 175 | void, and will automatically terminate your rights under this License. 176 | However, parties who have received copies, or rights, from you under 177 | this License will not have their licenses terminated so long as such 178 | parties remain in full compliance. 179 | 180 | 5. You are not required to accept this License, since you have not 181 | signed it. However, nothing else grants you permission to modify or 182 | distribute the Program or its derivative works. These actions are 183 | prohibited by law if you do not accept this License. Therefore, by 184 | modifying or distributing the Program (or any work based on the 185 | Program), you indicate your acceptance of this License to do so, and 186 | all its terms and conditions for copying, distributing or modifying 187 | the Program or works based on it. 188 | 189 | 6. Each time you redistribute the Program (or any work based on the 190 | Program), the recipient automatically receives a license from the 191 | original licensor to copy, distribute or modify the Program subject to 192 | these terms and conditions. You may not impose any further 193 | restrictions on the recipients' exercise of the rights granted herein. 194 | You are not responsible for enforcing compliance by third parties to 195 | this License. 196 | 197 | 7. If, as a consequence of a court judgment or allegation of patent 198 | infringement or for any other reason (not limited to patent issues), 199 | conditions are imposed on you (whether by court order, agreement or 200 | otherwise) that contradict the conditions of this License, they do not 201 | excuse you from the conditions of this License. If you cannot 202 | distribute so as to satisfy simultaneously your obligations under this 203 | License and any other pertinent obligations, then as a consequence you 204 | may not distribute the Program at all. For example, if a patent 205 | license would not permit royalty-free redistribution of the Program by 206 | all those who receive copies directly or indirectly through you, then 207 | the only way you could satisfy both it and this License would be to 208 | refrain entirely from distribution of the Program. 209 | 210 | If any portion of this section is held invalid or unenforceable under 211 | any particular circumstance, the balance of the section is intended to 212 | apply and the section as a whole is intended to apply in other 213 | circumstances. 214 | 215 | It is not the purpose of this section to induce you to infringe any 216 | patents or other property right claims or to contest validity of any 217 | such claims; this section has the sole purpose of protecting the 218 | integrity of the free software distribution system, which is 219 | implemented by public license practices. Many people have made 220 | generous contributions to the wide range of software distributed 221 | through that system in reliance on consistent application of that 222 | system; it is up to the author/donor to decide if he or she is willing 223 | to distribute software through any other system and a licensee cannot 224 | impose that choice. 225 | 226 | This section is intended to make thoroughly clear what is believed to 227 | be a consequence of the rest of this License. 228 | 229 | 8. If the distribution and/or use of the Program is restricted in 230 | certain countries either by patents or by copyrighted interfaces, the 231 | original copyright holder who places the Program under this License 232 | may add an explicit geographical distribution limitation excluding 233 | those countries, so that distribution is permitted only in or among 234 | countries not thus excluded. In such case, this License incorporates 235 | the limitation as if written in the body of this License. 236 | 237 | 9. The Free Software Foundation may publish revised and/or new versions 238 | of the General Public License from time to time. Such new versions will 239 | be similar in spirit to the present version, but may differ in detail to 240 | address new problems or concerns. 241 | 242 | Each version is given a distinguishing version number. If the Program 243 | specifies a version number of this License which applies to it and "any 244 | later version", you have the option of following the terms and conditions 245 | either of that version or of any later version published by the Free 246 | Software Foundation. If the Program does not specify a version number of 247 | this License, you may choose any version ever published by the Free Software 248 | Foundation. 249 | 250 | 10. If you wish to incorporate parts of the Program into other free 251 | programs whose distribution conditions are different, write to the author 252 | to ask for permission. For software which is copyrighted by the Free 253 | Software Foundation, write to the Free Software Foundation; we sometimes 254 | make exceptions for this. Our decision will be guided by the two goals 255 | of preserving the free status of all derivatives of our free software and 256 | of promoting the sharing and reuse of software generally. 257 | 258 | NO WARRANTY 259 | 260 | 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY 261 | FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN 262 | OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES 263 | PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED 264 | OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 265 | MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS 266 | TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE 267 | PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, 268 | REPAIR OR CORRECTION. 269 | 270 | 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING 271 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR 272 | REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, 273 | INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING 274 | OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED 275 | TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY 276 | YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER 277 | PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE 278 | POSSIBILITY OF SUCH DAMAGES. 279 | 280 | END OF TERMS AND CONDITIONS 281 | 282 | How to Apply These Terms to Your New Programs 283 | 284 | If you develop a new program, and you want it to be of the greatest 285 | possible use to the public, the best way to achieve this is to make it 286 | free software which everyone can redistribute and change under these terms. 287 | 288 | To do so, attach the following notices to the program. It is safest 289 | to attach them to the start of each source file to most effectively 290 | convey the exclusion of warranty; and each file should have at least 291 | the "copyright" line and a pointer to where the full notice is found. 292 | 293 | 294 | Copyright (C) 295 | 296 | This program is free software; you can redistribute it and/or modify 297 | it under the terms of the GNU General Public License as published by 298 | the Free Software Foundation; either version 2 of the License, or 299 | (at your option) any later version. 300 | 301 | This program is distributed in the hope that it will be useful, 302 | but WITHOUT ANY WARRANTY; without even the implied warranty of 303 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 304 | GNU General Public License for more details. 305 | 306 | You should have received a copy of the GNU General Public License 307 | along with this program; if not, write to the Free Software 308 | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 309 | 310 | 311 | Also add information on how to contact you by electronic and paper mail. 312 | 313 | If the program is interactive, make it output a short notice like this 314 | when it starts in an interactive mode: 315 | 316 | Gnomovision version 69, Copyright (C) year name of author 317 | Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. 318 | This is free software, and you are welcome to redistribute it 319 | under certain conditions; type `show c' for details. 320 | 321 | The hypothetical commands `show w' and `show c' should show the appropriate 322 | parts of the General Public License. Of course, the commands you use may 323 | be called something other than `show w' and `show c'; they could even be 324 | mouse-clicks or menu items--whatever suits your program. 325 | 326 | You should also get your employer (if you work as a programmer) or your 327 | school, if any, to sign a "copyright disclaimer" for the program, if 328 | necessary. Here is a sample; alter the names: 329 | 330 | Yoyodyne, Inc., hereby disclaims all copyright interest in the program 331 | `Gnomovision' (which makes passes at compilers) written by James Hacker. 332 | 333 | , 1 April 1989 334 | Ty Coon, President of Vice 335 | 336 | This General Public License does not permit incorporating your program into 337 | proprietary programs. If your program is a subroutine library, you may 338 | consider it more useful to permit linking proprietary applications with the 339 | library. If this is what you want to do, use the GNU Library General 340 | Public License instead of this License. 341 | -------------------------------------------------------------------------------- /ChangeLog: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/soundsrc/s3nbd/d308d7ae695522cfdd9f3d69d59e10dfa4b965c6/ChangeLog -------------------------------------------------------------------------------- /Doxyfile: -------------------------------------------------------------------------------- 1 | # Doxyfile 1.4.1-KDevelop 2 | 3 | #--------------------------------------------------------------------------- 4 | # Project related configuration options 5 | #--------------------------------------------------------------------------- 6 | PROJECT_NAME = s3fs-nbd.kdevelop 7 | PROJECT_NUMBER = 1.0 8 | OUTPUT_DIRECTORY = 9 | CREATE_SUBDIRS = NO 10 | OUTPUT_LANGUAGE = English 11 | USE_WINDOWS_ENCODING = NO 12 | BRIEF_MEMBER_DESC = YES 13 | REPEAT_BRIEF = YES 14 | ABBREVIATE_BRIEF = "The $name class" \ 15 | "The $name widget" \ 16 | "The $name file" \ 17 | is \ 18 | provides \ 19 | specifies \ 20 | contains \ 21 | represents \ 22 | a \ 23 | an \ 24 | the 25 | ALWAYS_DETAILED_SEC = NO 26 | INLINE_INHERITED_MEMB = NO 27 | FULL_PATH_NAMES = YES 28 | STRIP_FROM_PATH = /home/sound/ 29 | STRIP_FROM_INC_PATH = 30 | SHORT_NAMES = NO 31 | JAVADOC_AUTOBRIEF = NO 32 | MULTILINE_CPP_IS_BRIEF = NO 33 | DETAILS_AT_TOP = NO 34 | INHERIT_DOCS = YES 35 | DISTRIBUTE_GROUP_DOC = NO 36 | TAB_SIZE = 8 37 | ALIASES = 38 | OPTIMIZE_OUTPUT_FOR_C = NO 39 | OPTIMIZE_OUTPUT_JAVA = NO 40 | SUBGROUPING = YES 41 | #--------------------------------------------------------------------------- 42 | # Build related configuration options 43 | #--------------------------------------------------------------------------- 44 | EXTRACT_ALL = NO 45 | EXTRACT_PRIVATE = NO 46 | EXTRACT_STATIC = NO 47 | EXTRACT_LOCAL_CLASSES = YES 48 | EXTRACT_LOCAL_METHODS = NO 49 | HIDE_UNDOC_MEMBERS = NO 50 | HIDE_UNDOC_CLASSES = NO 51 | HIDE_FRIEND_COMPOUNDS = NO 52 | HIDE_IN_BODY_DOCS = NO 53 | INTERNAL_DOCS = NO 54 | CASE_SENSE_NAMES = YES 55 | HIDE_SCOPE_NAMES = NO 56 | SHOW_INCLUDE_FILES = YES 57 | INLINE_INFO = YES 58 | SORT_MEMBER_DOCS = YES 59 | SORT_BRIEF_DOCS = NO 60 | SORT_BY_SCOPE_NAME = NO 61 | GENERATE_TODOLIST = YES 62 | GENERATE_TESTLIST = YES 63 | GENERATE_BUGLIST = YES 64 | GENERATE_DEPRECATEDLIST= YES 65 | ENABLED_SECTIONS = 66 | MAX_INITIALIZER_LINES = 30 67 | SHOW_USED_FILES = YES 68 | SHOW_DIRECTORIES = YES 69 | FILE_VERSION_FILTER = 70 | #--------------------------------------------------------------------------- 71 | # configuration options related to warning and progress messages 72 | #--------------------------------------------------------------------------- 73 | QUIET = NO 74 | WARNINGS = YES 75 | WARN_IF_UNDOCUMENTED = YES 76 | WARN_IF_DOC_ERROR = YES 77 | WARN_NO_PARAMDOC = NO 78 | WARN_FORMAT = "$file:$line: $text" 79 | WARN_LOGFILE = 80 | #--------------------------------------------------------------------------- 81 | # configuration options related to the input files 82 | #--------------------------------------------------------------------------- 83 | INPUT = /home/sound/projects/s3fs-nbd 84 | FILE_PATTERNS = *.c \ 85 | *.cc \ 86 | *.cxx \ 87 | *.cpp \ 88 | *.c++ \ 89 | *.java \ 90 | *.ii \ 91 | *.ixx \ 92 | *.ipp \ 93 | *.i++ \ 94 | *.inl \ 95 | *.h \ 96 | *.hh \ 97 | *.hxx \ 98 | *.hpp \ 99 | *.h++ \ 100 | *.idl \ 101 | *.odl \ 102 | *.cs \ 103 | *.php \ 104 | *.php3 \ 105 | *.inc \ 106 | *.m \ 107 | *.mm \ 108 | *.dox \ 109 | *.C \ 110 | *.CC \ 111 | *.C++ \ 112 | *.II \ 113 | *.I++ \ 114 | *.H \ 115 | *.HH \ 116 | *.H++ \ 117 | *.CS \ 118 | *.PHP \ 119 | *.PHP3 \ 120 | *.M \ 121 | *.MM \ 122 | *.C \ 123 | *.H \ 124 | *.tlh \ 125 | *.diff \ 126 | *.patch \ 127 | *.moc \ 128 | *.xpm \ 129 | *.dox 130 | RECURSIVE = yes 131 | EXCLUDE = 132 | EXCLUDE_SYMLINKS = NO 133 | EXCLUDE_PATTERNS = 134 | EXAMPLE_PATH = 135 | EXAMPLE_PATTERNS = * 136 | EXAMPLE_RECURSIVE = NO 137 | IMAGE_PATH = 138 | INPUT_FILTER = 139 | FILTER_PATTERNS = 140 | FILTER_SOURCE_FILES = NO 141 | #--------------------------------------------------------------------------- 142 | # configuration options related to source browsing 143 | #--------------------------------------------------------------------------- 144 | SOURCE_BROWSER = NO 145 | INLINE_SOURCES = NO 146 | STRIP_CODE_COMMENTS = YES 147 | REFERENCED_BY_RELATION = YES 148 | REFERENCES_RELATION = YES 149 | VERBATIM_HEADERS = YES 150 | #--------------------------------------------------------------------------- 151 | # configuration options related to the alphabetical class index 152 | #--------------------------------------------------------------------------- 153 | ALPHABETICAL_INDEX = NO 154 | COLS_IN_ALPHA_INDEX = 5 155 | IGNORE_PREFIX = 156 | #--------------------------------------------------------------------------- 157 | # configuration options related to the HTML output 158 | #--------------------------------------------------------------------------- 159 | GENERATE_HTML = YES 160 | HTML_OUTPUT = html 161 | HTML_FILE_EXTENSION = .html 162 | HTML_HEADER = 163 | HTML_FOOTER = 164 | HTML_STYLESHEET = 165 | HTML_ALIGN_MEMBERS = YES 166 | GENERATE_HTMLHELP = NO 167 | CHM_FILE = 168 | HHC_LOCATION = 169 | GENERATE_CHI = NO 170 | BINARY_TOC = NO 171 | TOC_EXPAND = NO 172 | DISABLE_INDEX = NO 173 | ENUM_VALUES_PER_LINE = 4 174 | GENERATE_TREEVIEW = NO 175 | TREEVIEW_WIDTH = 250 176 | #--------------------------------------------------------------------------- 177 | # configuration options related to the LaTeX output 178 | #--------------------------------------------------------------------------- 179 | GENERATE_LATEX = YES 180 | LATEX_OUTPUT = latex 181 | LATEX_CMD_NAME = latex 182 | MAKEINDEX_CMD_NAME = makeindex 183 | COMPACT_LATEX = NO 184 | PAPER_TYPE = a4wide 185 | EXTRA_PACKAGES = 186 | LATEX_HEADER = 187 | PDF_HYPERLINKS = NO 188 | USE_PDFLATEX = NO 189 | LATEX_BATCHMODE = NO 190 | LATEX_HIDE_INDICES = NO 191 | #--------------------------------------------------------------------------- 192 | # configuration options related to the RTF output 193 | #--------------------------------------------------------------------------- 194 | GENERATE_RTF = NO 195 | RTF_OUTPUT = rtf 196 | COMPACT_RTF = NO 197 | RTF_HYPERLINKS = NO 198 | RTF_STYLESHEET_FILE = 199 | RTF_EXTENSIONS_FILE = 200 | #--------------------------------------------------------------------------- 201 | # configuration options related to the man page output 202 | #--------------------------------------------------------------------------- 203 | GENERATE_MAN = NO 204 | MAN_OUTPUT = man 205 | MAN_EXTENSION = .3 206 | MAN_LINKS = NO 207 | #--------------------------------------------------------------------------- 208 | # configuration options related to the XML output 209 | #--------------------------------------------------------------------------- 210 | GENERATE_XML = yes 211 | XML_OUTPUT = xml 212 | XML_SCHEMA = 213 | XML_DTD = 214 | XML_PROGRAMLISTING = YES 215 | #--------------------------------------------------------------------------- 216 | # configuration options for the AutoGen Definitions output 217 | #--------------------------------------------------------------------------- 218 | GENERATE_AUTOGEN_DEF = NO 219 | #--------------------------------------------------------------------------- 220 | # configuration options related to the Perl module output 221 | #--------------------------------------------------------------------------- 222 | GENERATE_PERLMOD = NO 223 | PERLMOD_LATEX = NO 224 | PERLMOD_PRETTY = YES 225 | PERLMOD_MAKEVAR_PREFIX = 226 | #--------------------------------------------------------------------------- 227 | # Configuration options related to the preprocessor 228 | #--------------------------------------------------------------------------- 229 | ENABLE_PREPROCESSING = YES 230 | MACRO_EXPANSION = NO 231 | EXPAND_ONLY_PREDEF = NO 232 | SEARCH_INCLUDES = YES 233 | INCLUDE_PATH = 234 | INCLUDE_FILE_PATTERNS = 235 | PREDEFINED = 236 | EXPAND_AS_DEFINED = 237 | SKIP_FUNCTION_MACROS = YES 238 | #--------------------------------------------------------------------------- 239 | # Configuration::additions related to external references 240 | #--------------------------------------------------------------------------- 241 | TAGFILES = 242 | GENERATE_TAGFILE = s3fs-nbd.tag 243 | ALLEXTERNALS = NO 244 | EXTERNAL_GROUPS = YES 245 | PERL_PATH = /usr/bin/perl 246 | #--------------------------------------------------------------------------- 247 | # Configuration options related to the dot tool 248 | #--------------------------------------------------------------------------- 249 | CLASS_DIAGRAMS = YES 250 | HIDE_UNDOC_RELATIONS = YES 251 | HAVE_DOT = NO 252 | CLASS_GRAPH = YES 253 | COLLABORATION_GRAPH = YES 254 | GROUP_GRAPHS = YES 255 | UML_LOOK = NO 256 | TEMPLATE_RELATIONS = NO 257 | INCLUDE_GRAPH = YES 258 | INCLUDED_BY_GRAPH = YES 259 | CALL_GRAPH = NO 260 | GRAPHICAL_HIERARCHY = YES 261 | DIRECTORY_GRAPH = YES 262 | DOT_IMAGE_FORMAT = png 263 | DOT_PATH = 264 | DOTFILE_DIRS = 265 | MAX_DOT_GRAPH_WIDTH = 1024 266 | MAX_DOT_GRAPH_HEIGHT = 1024 267 | MAX_DOT_GRAPH_DEPTH = 1000 268 | DOT_TRANSPARENT = NO 269 | DOT_MULTI_TARGETS = NO 270 | GENERATE_LEGEND = YES 271 | DOT_CLEANUP = YES 272 | #--------------------------------------------------------------------------- 273 | # Configuration::additions related to the search engine 274 | #--------------------------------------------------------------------------- 275 | SEARCHENGINE = NO 276 | -------------------------------------------------------------------------------- /INSTALL: -------------------------------------------------------------------------------- 1 | Basic Installation 2 | ================== 3 | 4 | These are generic installation instructions. 5 | 6 | The `configure' shell script attempts to guess correct values for 7 | various system-dependent variables used during compilation. It uses 8 | those values to create a `Makefile' in each directory of the package. 9 | It may also create one or more `.h' files containing system-dependent 10 | definitions. Finally, it creates a shell script `config.status' that 11 | you can run in the future to recreate the current configuration, a file 12 | `config.cache' that saves the results of its tests to speed up 13 | reconfiguring, and a file `config.log' containing compiler output 14 | (useful mainly for debugging `configure'). 15 | 16 | If you need to do unusual things to compile the package, please try 17 | to figure out how `configure' could check whether to do them, and mail 18 | diffs or instructions to the address given in the `README' so they can 19 | be considered for the next release. If at some point `config.cache' 20 | contains results you don't want to keep, you may remove or edit it. 21 | 22 | The file `configure.in' is used to create `configure' by a program 23 | called `autoconf'. You only need `configure.in' if you want to change 24 | it or regenerate `configure' using a newer version of `autoconf'. 25 | 26 | The simplest way to compile this package is: 27 | 28 | 1. `cd' to the directory containing the package's source code and type 29 | `./configure' to configure the package for your system. If you're 30 | using `csh' on an old version of System V, you might need to type 31 | `sh ./configure' instead to prevent `csh' from trying to execute 32 | `configure' itself. 33 | 34 | Running `configure' takes a while. While running, it prints some 35 | messages telling which features it is checking for. 36 | 37 | 2. Type `make' to compile the package. 38 | 39 | 3. Type `make install' to install the programs and any data files and 40 | documentation. 41 | 42 | 4. You can remove the program binaries and object files from the 43 | source code directory by typing `make clean'. 44 | 45 | Compilers and Options 46 | ===================== 47 | 48 | Some systems require unusual options for compilation or linking that 49 | the `configure' script does not know about. You can give `configure' 50 | initial values for variables by setting them in the environment. Using 51 | a Bourne-compatible shell, you can do that on the command line like 52 | this: 53 | CC=c89 CFLAGS=-O2 LIBS=-lposix ./configure 54 | 55 | Or on systems that have the `env' program, you can do it like this: 56 | env CPPFLAGS=-I/usr/local/include LDFLAGS=-s ./configure 57 | 58 | Compiling For Multiple Architectures 59 | ==================================== 60 | 61 | You can compile the package for more than one kind of computer at the 62 | same time, by placing the object files for each architecture in their 63 | own directory. To do this, you must use a version of `make' that 64 | supports the `VPATH' variable, such as GNU `make'. `cd' to the 65 | directory where you want the object files and executables to go and run 66 | the `configure' script. `configure' automatically checks for the 67 | source code in the directory that `configure' is in and in `..'. 68 | 69 | If you have to use a `make' that does not supports the `VPATH' 70 | variable, you have to compile the package for one architecture at a time 71 | in the source code directory. After you have installed the package for 72 | one architecture, use `make distclean' before reconfiguring for another 73 | architecture. 74 | 75 | Installation Names 76 | ================== 77 | 78 | By default, `make install' will install the package's files in 79 | `/usr/local/bin', `/usr/local/man', etc. You can specify an 80 | installation prefix other than `/usr/local' by giving `configure' the 81 | option `--prefix=PATH'. 82 | 83 | You can specify separate installation prefixes for 84 | architecture-specific files and architecture-independent files. If you 85 | give `configure' the option `--exec-prefix=PATH', the package will use 86 | PATH as the prefix for installing programs and libraries. 87 | Documentation and other data files will still use the regular prefix. 88 | 89 | If the package supports it, you can cause programs to be installed 90 | with an extra prefix or suffix on their names by giving `configure' the 91 | option `--program-prefix=PREFIX' or `--program-suffix=SUFFIX'. 92 | 93 | Optional Features 94 | ================= 95 | 96 | Some packages pay attention to `--enable-FEATURE' options to 97 | `configure', where FEATURE indicates an optional part of the package. 98 | They may also pay attention to `--with-PACKAGE' options, where PACKAGE 99 | is something like `gnu-as' or `x' (for the X Window System). The 100 | `README' should mention any `--enable-' and `--with-' options that the 101 | package recognizes. 102 | 103 | For packages that use the X Window System, `configure' can usually 104 | find the X include and library files automatically, but if it doesn't, 105 | you can use the `configure' options `--x-includes=DIR' and 106 | `--x-libraries=DIR' to specify their locations. 107 | 108 | Specifying the System Type 109 | ========================== 110 | 111 | There may be some features `configure' can not figure out 112 | automatically, but needs to determine by the type of host the package 113 | will run on. Usually `configure' can figure that out, but if it prints 114 | a message saying it can not guess the host type, give it the 115 | `--host=TYPE' option. TYPE can either be a short name for the system 116 | type, such as `sun4', or a canonical name with three fields: 117 | CPU-COMPANY-SYSTEM 118 | 119 | See the file `config.sub' for the possible values of each field. If 120 | `config.sub' isn't included in this package, then this package doesn't 121 | need to know the host type. 122 | 123 | If you are building compiler tools for cross-compiling, you can also 124 | use the `--target=TYPE' option to select the type of system they will 125 | produce code for and the `--build=TYPE' option to select the type of 126 | system on which you are compiling the package. 127 | 128 | Sharing Defaults 129 | ================ 130 | 131 | If you want to set default values for `configure' scripts to share, 132 | you can create a site shell script called `config.site' that gives 133 | default values for variables like `CC', `cache_file', and `prefix'. 134 | `configure' looks for `PREFIX/share/config.site' if it exists, then 135 | `PREFIX/etc/config.site' if it exists. Or, you can set the 136 | `CONFIG_SITE' environment variable to the location of the site script. 137 | A warning: not all `configure' scripts look for a site script. 138 | 139 | Operation Controls 140 | ================== 141 | 142 | `configure' recognizes the following options to control how it 143 | operates. 144 | 145 | `--cache-file=FILE' 146 | Use and save the results of the tests in FILE instead of 147 | `./config.cache'. Set FILE to `/dev/null' to disable caching, for 148 | debugging `configure'. 149 | 150 | `--help' 151 | Print a summary of the options to `configure', and exit. 152 | 153 | `--quiet' 154 | `--silent' 155 | `-q' 156 | Do not print messages saying which checks are being made. 157 | 158 | `--srcdir=DIR' 159 | Look for the package's source code in directory DIR. Usually 160 | `configure' can determine that directory automatically. 161 | 162 | `--version' 163 | Print the version of Autoconf used to generate the `configure' 164 | script, and exit. 165 | 166 | `configure' also accepts some other, not widely useful, options. 167 | 168 | -------------------------------------------------------------------------------- /Makefile.am: -------------------------------------------------------------------------------- 1 | # not a GNU package. You can remove this line, if 2 | # have all needed files, that a GNU package needs 3 | AUTOMAKE_OPTIONS = foreign 1.4 4 | 5 | SUBDIRS = src 6 | -------------------------------------------------------------------------------- /Makefile.cvs: -------------------------------------------------------------------------------- 1 | default: all 2 | 3 | all: 4 | aclocal 5 | autoheader 6 | automake 7 | autoconf 8 | 9 | -------------------------------------------------------------------------------- /NEWS: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/soundsrc/s3nbd/d308d7ae695522cfdd9f3d69d59e10dfa4b965c6/NEWS -------------------------------------------------------------------------------- /README: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/soundsrc/s3nbd/d308d7ae695522cfdd9f3d69d59e10dfa4b965c6/README -------------------------------------------------------------------------------- /TODO: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/soundsrc/s3nbd/d308d7ae695522cfdd9f3d69d59e10dfa4b965c6/TODO -------------------------------------------------------------------------------- /config.guess: -------------------------------------------------------------------------------- 1 | #! /bin/sh 2 | # Attempt to guess a canonical system name. 3 | # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 4 | # 2000, 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc. 5 | 6 | timestamp='2006-02-23' 7 | 8 | # This file is free software; you can redistribute it and/or modify it 9 | # under the terms of the GNU General Public License as published by 10 | # the Free Software Foundation; either version 2 of the License, or 11 | # (at your option) any later version. 12 | # 13 | # This program is distributed in the hope that it will be useful, but 14 | # WITHOUT ANY WARRANTY; without even the implied warranty of 15 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 16 | # General Public License for more details. 17 | # 18 | # You should have received a copy of the GNU General Public License 19 | # along with this program; if not, write to the Free Software 20 | # Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 21 | # 02110-1301, USA. 22 | # 23 | # As a special exception to the GNU General Public License, if you 24 | # distribute this file as part of a program that contains a 25 | # configuration script generated by Autoconf, you may include it under 26 | # the same distribution terms that you use for the rest of that program. 27 | 28 | 29 | # Originally written by Per Bothner . 30 | # Please send patches to . Submit a context 31 | # diff and a properly formatted ChangeLog entry. 32 | # 33 | # This script attempts to guess a canonical system name similar to 34 | # config.sub. If it succeeds, it prints the system name on stdout, and 35 | # exits with 0. Otherwise, it exits with 1. 36 | # 37 | # The plan is that this can be called by configure scripts if you 38 | # don't specify an explicit build system type. 39 | 40 | me=`echo "$0" | sed -e 's,.*/,,'` 41 | 42 | usage="\ 43 | Usage: $0 [OPTION] 44 | 45 | Output the configuration name of the system \`$me' is run on. 46 | 47 | Operation modes: 48 | -h, --help print this help, then exit 49 | -t, --time-stamp print date of last modification, then exit 50 | -v, --version print version number, then exit 51 | 52 | Report bugs and patches to ." 53 | 54 | version="\ 55 | GNU config.guess ($timestamp) 56 | 57 | Originally written by Per Bothner. 58 | Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005 59 | Free Software Foundation, Inc. 60 | 61 | This is free software; see the source for copying conditions. There is NO 62 | warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." 63 | 64 | help=" 65 | Try \`$me --help' for more information." 66 | 67 | # Parse command line 68 | while test $# -gt 0 ; do 69 | case $1 in 70 | --time-stamp | --time* | -t ) 71 | echo "$timestamp" ; exit ;; 72 | --version | -v ) 73 | echo "$version" ; exit ;; 74 | --help | --h* | -h ) 75 | echo "$usage"; exit ;; 76 | -- ) # Stop option processing 77 | shift; break ;; 78 | - ) # Use stdin as input. 79 | break ;; 80 | -* ) 81 | echo "$me: invalid option $1$help" >&2 82 | exit 1 ;; 83 | * ) 84 | break ;; 85 | esac 86 | done 87 | 88 | if test $# != 0; then 89 | echo "$me: too many arguments$help" >&2 90 | exit 1 91 | fi 92 | 93 | trap 'exit 1' 1 2 15 94 | 95 | # CC_FOR_BUILD -- compiler used by this script. Note that the use of a 96 | # compiler to aid in system detection is discouraged as it requires 97 | # temporary files to be created and, as you can see below, it is a 98 | # headache to deal with in a portable fashion. 99 | 100 | # Historically, `CC_FOR_BUILD' used to be named `HOST_CC'. We still 101 | # use `HOST_CC' if defined, but it is deprecated. 102 | 103 | # Portable tmp directory creation inspired by the Autoconf team. 104 | 105 | set_cc_for_build=' 106 | trap "exitcode=\$?; (rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null) && exit \$exitcode" 0 ; 107 | trap "rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null; exit 1" 1 2 13 15 ; 108 | : ${TMPDIR=/tmp} ; 109 | { tmp=`(umask 077 && mktemp -d "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } || 110 | { test -n "$RANDOM" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir $tmp) ; } || 111 | { tmp=$TMPDIR/cg-$$ && (umask 077 && mkdir $tmp) && echo "Warning: creating insecure temp directory" >&2 ; } || 112 | { echo "$me: cannot create a temporary directory in $TMPDIR" >&2 ; exit 1 ; } ; 113 | dummy=$tmp/dummy ; 114 | tmpfiles="$dummy.c $dummy.o $dummy.rel $dummy" ; 115 | case $CC_FOR_BUILD,$HOST_CC,$CC in 116 | ,,) echo "int x;" > $dummy.c ; 117 | for c in cc gcc c89 c99 ; do 118 | if ($c -c -o $dummy.o $dummy.c) >/dev/null 2>&1 ; then 119 | CC_FOR_BUILD="$c"; break ; 120 | fi ; 121 | done ; 122 | if test x"$CC_FOR_BUILD" = x ; then 123 | CC_FOR_BUILD=no_compiler_found ; 124 | fi 125 | ;; 126 | ,,*) CC_FOR_BUILD=$CC ;; 127 | ,*,*) CC_FOR_BUILD=$HOST_CC ;; 128 | esac ; set_cc_for_build= ;' 129 | 130 | # This is needed to find uname on a Pyramid OSx when run in the BSD universe. 131 | # (ghazi@noc.rutgers.edu 1994-08-24) 132 | if (test -f /.attbin/uname) >/dev/null 2>&1 ; then 133 | PATH=$PATH:/.attbin ; export PATH 134 | fi 135 | 136 | UNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown 137 | UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown 138 | UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown 139 | UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown 140 | 141 | # Note: order is significant - the case branches are not exclusive. 142 | 143 | case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in 144 | *:NetBSD:*:*) 145 | # NetBSD (nbsd) targets should (where applicable) match one or 146 | # more of the tupples: *-*-netbsdelf*, *-*-netbsdaout*, 147 | # *-*-netbsdecoff* and *-*-netbsd*. For targets that recently 148 | # switched to ELF, *-*-netbsd* would select the old 149 | # object file format. This provides both forward 150 | # compatibility and a consistent mechanism for selecting the 151 | # object file format. 152 | # 153 | # Note: NetBSD doesn't particularly care about the vendor 154 | # portion of the name. We always set it to "unknown". 155 | sysctl="sysctl -n hw.machine_arch" 156 | UNAME_MACHINE_ARCH=`(/sbin/$sysctl 2>/dev/null || \ 157 | /usr/sbin/$sysctl 2>/dev/null || echo unknown)` 158 | case "${UNAME_MACHINE_ARCH}" in 159 | armeb) machine=armeb-unknown ;; 160 | arm*) machine=arm-unknown ;; 161 | sh3el) machine=shl-unknown ;; 162 | sh3eb) machine=sh-unknown ;; 163 | *) machine=${UNAME_MACHINE_ARCH}-unknown ;; 164 | esac 165 | # The Operating System including object format, if it has switched 166 | # to ELF recently, or will in the future. 167 | case "${UNAME_MACHINE_ARCH}" in 168 | arm*|i386|m68k|ns32k|sh3*|sparc|vax) 169 | eval $set_cc_for_build 170 | if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \ 171 | | grep __ELF__ >/dev/null 172 | then 173 | # Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout). 174 | # Return netbsd for either. FIX? 175 | os=netbsd 176 | else 177 | os=netbsdelf 178 | fi 179 | ;; 180 | *) 181 | os=netbsd 182 | ;; 183 | esac 184 | # The OS release 185 | # Debian GNU/NetBSD machines have a different userland, and 186 | # thus, need a distinct triplet. However, they do not need 187 | # kernel version information, so it can be replaced with a 188 | # suitable tag, in the style of linux-gnu. 189 | case "${UNAME_VERSION}" in 190 | Debian*) 191 | release='-gnu' 192 | ;; 193 | *) 194 | release=`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'` 195 | ;; 196 | esac 197 | # Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM: 198 | # contains redundant information, the shorter form: 199 | # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used. 200 | echo "${machine}-${os}${release}" 201 | exit ;; 202 | *:OpenBSD:*:*) 203 | UNAME_MACHINE_ARCH=`arch | sed 's/OpenBSD.//'` 204 | echo ${UNAME_MACHINE_ARCH}-unknown-openbsd${UNAME_RELEASE} 205 | exit ;; 206 | *:ekkoBSD:*:*) 207 | echo ${UNAME_MACHINE}-unknown-ekkobsd${UNAME_RELEASE} 208 | exit ;; 209 | *:SolidBSD:*:*) 210 | echo ${UNAME_MACHINE}-unknown-solidbsd${UNAME_RELEASE} 211 | exit ;; 212 | macppc:MirBSD:*:*) 213 | echo powerppc-unknown-mirbsd${UNAME_RELEASE} 214 | exit ;; 215 | *:MirBSD:*:*) 216 | echo ${UNAME_MACHINE}-unknown-mirbsd${UNAME_RELEASE} 217 | exit ;; 218 | alpha:OSF1:*:*) 219 | case $UNAME_RELEASE in 220 | *4.0) 221 | UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'` 222 | ;; 223 | *5.*) 224 | UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $4}'` 225 | ;; 226 | esac 227 | # According to Compaq, /usr/sbin/psrinfo has been available on 228 | # OSF/1 and Tru64 systems produced since 1995. I hope that 229 | # covers most systems running today. This code pipes the CPU 230 | # types through head -n 1, so we only detect the type of CPU 0. 231 | ALPHA_CPU_TYPE=`/usr/sbin/psrinfo -v | sed -n -e 's/^ The alpha \(.*\) processor.*$/\1/p' | head -n 1` 232 | case "$ALPHA_CPU_TYPE" in 233 | "EV4 (21064)") 234 | UNAME_MACHINE="alpha" ;; 235 | "EV4.5 (21064)") 236 | UNAME_MACHINE="alpha" ;; 237 | "LCA4 (21066/21068)") 238 | UNAME_MACHINE="alpha" ;; 239 | "EV5 (21164)") 240 | UNAME_MACHINE="alphaev5" ;; 241 | "EV5.6 (21164A)") 242 | UNAME_MACHINE="alphaev56" ;; 243 | "EV5.6 (21164PC)") 244 | UNAME_MACHINE="alphapca56" ;; 245 | "EV5.7 (21164PC)") 246 | UNAME_MACHINE="alphapca57" ;; 247 | "EV6 (21264)") 248 | UNAME_MACHINE="alphaev6" ;; 249 | "EV6.7 (21264A)") 250 | UNAME_MACHINE="alphaev67" ;; 251 | "EV6.8CB (21264C)") 252 | UNAME_MACHINE="alphaev68" ;; 253 | "EV6.8AL (21264B)") 254 | UNAME_MACHINE="alphaev68" ;; 255 | "EV6.8CX (21264D)") 256 | UNAME_MACHINE="alphaev68" ;; 257 | "EV6.9A (21264/EV69A)") 258 | UNAME_MACHINE="alphaev69" ;; 259 | "EV7 (21364)") 260 | UNAME_MACHINE="alphaev7" ;; 261 | "EV7.9 (21364A)") 262 | UNAME_MACHINE="alphaev79" ;; 263 | esac 264 | # A Pn.n version is a patched version. 265 | # A Vn.n version is a released version. 266 | # A Tn.n version is a released field test version. 267 | # A Xn.n version is an unreleased experimental baselevel. 268 | # 1.2 uses "1.2" for uname -r. 269 | echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[PVTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` 270 | exit ;; 271 | Alpha\ *:Windows_NT*:*) 272 | # How do we know it's Interix rather than the generic POSIX subsystem? 273 | # Should we change UNAME_MACHINE based on the output of uname instead 274 | # of the specific Alpha model? 275 | echo alpha-pc-interix 276 | exit ;; 277 | 21064:Windows_NT:50:3) 278 | echo alpha-dec-winnt3.5 279 | exit ;; 280 | Amiga*:UNIX_System_V:4.0:*) 281 | echo m68k-unknown-sysv4 282 | exit ;; 283 | *:[Aa]miga[Oo][Ss]:*:*) 284 | echo ${UNAME_MACHINE}-unknown-amigaos 285 | exit ;; 286 | *:[Mm]orph[Oo][Ss]:*:*) 287 | echo ${UNAME_MACHINE}-unknown-morphos 288 | exit ;; 289 | *:OS/390:*:*) 290 | echo i370-ibm-openedition 291 | exit ;; 292 | *:z/VM:*:*) 293 | echo s390-ibm-zvmoe 294 | exit ;; 295 | *:OS400:*:*) 296 | echo powerpc-ibm-os400 297 | exit ;; 298 | arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*) 299 | echo arm-acorn-riscix${UNAME_RELEASE} 300 | exit ;; 301 | arm:riscos:*:*|arm:RISCOS:*:*) 302 | echo arm-unknown-riscos 303 | exit ;; 304 | SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*) 305 | echo hppa1.1-hitachi-hiuxmpp 306 | exit ;; 307 | Pyramid*:OSx*:*:* | MIS*:OSx*:*:* | MIS*:SMP_DC-OSx*:*:*) 308 | # akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE. 309 | if test "`(/bin/universe) 2>/dev/null`" = att ; then 310 | echo pyramid-pyramid-sysv3 311 | else 312 | echo pyramid-pyramid-bsd 313 | fi 314 | exit ;; 315 | NILE*:*:*:dcosx) 316 | echo pyramid-pyramid-svr4 317 | exit ;; 318 | DRS?6000:unix:4.0:6*) 319 | echo sparc-icl-nx6 320 | exit ;; 321 | DRS?6000:UNIX_SV:4.2*:7* | DRS?6000:isis:4.2*:7*) 322 | case `/usr/bin/uname -p` in 323 | sparc) echo sparc-icl-nx7; exit ;; 324 | esac ;; 325 | sun4H:SunOS:5.*:*) 326 | echo sparc-hal-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` 327 | exit ;; 328 | sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*) 329 | echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` 330 | exit ;; 331 | i86pc:SunOS:5.*:*) 332 | echo i386-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` 333 | exit ;; 334 | sun4*:SunOS:6*:*) 335 | # According to config.sub, this is the proper way to canonicalize 336 | # SunOS6. Hard to guess exactly what SunOS6 will be like, but 337 | # it's likely to be more like Solaris than SunOS4. 338 | echo sparc-sun-solaris3`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` 339 | exit ;; 340 | sun4*:SunOS:*:*) 341 | case "`/usr/bin/arch -k`" in 342 | Series*|S4*) 343 | UNAME_RELEASE=`uname -v` 344 | ;; 345 | esac 346 | # Japanese Language versions have a version number like `4.1.3-JL'. 347 | echo sparc-sun-sunos`echo ${UNAME_RELEASE}|sed -e 's/-/_/'` 348 | exit ;; 349 | sun3*:SunOS:*:*) 350 | echo m68k-sun-sunos${UNAME_RELEASE} 351 | exit ;; 352 | sun*:*:4.2BSD:*) 353 | UNAME_RELEASE=`(sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null` 354 | test "x${UNAME_RELEASE}" = "x" && UNAME_RELEASE=3 355 | case "`/bin/arch`" in 356 | sun3) 357 | echo m68k-sun-sunos${UNAME_RELEASE} 358 | ;; 359 | sun4) 360 | echo sparc-sun-sunos${UNAME_RELEASE} 361 | ;; 362 | esac 363 | exit ;; 364 | aushp:SunOS:*:*) 365 | echo sparc-auspex-sunos${UNAME_RELEASE} 366 | exit ;; 367 | # The situation for MiNT is a little confusing. The machine name 368 | # can be virtually everything (everything which is not 369 | # "atarist" or "atariste" at least should have a processor 370 | # > m68000). The system name ranges from "MiNT" over "FreeMiNT" 371 | # to the lowercase version "mint" (or "freemint"). Finally 372 | # the system name "TOS" denotes a system which is actually not 373 | # MiNT. But MiNT is downward compatible to TOS, so this should 374 | # be no problem. 375 | atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*) 376 | echo m68k-atari-mint${UNAME_RELEASE} 377 | exit ;; 378 | atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*) 379 | echo m68k-atari-mint${UNAME_RELEASE} 380 | exit ;; 381 | *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*) 382 | echo m68k-atari-mint${UNAME_RELEASE} 383 | exit ;; 384 | milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*) 385 | echo m68k-milan-mint${UNAME_RELEASE} 386 | exit ;; 387 | hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*) 388 | echo m68k-hades-mint${UNAME_RELEASE} 389 | exit ;; 390 | *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*) 391 | echo m68k-unknown-mint${UNAME_RELEASE} 392 | exit ;; 393 | m68k:machten:*:*) 394 | echo m68k-apple-machten${UNAME_RELEASE} 395 | exit ;; 396 | powerpc:machten:*:*) 397 | echo powerpc-apple-machten${UNAME_RELEASE} 398 | exit ;; 399 | RISC*:Mach:*:*) 400 | echo mips-dec-mach_bsd4.3 401 | exit ;; 402 | RISC*:ULTRIX:*:*) 403 | echo mips-dec-ultrix${UNAME_RELEASE} 404 | exit ;; 405 | VAX*:ULTRIX*:*:*) 406 | echo vax-dec-ultrix${UNAME_RELEASE} 407 | exit ;; 408 | 2020:CLIX:*:* | 2430:CLIX:*:*) 409 | echo clipper-intergraph-clix${UNAME_RELEASE} 410 | exit ;; 411 | mips:*:*:UMIPS | mips:*:*:RISCos) 412 | eval $set_cc_for_build 413 | sed 's/^ //' << EOF >$dummy.c 414 | #ifdef __cplusplus 415 | #include /* for printf() prototype */ 416 | int main (int argc, char *argv[]) { 417 | #else 418 | int main (argc, argv) int argc; char *argv[]; { 419 | #endif 420 | #if defined (host_mips) && defined (MIPSEB) 421 | #if defined (SYSTYPE_SYSV) 422 | printf ("mips-mips-riscos%ssysv\n", argv[1]); exit (0); 423 | #endif 424 | #if defined (SYSTYPE_SVR4) 425 | printf ("mips-mips-riscos%ssvr4\n", argv[1]); exit (0); 426 | #endif 427 | #if defined (SYSTYPE_BSD43) || defined(SYSTYPE_BSD) 428 | printf ("mips-mips-riscos%sbsd\n", argv[1]); exit (0); 429 | #endif 430 | #endif 431 | exit (-1); 432 | } 433 | EOF 434 | $CC_FOR_BUILD -o $dummy $dummy.c && 435 | dummyarg=`echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` && 436 | SYSTEM_NAME=`$dummy $dummyarg` && 437 | { echo "$SYSTEM_NAME"; exit; } 438 | echo mips-mips-riscos${UNAME_RELEASE} 439 | exit ;; 440 | Motorola:PowerMAX_OS:*:*) 441 | echo powerpc-motorola-powermax 442 | exit ;; 443 | Motorola:*:4.3:PL8-*) 444 | echo powerpc-harris-powermax 445 | exit ;; 446 | Night_Hawk:*:*:PowerMAX_OS | Synergy:PowerMAX_OS:*:*) 447 | echo powerpc-harris-powermax 448 | exit ;; 449 | Night_Hawk:Power_UNIX:*:*) 450 | echo powerpc-harris-powerunix 451 | exit ;; 452 | m88k:CX/UX:7*:*) 453 | echo m88k-harris-cxux7 454 | exit ;; 455 | m88k:*:4*:R4*) 456 | echo m88k-motorola-sysv4 457 | exit ;; 458 | m88k:*:3*:R3*) 459 | echo m88k-motorola-sysv3 460 | exit ;; 461 | AViiON:dgux:*:*) 462 | # DG/UX returns AViiON for all architectures 463 | UNAME_PROCESSOR=`/usr/bin/uname -p` 464 | if [ $UNAME_PROCESSOR = mc88100 ] || [ $UNAME_PROCESSOR = mc88110 ] 465 | then 466 | if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx ] || \ 467 | [ ${TARGET_BINARY_INTERFACE}x = x ] 468 | then 469 | echo m88k-dg-dgux${UNAME_RELEASE} 470 | else 471 | echo m88k-dg-dguxbcs${UNAME_RELEASE} 472 | fi 473 | else 474 | echo i586-dg-dgux${UNAME_RELEASE} 475 | fi 476 | exit ;; 477 | M88*:DolphinOS:*:*) # DolphinOS (SVR3) 478 | echo m88k-dolphin-sysv3 479 | exit ;; 480 | M88*:*:R3*:*) 481 | # Delta 88k system running SVR3 482 | echo m88k-motorola-sysv3 483 | exit ;; 484 | XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3) 485 | echo m88k-tektronix-sysv3 486 | exit ;; 487 | Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD) 488 | echo m68k-tektronix-bsd 489 | exit ;; 490 | *:IRIX*:*:*) 491 | echo mips-sgi-irix`echo ${UNAME_RELEASE}|sed -e 's/-/_/g'` 492 | exit ;; 493 | ????????:AIX?:[12].1:2) # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX. 494 | echo romp-ibm-aix # uname -m gives an 8 hex-code CPU id 495 | exit ;; # Note that: echo "'`uname -s`'" gives 'AIX ' 496 | i*86:AIX:*:*) 497 | echo i386-ibm-aix 498 | exit ;; 499 | ia64:AIX:*:*) 500 | if [ -x /usr/bin/oslevel ] ; then 501 | IBM_REV=`/usr/bin/oslevel` 502 | else 503 | IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE} 504 | fi 505 | echo ${UNAME_MACHINE}-ibm-aix${IBM_REV} 506 | exit ;; 507 | *:AIX:2:3) 508 | if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then 509 | eval $set_cc_for_build 510 | sed 's/^ //' << EOF >$dummy.c 511 | #include 512 | 513 | main() 514 | { 515 | if (!__power_pc()) 516 | exit(1); 517 | puts("powerpc-ibm-aix3.2.5"); 518 | exit(0); 519 | } 520 | EOF 521 | if $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy` 522 | then 523 | echo "$SYSTEM_NAME" 524 | else 525 | echo rs6000-ibm-aix3.2.5 526 | fi 527 | elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then 528 | echo rs6000-ibm-aix3.2.4 529 | else 530 | echo rs6000-ibm-aix3.2 531 | fi 532 | exit ;; 533 | *:AIX:*:[45]) 534 | IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'` 535 | if /usr/sbin/lsattr -El ${IBM_CPU_ID} | grep ' POWER' >/dev/null 2>&1; then 536 | IBM_ARCH=rs6000 537 | else 538 | IBM_ARCH=powerpc 539 | fi 540 | if [ -x /usr/bin/oslevel ] ; then 541 | IBM_REV=`/usr/bin/oslevel` 542 | else 543 | IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE} 544 | fi 545 | echo ${IBM_ARCH}-ibm-aix${IBM_REV} 546 | exit ;; 547 | *:AIX:*:*) 548 | echo rs6000-ibm-aix 549 | exit ;; 550 | ibmrt:4.4BSD:*|romp-ibm:BSD:*) 551 | echo romp-ibm-bsd4.4 552 | exit ;; 553 | ibmrt:*BSD:*|romp-ibm:BSD:*) # covers RT/PC BSD and 554 | echo romp-ibm-bsd${UNAME_RELEASE} # 4.3 with uname added to 555 | exit ;; # report: romp-ibm BSD 4.3 556 | *:BOSX:*:*) 557 | echo rs6000-bull-bosx 558 | exit ;; 559 | DPX/2?00:B.O.S.:*:*) 560 | echo m68k-bull-sysv3 561 | exit ;; 562 | 9000/[34]??:4.3bsd:1.*:*) 563 | echo m68k-hp-bsd 564 | exit ;; 565 | hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*) 566 | echo m68k-hp-bsd4.4 567 | exit ;; 568 | 9000/[34678]??:HP-UX:*:*) 569 | HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` 570 | case "${UNAME_MACHINE}" in 571 | 9000/31? ) HP_ARCH=m68000 ;; 572 | 9000/[34]?? ) HP_ARCH=m68k ;; 573 | 9000/[678][0-9][0-9]) 574 | if [ -x /usr/bin/getconf ]; then 575 | sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null` 576 | sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null` 577 | case "${sc_cpu_version}" in 578 | 523) HP_ARCH="hppa1.0" ;; # CPU_PA_RISC1_0 579 | 528) HP_ARCH="hppa1.1" ;; # CPU_PA_RISC1_1 580 | 532) # CPU_PA_RISC2_0 581 | case "${sc_kernel_bits}" in 582 | 32) HP_ARCH="hppa2.0n" ;; 583 | 64) HP_ARCH="hppa2.0w" ;; 584 | '') HP_ARCH="hppa2.0" ;; # HP-UX 10.20 585 | esac ;; 586 | esac 587 | fi 588 | if [ "${HP_ARCH}" = "" ]; then 589 | eval $set_cc_for_build 590 | sed 's/^ //' << EOF >$dummy.c 591 | 592 | #define _HPUX_SOURCE 593 | #include 594 | #include 595 | 596 | int main () 597 | { 598 | #if defined(_SC_KERNEL_BITS) 599 | long bits = sysconf(_SC_KERNEL_BITS); 600 | #endif 601 | long cpu = sysconf (_SC_CPU_VERSION); 602 | 603 | switch (cpu) 604 | { 605 | case CPU_PA_RISC1_0: puts ("hppa1.0"); break; 606 | case CPU_PA_RISC1_1: puts ("hppa1.1"); break; 607 | case CPU_PA_RISC2_0: 608 | #if defined(_SC_KERNEL_BITS) 609 | switch (bits) 610 | { 611 | case 64: puts ("hppa2.0w"); break; 612 | case 32: puts ("hppa2.0n"); break; 613 | default: puts ("hppa2.0"); break; 614 | } break; 615 | #else /* !defined(_SC_KERNEL_BITS) */ 616 | puts ("hppa2.0"); break; 617 | #endif 618 | default: puts ("hppa1.0"); break; 619 | } 620 | exit (0); 621 | } 622 | EOF 623 | (CCOPTS= $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null) && HP_ARCH=`$dummy` 624 | test -z "$HP_ARCH" && HP_ARCH=hppa 625 | fi ;; 626 | esac 627 | if [ ${HP_ARCH} = "hppa2.0w" ] 628 | then 629 | eval $set_cc_for_build 630 | 631 | # hppa2.0w-hp-hpux* has a 64-bit kernel and a compiler generating 632 | # 32-bit code. hppa64-hp-hpux* has the same kernel and a compiler 633 | # generating 64-bit code. GNU and HP use different nomenclature: 634 | # 635 | # $ CC_FOR_BUILD=cc ./config.guess 636 | # => hppa2.0w-hp-hpux11.23 637 | # $ CC_FOR_BUILD="cc +DA2.0w" ./config.guess 638 | # => hppa64-hp-hpux11.23 639 | 640 | if echo __LP64__ | (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | 641 | grep __LP64__ >/dev/null 642 | then 643 | HP_ARCH="hppa2.0w" 644 | else 645 | HP_ARCH="hppa64" 646 | fi 647 | fi 648 | echo ${HP_ARCH}-hp-hpux${HPUX_REV} 649 | exit ;; 650 | ia64:HP-UX:*:*) 651 | HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` 652 | echo ia64-hp-hpux${HPUX_REV} 653 | exit ;; 654 | 3050*:HI-UX:*:*) 655 | eval $set_cc_for_build 656 | sed 's/^ //' << EOF >$dummy.c 657 | #include 658 | int 659 | main () 660 | { 661 | long cpu = sysconf (_SC_CPU_VERSION); 662 | /* The order matters, because CPU_IS_HP_MC68K erroneously returns 663 | true for CPU_PA_RISC1_0. CPU_IS_PA_RISC returns correct 664 | results, however. */ 665 | if (CPU_IS_PA_RISC (cpu)) 666 | { 667 | switch (cpu) 668 | { 669 | case CPU_PA_RISC1_0: puts ("hppa1.0-hitachi-hiuxwe2"); break; 670 | case CPU_PA_RISC1_1: puts ("hppa1.1-hitachi-hiuxwe2"); break; 671 | case CPU_PA_RISC2_0: puts ("hppa2.0-hitachi-hiuxwe2"); break; 672 | default: puts ("hppa-hitachi-hiuxwe2"); break; 673 | } 674 | } 675 | else if (CPU_IS_HP_MC68K (cpu)) 676 | puts ("m68k-hitachi-hiuxwe2"); 677 | else puts ("unknown-hitachi-hiuxwe2"); 678 | exit (0); 679 | } 680 | EOF 681 | $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy` && 682 | { echo "$SYSTEM_NAME"; exit; } 683 | echo unknown-hitachi-hiuxwe2 684 | exit ;; 685 | 9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:* ) 686 | echo hppa1.1-hp-bsd 687 | exit ;; 688 | 9000/8??:4.3bsd:*:*) 689 | echo hppa1.0-hp-bsd 690 | exit ;; 691 | *9??*:MPE/iX:*:* | *3000*:MPE/iX:*:*) 692 | echo hppa1.0-hp-mpeix 693 | exit ;; 694 | hp7??:OSF1:*:* | hp8?[79]:OSF1:*:* ) 695 | echo hppa1.1-hp-osf 696 | exit ;; 697 | hp8??:OSF1:*:*) 698 | echo hppa1.0-hp-osf 699 | exit ;; 700 | i*86:OSF1:*:*) 701 | if [ -x /usr/sbin/sysversion ] ; then 702 | echo ${UNAME_MACHINE}-unknown-osf1mk 703 | else 704 | echo ${UNAME_MACHINE}-unknown-osf1 705 | fi 706 | exit ;; 707 | parisc*:Lites*:*:*) 708 | echo hppa1.1-hp-lites 709 | exit ;; 710 | C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*) 711 | echo c1-convex-bsd 712 | exit ;; 713 | C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*) 714 | if getsysinfo -f scalar_acc 715 | then echo c32-convex-bsd 716 | else echo c2-convex-bsd 717 | fi 718 | exit ;; 719 | C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*) 720 | echo c34-convex-bsd 721 | exit ;; 722 | C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*) 723 | echo c38-convex-bsd 724 | exit ;; 725 | C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*) 726 | echo c4-convex-bsd 727 | exit ;; 728 | CRAY*Y-MP:*:*:*) 729 | echo ymp-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' 730 | exit ;; 731 | CRAY*[A-Z]90:*:*:*) 732 | echo ${UNAME_MACHINE}-cray-unicos${UNAME_RELEASE} \ 733 | | sed -e 's/CRAY.*\([A-Z]90\)/\1/' \ 734 | -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ \ 735 | -e 's/\.[^.]*$/.X/' 736 | exit ;; 737 | CRAY*TS:*:*:*) 738 | echo t90-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' 739 | exit ;; 740 | CRAY*T3E:*:*:*) 741 | echo alphaev5-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' 742 | exit ;; 743 | CRAY*SV1:*:*:*) 744 | echo sv1-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' 745 | exit ;; 746 | *:UNICOS/mp:*:*) 747 | echo craynv-cray-unicosmp${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' 748 | exit ;; 749 | F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*) 750 | FUJITSU_PROC=`uname -m | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` 751 | FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` 752 | FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'` 753 | echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" 754 | exit ;; 755 | 5000:UNIX_System_V:4.*:*) 756 | FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` 757 | FUJITSU_REL=`echo ${UNAME_RELEASE} | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/ /_/'` 758 | echo "sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" 759 | exit ;; 760 | i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*) 761 | echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE} 762 | exit ;; 763 | sparc*:BSD/OS:*:*) 764 | echo sparc-unknown-bsdi${UNAME_RELEASE} 765 | exit ;; 766 | *:BSD/OS:*:*) 767 | echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE} 768 | exit ;; 769 | *:FreeBSD:*:*) 770 | case ${UNAME_MACHINE} in 771 | pc98) 772 | echo i386-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; 773 | *) 774 | echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; 775 | esac 776 | exit ;; 777 | i*:CYGWIN*:*) 778 | echo ${UNAME_MACHINE}-pc-cygwin 779 | exit ;; 780 | i*:MINGW*:*) 781 | echo ${UNAME_MACHINE}-pc-mingw32 782 | exit ;; 783 | i*:MSYS_NT-*:*:*) 784 | echo ${UNAME_MACHINE}-pc-mingw32 785 | exit ;; 786 | i*:windows32*:*) 787 | # uname -m includes "-pc" on this system. 788 | echo ${UNAME_MACHINE}-mingw32 789 | exit ;; 790 | i*:PW*:*) 791 | echo ${UNAME_MACHINE}-pc-pw32 792 | exit ;; 793 | x86:Interix*:[345]*) 794 | echo i586-pc-interix${UNAME_RELEASE} 795 | exit ;; 796 | EM64T:Interix*:[345]*) 797 | echo x86_64-unknown-interix${UNAME_RELEASE} 798 | exit ;; 799 | [345]86:Windows_95:* | [345]86:Windows_98:* | [345]86:Windows_NT:*) 800 | echo i${UNAME_MACHINE}-pc-mks 801 | exit ;; 802 | i*:Windows_NT*:* | Pentium*:Windows_NT*:*) 803 | # How do we know it's Interix rather than the generic POSIX subsystem? 804 | # It also conflicts with pre-2.0 versions of AT&T UWIN. Should we 805 | # UNAME_MACHINE based on the output of uname instead of i386? 806 | echo i586-pc-interix 807 | exit ;; 808 | i*:UWIN*:*) 809 | echo ${UNAME_MACHINE}-pc-uwin 810 | exit ;; 811 | amd64:CYGWIN*:*:* | x86_64:CYGWIN*:*:*) 812 | echo x86_64-unknown-cygwin 813 | exit ;; 814 | p*:CYGWIN*:*) 815 | echo powerpcle-unknown-cygwin 816 | exit ;; 817 | prep*:SunOS:5.*:*) 818 | echo powerpcle-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` 819 | exit ;; 820 | *:GNU:*:*) 821 | # the GNU system 822 | echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'` 823 | exit ;; 824 | *:GNU/*:*:*) 825 | # other systems with GNU libc and userland 826 | echo ${UNAME_MACHINE}-unknown-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr '[A-Z]' '[a-z]'``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-gnu 827 | exit ;; 828 | i*86:Minix:*:*) 829 | echo ${UNAME_MACHINE}-pc-minix 830 | exit ;; 831 | arm*:Linux:*:*) 832 | echo ${UNAME_MACHINE}-unknown-linux-gnu 833 | exit ;; 834 | cris:Linux:*:*) 835 | echo cris-axis-linux-gnu 836 | exit ;; 837 | crisv32:Linux:*:*) 838 | echo crisv32-axis-linux-gnu 839 | exit ;; 840 | frv:Linux:*:*) 841 | echo frv-unknown-linux-gnu 842 | exit ;; 843 | ia64:Linux:*:*) 844 | echo ${UNAME_MACHINE}-unknown-linux-gnu 845 | exit ;; 846 | m32r*:Linux:*:*) 847 | echo ${UNAME_MACHINE}-unknown-linux-gnu 848 | exit ;; 849 | m68*:Linux:*:*) 850 | echo ${UNAME_MACHINE}-unknown-linux-gnu 851 | exit ;; 852 | mips:Linux:*:*) 853 | eval $set_cc_for_build 854 | sed 's/^ //' << EOF >$dummy.c 855 | #undef CPU 856 | #undef mips 857 | #undef mipsel 858 | #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL) 859 | CPU=mipsel 860 | #else 861 | #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB) 862 | CPU=mips 863 | #else 864 | CPU= 865 | #endif 866 | #endif 867 | EOF 868 | eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n ' 869 | /^CPU/{ 870 | s: ::g 871 | p 872 | }'`" 873 | test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; } 874 | ;; 875 | mips64:Linux:*:*) 876 | eval $set_cc_for_build 877 | sed 's/^ //' << EOF >$dummy.c 878 | #undef CPU 879 | #undef mips64 880 | #undef mips64el 881 | #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL) 882 | CPU=mips64el 883 | #else 884 | #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB) 885 | CPU=mips64 886 | #else 887 | CPU= 888 | #endif 889 | #endif 890 | EOF 891 | eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n ' 892 | /^CPU/{ 893 | s: ::g 894 | p 895 | }'`" 896 | test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; } 897 | ;; 898 | or32:Linux:*:*) 899 | echo or32-unknown-linux-gnu 900 | exit ;; 901 | ppc:Linux:*:*) 902 | echo powerpc-unknown-linux-gnu 903 | exit ;; 904 | ppc64:Linux:*:*) 905 | echo powerpc64-unknown-linux-gnu 906 | exit ;; 907 | alpha:Linux:*:*) 908 | case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in 909 | EV5) UNAME_MACHINE=alphaev5 ;; 910 | EV56) UNAME_MACHINE=alphaev56 ;; 911 | PCA56) UNAME_MACHINE=alphapca56 ;; 912 | PCA57) UNAME_MACHINE=alphapca56 ;; 913 | EV6) UNAME_MACHINE=alphaev6 ;; 914 | EV67) UNAME_MACHINE=alphaev67 ;; 915 | EV68*) UNAME_MACHINE=alphaev68 ;; 916 | esac 917 | objdump --private-headers /bin/sh | grep ld.so.1 >/dev/null 918 | if test "$?" = 0 ; then LIBC="libc1" ; else LIBC="" ; fi 919 | echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC} 920 | exit ;; 921 | parisc:Linux:*:* | hppa:Linux:*:*) 922 | # Look for CPU level 923 | case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in 924 | PA7*) echo hppa1.1-unknown-linux-gnu ;; 925 | PA8*) echo hppa2.0-unknown-linux-gnu ;; 926 | *) echo hppa-unknown-linux-gnu ;; 927 | esac 928 | exit ;; 929 | parisc64:Linux:*:* | hppa64:Linux:*:*) 930 | echo hppa64-unknown-linux-gnu 931 | exit ;; 932 | s390:Linux:*:* | s390x:Linux:*:*) 933 | echo ${UNAME_MACHINE}-ibm-linux 934 | exit ;; 935 | sh64*:Linux:*:*) 936 | echo ${UNAME_MACHINE}-unknown-linux-gnu 937 | exit ;; 938 | sh*:Linux:*:*) 939 | echo ${UNAME_MACHINE}-unknown-linux-gnu 940 | exit ;; 941 | sparc:Linux:*:* | sparc64:Linux:*:*) 942 | echo ${UNAME_MACHINE}-unknown-linux-gnu 943 | exit ;; 944 | vax:Linux:*:*) 945 | echo ${UNAME_MACHINE}-dec-linux-gnu 946 | exit ;; 947 | x86_64:Linux:*:*) 948 | echo x86_64-unknown-linux-gnu 949 | exit ;; 950 | i*86:Linux:*:*) 951 | # The BFD linker knows what the default object file format is, so 952 | # first see if it will tell us. cd to the root directory to prevent 953 | # problems with other programs or directories called `ld' in the path. 954 | # Set LC_ALL=C to ensure ld outputs messages in English. 955 | ld_supported_targets=`cd /; LC_ALL=C ld --help 2>&1 \ 956 | | sed -ne '/supported targets:/!d 957 | s/[ ][ ]*/ /g 958 | s/.*supported targets: *// 959 | s/ .*// 960 | p'` 961 | case "$ld_supported_targets" in 962 | elf32-i386) 963 | TENTATIVE="${UNAME_MACHINE}-pc-linux-gnu" 964 | ;; 965 | a.out-i386-linux) 966 | echo "${UNAME_MACHINE}-pc-linux-gnuaout" 967 | exit ;; 968 | coff-i386) 969 | echo "${UNAME_MACHINE}-pc-linux-gnucoff" 970 | exit ;; 971 | "") 972 | # Either a pre-BFD a.out linker (linux-gnuoldld) or 973 | # one that does not give us useful --help. 974 | echo "${UNAME_MACHINE}-pc-linux-gnuoldld" 975 | exit ;; 976 | esac 977 | # Determine whether the default compiler is a.out or elf 978 | eval $set_cc_for_build 979 | sed 's/^ //' << EOF >$dummy.c 980 | #include 981 | #ifdef __ELF__ 982 | # ifdef __GLIBC__ 983 | # if __GLIBC__ >= 2 984 | LIBC=gnu 985 | # else 986 | LIBC=gnulibc1 987 | # endif 988 | # else 989 | LIBC=gnulibc1 990 | # endif 991 | #else 992 | #if defined(__INTEL_COMPILER) || defined(__PGI) || defined(__sun) 993 | LIBC=gnu 994 | #else 995 | LIBC=gnuaout 996 | #endif 997 | #endif 998 | #ifdef __dietlibc__ 999 | LIBC=dietlibc 1000 | #endif 1001 | EOF 1002 | eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n ' 1003 | /^LIBC/{ 1004 | s: ::g 1005 | p 1006 | }'`" 1007 | test x"${LIBC}" != x && { 1008 | echo "${UNAME_MACHINE}-pc-linux-${LIBC}" 1009 | exit 1010 | } 1011 | test x"${TENTATIVE}" != x && { echo "${TENTATIVE}"; exit; } 1012 | ;; 1013 | i*86:DYNIX/ptx:4*:*) 1014 | # ptx 4.0 does uname -s correctly, with DYNIX/ptx in there. 1015 | # earlier versions are messed up and put the nodename in both 1016 | # sysname and nodename. 1017 | echo i386-sequent-sysv4 1018 | exit ;; 1019 | i*86:UNIX_SV:4.2MP:2.*) 1020 | # Unixware is an offshoot of SVR4, but it has its own version 1021 | # number series starting with 2... 1022 | # I am not positive that other SVR4 systems won't match this, 1023 | # I just have to hope. -- rms. 1024 | # Use sysv4.2uw... so that sysv4* matches it. 1025 | echo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION} 1026 | exit ;; 1027 | i*86:OS/2:*:*) 1028 | # If we were able to find `uname', then EMX Unix compatibility 1029 | # is probably installed. 1030 | echo ${UNAME_MACHINE}-pc-os2-emx 1031 | exit ;; 1032 | i*86:XTS-300:*:STOP) 1033 | echo ${UNAME_MACHINE}-unknown-stop 1034 | exit ;; 1035 | i*86:atheos:*:*) 1036 | echo ${UNAME_MACHINE}-unknown-atheos 1037 | exit ;; 1038 | i*86:syllable:*:*) 1039 | echo ${UNAME_MACHINE}-pc-syllable 1040 | exit ;; 1041 | i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.0*:*) 1042 | echo i386-unknown-lynxos${UNAME_RELEASE} 1043 | exit ;; 1044 | i*86:*DOS:*:*) 1045 | echo ${UNAME_MACHINE}-pc-msdosdjgpp 1046 | exit ;; 1047 | i*86:*:4.*:* | i*86:SYSTEM_V:4.*:*) 1048 | UNAME_REL=`echo ${UNAME_RELEASE} | sed 's/\/MP$//'` 1049 | if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then 1050 | echo ${UNAME_MACHINE}-univel-sysv${UNAME_REL} 1051 | else 1052 | echo ${UNAME_MACHINE}-pc-sysv${UNAME_REL} 1053 | fi 1054 | exit ;; 1055 | i*86:*:5:[678]*) 1056 | # UnixWare 7.x, OpenUNIX and OpenServer 6. 1057 | case `/bin/uname -X | grep "^Machine"` in 1058 | *486*) UNAME_MACHINE=i486 ;; 1059 | *Pentium) UNAME_MACHINE=i586 ;; 1060 | *Pent*|*Celeron) UNAME_MACHINE=i686 ;; 1061 | esac 1062 | echo ${UNAME_MACHINE}-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}${UNAME_VERSION} 1063 | exit ;; 1064 | i*86:*:3.2:*) 1065 | if test -f /usr/options/cb.name; then 1066 | UNAME_REL=`sed -n 's/.*Version //p' /dev/null >/dev/null ; then 1069 | UNAME_REL=`(/bin/uname -X|grep Release|sed -e 's/.*= //')` 1070 | (/bin/uname -X|grep i80486 >/dev/null) && UNAME_MACHINE=i486 1071 | (/bin/uname -X|grep '^Machine.*Pentium' >/dev/null) \ 1072 | && UNAME_MACHINE=i586 1073 | (/bin/uname -X|grep '^Machine.*Pent *II' >/dev/null) \ 1074 | && UNAME_MACHINE=i686 1075 | (/bin/uname -X|grep '^Machine.*Pentium Pro' >/dev/null) \ 1076 | && UNAME_MACHINE=i686 1077 | echo ${UNAME_MACHINE}-pc-sco$UNAME_REL 1078 | else 1079 | echo ${UNAME_MACHINE}-pc-sysv32 1080 | fi 1081 | exit ;; 1082 | pc:*:*:*) 1083 | # Left here for compatibility: 1084 | # uname -m prints for DJGPP always 'pc', but it prints nothing about 1085 | # the processor, so we play safe by assuming i386. 1086 | echo i386-pc-msdosdjgpp 1087 | exit ;; 1088 | Intel:Mach:3*:*) 1089 | echo i386-pc-mach3 1090 | exit ;; 1091 | paragon:*:*:*) 1092 | echo i860-intel-osf1 1093 | exit ;; 1094 | i860:*:4.*:*) # i860-SVR4 1095 | if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then 1096 | echo i860-stardent-sysv${UNAME_RELEASE} # Stardent Vistra i860-SVR4 1097 | else # Add other i860-SVR4 vendors below as they are discovered. 1098 | echo i860-unknown-sysv${UNAME_RELEASE} # Unknown i860-SVR4 1099 | fi 1100 | exit ;; 1101 | mini*:CTIX:SYS*5:*) 1102 | # "miniframe" 1103 | echo m68010-convergent-sysv 1104 | exit ;; 1105 | mc68k:UNIX:SYSTEM5:3.51m) 1106 | echo m68k-convergent-sysv 1107 | exit ;; 1108 | M680?0:D-NIX:5.3:*) 1109 | echo m68k-diab-dnix 1110 | exit ;; 1111 | M68*:*:R3V[5678]*:*) 1112 | test -r /sysV68 && { echo 'm68k-motorola-sysv'; exit; } ;; 1113 | 3[345]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 3[34]??/*:*:4.0:3.0 | 4400:*:4.0:3.0 | 4850:*:4.0:3.0 | SKA40:*:4.0:3.0 | SDS2:*:4.0:3.0 | SHG2:*:4.0:3.0 | S7501*:*:4.0:3.0) 1114 | OS_REL='' 1115 | test -r /etc/.relid \ 1116 | && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid` 1117 | /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ 1118 | && { echo i486-ncr-sysv4.3${OS_REL}; exit; } 1119 | /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \ 1120 | && { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;; 1121 | 3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*) 1122 | /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ 1123 | && { echo i486-ncr-sysv4; exit; } ;; 1124 | m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*) 1125 | echo m68k-unknown-lynxos${UNAME_RELEASE} 1126 | exit ;; 1127 | mc68030:UNIX_System_V:4.*:*) 1128 | echo m68k-atari-sysv4 1129 | exit ;; 1130 | TSUNAMI:LynxOS:2.*:*) 1131 | echo sparc-unknown-lynxos${UNAME_RELEASE} 1132 | exit ;; 1133 | rs6000:LynxOS:2.*:*) 1134 | echo rs6000-unknown-lynxos${UNAME_RELEASE} 1135 | exit ;; 1136 | PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.0*:*) 1137 | echo powerpc-unknown-lynxos${UNAME_RELEASE} 1138 | exit ;; 1139 | SM[BE]S:UNIX_SV:*:*) 1140 | echo mips-dde-sysv${UNAME_RELEASE} 1141 | exit ;; 1142 | RM*:ReliantUNIX-*:*:*) 1143 | echo mips-sni-sysv4 1144 | exit ;; 1145 | RM*:SINIX-*:*:*) 1146 | echo mips-sni-sysv4 1147 | exit ;; 1148 | *:SINIX-*:*:*) 1149 | if uname -p 2>/dev/null >/dev/null ; then 1150 | UNAME_MACHINE=`(uname -p) 2>/dev/null` 1151 | echo ${UNAME_MACHINE}-sni-sysv4 1152 | else 1153 | echo ns32k-sni-sysv 1154 | fi 1155 | exit ;; 1156 | PENTIUM:*:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort 1157 | # says 1158 | echo i586-unisys-sysv4 1159 | exit ;; 1160 | *:UNIX_System_V:4*:FTX*) 1161 | # From Gerald Hewes . 1162 | # How about differentiating between stratus architectures? -djm 1163 | echo hppa1.1-stratus-sysv4 1164 | exit ;; 1165 | *:*:*:FTX*) 1166 | # From seanf@swdc.stratus.com. 1167 | echo i860-stratus-sysv4 1168 | exit ;; 1169 | i*86:VOS:*:*) 1170 | # From Paul.Green@stratus.com. 1171 | echo ${UNAME_MACHINE}-stratus-vos 1172 | exit ;; 1173 | *:VOS:*:*) 1174 | # From Paul.Green@stratus.com. 1175 | echo hppa1.1-stratus-vos 1176 | exit ;; 1177 | mc68*:A/UX:*:*) 1178 | echo m68k-apple-aux${UNAME_RELEASE} 1179 | exit ;; 1180 | news*:NEWS-OS:6*:*) 1181 | echo mips-sony-newsos6 1182 | exit ;; 1183 | R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*) 1184 | if [ -d /usr/nec ]; then 1185 | echo mips-nec-sysv${UNAME_RELEASE} 1186 | else 1187 | echo mips-unknown-sysv${UNAME_RELEASE} 1188 | fi 1189 | exit ;; 1190 | BeBox:BeOS:*:*) # BeOS running on hardware made by Be, PPC only. 1191 | echo powerpc-be-beos 1192 | exit ;; 1193 | BeMac:BeOS:*:*) # BeOS running on Mac or Mac clone, PPC only. 1194 | echo powerpc-apple-beos 1195 | exit ;; 1196 | BePC:BeOS:*:*) # BeOS running on Intel PC compatible. 1197 | echo i586-pc-beos 1198 | exit ;; 1199 | SX-4:SUPER-UX:*:*) 1200 | echo sx4-nec-superux${UNAME_RELEASE} 1201 | exit ;; 1202 | SX-5:SUPER-UX:*:*) 1203 | echo sx5-nec-superux${UNAME_RELEASE} 1204 | exit ;; 1205 | SX-6:SUPER-UX:*:*) 1206 | echo sx6-nec-superux${UNAME_RELEASE} 1207 | exit ;; 1208 | Power*:Rhapsody:*:*) 1209 | echo powerpc-apple-rhapsody${UNAME_RELEASE} 1210 | exit ;; 1211 | *:Rhapsody:*:*) 1212 | echo ${UNAME_MACHINE}-apple-rhapsody${UNAME_RELEASE} 1213 | exit ;; 1214 | *:Darwin:*:*) 1215 | UNAME_PROCESSOR=`uname -p` || UNAME_PROCESSOR=unknown 1216 | case $UNAME_PROCESSOR in 1217 | unknown) UNAME_PROCESSOR=powerpc ;; 1218 | esac 1219 | echo ${UNAME_PROCESSOR}-apple-darwin${UNAME_RELEASE} 1220 | exit ;; 1221 | *:procnto*:*:* | *:QNX:[0123456789]*:*) 1222 | UNAME_PROCESSOR=`uname -p` 1223 | if test "$UNAME_PROCESSOR" = "x86"; then 1224 | UNAME_PROCESSOR=i386 1225 | UNAME_MACHINE=pc 1226 | fi 1227 | echo ${UNAME_PROCESSOR}-${UNAME_MACHINE}-nto-qnx${UNAME_RELEASE} 1228 | exit ;; 1229 | *:QNX:*:4*) 1230 | echo i386-pc-qnx 1231 | exit ;; 1232 | NSE-?:NONSTOP_KERNEL:*:*) 1233 | echo nse-tandem-nsk${UNAME_RELEASE} 1234 | exit ;; 1235 | NSR-?:NONSTOP_KERNEL:*:*) 1236 | echo nsr-tandem-nsk${UNAME_RELEASE} 1237 | exit ;; 1238 | *:NonStop-UX:*:*) 1239 | echo mips-compaq-nonstopux 1240 | exit ;; 1241 | BS2000:POSIX*:*:*) 1242 | echo bs2000-siemens-sysv 1243 | exit ;; 1244 | DS/*:UNIX_System_V:*:*) 1245 | echo ${UNAME_MACHINE}-${UNAME_SYSTEM}-${UNAME_RELEASE} 1246 | exit ;; 1247 | *:Plan9:*:*) 1248 | # "uname -m" is not consistent, so use $cputype instead. 386 1249 | # is converted to i386 for consistency with other x86 1250 | # operating systems. 1251 | if test "$cputype" = "386"; then 1252 | UNAME_MACHINE=i386 1253 | else 1254 | UNAME_MACHINE="$cputype" 1255 | fi 1256 | echo ${UNAME_MACHINE}-unknown-plan9 1257 | exit ;; 1258 | *:TOPS-10:*:*) 1259 | echo pdp10-unknown-tops10 1260 | exit ;; 1261 | *:TENEX:*:*) 1262 | echo pdp10-unknown-tenex 1263 | exit ;; 1264 | KS10:TOPS-20:*:* | KL10:TOPS-20:*:* | TYPE4:TOPS-20:*:*) 1265 | echo pdp10-dec-tops20 1266 | exit ;; 1267 | XKL-1:TOPS-20:*:* | TYPE5:TOPS-20:*:*) 1268 | echo pdp10-xkl-tops20 1269 | exit ;; 1270 | *:TOPS-20:*:*) 1271 | echo pdp10-unknown-tops20 1272 | exit ;; 1273 | *:ITS:*:*) 1274 | echo pdp10-unknown-its 1275 | exit ;; 1276 | SEI:*:*:SEIUX) 1277 | echo mips-sei-seiux${UNAME_RELEASE} 1278 | exit ;; 1279 | *:DragonFly:*:*) 1280 | echo ${UNAME_MACHINE}-unknown-dragonfly`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` 1281 | exit ;; 1282 | *:*VMS:*:*) 1283 | UNAME_MACHINE=`(uname -p) 2>/dev/null` 1284 | case "${UNAME_MACHINE}" in 1285 | A*) echo alpha-dec-vms ; exit ;; 1286 | I*) echo ia64-dec-vms ; exit ;; 1287 | V*) echo vax-dec-vms ; exit ;; 1288 | esac ;; 1289 | *:XENIX:*:SysV) 1290 | echo i386-pc-xenix 1291 | exit ;; 1292 | i*86:skyos:*:*) 1293 | echo ${UNAME_MACHINE}-pc-skyos`echo ${UNAME_RELEASE}` | sed -e 's/ .*$//' 1294 | exit ;; 1295 | i*86:rdos:*:*) 1296 | echo ${UNAME_MACHINE}-pc-rdos 1297 | exit ;; 1298 | esac 1299 | 1300 | #echo '(No uname command or uname output not recognized.)' 1>&2 1301 | #echo "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" 1>&2 1302 | 1303 | eval $set_cc_for_build 1304 | cat >$dummy.c < 1307 | # include 1308 | #endif 1309 | main () 1310 | { 1311 | #if defined (sony) 1312 | #if defined (MIPSEB) 1313 | /* BFD wants "bsd" instead of "newsos". Perhaps BFD should be changed, 1314 | I don't know.... */ 1315 | printf ("mips-sony-bsd\n"); exit (0); 1316 | #else 1317 | #include 1318 | printf ("m68k-sony-newsos%s\n", 1319 | #ifdef NEWSOS4 1320 | "4" 1321 | #else 1322 | "" 1323 | #endif 1324 | ); exit (0); 1325 | #endif 1326 | #endif 1327 | 1328 | #if defined (__arm) && defined (__acorn) && defined (__unix) 1329 | printf ("arm-acorn-riscix\n"); exit (0); 1330 | #endif 1331 | 1332 | #if defined (hp300) && !defined (hpux) 1333 | printf ("m68k-hp-bsd\n"); exit (0); 1334 | #endif 1335 | 1336 | #if defined (NeXT) 1337 | #if !defined (__ARCHITECTURE__) 1338 | #define __ARCHITECTURE__ "m68k" 1339 | #endif 1340 | int version; 1341 | version=`(hostinfo | sed -n 's/.*NeXT Mach \([0-9]*\).*/\1/p') 2>/dev/null`; 1342 | if (version < 4) 1343 | printf ("%s-next-nextstep%d\n", __ARCHITECTURE__, version); 1344 | else 1345 | printf ("%s-next-openstep%d\n", __ARCHITECTURE__, version); 1346 | exit (0); 1347 | #endif 1348 | 1349 | #if defined (MULTIMAX) || defined (n16) 1350 | #if defined (UMAXV) 1351 | printf ("ns32k-encore-sysv\n"); exit (0); 1352 | #else 1353 | #if defined (CMU) 1354 | printf ("ns32k-encore-mach\n"); exit (0); 1355 | #else 1356 | printf ("ns32k-encore-bsd\n"); exit (0); 1357 | #endif 1358 | #endif 1359 | #endif 1360 | 1361 | #if defined (__386BSD__) 1362 | printf ("i386-pc-bsd\n"); exit (0); 1363 | #endif 1364 | 1365 | #if defined (sequent) 1366 | #if defined (i386) 1367 | printf ("i386-sequent-dynix\n"); exit (0); 1368 | #endif 1369 | #if defined (ns32000) 1370 | printf ("ns32k-sequent-dynix\n"); exit (0); 1371 | #endif 1372 | #endif 1373 | 1374 | #if defined (_SEQUENT_) 1375 | struct utsname un; 1376 | 1377 | uname(&un); 1378 | 1379 | if (strncmp(un.version, "V2", 2) == 0) { 1380 | printf ("i386-sequent-ptx2\n"); exit (0); 1381 | } 1382 | if (strncmp(un.version, "V1", 2) == 0) { /* XXX is V1 correct? */ 1383 | printf ("i386-sequent-ptx1\n"); exit (0); 1384 | } 1385 | printf ("i386-sequent-ptx\n"); exit (0); 1386 | 1387 | #endif 1388 | 1389 | #if defined (vax) 1390 | # if !defined (ultrix) 1391 | # include 1392 | # if defined (BSD) 1393 | # if BSD == 43 1394 | printf ("vax-dec-bsd4.3\n"); exit (0); 1395 | # else 1396 | # if BSD == 199006 1397 | printf ("vax-dec-bsd4.3reno\n"); exit (0); 1398 | # else 1399 | printf ("vax-dec-bsd\n"); exit (0); 1400 | # endif 1401 | # endif 1402 | # else 1403 | printf ("vax-dec-bsd\n"); exit (0); 1404 | # endif 1405 | # else 1406 | printf ("vax-dec-ultrix\n"); exit (0); 1407 | # endif 1408 | #endif 1409 | 1410 | #if defined (alliant) && defined (i860) 1411 | printf ("i860-alliant-bsd\n"); exit (0); 1412 | #endif 1413 | 1414 | exit (1); 1415 | } 1416 | EOF 1417 | 1418 | $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null && SYSTEM_NAME=`$dummy` && 1419 | { echo "$SYSTEM_NAME"; exit; } 1420 | 1421 | # Apollos put the system type in the environment. 1422 | 1423 | test -d /usr/apollo && { echo ${ISP}-apollo-${SYSTYPE}; exit; } 1424 | 1425 | # Convex versions that predate uname can use getsysinfo(1) 1426 | 1427 | if [ -x /usr/convex/getsysinfo ] 1428 | then 1429 | case `getsysinfo -f cpu_type` in 1430 | c1*) 1431 | echo c1-convex-bsd 1432 | exit ;; 1433 | c2*) 1434 | if getsysinfo -f scalar_acc 1435 | then echo c32-convex-bsd 1436 | else echo c2-convex-bsd 1437 | fi 1438 | exit ;; 1439 | c34*) 1440 | echo c34-convex-bsd 1441 | exit ;; 1442 | c38*) 1443 | echo c38-convex-bsd 1444 | exit ;; 1445 | c4*) 1446 | echo c4-convex-bsd 1447 | exit ;; 1448 | esac 1449 | fi 1450 | 1451 | cat >&2 < in order to provide the needed 1465 | information to handle your system. 1466 | 1467 | config.guess timestamp = $timestamp 1468 | 1469 | uname -m = `(uname -m) 2>/dev/null || echo unknown` 1470 | uname -r = `(uname -r) 2>/dev/null || echo unknown` 1471 | uname -s = `(uname -s) 2>/dev/null || echo unknown` 1472 | uname -v = `(uname -v) 2>/dev/null || echo unknown` 1473 | 1474 | /usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null` 1475 | /bin/uname -X = `(/bin/uname -X) 2>/dev/null` 1476 | 1477 | hostinfo = `(hostinfo) 2>/dev/null` 1478 | /bin/universe = `(/bin/universe) 2>/dev/null` 1479 | /usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null` 1480 | /bin/arch = `(/bin/arch) 2>/dev/null` 1481 | /usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null` 1482 | /usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null` 1483 | 1484 | UNAME_MACHINE = ${UNAME_MACHINE} 1485 | UNAME_RELEASE = ${UNAME_RELEASE} 1486 | UNAME_SYSTEM = ${UNAME_SYSTEM} 1487 | UNAME_VERSION = ${UNAME_VERSION} 1488 | EOF 1489 | 1490 | exit 1 1491 | 1492 | # Local variables: 1493 | # eval: (add-hook 'write-file-hooks 'time-stamp) 1494 | # time-stamp-start: "timestamp='" 1495 | # time-stamp-format: "%:y-%02m-%02d" 1496 | # time-stamp-end: "'" 1497 | # End: 1498 | -------------------------------------------------------------------------------- /config.sub: -------------------------------------------------------------------------------- 1 | #! /bin/sh 2 | # Configuration validation subroutine script. 3 | # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 4 | # 2000, 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc. 5 | 6 | timestamp='2006-02-23' 7 | 8 | # This file is (in principle) common to ALL GNU software. 9 | # The presence of a machine in this file suggests that SOME GNU software 10 | # can handle that machine. It does not imply ALL GNU software can. 11 | # 12 | # This file is free software; you can redistribute it and/or modify 13 | # it under the terms of the GNU General Public License as published by 14 | # the Free Software Foundation; either version 2 of the License, or 15 | # (at your option) any later version. 16 | # 17 | # This program is distributed in the hope that it will be useful, 18 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 19 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 20 | # GNU General Public License for more details. 21 | # 22 | # You should have received a copy of the GNU General Public License 23 | # along with this program; if not, write to the Free Software 24 | # Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 25 | # 02110-1301, USA. 26 | # 27 | # As a special exception to the GNU General Public License, if you 28 | # distribute this file as part of a program that contains a 29 | # configuration script generated by Autoconf, you may include it under 30 | # the same distribution terms that you use for the rest of that program. 31 | 32 | 33 | # Please send patches to . Submit a context 34 | # diff and a properly formatted ChangeLog entry. 35 | # 36 | # Configuration subroutine to validate and canonicalize a configuration type. 37 | # Supply the specified configuration type as an argument. 38 | # If it is invalid, we print an error message on stderr and exit with code 1. 39 | # Otherwise, we print the canonical config type on stdout and succeed. 40 | 41 | # This file is supposed to be the same for all GNU packages 42 | # and recognize all the CPU types, system types and aliases 43 | # that are meaningful with *any* GNU software. 44 | # Each package is responsible for reporting which valid configurations 45 | # it does not support. The user should be able to distinguish 46 | # a failure to support a valid configuration from a meaningless 47 | # configuration. 48 | 49 | # The goal of this file is to map all the various variations of a given 50 | # machine specification into a single specification in the form: 51 | # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM 52 | # or in some cases, the newer four-part form: 53 | # CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM 54 | # It is wrong to echo any other type of specification. 55 | 56 | me=`echo "$0" | sed -e 's,.*/,,'` 57 | 58 | usage="\ 59 | Usage: $0 [OPTION] CPU-MFR-OPSYS 60 | $0 [OPTION] ALIAS 61 | 62 | Canonicalize a configuration name. 63 | 64 | Operation modes: 65 | -h, --help print this help, then exit 66 | -t, --time-stamp print date of last modification, then exit 67 | -v, --version print version number, then exit 68 | 69 | Report bugs and patches to ." 70 | 71 | version="\ 72 | GNU config.sub ($timestamp) 73 | 74 | Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005 75 | Free Software Foundation, Inc. 76 | 77 | This is free software; see the source for copying conditions. There is NO 78 | warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." 79 | 80 | help=" 81 | Try \`$me --help' for more information." 82 | 83 | # Parse command line 84 | while test $# -gt 0 ; do 85 | case $1 in 86 | --time-stamp | --time* | -t ) 87 | echo "$timestamp" ; exit ;; 88 | --version | -v ) 89 | echo "$version" ; exit ;; 90 | --help | --h* | -h ) 91 | echo "$usage"; exit ;; 92 | -- ) # Stop option processing 93 | shift; break ;; 94 | - ) # Use stdin as input. 95 | break ;; 96 | -* ) 97 | echo "$me: invalid option $1$help" 98 | exit 1 ;; 99 | 100 | *local*) 101 | # First pass through any local machine types. 102 | echo $1 103 | exit ;; 104 | 105 | * ) 106 | break ;; 107 | esac 108 | done 109 | 110 | case $# in 111 | 0) echo "$me: missing argument$help" >&2 112 | exit 1;; 113 | 1) ;; 114 | *) echo "$me: too many arguments$help" >&2 115 | exit 1;; 116 | esac 117 | 118 | # Separate what the user gave into CPU-COMPANY and OS or KERNEL-OS (if any). 119 | # Here we must recognize all the valid KERNEL-OS combinations. 120 | maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'` 121 | case $maybe_os in 122 | nto-qnx* | linux-gnu* | linux-dietlibc | linux-newlib* | linux-uclibc* | \ 123 | uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | knetbsd*-gnu* | netbsd*-gnu* | \ 124 | storm-chaos* | os2-emx* | rtmk-nova*) 125 | os=-$maybe_os 126 | basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'` 127 | ;; 128 | *) 129 | basic_machine=`echo $1 | sed 's/-[^-]*$//'` 130 | if [ $basic_machine != $1 ] 131 | then os=`echo $1 | sed 's/.*-/-/'` 132 | else os=; fi 133 | ;; 134 | esac 135 | 136 | ### Let's recognize common machines as not being operating systems so 137 | ### that things like config.sub decstation-3100 work. We also 138 | ### recognize some manufacturers as not being operating systems, so we 139 | ### can provide default operating systems below. 140 | case $os in 141 | -sun*os*) 142 | # Prevent following clause from handling this invalid input. 143 | ;; 144 | -dec* | -mips* | -sequent* | -encore* | -pc532* | -sgi* | -sony* | \ 145 | -att* | -7300* | -3300* | -delta* | -motorola* | -sun[234]* | \ 146 | -unicom* | -ibm* | -next | -hp | -isi* | -apollo | -altos* | \ 147 | -convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\ 148 | -c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \ 149 | -harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \ 150 | -apple | -axis | -knuth | -cray) 151 | os= 152 | basic_machine=$1 153 | ;; 154 | -sim | -cisco | -oki | -wec | -winbond) 155 | os= 156 | basic_machine=$1 157 | ;; 158 | -scout) 159 | ;; 160 | -wrs) 161 | os=-vxworks 162 | basic_machine=$1 163 | ;; 164 | -chorusos*) 165 | os=-chorusos 166 | basic_machine=$1 167 | ;; 168 | -chorusrdb) 169 | os=-chorusrdb 170 | basic_machine=$1 171 | ;; 172 | -hiux*) 173 | os=-hiuxwe2 174 | ;; 175 | -sco6) 176 | os=-sco5v6 177 | basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` 178 | ;; 179 | -sco5) 180 | os=-sco3.2v5 181 | basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` 182 | ;; 183 | -sco4) 184 | os=-sco3.2v4 185 | basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` 186 | ;; 187 | -sco3.2.[4-9]*) 188 | os=`echo $os | sed -e 's/sco3.2./sco3.2v/'` 189 | basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` 190 | ;; 191 | -sco3.2v[4-9]*) 192 | # Don't forget version if it is 3.2v4 or newer. 193 | basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` 194 | ;; 195 | -sco5v6*) 196 | # Don't forget version if it is 3.2v4 or newer. 197 | basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` 198 | ;; 199 | -sco*) 200 | os=-sco3.2v2 201 | basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` 202 | ;; 203 | -udk*) 204 | basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` 205 | ;; 206 | -isc) 207 | os=-isc2.2 208 | basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` 209 | ;; 210 | -clix*) 211 | basic_machine=clipper-intergraph 212 | ;; 213 | -isc*) 214 | basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` 215 | ;; 216 | -lynx*) 217 | os=-lynxos 218 | ;; 219 | -ptx*) 220 | basic_machine=`echo $1 | sed -e 's/86-.*/86-sequent/'` 221 | ;; 222 | -windowsnt*) 223 | os=`echo $os | sed -e 's/windowsnt/winnt/'` 224 | ;; 225 | -psos*) 226 | os=-psos 227 | ;; 228 | -mint | -mint[0-9]*) 229 | basic_machine=m68k-atari 230 | os=-mint 231 | ;; 232 | esac 233 | 234 | # Decode aliases for certain CPU-COMPANY combinations. 235 | case $basic_machine in 236 | # Recognize the basic CPU types without company name. 237 | # Some are omitted here because they have special meanings below. 238 | 1750a | 580 \ 239 | | a29k \ 240 | | alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \ 241 | | alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \ 242 | | am33_2.0 \ 243 | | arc | arm | arm[bl]e | arme[lb] | armv[2345] | armv[345][lb] | avr \ 244 | | bfin \ 245 | | c4x | clipper \ 246 | | d10v | d30v | dlx | dsp16xx \ 247 | | fr30 | frv \ 248 | | h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \ 249 | | i370 | i860 | i960 | ia64 \ 250 | | ip2k | iq2000 \ 251 | | m32r | m32rle | m68000 | m68k | m88k | maxq | mb | microblaze | mcore \ 252 | | mips | mipsbe | mipseb | mipsel | mipsle \ 253 | | mips16 \ 254 | | mips64 | mips64el \ 255 | | mips64vr | mips64vrel \ 256 | | mips64orion | mips64orionel \ 257 | | mips64vr4100 | mips64vr4100el \ 258 | | mips64vr4300 | mips64vr4300el \ 259 | | mips64vr5000 | mips64vr5000el \ 260 | | mips64vr5900 | mips64vr5900el \ 261 | | mipsisa32 | mipsisa32el \ 262 | | mipsisa32r2 | mipsisa32r2el \ 263 | | mipsisa64 | mipsisa64el \ 264 | | mipsisa64r2 | mipsisa64r2el \ 265 | | mipsisa64sb1 | mipsisa64sb1el \ 266 | | mipsisa64sr71k | mipsisa64sr71kel \ 267 | | mipstx39 | mipstx39el \ 268 | | mn10200 | mn10300 \ 269 | | mt \ 270 | | msp430 \ 271 | | nios | nios2 \ 272 | | ns16k | ns32k \ 273 | | or32 \ 274 | | pdp10 | pdp11 | pj | pjl \ 275 | | powerpc | powerpc64 | powerpc64le | powerpcle | ppcbe \ 276 | | pyramid \ 277 | | sh | sh[1234] | sh[24]a | sh[23]e | sh[34]eb | shbe | shle | sh[1234]le | sh3ele \ 278 | | sh64 | sh64le \ 279 | | sparc | sparc64 | sparc64b | sparc86x | sparclet | sparclite \ 280 | | sparcv8 | sparcv9 | sparcv9b \ 281 | | strongarm \ 282 | | tahoe | thumb | tic4x | tic80 | tron \ 283 | | v850 | v850e \ 284 | | we32k \ 285 | | x86 | xscale | xscalee[bl] | xstormy16 | xtensa \ 286 | | z8k) 287 | basic_machine=$basic_machine-unknown 288 | ;; 289 | m32c) 290 | basic_machine=$basic_machine-unknown 291 | ;; 292 | m6811 | m68hc11 | m6812 | m68hc12) 293 | # Motorola 68HC11/12. 294 | basic_machine=$basic_machine-unknown 295 | os=-none 296 | ;; 297 | m88110 | m680[12346]0 | m683?2 | m68360 | m5200 | v70 | w65 | z8k) 298 | ;; 299 | ms1) 300 | basic_machine=mt-unknown 301 | ;; 302 | 303 | # We use `pc' rather than `unknown' 304 | # because (1) that's what they normally are, and 305 | # (2) the word "unknown" tends to confuse beginning users. 306 | i*86 | x86_64) 307 | basic_machine=$basic_machine-pc 308 | ;; 309 | # Object if more than one company name word. 310 | *-*-*) 311 | echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2 312 | exit 1 313 | ;; 314 | # Recognize the basic CPU types with company name. 315 | 580-* \ 316 | | a29k-* \ 317 | | alpha-* | alphaev[4-8]-* | alphaev56-* | alphaev6[78]-* \ 318 | | alpha64-* | alpha64ev[4-8]-* | alpha64ev56-* | alpha64ev6[78]-* \ 319 | | alphapca5[67]-* | alpha64pca5[67]-* | arc-* \ 320 | | arm-* | armbe-* | armle-* | armeb-* | armv*-* \ 321 | | avr-* \ 322 | | bfin-* | bs2000-* \ 323 | | c[123]* | c30-* | [cjt]90-* | c4x-* | c54x-* | c55x-* | c6x-* \ 324 | | clipper-* | craynv-* | cydra-* \ 325 | | d10v-* | d30v-* | dlx-* \ 326 | | elxsi-* \ 327 | | f30[01]-* | f700-* | fr30-* | frv-* | fx80-* \ 328 | | h8300-* | h8500-* \ 329 | | hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \ 330 | | i*86-* | i860-* | i960-* | ia64-* \ 331 | | ip2k-* | iq2000-* \ 332 | | m32r-* | m32rle-* \ 333 | | m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \ 334 | | m88110-* | m88k-* | maxq-* | mcore-* \ 335 | | mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \ 336 | | mips16-* \ 337 | | mips64-* | mips64el-* \ 338 | | mips64vr-* | mips64vrel-* \ 339 | | mips64orion-* | mips64orionel-* \ 340 | | mips64vr4100-* | mips64vr4100el-* \ 341 | | mips64vr4300-* | mips64vr4300el-* \ 342 | | mips64vr5000-* | mips64vr5000el-* \ 343 | | mips64vr5900-* | mips64vr5900el-* \ 344 | | mipsisa32-* | mipsisa32el-* \ 345 | | mipsisa32r2-* | mipsisa32r2el-* \ 346 | | mipsisa64-* | mipsisa64el-* \ 347 | | mipsisa64r2-* | mipsisa64r2el-* \ 348 | | mipsisa64sb1-* | mipsisa64sb1el-* \ 349 | | mipsisa64sr71k-* | mipsisa64sr71kel-* \ 350 | | mipstx39-* | mipstx39el-* \ 351 | | mmix-* \ 352 | | mt-* \ 353 | | msp430-* \ 354 | | nios-* | nios2-* \ 355 | | none-* | np1-* | ns16k-* | ns32k-* \ 356 | | orion-* \ 357 | | pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \ 358 | | powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* | ppcbe-* \ 359 | | pyramid-* \ 360 | | romp-* | rs6000-* \ 361 | | sh-* | sh[1234]-* | sh[24]a-* | sh[23]e-* | sh[34]eb-* | shbe-* \ 362 | | shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \ 363 | | sparc-* | sparc64-* | sparc64b-* | sparc86x-* | sparclet-* \ 364 | | sparclite-* \ 365 | | sparcv8-* | sparcv9-* | sparcv9b-* | strongarm-* | sv1-* | sx?-* \ 366 | | tahoe-* | thumb-* \ 367 | | tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* \ 368 | | tron-* \ 369 | | v850-* | v850e-* | vax-* \ 370 | | we32k-* \ 371 | | x86-* | x86_64-* | xps100-* | xscale-* | xscalee[bl]-* \ 372 | | xstormy16-* | xtensa-* \ 373 | | ymp-* \ 374 | | z8k-*) 375 | ;; 376 | m32c-*) 377 | ;; 378 | # Recognize the various machine names and aliases which stand 379 | # for a CPU type and a company and sometimes even an OS. 380 | 386bsd) 381 | basic_machine=i386-unknown 382 | os=-bsd 383 | ;; 384 | 3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc) 385 | basic_machine=m68000-att 386 | ;; 387 | 3b*) 388 | basic_machine=we32k-att 389 | ;; 390 | a29khif) 391 | basic_machine=a29k-amd 392 | os=-udi 393 | ;; 394 | abacus) 395 | basic_machine=abacus-unknown 396 | ;; 397 | adobe68k) 398 | basic_machine=m68010-adobe 399 | os=-scout 400 | ;; 401 | alliant | fx80) 402 | basic_machine=fx80-alliant 403 | ;; 404 | altos | altos3068) 405 | basic_machine=m68k-altos 406 | ;; 407 | am29k) 408 | basic_machine=a29k-none 409 | os=-bsd 410 | ;; 411 | amd64) 412 | basic_machine=x86_64-pc 413 | ;; 414 | amd64-*) 415 | basic_machine=x86_64-`echo $basic_machine | sed 's/^[^-]*-//'` 416 | ;; 417 | amdahl) 418 | basic_machine=580-amdahl 419 | os=-sysv 420 | ;; 421 | amiga | amiga-*) 422 | basic_machine=m68k-unknown 423 | ;; 424 | amigaos | amigados) 425 | basic_machine=m68k-unknown 426 | os=-amigaos 427 | ;; 428 | amigaunix | amix) 429 | basic_machine=m68k-unknown 430 | os=-sysv4 431 | ;; 432 | apollo68) 433 | basic_machine=m68k-apollo 434 | os=-sysv 435 | ;; 436 | apollo68bsd) 437 | basic_machine=m68k-apollo 438 | os=-bsd 439 | ;; 440 | aux) 441 | basic_machine=m68k-apple 442 | os=-aux 443 | ;; 444 | balance) 445 | basic_machine=ns32k-sequent 446 | os=-dynix 447 | ;; 448 | c90) 449 | basic_machine=c90-cray 450 | os=-unicos 451 | ;; 452 | convex-c1) 453 | basic_machine=c1-convex 454 | os=-bsd 455 | ;; 456 | convex-c2) 457 | basic_machine=c2-convex 458 | os=-bsd 459 | ;; 460 | convex-c32) 461 | basic_machine=c32-convex 462 | os=-bsd 463 | ;; 464 | convex-c34) 465 | basic_machine=c34-convex 466 | os=-bsd 467 | ;; 468 | convex-c38) 469 | basic_machine=c38-convex 470 | os=-bsd 471 | ;; 472 | cray | j90) 473 | basic_machine=j90-cray 474 | os=-unicos 475 | ;; 476 | craynv) 477 | basic_machine=craynv-cray 478 | os=-unicosmp 479 | ;; 480 | cr16c) 481 | basic_machine=cr16c-unknown 482 | os=-elf 483 | ;; 484 | crds | unos) 485 | basic_machine=m68k-crds 486 | ;; 487 | crisv32 | crisv32-* | etraxfs*) 488 | basic_machine=crisv32-axis 489 | ;; 490 | cris | cris-* | etrax*) 491 | basic_machine=cris-axis 492 | ;; 493 | crx) 494 | basic_machine=crx-unknown 495 | os=-elf 496 | ;; 497 | da30 | da30-*) 498 | basic_machine=m68k-da30 499 | ;; 500 | decstation | decstation-3100 | pmax | pmax-* | pmin | dec3100 | decstatn) 501 | basic_machine=mips-dec 502 | ;; 503 | decsystem10* | dec10*) 504 | basic_machine=pdp10-dec 505 | os=-tops10 506 | ;; 507 | decsystem20* | dec20*) 508 | basic_machine=pdp10-dec 509 | os=-tops20 510 | ;; 511 | delta | 3300 | motorola-3300 | motorola-delta \ 512 | | 3300-motorola | delta-motorola) 513 | basic_machine=m68k-motorola 514 | ;; 515 | delta88) 516 | basic_machine=m88k-motorola 517 | os=-sysv3 518 | ;; 519 | djgpp) 520 | basic_machine=i586-pc 521 | os=-msdosdjgpp 522 | ;; 523 | dpx20 | dpx20-*) 524 | basic_machine=rs6000-bull 525 | os=-bosx 526 | ;; 527 | dpx2* | dpx2*-bull) 528 | basic_machine=m68k-bull 529 | os=-sysv3 530 | ;; 531 | ebmon29k) 532 | basic_machine=a29k-amd 533 | os=-ebmon 534 | ;; 535 | elxsi) 536 | basic_machine=elxsi-elxsi 537 | os=-bsd 538 | ;; 539 | encore | umax | mmax) 540 | basic_machine=ns32k-encore 541 | ;; 542 | es1800 | OSE68k | ose68k | ose | OSE) 543 | basic_machine=m68k-ericsson 544 | os=-ose 545 | ;; 546 | fx2800) 547 | basic_machine=i860-alliant 548 | ;; 549 | genix) 550 | basic_machine=ns32k-ns 551 | ;; 552 | gmicro) 553 | basic_machine=tron-gmicro 554 | os=-sysv 555 | ;; 556 | go32) 557 | basic_machine=i386-pc 558 | os=-go32 559 | ;; 560 | h3050r* | hiux*) 561 | basic_machine=hppa1.1-hitachi 562 | os=-hiuxwe2 563 | ;; 564 | h8300hms) 565 | basic_machine=h8300-hitachi 566 | os=-hms 567 | ;; 568 | h8300xray) 569 | basic_machine=h8300-hitachi 570 | os=-xray 571 | ;; 572 | h8500hms) 573 | basic_machine=h8500-hitachi 574 | os=-hms 575 | ;; 576 | harris) 577 | basic_machine=m88k-harris 578 | os=-sysv3 579 | ;; 580 | hp300-*) 581 | basic_machine=m68k-hp 582 | ;; 583 | hp300bsd) 584 | basic_machine=m68k-hp 585 | os=-bsd 586 | ;; 587 | hp300hpux) 588 | basic_machine=m68k-hp 589 | os=-hpux 590 | ;; 591 | hp3k9[0-9][0-9] | hp9[0-9][0-9]) 592 | basic_machine=hppa1.0-hp 593 | ;; 594 | hp9k2[0-9][0-9] | hp9k31[0-9]) 595 | basic_machine=m68000-hp 596 | ;; 597 | hp9k3[2-9][0-9]) 598 | basic_machine=m68k-hp 599 | ;; 600 | hp9k6[0-9][0-9] | hp6[0-9][0-9]) 601 | basic_machine=hppa1.0-hp 602 | ;; 603 | hp9k7[0-79][0-9] | hp7[0-79][0-9]) 604 | basic_machine=hppa1.1-hp 605 | ;; 606 | hp9k78[0-9] | hp78[0-9]) 607 | # FIXME: really hppa2.0-hp 608 | basic_machine=hppa1.1-hp 609 | ;; 610 | hp9k8[67]1 | hp8[67]1 | hp9k80[24] | hp80[24] | hp9k8[78]9 | hp8[78]9 | hp9k893 | hp893) 611 | # FIXME: really hppa2.0-hp 612 | basic_machine=hppa1.1-hp 613 | ;; 614 | hp9k8[0-9][13679] | hp8[0-9][13679]) 615 | basic_machine=hppa1.1-hp 616 | ;; 617 | hp9k8[0-9][0-9] | hp8[0-9][0-9]) 618 | basic_machine=hppa1.0-hp 619 | ;; 620 | hppa-next) 621 | os=-nextstep3 622 | ;; 623 | hppaosf) 624 | basic_machine=hppa1.1-hp 625 | os=-osf 626 | ;; 627 | hppro) 628 | basic_machine=hppa1.1-hp 629 | os=-proelf 630 | ;; 631 | i370-ibm* | ibm*) 632 | basic_machine=i370-ibm 633 | ;; 634 | # I'm not sure what "Sysv32" means. Should this be sysv3.2? 635 | i*86v32) 636 | basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` 637 | os=-sysv32 638 | ;; 639 | i*86v4*) 640 | basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` 641 | os=-sysv4 642 | ;; 643 | i*86v) 644 | basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` 645 | os=-sysv 646 | ;; 647 | i*86sol2) 648 | basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` 649 | os=-solaris2 650 | ;; 651 | i386mach) 652 | basic_machine=i386-mach 653 | os=-mach 654 | ;; 655 | i386-vsta | vsta) 656 | basic_machine=i386-unknown 657 | os=-vsta 658 | ;; 659 | iris | iris4d) 660 | basic_machine=mips-sgi 661 | case $os in 662 | -irix*) 663 | ;; 664 | *) 665 | os=-irix4 666 | ;; 667 | esac 668 | ;; 669 | isi68 | isi) 670 | basic_machine=m68k-isi 671 | os=-sysv 672 | ;; 673 | m88k-omron*) 674 | basic_machine=m88k-omron 675 | ;; 676 | magnum | m3230) 677 | basic_machine=mips-mips 678 | os=-sysv 679 | ;; 680 | merlin) 681 | basic_machine=ns32k-utek 682 | os=-sysv 683 | ;; 684 | mingw32) 685 | basic_machine=i386-pc 686 | os=-mingw32 687 | ;; 688 | miniframe) 689 | basic_machine=m68000-convergent 690 | ;; 691 | *mint | -mint[0-9]* | *MiNT | *MiNT[0-9]*) 692 | basic_machine=m68k-atari 693 | os=-mint 694 | ;; 695 | mips3*-*) 696 | basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'` 697 | ;; 698 | mips3*) 699 | basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`-unknown 700 | ;; 701 | monitor) 702 | basic_machine=m68k-rom68k 703 | os=-coff 704 | ;; 705 | morphos) 706 | basic_machine=powerpc-unknown 707 | os=-morphos 708 | ;; 709 | msdos) 710 | basic_machine=i386-pc 711 | os=-msdos 712 | ;; 713 | ms1-*) 714 | basic_machine=`echo $basic_machine | sed -e 's/ms1-/mt-/'` 715 | ;; 716 | mvs) 717 | basic_machine=i370-ibm 718 | os=-mvs 719 | ;; 720 | ncr3000) 721 | basic_machine=i486-ncr 722 | os=-sysv4 723 | ;; 724 | netbsd386) 725 | basic_machine=i386-unknown 726 | os=-netbsd 727 | ;; 728 | netwinder) 729 | basic_machine=armv4l-rebel 730 | os=-linux 731 | ;; 732 | news | news700 | news800 | news900) 733 | basic_machine=m68k-sony 734 | os=-newsos 735 | ;; 736 | news1000) 737 | basic_machine=m68030-sony 738 | os=-newsos 739 | ;; 740 | news-3600 | risc-news) 741 | basic_machine=mips-sony 742 | os=-newsos 743 | ;; 744 | necv70) 745 | basic_machine=v70-nec 746 | os=-sysv 747 | ;; 748 | next | m*-next ) 749 | basic_machine=m68k-next 750 | case $os in 751 | -nextstep* ) 752 | ;; 753 | -ns2*) 754 | os=-nextstep2 755 | ;; 756 | *) 757 | os=-nextstep3 758 | ;; 759 | esac 760 | ;; 761 | nh3000) 762 | basic_machine=m68k-harris 763 | os=-cxux 764 | ;; 765 | nh[45]000) 766 | basic_machine=m88k-harris 767 | os=-cxux 768 | ;; 769 | nindy960) 770 | basic_machine=i960-intel 771 | os=-nindy 772 | ;; 773 | mon960) 774 | basic_machine=i960-intel 775 | os=-mon960 776 | ;; 777 | nonstopux) 778 | basic_machine=mips-compaq 779 | os=-nonstopux 780 | ;; 781 | np1) 782 | basic_machine=np1-gould 783 | ;; 784 | nsr-tandem) 785 | basic_machine=nsr-tandem 786 | ;; 787 | op50n-* | op60c-*) 788 | basic_machine=hppa1.1-oki 789 | os=-proelf 790 | ;; 791 | openrisc | openrisc-*) 792 | basic_machine=or32-unknown 793 | ;; 794 | os400) 795 | basic_machine=powerpc-ibm 796 | os=-os400 797 | ;; 798 | OSE68000 | ose68000) 799 | basic_machine=m68000-ericsson 800 | os=-ose 801 | ;; 802 | os68k) 803 | basic_machine=m68k-none 804 | os=-os68k 805 | ;; 806 | pa-hitachi) 807 | basic_machine=hppa1.1-hitachi 808 | os=-hiuxwe2 809 | ;; 810 | paragon) 811 | basic_machine=i860-intel 812 | os=-osf 813 | ;; 814 | pbd) 815 | basic_machine=sparc-tti 816 | ;; 817 | pbb) 818 | basic_machine=m68k-tti 819 | ;; 820 | pc532 | pc532-*) 821 | basic_machine=ns32k-pc532 822 | ;; 823 | pc98) 824 | basic_machine=i386-pc 825 | ;; 826 | pc98-*) 827 | basic_machine=i386-`echo $basic_machine | sed 's/^[^-]*-//'` 828 | ;; 829 | pentium | p5 | k5 | k6 | nexgen | viac3) 830 | basic_machine=i586-pc 831 | ;; 832 | pentiumpro | p6 | 6x86 | athlon | athlon_*) 833 | basic_machine=i686-pc 834 | ;; 835 | pentiumii | pentium2 | pentiumiii | pentium3) 836 | basic_machine=i686-pc 837 | ;; 838 | pentium4) 839 | basic_machine=i786-pc 840 | ;; 841 | pentium-* | p5-* | k5-* | k6-* | nexgen-* | viac3-*) 842 | basic_machine=i586-`echo $basic_machine | sed 's/^[^-]*-//'` 843 | ;; 844 | pentiumpro-* | p6-* | 6x86-* | athlon-*) 845 | basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` 846 | ;; 847 | pentiumii-* | pentium2-* | pentiumiii-* | pentium3-*) 848 | basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` 849 | ;; 850 | pentium4-*) 851 | basic_machine=i786-`echo $basic_machine | sed 's/^[^-]*-//'` 852 | ;; 853 | pn) 854 | basic_machine=pn-gould 855 | ;; 856 | power) basic_machine=power-ibm 857 | ;; 858 | ppc) basic_machine=powerpc-unknown 859 | ;; 860 | ppc-*) basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'` 861 | ;; 862 | ppcle | powerpclittle | ppc-le | powerpc-little) 863 | basic_machine=powerpcle-unknown 864 | ;; 865 | ppcle-* | powerpclittle-*) 866 | basic_machine=powerpcle-`echo $basic_machine | sed 's/^[^-]*-//'` 867 | ;; 868 | ppc64) basic_machine=powerpc64-unknown 869 | ;; 870 | ppc64-*) basic_machine=powerpc64-`echo $basic_machine | sed 's/^[^-]*-//'` 871 | ;; 872 | ppc64le | powerpc64little | ppc64-le | powerpc64-little) 873 | basic_machine=powerpc64le-unknown 874 | ;; 875 | ppc64le-* | powerpc64little-*) 876 | basic_machine=powerpc64le-`echo $basic_machine | sed 's/^[^-]*-//'` 877 | ;; 878 | ps2) 879 | basic_machine=i386-ibm 880 | ;; 881 | pw32) 882 | basic_machine=i586-unknown 883 | os=-pw32 884 | ;; 885 | rdos) 886 | basic_machine=i386-pc 887 | os=-rdos 888 | ;; 889 | rom68k) 890 | basic_machine=m68k-rom68k 891 | os=-coff 892 | ;; 893 | rm[46]00) 894 | basic_machine=mips-siemens 895 | ;; 896 | rtpc | rtpc-*) 897 | basic_machine=romp-ibm 898 | ;; 899 | s390 | s390-*) 900 | basic_machine=s390-ibm 901 | ;; 902 | s390x | s390x-*) 903 | basic_machine=s390x-ibm 904 | ;; 905 | sa29200) 906 | basic_machine=a29k-amd 907 | os=-udi 908 | ;; 909 | sb1) 910 | basic_machine=mipsisa64sb1-unknown 911 | ;; 912 | sb1el) 913 | basic_machine=mipsisa64sb1el-unknown 914 | ;; 915 | sei) 916 | basic_machine=mips-sei 917 | os=-seiux 918 | ;; 919 | sequent) 920 | basic_machine=i386-sequent 921 | ;; 922 | sh) 923 | basic_machine=sh-hitachi 924 | os=-hms 925 | ;; 926 | sh64) 927 | basic_machine=sh64-unknown 928 | ;; 929 | sparclite-wrs | simso-wrs) 930 | basic_machine=sparclite-wrs 931 | os=-vxworks 932 | ;; 933 | sps7) 934 | basic_machine=m68k-bull 935 | os=-sysv2 936 | ;; 937 | spur) 938 | basic_machine=spur-unknown 939 | ;; 940 | st2000) 941 | basic_machine=m68k-tandem 942 | ;; 943 | stratus) 944 | basic_machine=i860-stratus 945 | os=-sysv4 946 | ;; 947 | sun2) 948 | basic_machine=m68000-sun 949 | ;; 950 | sun2os3) 951 | basic_machine=m68000-sun 952 | os=-sunos3 953 | ;; 954 | sun2os4) 955 | basic_machine=m68000-sun 956 | os=-sunos4 957 | ;; 958 | sun3os3) 959 | basic_machine=m68k-sun 960 | os=-sunos3 961 | ;; 962 | sun3os4) 963 | basic_machine=m68k-sun 964 | os=-sunos4 965 | ;; 966 | sun4os3) 967 | basic_machine=sparc-sun 968 | os=-sunos3 969 | ;; 970 | sun4os4) 971 | basic_machine=sparc-sun 972 | os=-sunos4 973 | ;; 974 | sun4sol2) 975 | basic_machine=sparc-sun 976 | os=-solaris2 977 | ;; 978 | sun3 | sun3-*) 979 | basic_machine=m68k-sun 980 | ;; 981 | sun4) 982 | basic_machine=sparc-sun 983 | ;; 984 | sun386 | sun386i | roadrunner) 985 | basic_machine=i386-sun 986 | ;; 987 | sv1) 988 | basic_machine=sv1-cray 989 | os=-unicos 990 | ;; 991 | symmetry) 992 | basic_machine=i386-sequent 993 | os=-dynix 994 | ;; 995 | t3e) 996 | basic_machine=alphaev5-cray 997 | os=-unicos 998 | ;; 999 | t90) 1000 | basic_machine=t90-cray 1001 | os=-unicos 1002 | ;; 1003 | tic54x | c54x*) 1004 | basic_machine=tic54x-unknown 1005 | os=-coff 1006 | ;; 1007 | tic55x | c55x*) 1008 | basic_machine=tic55x-unknown 1009 | os=-coff 1010 | ;; 1011 | tic6x | c6x*) 1012 | basic_machine=tic6x-unknown 1013 | os=-coff 1014 | ;; 1015 | tx39) 1016 | basic_machine=mipstx39-unknown 1017 | ;; 1018 | tx39el) 1019 | basic_machine=mipstx39el-unknown 1020 | ;; 1021 | toad1) 1022 | basic_machine=pdp10-xkl 1023 | os=-tops20 1024 | ;; 1025 | tower | tower-32) 1026 | basic_machine=m68k-ncr 1027 | ;; 1028 | tpf) 1029 | basic_machine=s390x-ibm 1030 | os=-tpf 1031 | ;; 1032 | udi29k) 1033 | basic_machine=a29k-amd 1034 | os=-udi 1035 | ;; 1036 | ultra3) 1037 | basic_machine=a29k-nyu 1038 | os=-sym1 1039 | ;; 1040 | v810 | necv810) 1041 | basic_machine=v810-nec 1042 | os=-none 1043 | ;; 1044 | vaxv) 1045 | basic_machine=vax-dec 1046 | os=-sysv 1047 | ;; 1048 | vms) 1049 | basic_machine=vax-dec 1050 | os=-vms 1051 | ;; 1052 | vpp*|vx|vx-*) 1053 | basic_machine=f301-fujitsu 1054 | ;; 1055 | vxworks960) 1056 | basic_machine=i960-wrs 1057 | os=-vxworks 1058 | ;; 1059 | vxworks68) 1060 | basic_machine=m68k-wrs 1061 | os=-vxworks 1062 | ;; 1063 | vxworks29k) 1064 | basic_machine=a29k-wrs 1065 | os=-vxworks 1066 | ;; 1067 | w65*) 1068 | basic_machine=w65-wdc 1069 | os=-none 1070 | ;; 1071 | w89k-*) 1072 | basic_machine=hppa1.1-winbond 1073 | os=-proelf 1074 | ;; 1075 | xbox) 1076 | basic_machine=i686-pc 1077 | os=-mingw32 1078 | ;; 1079 | xps | xps100) 1080 | basic_machine=xps100-honeywell 1081 | ;; 1082 | ymp) 1083 | basic_machine=ymp-cray 1084 | os=-unicos 1085 | ;; 1086 | z8k-*-coff) 1087 | basic_machine=z8k-unknown 1088 | os=-sim 1089 | ;; 1090 | none) 1091 | basic_machine=none-none 1092 | os=-none 1093 | ;; 1094 | 1095 | # Here we handle the default manufacturer of certain CPU types. It is in 1096 | # some cases the only manufacturer, in others, it is the most popular. 1097 | w89k) 1098 | basic_machine=hppa1.1-winbond 1099 | ;; 1100 | op50n) 1101 | basic_machine=hppa1.1-oki 1102 | ;; 1103 | op60c) 1104 | basic_machine=hppa1.1-oki 1105 | ;; 1106 | romp) 1107 | basic_machine=romp-ibm 1108 | ;; 1109 | mmix) 1110 | basic_machine=mmix-knuth 1111 | ;; 1112 | rs6000) 1113 | basic_machine=rs6000-ibm 1114 | ;; 1115 | vax) 1116 | basic_machine=vax-dec 1117 | ;; 1118 | pdp10) 1119 | # there are many clones, so DEC is not a safe bet 1120 | basic_machine=pdp10-unknown 1121 | ;; 1122 | pdp11) 1123 | basic_machine=pdp11-dec 1124 | ;; 1125 | we32k) 1126 | basic_machine=we32k-att 1127 | ;; 1128 | sh[1234] | sh[24]a | sh[34]eb | sh[1234]le | sh[23]ele) 1129 | basic_machine=sh-unknown 1130 | ;; 1131 | sparc | sparcv8 | sparcv9 | sparcv9b) 1132 | basic_machine=sparc-sun 1133 | ;; 1134 | cydra) 1135 | basic_machine=cydra-cydrome 1136 | ;; 1137 | orion) 1138 | basic_machine=orion-highlevel 1139 | ;; 1140 | orion105) 1141 | basic_machine=clipper-highlevel 1142 | ;; 1143 | mac | mpw | mac-mpw) 1144 | basic_machine=m68k-apple 1145 | ;; 1146 | pmac | pmac-mpw) 1147 | basic_machine=powerpc-apple 1148 | ;; 1149 | *-unknown) 1150 | # Make sure to match an already-canonicalized machine name. 1151 | ;; 1152 | *) 1153 | echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2 1154 | exit 1 1155 | ;; 1156 | esac 1157 | 1158 | # Here we canonicalize certain aliases for manufacturers. 1159 | case $basic_machine in 1160 | *-digital*) 1161 | basic_machine=`echo $basic_machine | sed 's/digital.*/dec/'` 1162 | ;; 1163 | *-commodore*) 1164 | basic_machine=`echo $basic_machine | sed 's/commodore.*/cbm/'` 1165 | ;; 1166 | *) 1167 | ;; 1168 | esac 1169 | 1170 | # Decode manufacturer-specific aliases for certain operating systems. 1171 | 1172 | if [ x"$os" != x"" ] 1173 | then 1174 | case $os in 1175 | # First match some system type aliases 1176 | # that might get confused with valid system types. 1177 | # -solaris* is a basic system type, with this one exception. 1178 | -solaris1 | -solaris1.*) 1179 | os=`echo $os | sed -e 's|solaris1|sunos4|'` 1180 | ;; 1181 | -solaris) 1182 | os=-solaris2 1183 | ;; 1184 | -svr4*) 1185 | os=-sysv4 1186 | ;; 1187 | -unixware*) 1188 | os=-sysv4.2uw 1189 | ;; 1190 | -gnu/linux*) 1191 | os=`echo $os | sed -e 's|gnu/linux|linux-gnu|'` 1192 | ;; 1193 | # First accept the basic system types. 1194 | # The portable systems comes first. 1195 | # Each alternative MUST END IN A *, to match a version number. 1196 | # -sysv* is not here because it comes later, after sysvr4. 1197 | -gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \ 1198 | | -*vms* | -sco* | -esix* | -isc* | -aix* | -sunos | -sunos[34]*\ 1199 | | -hpux* | -unos* | -osf* | -luna* | -dgux* | -solaris* | -sym* \ 1200 | | -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \ 1201 | | -aos* \ 1202 | | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \ 1203 | | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \ 1204 | | -hiux* | -386bsd* | -knetbsd* | -mirbsd* | -netbsd* \ 1205 | | -openbsd* | -solidbsd* \ 1206 | | -ekkobsd* | -kfreebsd* | -freebsd* | -riscix* | -lynxos* \ 1207 | | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \ 1208 | | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \ 1209 | | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \ 1210 | | -chorusos* | -chorusrdb* \ 1211 | | -cygwin* | -pe* | -psos* | -moss* | -proelf* | -rtems* \ 1212 | | -mingw32* | -linux-gnu* | -linux-newlib* | -linux-uclibc* \ 1213 | | -uxpv* | -beos* | -mpeix* | -udk* \ 1214 | | -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \ 1215 | | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \ 1216 | | -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \ 1217 | | -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \ 1218 | | -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \ 1219 | | -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly* \ 1220 | | -skyos* | -haiku* | -rdos*) 1221 | # Remember, each alternative MUST END IN *, to match a version number. 1222 | ;; 1223 | -qnx*) 1224 | case $basic_machine in 1225 | x86-* | i*86-*) 1226 | ;; 1227 | *) 1228 | os=-nto$os 1229 | ;; 1230 | esac 1231 | ;; 1232 | -nto-qnx*) 1233 | ;; 1234 | -nto*) 1235 | os=`echo $os | sed -e 's|nto|nto-qnx|'` 1236 | ;; 1237 | -sim | -es1800* | -hms* | -xray | -os68k* | -none* | -v88r* \ 1238 | | -windows* | -osx | -abug | -netware* | -os9* | -beos* | -haiku* \ 1239 | | -macos* | -mpw* | -magic* | -mmixware* | -mon960* | -lnews*) 1240 | ;; 1241 | -mac*) 1242 | os=`echo $os | sed -e 's|mac|macos|'` 1243 | ;; 1244 | -linux-dietlibc) 1245 | os=-linux-dietlibc 1246 | ;; 1247 | -linux*) 1248 | os=`echo $os | sed -e 's|linux|linux-gnu|'` 1249 | ;; 1250 | -sunos5*) 1251 | os=`echo $os | sed -e 's|sunos5|solaris2|'` 1252 | ;; 1253 | -sunos6*) 1254 | os=`echo $os | sed -e 's|sunos6|solaris3|'` 1255 | ;; 1256 | -opened*) 1257 | os=-openedition 1258 | ;; 1259 | -os400*) 1260 | os=-os400 1261 | ;; 1262 | -wince*) 1263 | os=-wince 1264 | ;; 1265 | -osfrose*) 1266 | os=-osfrose 1267 | ;; 1268 | -osf*) 1269 | os=-osf 1270 | ;; 1271 | -utek*) 1272 | os=-bsd 1273 | ;; 1274 | -dynix*) 1275 | os=-bsd 1276 | ;; 1277 | -acis*) 1278 | os=-aos 1279 | ;; 1280 | -atheos*) 1281 | os=-atheos 1282 | ;; 1283 | -syllable*) 1284 | os=-syllable 1285 | ;; 1286 | -386bsd) 1287 | os=-bsd 1288 | ;; 1289 | -ctix* | -uts*) 1290 | os=-sysv 1291 | ;; 1292 | -nova*) 1293 | os=-rtmk-nova 1294 | ;; 1295 | -ns2 ) 1296 | os=-nextstep2 1297 | ;; 1298 | -nsk*) 1299 | os=-nsk 1300 | ;; 1301 | # Preserve the version number of sinix5. 1302 | -sinix5.*) 1303 | os=`echo $os | sed -e 's|sinix|sysv|'` 1304 | ;; 1305 | -sinix*) 1306 | os=-sysv4 1307 | ;; 1308 | -tpf*) 1309 | os=-tpf 1310 | ;; 1311 | -triton*) 1312 | os=-sysv3 1313 | ;; 1314 | -oss*) 1315 | os=-sysv3 1316 | ;; 1317 | -svr4) 1318 | os=-sysv4 1319 | ;; 1320 | -svr3) 1321 | os=-sysv3 1322 | ;; 1323 | -sysvr4) 1324 | os=-sysv4 1325 | ;; 1326 | # This must come after -sysvr4. 1327 | -sysv*) 1328 | ;; 1329 | -ose*) 1330 | os=-ose 1331 | ;; 1332 | -es1800*) 1333 | os=-ose 1334 | ;; 1335 | -xenix) 1336 | os=-xenix 1337 | ;; 1338 | -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) 1339 | os=-mint 1340 | ;; 1341 | -aros*) 1342 | os=-aros 1343 | ;; 1344 | -kaos*) 1345 | os=-kaos 1346 | ;; 1347 | -zvmoe) 1348 | os=-zvmoe 1349 | ;; 1350 | -none) 1351 | ;; 1352 | *) 1353 | # Get rid of the `-' at the beginning of $os. 1354 | os=`echo $os | sed 's/[^-]*-//'` 1355 | echo Invalid configuration \`$1\': system \`$os\' not recognized 1>&2 1356 | exit 1 1357 | ;; 1358 | esac 1359 | else 1360 | 1361 | # Here we handle the default operating systems that come with various machines. 1362 | # The value should be what the vendor currently ships out the door with their 1363 | # machine or put another way, the most popular os provided with the machine. 1364 | 1365 | # Note that if you're going to try to match "-MANUFACTURER" here (say, 1366 | # "-sun"), then you have to tell the case statement up towards the top 1367 | # that MANUFACTURER isn't an operating system. Otherwise, code above 1368 | # will signal an error saying that MANUFACTURER isn't an operating 1369 | # system, and we'll never get to this point. 1370 | 1371 | case $basic_machine in 1372 | *-acorn) 1373 | os=-riscix1.2 1374 | ;; 1375 | arm*-rebel) 1376 | os=-linux 1377 | ;; 1378 | arm*-semi) 1379 | os=-aout 1380 | ;; 1381 | c4x-* | tic4x-*) 1382 | os=-coff 1383 | ;; 1384 | # This must come before the *-dec entry. 1385 | pdp10-*) 1386 | os=-tops20 1387 | ;; 1388 | pdp11-*) 1389 | os=-none 1390 | ;; 1391 | *-dec | vax-*) 1392 | os=-ultrix4.2 1393 | ;; 1394 | m68*-apollo) 1395 | os=-domain 1396 | ;; 1397 | i386-sun) 1398 | os=-sunos4.0.2 1399 | ;; 1400 | m68000-sun) 1401 | os=-sunos3 1402 | # This also exists in the configure program, but was not the 1403 | # default. 1404 | # os=-sunos4 1405 | ;; 1406 | m68*-cisco) 1407 | os=-aout 1408 | ;; 1409 | mips*-cisco) 1410 | os=-elf 1411 | ;; 1412 | mips*-*) 1413 | os=-elf 1414 | ;; 1415 | or32-*) 1416 | os=-coff 1417 | ;; 1418 | *-tti) # must be before sparc entry or we get the wrong os. 1419 | os=-sysv3 1420 | ;; 1421 | sparc-* | *-sun) 1422 | os=-sunos4.1.1 1423 | ;; 1424 | *-be) 1425 | os=-beos 1426 | ;; 1427 | *-haiku) 1428 | os=-haiku 1429 | ;; 1430 | *-ibm) 1431 | os=-aix 1432 | ;; 1433 | *-knuth) 1434 | os=-mmixware 1435 | ;; 1436 | *-wec) 1437 | os=-proelf 1438 | ;; 1439 | *-winbond) 1440 | os=-proelf 1441 | ;; 1442 | *-oki) 1443 | os=-proelf 1444 | ;; 1445 | *-hp) 1446 | os=-hpux 1447 | ;; 1448 | *-hitachi) 1449 | os=-hiux 1450 | ;; 1451 | i860-* | *-att | *-ncr | *-altos | *-motorola | *-convergent) 1452 | os=-sysv 1453 | ;; 1454 | *-cbm) 1455 | os=-amigaos 1456 | ;; 1457 | *-dg) 1458 | os=-dgux 1459 | ;; 1460 | *-dolphin) 1461 | os=-sysv3 1462 | ;; 1463 | m68k-ccur) 1464 | os=-rtu 1465 | ;; 1466 | m88k-omron*) 1467 | os=-luna 1468 | ;; 1469 | *-next ) 1470 | os=-nextstep 1471 | ;; 1472 | *-sequent) 1473 | os=-ptx 1474 | ;; 1475 | *-crds) 1476 | os=-unos 1477 | ;; 1478 | *-ns) 1479 | os=-genix 1480 | ;; 1481 | i370-*) 1482 | os=-mvs 1483 | ;; 1484 | *-next) 1485 | os=-nextstep3 1486 | ;; 1487 | *-gould) 1488 | os=-sysv 1489 | ;; 1490 | *-highlevel) 1491 | os=-bsd 1492 | ;; 1493 | *-encore) 1494 | os=-bsd 1495 | ;; 1496 | *-sgi) 1497 | os=-irix 1498 | ;; 1499 | *-siemens) 1500 | os=-sysv4 1501 | ;; 1502 | *-masscomp) 1503 | os=-rtu 1504 | ;; 1505 | f30[01]-fujitsu | f700-fujitsu) 1506 | os=-uxpv 1507 | ;; 1508 | *-rom68k) 1509 | os=-coff 1510 | ;; 1511 | *-*bug) 1512 | os=-coff 1513 | ;; 1514 | *-apple) 1515 | os=-macos 1516 | ;; 1517 | *-atari*) 1518 | os=-mint 1519 | ;; 1520 | *) 1521 | os=-none 1522 | ;; 1523 | esac 1524 | fi 1525 | 1526 | # Here we handle the case where we know the os, and the CPU type, but not the 1527 | # manufacturer. We pick the logical manufacturer. 1528 | vendor=unknown 1529 | case $basic_machine in 1530 | *-unknown) 1531 | case $os in 1532 | -riscix*) 1533 | vendor=acorn 1534 | ;; 1535 | -sunos*) 1536 | vendor=sun 1537 | ;; 1538 | -aix*) 1539 | vendor=ibm 1540 | ;; 1541 | -beos*) 1542 | vendor=be 1543 | ;; 1544 | -hpux*) 1545 | vendor=hp 1546 | ;; 1547 | -mpeix*) 1548 | vendor=hp 1549 | ;; 1550 | -hiux*) 1551 | vendor=hitachi 1552 | ;; 1553 | -unos*) 1554 | vendor=crds 1555 | ;; 1556 | -dgux*) 1557 | vendor=dg 1558 | ;; 1559 | -luna*) 1560 | vendor=omron 1561 | ;; 1562 | -genix*) 1563 | vendor=ns 1564 | ;; 1565 | -mvs* | -opened*) 1566 | vendor=ibm 1567 | ;; 1568 | -os400*) 1569 | vendor=ibm 1570 | ;; 1571 | -ptx*) 1572 | vendor=sequent 1573 | ;; 1574 | -tpf*) 1575 | vendor=ibm 1576 | ;; 1577 | -vxsim* | -vxworks* | -windiss*) 1578 | vendor=wrs 1579 | ;; 1580 | -aux*) 1581 | vendor=apple 1582 | ;; 1583 | -hms*) 1584 | vendor=hitachi 1585 | ;; 1586 | -mpw* | -macos*) 1587 | vendor=apple 1588 | ;; 1589 | -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) 1590 | vendor=atari 1591 | ;; 1592 | -vos*) 1593 | vendor=stratus 1594 | ;; 1595 | esac 1596 | basic_machine=`echo $basic_machine | sed "s/unknown/$vendor/"` 1597 | ;; 1598 | esac 1599 | 1600 | echo $basic_machine$os 1601 | exit 1602 | 1603 | # Local variables: 1604 | # eval: (add-hook 'write-file-hooks 'time-stamp) 1605 | # time-stamp-start: "timestamp='" 1606 | # time-stamp-format: "%:y-%02m-%02d" 1607 | # time-stamp-end: "'" 1608 | # End: 1609 | -------------------------------------------------------------------------------- /configure.in: -------------------------------------------------------------------------------- 1 | AC_INIT(configure.in) 2 | 3 | AM_CONFIG_HEADER(config.h) 4 | AM_INIT_AUTOMAKE(s3fsnbd, 1.0) 5 | 6 | AC_LANG_C 7 | AC_PROG_CC 8 | AM_PROG_LIBTOOL 9 | 10 | NEON_LIBRARY 11 | NEON_XML_PARSER 12 | CFLAGS="$CFLAGS `pkg-config fuse --cflags`" 13 | LIBS="$NEON_LIBS $LIBS `pkg-config fuse --libs` -lssl -lcrypto" 14 | 15 | AC_OUTPUT(Makefile src/Makefile) 16 | -------------------------------------------------------------------------------- /depcomp: -------------------------------------------------------------------------------- 1 | #! /bin/sh 2 | 3 | # depcomp - compile a program generating dependencies as side-effects 4 | # Copyright 1999, 2000 Free Software Foundation, Inc. 5 | 6 | # This program is free software; you can redistribute it and/or modify 7 | # it under the terms of the GNU General Public License as published by 8 | # the Free Software Foundation; either version 2, or (at your option) 9 | # any later version. 10 | 11 | # This program is distributed in the hope that it will be useful, 12 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | # GNU General Public License for more details. 15 | 16 | # You should have received a copy of the GNU General Public License 17 | # along with this program; if not, write to the Free Software 18 | # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 19 | # 02111-1307, USA. 20 | 21 | # As a special exception to the GNU General Public License, if you 22 | # distribute this file as part of a program that contains a 23 | # configuration script generated by Autoconf, you may include it under 24 | # the same distribution terms that you use for the rest of that program. 25 | 26 | # Originally written by Alexandre Oliva . 27 | 28 | if test -z "$depmode" || test -z "$source" || test -z "$object"; then 29 | echo "depcomp: Variables source, object and depmode must be set" 1>&2 30 | exit 1 31 | fi 32 | # `libtool' can also be set to `yes' or `no'. 33 | 34 | depfile=${depfile-`echo "$object" | sed 's,\([^/]*\)$,.deps/\1,;s/\.\([^.]*\)$/.P\1/'`} 35 | tmpdepfile=${tmpdepfile-`echo "$depfile" | sed 's/\.\([^.]*\)$/.T\1/'`} 36 | 37 | rm -f "$tmpdepfile" 38 | 39 | # Some modes work just like other modes, but use different flags. We 40 | # parameterize here, but still list the modes in the big case below, 41 | # to make depend.m4 easier to write. Note that we *cannot* use a case 42 | # here, because this file can only contain one case statement. 43 | if test "$depmode" = hp; then 44 | # HP compiler uses -M and no extra arg. 45 | gccflag=-M 46 | depmode=gcc 47 | fi 48 | 49 | if test "$depmode" = dashXmstdout; then 50 | # This is just like dashmstdout with a different argument. 51 | dashmflag=-xM 52 | depmode=dashmstdout 53 | fi 54 | 55 | case "$depmode" in 56 | gcc3) 57 | ## gcc 3 implements dependency tracking that does exactly what 58 | ## we want. Yay! Note: for some reason libtool 1.4 doesn't like 59 | ## it if -MD -MP comes after the -MF stuff. Hmm. 60 | "$@" -MT "$object" -MD -MP -MF "$tmpdepfile" 61 | stat=$? 62 | if test $stat -eq 0; then : 63 | else 64 | rm -f "$tmpdepfile" 65 | exit $stat 66 | fi 67 | mv "$tmpdepfile" "$depfile" 68 | ;; 69 | 70 | gcc) 71 | ## There are various ways to get dependency output from gcc. Here's 72 | ## why we pick this rather obscure method: 73 | ## - Don't want to use -MD because we'd like the dependencies to end 74 | ## up in a subdir. Having to rename by hand is ugly. 75 | ## (We might end up doing this anyway to support other compilers.) 76 | ## - The DEPENDENCIES_OUTPUT environment variable makes gcc act like 77 | ## -MM, not -M (despite what the docs say). 78 | ## - Using -M directly means running the compiler twice (even worse 79 | ## than renaming). 80 | if test -z "$gccflag"; then 81 | gccflag=-MD, 82 | fi 83 | "$@" -Wp,"$gccflag$tmpdepfile" 84 | stat=$? 85 | if test $stat -eq 0; then : 86 | else 87 | rm -f "$tmpdepfile" 88 | exit $stat 89 | fi 90 | rm -f "$depfile" 91 | echo "$object : \\" > "$depfile" 92 | alpha=ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz 93 | ## The second -e expression handles DOS-style file names with drive letters. 94 | sed -e 's/^[^:]*: / /' \ 95 | -e 's/^['$alpha']:\/[^:]*: / /' < "$tmpdepfile" >> "$depfile" 96 | ## This next piece of magic avoids the `deleted header file' problem. 97 | ## The problem is that when a header file which appears in a .P file 98 | ## is deleted, the dependency causes make to die (because there is 99 | ## typically no way to rebuild the header). We avoid this by adding 100 | ## dummy dependencies for each header file. Too bad gcc doesn't do 101 | ## this for us directly. 102 | tr ' ' ' 103 | ' < "$tmpdepfile" | 104 | ## Some versions of gcc put a space before the `:'. On the theory 105 | ## that the space means something, we add a space to the output as 106 | ## well. 107 | ## Some versions of the HPUX 10.20 sed can't process this invocation 108 | ## correctly. Breaking it into two sed invocations is a workaround. 109 | sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile" 110 | rm -f "$tmpdepfile" 111 | ;; 112 | 113 | hp) 114 | # This case exists only to let depend.m4 do its work. It works by 115 | # looking at the text of this script. This case will never be run, 116 | # since it is checked for above. 117 | exit 1 118 | ;; 119 | 120 | sgi) 121 | if test "$libtool" = yes; then 122 | "$@" "-Wp,-MDupdate,$tmpdepfile" 123 | else 124 | "$@" -MDupdate "$tmpdepfile" 125 | fi 126 | stat=$? 127 | if test $stat -eq 0; then : 128 | else 129 | rm -f "$tmpdepfile" 130 | exit $stat 131 | fi 132 | rm -f "$depfile" 133 | 134 | if test -f "$tmpdepfile"; then # yes, the sourcefile depend on other files 135 | echo "$object : \\" > "$depfile" 136 | 137 | # Clip off the initial element (the dependent). Don't try to be 138 | # clever and replace this with sed code, as IRIX sed won't handle 139 | # lines with more than a fixed number of characters (4096 in 140 | # IRIX 6.2 sed, 8192 in IRIX 6.5). We also remove comment lines; 141 | # the IRIX cc adds comments like `#:fec' to the end of the 142 | # dependency line. 143 | tr ' ' ' 144 | ' < "$tmpdepfile" \ 145 | | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' | \ 146 | tr ' 147 | ' ' ' >> $depfile 148 | echo >> $depfile 149 | 150 | # The second pass generates a dummy entry for each header file. 151 | tr ' ' ' 152 | ' < "$tmpdepfile" \ 153 | | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' -e 's/$/:/' \ 154 | >> $depfile 155 | else 156 | # The sourcefile does not contain any dependencies, so just 157 | # store a dummy comment line, to avoid errors with the Makefile 158 | # "include basename.Plo" scheme. 159 | echo "#dummy" > "$depfile" 160 | fi 161 | rm -f "$tmpdepfile" 162 | ;; 163 | 164 | aix) 165 | # The C for AIX Compiler uses -M and outputs the dependencies 166 | # in a .u file. This file always lives in the current directory. 167 | # Also, the AIX compiler puts `$object:' at the start of each line; 168 | # $object doesn't have directory information. 169 | stripped=`echo "$object" | sed -e 's,^.*/,,' -e 's/\(.*\)\..*$/\1/'` 170 | tmpdepfile="$stripped.u" 171 | outname="$stripped.o" 172 | if test "$libtool" = yes; then 173 | "$@" -Wc,-M 174 | else 175 | "$@" -M 176 | fi 177 | 178 | stat=$? 179 | if test $stat -eq 0; then : 180 | else 181 | rm -f "$tmpdepfile" 182 | exit $stat 183 | fi 184 | 185 | if test -f "$tmpdepfile"; then 186 | # Each line is of the form `foo.o: dependent.h'. 187 | # Do two passes, one to just change these to 188 | # `$object: dependent.h' and one to simply `dependent.h:'. 189 | sed -e "s,^$outname:,$object :," < "$tmpdepfile" > "$depfile" 190 | sed -e "s,^$outname: \(.*\)$,\1:," < "$tmpdepfile" >> "$depfile" 191 | else 192 | # The sourcefile does not contain any dependencies, so just 193 | # store a dummy comment line, to avoid errors with the Makefile 194 | # "include basename.Plo" scheme. 195 | echo "#dummy" > "$depfile" 196 | fi 197 | rm -f "$tmpdepfile" 198 | ;; 199 | 200 | icc) 201 | # Must come before tru64. 202 | 203 | # Intel's C compiler understands `-MD -MF file'. However 204 | # icc -MD -MF foo.d -c -o sub/foo.o sub/foo.c 205 | # will fill foo.d with something like 206 | # foo.o: sub/foo.c 207 | # foo.o: sub/foo.h 208 | # which is wrong. We want: 209 | # sub/foo.o: sub/foo.c 210 | # sub/foo.o: sub/foo.h 211 | # sub/foo.c: 212 | # sub/foo.h: 213 | 214 | "$@" -MD -MF "$tmpdepfile" 215 | stat=$? 216 | if test $stat -eq 0; then : 217 | else 218 | rm -f "$tmpdepfile" 219 | exit $stat 220 | fi 221 | rm -f "$depfile" 222 | # Each line is of the form `foo.o: dependent.h'. 223 | # Do two passes, one to just change these to 224 | # `$object: dependent.h' and one to simply `dependent.h:'. 225 | sed -e "s,^[^:]*:,$object :," < "$tmpdepfile" > "$depfile" 226 | sed -e "s,^[^:]*: \(.*\)$,\1:," < "$tmpdepfile" >> "$depfile" 227 | rm -f "$tmpdepfile" 228 | ;; 229 | 230 | tru64) 231 | # The Tru64 AIX compiler uses -MD to generate dependencies as a side 232 | # effect. `cc -MD -o foo.o ...' puts the dependencies into `foo.o.d'. 233 | # At least on Alpha/Redhat 6.1, Compaq CCC V6.2-504 seems to put 234 | # dependencies in `foo.d' instead, so we check for that too. 235 | # Subdirectories are respected. 236 | 237 | tmpdepfile1="$object.d" 238 | tmpdepfile2=`echo "$object" | sed -e 's/.o$/.d/'` 239 | if test "$libtool" = yes; then 240 | "$@" -Wc,-MD 241 | else 242 | "$@" -MD 243 | fi 244 | 245 | stat=$? 246 | if test $stat -eq 0; then : 247 | else 248 | rm -f "$tmpdepfile1" "$tmpdepfile2" 249 | exit $stat 250 | fi 251 | 252 | if test -f "$tmpdepfile1"; then 253 | tmpdepfile="$tmpdepfile1" 254 | else 255 | tmpdepfile="$tmpdepfile2" 256 | fi 257 | if test -f "$tmpdepfile"; then 258 | sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile" 259 | # That's a space and a tab in the []. 260 | sed -e 's,^.*\.[a-z]*:[ ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile" 261 | else 262 | echo "#dummy" > "$depfile" 263 | fi 264 | rm -f "$tmpdepfile" 265 | ;; 266 | 267 | #nosideeffect) 268 | # This comment above is used by automake to tell side-effect 269 | # dependency tracking mechanisms from slower ones. 270 | 271 | dashmstdout) 272 | # Important note: in order to support this mode, a compiler *must* 273 | # always write the proprocessed file to stdout, regardless of -o, 274 | # because we must use -o when running libtool. 275 | test -z "$dashmflag" && dashmflag=-M 276 | ( IFS=" " 277 | case " $* " in 278 | *" --mode=compile "*) # this is libtool, let us make it quiet 279 | for arg 280 | do # cycle over the arguments 281 | case "$arg" in 282 | "--mode=compile") 283 | # insert --quiet before "--mode=compile" 284 | set fnord "$@" --quiet 285 | shift # fnord 286 | ;; 287 | esac 288 | set fnord "$@" "$arg" 289 | shift # fnord 290 | shift # "$arg" 291 | done 292 | ;; 293 | esac 294 | "$@" $dashmflag | sed 's:^[^:]*\:[ ]*:'"$object"'\: :' > "$tmpdepfile" 295 | ) & 296 | proc=$! 297 | "$@" 298 | stat=$? 299 | wait "$proc" 300 | if test "$stat" != 0; then exit $stat; fi 301 | rm -f "$depfile" 302 | cat < "$tmpdepfile" > "$depfile" 303 | tr ' ' ' 304 | ' < "$tmpdepfile" | \ 305 | ## Some versions of the HPUX 10.20 sed can't process this invocation 306 | ## correctly. Breaking it into two sed invocations is a workaround. 307 | sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile" 308 | rm -f "$tmpdepfile" 309 | ;; 310 | 311 | dashXmstdout) 312 | # This case only exists to satisfy depend.m4. It is never actually 313 | # run, as this mode is specially recognized in the preamble. 314 | exit 1 315 | ;; 316 | 317 | makedepend) 318 | # X makedepend 319 | ( 320 | shift 321 | cleared=no 322 | for arg in "$@"; do 323 | case $cleared in no) 324 | set ""; shift 325 | cleared=yes 326 | esac 327 | case "$arg" in 328 | -D*|-I*) 329 | set fnord "$@" "$arg"; shift;; 330 | -*) 331 | ;; 332 | *) 333 | set fnord "$@" "$arg"; shift;; 334 | esac 335 | done 336 | obj_suffix="`echo $object | sed 's/^.*\././'`" 337 | touch "$tmpdepfile" 338 | ${MAKEDEPEND-makedepend} 2>/dev/null -o"$obj_suffix" -f"$tmpdepfile" "$@" 339 | ) & 340 | proc=$! 341 | "$@" 342 | stat=$? 343 | wait "$proc" 344 | if test "$stat" != 0; then exit $stat; fi 345 | rm -f "$depfile" 346 | cat < "$tmpdepfile" > "$depfile" 347 | tail +3 "$tmpdepfile" | tr ' ' ' 348 | ' | \ 349 | ## Some versions of the HPUX 10.20 sed can't process this invocation 350 | ## correctly. Breaking it into two sed invocations is a workaround. 351 | sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile" 352 | rm -f "$tmpdepfile" "$tmpdepfile".bak 353 | ;; 354 | 355 | cpp) 356 | # Important note: in order to support this mode, a compiler *must* 357 | # always write the proprocessed file to stdout, regardless of -o, 358 | # because we must use -o when running libtool. 359 | ( IFS=" " 360 | case " $* " in 361 | *" --mode=compile "*) 362 | for arg 363 | do # cycle over the arguments 364 | case $arg in 365 | "--mode=compile") 366 | # insert --quiet before "--mode=compile" 367 | set fnord "$@" --quiet 368 | shift # fnord 369 | ;; 370 | esac 371 | set fnord "$@" "$arg" 372 | shift # fnord 373 | shift # "$arg" 374 | done 375 | ;; 376 | esac 377 | "$@" -E | 378 | sed -n '/^# [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' | 379 | sed '$ s: \\$::' > "$tmpdepfile" 380 | ) & 381 | proc=$! 382 | "$@" 383 | stat=$? 384 | wait "$proc" 385 | if test "$stat" != 0; then exit $stat; fi 386 | rm -f "$depfile" 387 | echo "$object : \\" > "$depfile" 388 | cat < "$tmpdepfile" >> "$depfile" 389 | sed < "$tmpdepfile" '/^$/d;s/^ //;s/ \\$//;s/$/ :/' >> "$depfile" 390 | rm -f "$tmpdepfile" 391 | ;; 392 | 393 | msvisualcpp) 394 | # Important note: in order to support this mode, a compiler *must* 395 | # always write the proprocessed file to stdout, regardless of -o, 396 | # because we must use -o when running libtool. 397 | ( IFS=" " 398 | case " $* " in 399 | *" --mode=compile "*) 400 | for arg 401 | do # cycle over the arguments 402 | case $arg in 403 | "--mode=compile") 404 | # insert --quiet before "--mode=compile" 405 | set fnord "$@" --quiet 406 | shift # fnord 407 | ;; 408 | esac 409 | set fnord "$@" "$arg" 410 | shift # fnord 411 | shift # "$arg" 412 | done 413 | ;; 414 | esac 415 | "$@" -E | 416 | sed -n '/^#line [0-9][0-9]* "\([^"]*\)"/ s::echo "`cygpath -u \\"\1\\"`":p' | sort | uniq > "$tmpdepfile" 417 | ) & 418 | proc=$! 419 | "$@" 420 | stat=$? 421 | wait "$proc" 422 | if test "$stat" != 0; then exit $stat; fi 423 | rm -f "$depfile" 424 | echo "$object : \\" > "$depfile" 425 | . "$tmpdepfile" | sed 's% %\\ %g' | sed -n '/^\(.*\)$/ s:: \1 \\:p' >> "$depfile" 426 | echo " " >> "$depfile" 427 | . "$tmpdepfile" | sed 's% %\\ %g' | sed -n '/^\(.*\)$/ s::\1\::p' >> "$depfile" 428 | rm -f "$tmpdepfile" 429 | ;; 430 | 431 | none) 432 | exec "$@" 433 | ;; 434 | 435 | *) 436 | echo "Unknown depmode $depmode" 1>&2 437 | exit 1 438 | ;; 439 | esac 440 | 441 | exit 0 442 | -------------------------------------------------------------------------------- /install-sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # 3 | # install - install a program, script, or datafile 4 | # This comes from X11R5 (mit/util/scripts/install.sh). 5 | # 6 | # Copyright 1991 by the Massachusetts Institute of Technology 7 | # 8 | # Permission to use, copy, modify, distribute, and sell this software and its 9 | # documentation for any purpose is hereby granted without fee, provided that 10 | # the above copyright notice appear in all copies and that both that 11 | # copyright notice and this permission notice appear in supporting 12 | # documentation, and that the name of M.I.T. not be used in advertising or 13 | # publicity pertaining to distribution of the software without specific, 14 | # written prior permission. M.I.T. makes no representations about the 15 | # suitability of this software for any purpose. It is provided "as is" 16 | # without express or implied warranty. 17 | # 18 | # Calling this script install-sh is preferred over install.sh, to prevent 19 | # `make' implicit rules from creating a file called install from it 20 | # when there is no Makefile. 21 | # 22 | # This script is compatible with the BSD install script, but was written 23 | # from scratch. It can only install one file at a time, a restriction 24 | # shared with many OS's install programs. 25 | 26 | 27 | # set DOITPROG to echo to test this script 28 | 29 | # Don't use :- since 4.3BSD and earlier shells don't like it. 30 | doit="${DOITPROG-}" 31 | 32 | 33 | # put in absolute paths if you don't have them in your path; or use env. vars. 34 | 35 | mvprog="${MVPROG-mv}" 36 | cpprog="${CPPROG-cp}" 37 | chmodprog="${CHMODPROG-chmod}" 38 | chownprog="${CHOWNPROG-chown}" 39 | chgrpprog="${CHGRPPROG-chgrp}" 40 | stripprog="${STRIPPROG-strip}" 41 | rmprog="${RMPROG-rm}" 42 | mkdirprog="${MKDIRPROG-mkdir}" 43 | 44 | transformbasename="" 45 | transform_arg="" 46 | instcmd="$mvprog" 47 | chmodcmd="$chmodprog 0755" 48 | chowncmd="" 49 | chgrpcmd="" 50 | stripcmd="" 51 | rmcmd="$rmprog -f" 52 | mvcmd="$mvprog" 53 | src="" 54 | dst="" 55 | dir_arg="" 56 | 57 | while [ x"$1" != x ]; do 58 | case $1 in 59 | -c) instcmd=$cpprog 60 | shift 61 | continue;; 62 | 63 | -d) dir_arg=true 64 | shift 65 | continue;; 66 | 67 | -m) chmodcmd="$chmodprog $2" 68 | shift 69 | shift 70 | continue;; 71 | 72 | -o) chowncmd="$chownprog $2" 73 | shift 74 | shift 75 | continue;; 76 | 77 | -g) chgrpcmd="$chgrpprog $2" 78 | shift 79 | shift 80 | continue;; 81 | 82 | -s) stripcmd=$stripprog 83 | shift 84 | continue;; 85 | 86 | -t=*) transformarg=`echo $1 | sed 's/-t=//'` 87 | shift 88 | continue;; 89 | 90 | -b=*) transformbasename=`echo $1 | sed 's/-b=//'` 91 | shift 92 | continue;; 93 | 94 | *) if [ x"$src" = x ] 95 | then 96 | src=$1 97 | else 98 | # this colon is to work around a 386BSD /bin/sh bug 99 | : 100 | dst=$1 101 | fi 102 | shift 103 | continue;; 104 | esac 105 | done 106 | 107 | if [ x"$src" = x ] 108 | then 109 | echo "$0: no input file specified" >&2 110 | exit 1 111 | else 112 | : 113 | fi 114 | 115 | if [ x"$dir_arg" != x ]; then 116 | dst=$src 117 | src="" 118 | 119 | if [ -d "$dst" ]; then 120 | instcmd=: 121 | chmodcmd="" 122 | else 123 | instcmd=$mkdirprog 124 | fi 125 | else 126 | 127 | # Waiting for this to be detected by the "$instcmd $src $dsttmp" command 128 | # might cause directories to be created, which would be especially bad 129 | # if $src (and thus $dsttmp) contains '*'. 130 | 131 | if [ -f "$src" ] || [ -d "$src" ] 132 | then 133 | : 134 | else 135 | echo "$0: $src does not exist" >&2 136 | exit 1 137 | fi 138 | 139 | if [ x"$dst" = x ] 140 | then 141 | echo "$0: no destination specified" >&2 142 | exit 1 143 | else 144 | : 145 | fi 146 | 147 | # If destination is a directory, append the input filename; if your system 148 | # does not like double slashes in filenames, you may need to add some logic 149 | 150 | if [ -d "$dst" ] 151 | then 152 | dst=$dst/`basename "$src"` 153 | else 154 | : 155 | fi 156 | fi 157 | 158 | ## this sed command emulates the dirname command 159 | dstdir=`echo "$dst" | sed -e 's,[^/]*$,,;s,/$,,;s,^$,.,'` 160 | 161 | # Make sure that the destination directory exists. 162 | # this part is taken from Noah Friedman's mkinstalldirs script 163 | 164 | # Skip lots of stat calls in the usual case. 165 | if [ ! -d "$dstdir" ]; then 166 | defaultIFS=' 167 | ' 168 | IFS="${IFS-$defaultIFS}" 169 | 170 | oIFS=$IFS 171 | # Some sh's can't handle IFS=/ for some reason. 172 | IFS='%' 173 | set - `echo "$dstdir" | sed -e 's@/@%@g' -e 's@^%@/@'` 174 | IFS=$oIFS 175 | 176 | pathcomp='' 177 | 178 | while [ $# -ne 0 ] ; do 179 | pathcomp=$pathcomp$1 180 | shift 181 | 182 | if [ ! -d "$pathcomp" ] ; 183 | then 184 | $mkdirprog "$pathcomp" 185 | else 186 | : 187 | fi 188 | 189 | pathcomp=$pathcomp/ 190 | done 191 | fi 192 | 193 | if [ x"$dir_arg" != x ] 194 | then 195 | $doit $instcmd "$dst" && 196 | 197 | if [ x"$chowncmd" != x ]; then $doit $chowncmd "$dst"; else : ; fi && 198 | if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd "$dst"; else : ; fi && 199 | if [ x"$stripcmd" != x ]; then $doit $stripcmd "$dst"; else : ; fi && 200 | if [ x"$chmodcmd" != x ]; then $doit $chmodcmd "$dst"; else : ; fi 201 | else 202 | 203 | # If we're going to rename the final executable, determine the name now. 204 | 205 | if [ x"$transformarg" = x ] 206 | then 207 | dstfile=`basename "$dst"` 208 | else 209 | dstfile=`basename "$dst" $transformbasename | 210 | sed $transformarg`$transformbasename 211 | fi 212 | 213 | # don't allow the sed command to completely eliminate the filename 214 | 215 | if [ x"$dstfile" = x ] 216 | then 217 | dstfile=`basename "$dst"` 218 | else 219 | : 220 | fi 221 | 222 | # Make a couple of temp file names in the proper directory. 223 | 224 | dsttmp=$dstdir/#inst.$$# 225 | rmtmp=$dstdir/#rm.$$# 226 | 227 | # Trap to clean up temp files at exit. 228 | 229 | trap 'status=$?; rm -f "$dsttmp" "$rmtmp" && exit $status' 0 230 | trap '(exit $?); exit' 1 2 13 15 231 | 232 | # Move or copy the file name to the temp name 233 | 234 | $doit $instcmd "$src" "$dsttmp" && 235 | 236 | # and set any options; do chmod last to preserve setuid bits 237 | 238 | # If any of these fail, we abort the whole thing. If we want to 239 | # ignore errors from any of these, just make sure not to ignore 240 | # errors from the above "$doit $instcmd $src $dsttmp" command. 241 | 242 | if [ x"$chowncmd" != x ]; then $doit $chowncmd "$dsttmp"; else :;fi && 243 | if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd "$dsttmp"; else :;fi && 244 | if [ x"$stripcmd" != x ]; then $doit $stripcmd "$dsttmp"; else :;fi && 245 | if [ x"$chmodcmd" != x ]; then $doit $chmodcmd "$dsttmp"; else :;fi && 246 | 247 | # Now remove or move aside any old file at destination location. We try this 248 | # two ways since rm can't unlink itself on some systems and the destination 249 | # file might be busy for other reasons. In this case, the final cleanup 250 | # might fail but the new file should still install successfully. 251 | 252 | { 253 | if [ -f "$dstdir/$dstfile" ] 254 | then 255 | $doit $rmcmd -f "$dstdir/$dstfile" 2>/dev/null || 256 | $doit $mvcmd -f "$dstdir/$dstfile" "$rmtmp" 2>/dev/null || 257 | { 258 | echo "$0: cannot unlink or rename $dstdir/$dstfile" >&2 259 | (exit 1); exit 260 | } 261 | else 262 | : 263 | fi 264 | } && 265 | 266 | # Now rename the file to the real destination. 267 | 268 | $doit $mvcmd "$dsttmp" "$dstdir/$dstfile" 269 | 270 | fi && 271 | 272 | # The final little trick to "correctly" pass the exit status to the exit trap. 273 | 274 | { 275 | (exit 0); exit 276 | } 277 | -------------------------------------------------------------------------------- /missing: -------------------------------------------------------------------------------- 1 | #! /bin/sh 2 | # Common stub for a few missing GNU programs while installing. 3 | # Copyright (C) 1996, 1997, 1999, 2000, 2002 Free Software Foundation, Inc. 4 | # Originally by Fran,cois Pinard , 1996. 5 | 6 | # This program is free software; you can redistribute it and/or modify 7 | # it under the terms of the GNU General Public License as published by 8 | # the Free Software Foundation; either version 2, or (at your option) 9 | # any later version. 10 | 11 | # This program is distributed in the hope that it will be useful, 12 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | # GNU General Public License for more details. 15 | 16 | # You should have received a copy of the GNU General Public License 17 | # along with this program; if not, write to the Free Software 18 | # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 19 | # 02111-1307, USA. 20 | 21 | # As a special exception to the GNU General Public License, if you 22 | # distribute this file as part of a program that contains a 23 | # configuration script generated by Autoconf, you may include it under 24 | # the same distribution terms that you use for the rest of that program. 25 | 26 | if test $# -eq 0; then 27 | echo 1>&2 "Try \`$0 --help' for more information" 28 | exit 1 29 | fi 30 | 31 | run=: 32 | 33 | # In the cases where this matters, `missing' is being run in the 34 | # srcdir already. 35 | if test -f configure.ac; then 36 | configure_ac=configure.ac 37 | else 38 | configure_ac=configure.in 39 | fi 40 | 41 | case "$1" in 42 | --run) 43 | # Try to run requested program, and just exit if it succeeds. 44 | run= 45 | shift 46 | "$@" && exit 0 47 | ;; 48 | esac 49 | 50 | # If it does not exist, or fails to run (possibly an outdated version), 51 | # try to emulate it. 52 | case "$1" in 53 | 54 | -h|--h|--he|--hel|--help) 55 | echo "\ 56 | $0 [OPTION]... PROGRAM [ARGUMENT]... 57 | 58 | Handle \`PROGRAM [ARGUMENT]...' for when PROGRAM is missing, or return an 59 | error status if there is no known handling for PROGRAM. 60 | 61 | Options: 62 | -h, --help display this help and exit 63 | -v, --version output version information and exit 64 | --run try to run the given command, and emulate it if it fails 65 | 66 | Supported PROGRAM values: 67 | aclocal touch file \`aclocal.m4' 68 | autoconf touch file \`configure' 69 | autoheader touch file \`config.h.in' 70 | automake touch all \`Makefile.in' files 71 | bison create \`y.tab.[ch]', if possible, from existing .[ch] 72 | flex create \`lex.yy.c', if possible, from existing .c 73 | help2man touch the output file 74 | lex create \`lex.yy.c', if possible, from existing .c 75 | makeinfo touch the output file 76 | tar try tar, gnutar, gtar, then tar without non-portable flags 77 | yacc create \`y.tab.[ch]', if possible, from existing .[ch]" 78 | ;; 79 | 80 | -v|--v|--ve|--ver|--vers|--versi|--versio|--version) 81 | echo "missing 0.4 - GNU automake" 82 | ;; 83 | 84 | -*) 85 | echo 1>&2 "$0: Unknown \`$1' option" 86 | echo 1>&2 "Try \`$0 --help' for more information" 87 | exit 1 88 | ;; 89 | 90 | aclocal*) 91 | if test -z "$run" && ($1 --version) > /dev/null 2>&1; then 92 | # We have it, but it failed. 93 | exit 1 94 | fi 95 | 96 | echo 1>&2 "\ 97 | WARNING: \`$1' is missing on your system. You should only need it if 98 | you modified \`acinclude.m4' or \`${configure_ac}'. You might want 99 | to install the \`Automake' and \`Perl' packages. Grab them from 100 | any GNU archive site." 101 | touch aclocal.m4 102 | ;; 103 | 104 | autoconf) 105 | if test -z "$run" && ($1 --version) > /dev/null 2>&1; then 106 | # We have it, but it failed. 107 | exit 1 108 | fi 109 | 110 | echo 1>&2 "\ 111 | WARNING: \`$1' is missing on your system. You should only need it if 112 | you modified \`${configure_ac}'. You might want to install the 113 | \`Autoconf' and \`GNU m4' packages. Grab them from any GNU 114 | archive site." 115 | touch configure 116 | ;; 117 | 118 | autoheader) 119 | if test -z "$run" && ($1 --version) > /dev/null 2>&1; then 120 | # We have it, but it failed. 121 | exit 1 122 | fi 123 | 124 | echo 1>&2 "\ 125 | WARNING: \`$1' is missing on your system. You should only need it if 126 | you modified \`acconfig.h' or \`${configure_ac}'. You might want 127 | to install the \`Autoconf' and \`GNU m4' packages. Grab them 128 | from any GNU archive site." 129 | files=`sed -n 's/^[ ]*A[CM]_CONFIG_HEADER(\([^)]*\)).*/\1/p' ${configure_ac}` 130 | test -z "$files" && files="config.h" 131 | touch_files= 132 | for f in $files; do 133 | case "$f" in 134 | *:*) touch_files="$touch_files "`echo "$f" | 135 | sed -e 's/^[^:]*://' -e 's/:.*//'`;; 136 | *) touch_files="$touch_files $f.in";; 137 | esac 138 | done 139 | touch $touch_files 140 | ;; 141 | 142 | automake*) 143 | if test -z "$run" && ($1 --version) > /dev/null 2>&1; then 144 | # We have it, but it failed. 145 | exit 1 146 | fi 147 | 148 | echo 1>&2 "\ 149 | WARNING: \`$1' is missing on your system. You should only need it if 150 | you modified \`Makefile.am', \`acinclude.m4' or \`${configure_ac}'. 151 | You might want to install the \`Automake' and \`Perl' packages. 152 | Grab them from any GNU archive site." 153 | find . -type f -name Makefile.am -print | 154 | sed 's/\.am$/.in/' | 155 | while read f; do touch "$f"; done 156 | ;; 157 | 158 | autom4te) 159 | if test -z "$run" && ($1 --version) > /dev/null 2>&1; then 160 | # We have it, but it failed. 161 | exit 1 162 | fi 163 | 164 | echo 1>&2 "\ 165 | WARNING: \`$1' is needed, and you do not seem to have it handy on your 166 | system. You might have modified some files without having the 167 | proper tools for further handling them. 168 | You can get \`$1Help2man' as part of \`Autoconf' from any GNU 169 | archive site." 170 | 171 | file=`echo "$*" | sed -n 's/.*--output[ =]*\([^ ]*\).*/\1/p'` 172 | test -z "$file" && file=`echo "$*" | sed -n 's/.*-o[ ]*\([^ ]*\).*/\1/p'` 173 | if test -f "$file"; then 174 | touch $file 175 | else 176 | test -z "$file" || exec >$file 177 | echo "#! /bin/sh" 178 | echo "# Created by GNU Automake missing as a replacement of" 179 | echo "# $ $@" 180 | echo "exit 0" 181 | chmod +x $file 182 | exit 1 183 | fi 184 | ;; 185 | 186 | bison|yacc) 187 | echo 1>&2 "\ 188 | WARNING: \`$1' is missing on your system. You should only need it if 189 | you modified a \`.y' file. You may need the \`Bison' package 190 | in order for those modifications to take effect. You can get 191 | \`Bison' from any GNU archive site." 192 | rm -f y.tab.c y.tab.h 193 | if [ $# -ne 1 ]; then 194 | eval LASTARG="\${$#}" 195 | case "$LASTARG" in 196 | *.y) 197 | SRCFILE=`echo "$LASTARG" | sed 's/y$/c/'` 198 | if [ -f "$SRCFILE" ]; then 199 | cp "$SRCFILE" y.tab.c 200 | fi 201 | SRCFILE=`echo "$LASTARG" | sed 's/y$/h/'` 202 | if [ -f "$SRCFILE" ]; then 203 | cp "$SRCFILE" y.tab.h 204 | fi 205 | ;; 206 | esac 207 | fi 208 | if [ ! -f y.tab.h ]; then 209 | echo >y.tab.h 210 | fi 211 | if [ ! -f y.tab.c ]; then 212 | echo 'main() { return 0; }' >y.tab.c 213 | fi 214 | ;; 215 | 216 | lex|flex) 217 | echo 1>&2 "\ 218 | WARNING: \`$1' is missing on your system. You should only need it if 219 | you modified a \`.l' file. You may need the \`Flex' package 220 | in order for those modifications to take effect. You can get 221 | \`Flex' from any GNU archive site." 222 | rm -f lex.yy.c 223 | if [ $# -ne 1 ]; then 224 | eval LASTARG="\${$#}" 225 | case "$LASTARG" in 226 | *.l) 227 | SRCFILE=`echo "$LASTARG" | sed 's/l$/c/'` 228 | if [ -f "$SRCFILE" ]; then 229 | cp "$SRCFILE" lex.yy.c 230 | fi 231 | ;; 232 | esac 233 | fi 234 | if [ ! -f lex.yy.c ]; then 235 | echo 'main() { return 0; }' >lex.yy.c 236 | fi 237 | ;; 238 | 239 | help2man) 240 | if test -z "$run" && ($1 --version) > /dev/null 2>&1; then 241 | # We have it, but it failed. 242 | exit 1 243 | fi 244 | 245 | echo 1>&2 "\ 246 | WARNING: \`$1' is missing on your system. You should only need it if 247 | you modified a dependency of a manual page. You may need the 248 | \`Help2man' package in order for those modifications to take 249 | effect. You can get \`Help2man' from any GNU archive site." 250 | 251 | file=`echo "$*" | sed -n 's/.*-o \([^ ]*\).*/\1/p'` 252 | if test -z "$file"; then 253 | file=`echo "$*" | sed -n 's/.*--output=\([^ ]*\).*/\1/p'` 254 | fi 255 | if [ -f "$file" ]; then 256 | touch $file 257 | else 258 | test -z "$file" || exec >$file 259 | echo ".ab help2man is required to generate this page" 260 | exit 1 261 | fi 262 | ;; 263 | 264 | makeinfo) 265 | if test -z "$run" && (makeinfo --version) > /dev/null 2>&1; then 266 | # We have makeinfo, but it failed. 267 | exit 1 268 | fi 269 | 270 | echo 1>&2 "\ 271 | WARNING: \`$1' is missing on your system. You should only need it if 272 | you modified a \`.texi' or \`.texinfo' file, or any other file 273 | indirectly affecting the aspect of the manual. The spurious 274 | call might also be the consequence of using a buggy \`make' (AIX, 275 | DU, IRIX). You might want to install the \`Texinfo' package or 276 | the \`GNU make' package. Grab either from any GNU archive site." 277 | file=`echo "$*" | sed -n 's/.*-o \([^ ]*\).*/\1/p'` 278 | if test -z "$file"; then 279 | file=`echo "$*" | sed 's/.* \([^ ]*\) *$/\1/'` 280 | file=`sed -n '/^@setfilename/ { s/.* \([^ ]*\) *$/\1/; p; q; }' $file` 281 | fi 282 | touch $file 283 | ;; 284 | 285 | tar) 286 | shift 287 | if test -n "$run"; then 288 | echo 1>&2 "ERROR: \`tar' requires --run" 289 | exit 1 290 | fi 291 | 292 | # We have already tried tar in the generic part. 293 | # Look for gnutar/gtar before invocation to avoid ugly error 294 | # messages. 295 | if (gnutar --version > /dev/null 2>&1); then 296 | gnutar "$@" && exit 0 297 | fi 298 | if (gtar --version > /dev/null 2>&1); then 299 | gtar "$@" && exit 0 300 | fi 301 | firstarg="$1" 302 | if shift; then 303 | case "$firstarg" in 304 | *o*) 305 | firstarg=`echo "$firstarg" | sed s/o//` 306 | tar "$firstarg" "$@" && exit 0 307 | ;; 308 | esac 309 | case "$firstarg" in 310 | *h*) 311 | firstarg=`echo "$firstarg" | sed s/h//` 312 | tar "$firstarg" "$@" && exit 0 313 | ;; 314 | esac 315 | fi 316 | 317 | echo 1>&2 "\ 318 | WARNING: I can't seem to be able to run \`tar' with the given arguments. 319 | You may want to install GNU tar or Free paxutils, or check the 320 | command line arguments." 321 | exit 1 322 | ;; 323 | 324 | *) 325 | echo 1>&2 "\ 326 | WARNING: \`$1' is needed, and you do not seem to have it handy on your 327 | system. You might have modified some files without having the 328 | proper tools for further handling them. Check the \`README' file, 329 | it often tells you about the needed prerequirements for installing 330 | this package. You may also peek at any GNU archive site, in case 331 | some other package would contain this missing \`$1' program." 332 | exit 1 333 | ;; 334 | esac 335 | 336 | exit 0 337 | -------------------------------------------------------------------------------- /mkinstalldirs: -------------------------------------------------------------------------------- 1 | #! /bin/sh 2 | # mkinstalldirs --- make directory hierarchy 3 | # Author: Noah Friedman 4 | # Created: 1993-05-16 5 | # Public domain 6 | 7 | errstatus=0 8 | dirmode="" 9 | 10 | usage="\ 11 | Usage: mkinstalldirs [-h] [--help] [-m mode] dir ..." 12 | 13 | # process command line arguments 14 | while test $# -gt 0 ; do 15 | case $1 in 16 | -h | --help | --h*) # -h for help 17 | echo "$usage" 1>&2 18 | exit 0 19 | ;; 20 | -m) # -m PERM arg 21 | shift 22 | test $# -eq 0 && { echo "$usage" 1>&2; exit 1; } 23 | dirmode=$1 24 | shift 25 | ;; 26 | --) # stop option processing 27 | shift 28 | break 29 | ;; 30 | -*) # unknown option 31 | echo "$usage" 1>&2 32 | exit 1 33 | ;; 34 | *) # first non-opt arg 35 | break 36 | ;; 37 | esac 38 | done 39 | 40 | for file 41 | do 42 | if test -d "$file"; then 43 | shift 44 | else 45 | break 46 | fi 47 | done 48 | 49 | case $# in 50 | 0) exit 0 ;; 51 | esac 52 | 53 | case $dirmode in 54 | '') 55 | if mkdir -p -- . 2>/dev/null; then 56 | echo "mkdir -p -- $*" 57 | exec mkdir -p -- "$@" 58 | fi 59 | ;; 60 | *) 61 | if mkdir -m "$dirmode" -p -- . 2>/dev/null; then 62 | echo "mkdir -m $dirmode -p -- $*" 63 | exec mkdir -m "$dirmode" -p -- "$@" 64 | fi 65 | ;; 66 | esac 67 | 68 | for file 69 | do 70 | set fnord `echo ":$file" | sed -ne 's/^:\//#/;s/^://;s/\// /g;s/^#/\//;p'` 71 | shift 72 | 73 | pathcomp= 74 | for d 75 | do 76 | pathcomp="$pathcomp$d" 77 | case $pathcomp in 78 | -*) pathcomp=./$pathcomp ;; 79 | esac 80 | 81 | if test ! -d "$pathcomp"; then 82 | echo "mkdir $pathcomp" 83 | 84 | mkdir "$pathcomp" || lasterr=$? 85 | 86 | if test ! -d "$pathcomp"; then 87 | errstatus=$lasterr 88 | else 89 | if test ! -z "$dirmode"; then 90 | echo "chmod $dirmode $pathcomp" 91 | lasterr="" 92 | chmod "$dirmode" "$pathcomp" || lasterr=$? 93 | 94 | if test ! -z "$lasterr"; then 95 | errstatus=$lasterr 96 | fi 97 | fi 98 | fi 99 | fi 100 | 101 | pathcomp="$pathcomp/" 102 | done 103 | done 104 | 105 | exit $errstatus 106 | 107 | # Local Variables: 108 | # mode: shell-script 109 | # sh-indentation: 2 110 | # End: 111 | # mkinstalldirs ends here 112 | -------------------------------------------------------------------------------- /src/Makefile.am: -------------------------------------------------------------------------------- 1 | 2 | # set the include path found by configure 3 | INCLUDES= $(all_includes) 4 | 5 | # the library search path. 6 | noinst_HEADERS = libs3.h 7 | bin_PROGRAMS = s3nbd 8 | s3nbd_SOURCES = libs3.c s3nbd.c 9 | -------------------------------------------------------------------------------- /src/libs3.c: -------------------------------------------------------------------------------- 1 | /* 2 | Amazon S3 library 3 | Copyright (C) 2007 Sound 4 | 5 | This program is free software; you can redistribute it and/or 6 | modify it under the terms of the GNU General Public License 7 | as published by the Free Software Foundation; either version 2 8 | of the License, or (at your option) any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program; if not, write to the Free Software 17 | Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 18 | */ 19 | #include 20 | #include 21 | #include 22 | #include 23 | #include 24 | #include 25 | #include 26 | #include 27 | #include 28 | #include 29 | #include 30 | #include 31 | #include 32 | #include "libs3.h" 33 | 34 | char *s3_sign_string(const S3 *s3,const char *string) 35 | { 36 | unsigned char md[EVP_MAX_MD_SIZE]; 37 | unsigned int md_len; 38 | 39 | if(!s3) return NULL; 40 | 41 | HMAC(EVP_sha1(),s3->secret_key,strlen(s3->secret_key), 42 | (unsigned char *)string,strlen(string),md,&md_len); 43 | return ne_base64(md,md_len); 44 | } 45 | 46 | static void s3_parse_xml_response(S3 *s3,ne_request *req, 47 | ne_xml_startelm_cb *startelm, 48 | ne_xml_cdata_cb *cdata, 49 | ne_xml_endelm_cb *endelm, 50 | void *userdata) 51 | { 52 | char buffer[4096]; 53 | size_t bytes_read; 54 | ne_xml_parser *xml; 55 | 56 | xml = ne_xml_create(); 57 | ne_xml_push_handler(xml,startelm,cdata,endelm,userdata); 58 | 59 | while((bytes_read = ne_read_response_block(req,buffer,4096)) > 0) { 60 | if(ne_xml_parse(xml,buffer,bytes_read) != 0) 61 | strncpy(s3->error,ne_xml_get_error(xml),511); 62 | } 63 | ne_xml_parse(xml,buffer,0); 64 | ne_xml_destroy(xml); 65 | } 66 | 67 | int s3_xml_error_startelm(void *userdata, int parent, 68 | const char *nspace, const char *name, 69 | const char **atts) { 70 | if(strcmp(name,"Error") == 0) return 1; 71 | if(parent == 1 && strcmp(name,"Message") == 0) return 2; 72 | return 0; 73 | } 74 | 75 | int s3_xml_error_cdata(void *userdata, int state, 76 | const char *cdata, size_t len) { 77 | S3 *s3 = userdata; 78 | if(state == 2) { 79 | strncpy(s3->error,cdata,len < 511 ? len : 511); 80 | s3->error[len < 511 ? len : 511] = 0; 81 | } 82 | return 0; 83 | } 84 | // int s3_xml_error_endelm(void *userdata, int state, 85 | // const char *nspace, const char *name) { } 86 | 87 | int s3_handle_error_response(S3 *s3,ne_request *req) 88 | { 89 | s3_parse_xml_response(s3,req,s3_xml_error_startelm,s3_xml_error_cdata,NULL,s3); 90 | return 0; 91 | } 92 | 93 | S3 *new_S3(const char *access_id,const char *secret_key) 94 | { 95 | S3 *s3; 96 | 97 | if(!access_id) return NULL; 98 | if(!secret_key) return NULL; 99 | 100 | if(strlen(access_id) > 63) return NULL; 101 | if(strlen(secret_key) > 63) return NULL; 102 | 103 | s3 = (S3 *)calloc(1,sizeof(S3)); 104 | if(!s3) { 105 | fprintf(stderr,"Could not create S3 object. Out of memory.\n"); 106 | exit(1); 107 | } 108 | 109 | strcpy(s3->access_id,access_id); 110 | strcpy(s3->secret_key,secret_key); 111 | s3->error[0] = 0; 112 | 113 | s3->session = NULL; 114 | s3->session_count = 0; 115 | 116 | s3->key_info.nb_name = ne_buffer_create(); 117 | s3->key_info.nb_etag = ne_buffer_create(); 118 | s3->key_info.nb_storage_class = ne_buffer_create(); 119 | s3->key_info.nb_owner_id = ne_buffer_create(); 120 | s3->key_info.nb_owner_display_name = ne_buffer_create(); 121 | 122 | ne_sock_init(); 123 | 124 | return s3; 125 | } 126 | 127 | void free_S3(S3 *s3) 128 | { 129 | if(s3) { 130 | ne_buffer_destroy(s3->key_info.nb_name); 131 | ne_buffer_destroy(s3->key_info.nb_etag); 132 | ne_buffer_destroy(s3->key_info.nb_storage_class); 133 | ne_buffer_destroy(s3->key_info.nb_owner_id); 134 | ne_buffer_destroy(s3->key_info.nb_owner_display_name); 135 | memset(s3->access_id,0,64); 136 | memset(s3->secret_key,0,64); 137 | ne_sock_exit(); 138 | free(s3); 139 | } 140 | } 141 | 142 | void s3_begin_session(S3 *s3) 143 | { 144 | if(s3) { 145 | if(s3->session_count == 0) s3->session = ne_session_create("http",AWS_S3_URL,80); 146 | s3->session_count++; 147 | } 148 | } 149 | 150 | void s3_end_session(S3 *s3) 151 | { 152 | if(s3 && s3->session) { 153 | s3->session_count--; 154 | if(s3->session_count == 0) { 155 | ne_session_destroy(s3->session); 156 | s3->session = NULL; 157 | } 158 | } 159 | } 160 | 161 | static ne_request *s3_new_request(const S3 *s3,const char *method,const char *bucket,const char *key,const char *params,const char *content_type) 162 | { 163 | ne_buffer *date, *signing_string, *request_str; 164 | ne_request *req; 165 | char *sig, *p; 166 | time_t t; 167 | 168 | if(!s3) return NULL; 169 | if(!method) return NULL; 170 | if(!bucket) return NULL; 171 | if(!s3->session) return NULL; 172 | 173 | // create some string buffers 174 | date = ne_buffer_create(); 175 | signing_string = ne_buffer_create(); 176 | request_str = ne_buffer_create(); 177 | 178 | // get the time 179 | t = time(NULL); 180 | ne_buffer_zappend(date,asctime(gmtime(&t))); 181 | if(date->data[date->used - 2] == '\n') 182 | date->data[date->used - 2] = 0; 183 | ne_buffer_altered(date); 184 | 185 | // create request 186 | if(key) ne_buffer_concat(request_str,"/",bucket,"/",key,NULL); 187 | else ne_buffer_concat(request_str,"/",bucket,NULL); 188 | 189 | if(params && params[0] != 0) { 190 | ne_buffer_zappend(request_str,"?"); 191 | ne_buffer_zappend(request_str,params); 192 | } 193 | 194 | req = ne_request_create(s3->session,method,request_str->data); 195 | 196 | // Add date header 197 | ne_add_request_header(req,"Date",date->data); 198 | 199 | // Add content-type header 200 | if(content_type) ne_add_request_header(req,"Content-Type",content_type); 201 | else content_type = ""; 202 | 203 | // construct signing string 204 | p = strrchr(request_str->data,'?'); 205 | if(p) { 206 | *p = 0; 207 | ne_buffer_altered(request_str); 208 | } 209 | ne_buffer_concat(signing_string,method,"\n\n",content_type,"\n",date->data,"\n",request_str->data,NULL); 210 | // sign the string 211 | sig = s3_sign_string(s3,signing_string->data); 212 | 213 | // construct signed header 214 | ne_print_request_header(req,"Authorization","AWS %s:%s",s3->access_id,sig); 215 | 216 | ne_buffer_destroy(date); 217 | ne_buffer_destroy(signing_string); 218 | ne_buffer_destroy(request_str); 219 | free(sig); 220 | 221 | return req; 222 | } 223 | 224 | int s3_create_bucket(S3 *s3,const char *bucket) 225 | { 226 | ne_request *req; 227 | int err, retry; 228 | 229 | if(!s3) return -1; 230 | if(!bucket) return -1; 231 | 232 | s3_begin_session(s3); 233 | 234 | req = s3_new_request(s3,"PUT",bucket,NULL,NULL,NULL); 235 | 236 | // send to server 237 | do { 238 | err = ne_begin_request(req); 239 | if(err != NE_OK) err = -EIO; 240 | else { 241 | if(ne_get_status(req)->code != 200) { 242 | s3_handle_error_response(s3,req); 243 | err = -EACCES; 244 | } 245 | retry = ne_end_request(req); 246 | } 247 | } while(retry == NE_RETRY); 248 | 249 | ne_request_destroy(req); 250 | s3_end_session(s3); 251 | 252 | return err; 253 | } 254 | 255 | int s3_delete_bucket(S3 *s3,const char *bucket) 256 | { 257 | ne_request *req; 258 | int err, retry; 259 | 260 | if(!s3) return -1; 261 | if(!bucket) return -1; 262 | 263 | s3_begin_session(s3); 264 | 265 | req = s3_new_request(s3,"DELETE",bucket,NULL,NULL,NULL); 266 | 267 | // send to server 268 | do { 269 | err = ne_begin_request(req); 270 | if(err != NE_OK) err = -EIO; 271 | else { 272 | if(ne_get_status(req)->code != 204) { 273 | s3_handle_error_response(s3,req); 274 | err = -EACCES; 275 | } 276 | retry = ne_end_request(req); 277 | } 278 | } while(retry == NE_RETRY); 279 | 280 | ne_request_destroy(req); 281 | s3_end_session(s3); 282 | 283 | return err; 284 | } 285 | 286 | 287 | enum S3XmlStates 288 | { 289 | XML_STATE_NONE, 290 | XML_STATE_LIST_BUCKET_RESULT, 291 | XML_STATE_CONTENTS, 292 | XML_STATE_KEY, 293 | XML_STATE_ETAG, 294 | XML_STATE_LAST_MODIFIED, 295 | XML_STATE_SIZE, 296 | XML_STATE_STORAGE_CLASS, 297 | XML_STATE_OWNER, 298 | XML_STATE_ID, 299 | XML_STATE_DISPLAY_NAME, 300 | }; 301 | 302 | int s3_xml_key_info_startelm(void *userdata, int parent, 303 | const char *nspace, const char *name, 304 | const char **atts) { 305 | if(strcmp(name,"ListBucketResult") == 0) return XML_STATE_LIST_BUCKET_RESULT; 306 | if(parent == XML_STATE_LIST_BUCKET_RESULT && strcmp(name,"Contents") == 0) { 307 | S3KeyInfo *ki = userdata; 308 | ne_buffer_clear(ki->nb_name); 309 | ne_buffer_clear(ki->nb_etag); 310 | ne_buffer_clear(ki->nb_storage_class); 311 | ne_buffer_clear(ki->nb_owner_id); 312 | ne_buffer_clear(ki->nb_owner_display_name); 313 | return XML_STATE_CONTENTS; 314 | } 315 | if(parent == XML_STATE_CONTENTS) { 316 | if(strcasecmp(name,"Key") == 0) return XML_STATE_KEY; 317 | if(strcasecmp(name,"LastModified") == 0) return XML_STATE_LAST_MODIFIED; 318 | if(strcasecmp(name,"ETag") == 0) return XML_STATE_ETAG; 319 | if(strcasecmp(name,"Size") == 0) return XML_STATE_SIZE; 320 | if(strcasecmp(name,"StorageClass") == 0) return XML_STATE_STORAGE_CLASS; 321 | if(strcasecmp(name,"Owner") == 0) return XML_STATE_OWNER; 322 | } 323 | if(parent == XML_STATE_OWNER) { 324 | if(strcasecmp(name,"ID") == 0) return XML_STATE_ID; 325 | if(strcasecmp(name,"DisplayName") == 0) return XML_STATE_DISPLAY_NAME; 326 | } 327 | 328 | return parent; 329 | } 330 | 331 | int s3_xml_key_info_cdata(void *userdata, int state, 332 | const char *cdata, size_t len) { 333 | S3KeyInfo *ki = userdata; 334 | switch(state) { 335 | case XML_STATE_KEY: 336 | ne_buffer_append(ki->nb_name,cdata,len); 337 | break; 338 | case XML_STATE_ETAG: 339 | ne_buffer_append(ki->nb_etag,cdata,len); 340 | break; 341 | case XML_STATE_SIZE: 342 | ki->size = strtol(cdata,NULL,10); 343 | break; 344 | case XML_STATE_STORAGE_CLASS: 345 | ne_buffer_append(ki->nb_storage_class,cdata,len); 346 | break; 347 | case XML_STATE_ID: 348 | ne_buffer_append(ki->nb_owner_id,cdata,len); 349 | break; 350 | case XML_STATE_DISPLAY_NAME: 351 | ne_buffer_append(ki->nb_owner_display_name,cdata,len); 352 | break; 353 | } 354 | return 0; 355 | } 356 | 357 | int s3_xml_key_info_endelm(void *userdata, int state, 358 | const char *nspace, const char *name) { 359 | if(strcmp(name,"Contents") == 0) { 360 | S3KeyInfo *ki = userdata; 361 | ki->name = ki->nb_name->data; 362 | ki->etag = ki->nb_etag->data; 363 | ki->storage_class = ki->nb_storage_class->data; 364 | ki->owner_id = ki->nb_owner_id->data; 365 | ki->owner_display_name = ki->nb_owner_display_name->data; 366 | if(ki->key_info_cb) ki->key_info_cb->callback(ki->key_info_cb->userdata,ki); 367 | } 368 | return 0; 369 | } 370 | 371 | int s3_get_bucket(S3 *s3,const char *bucket, 372 | const char *prefix,const char *marker,int max_keys,const char *delimiter, 373 | const S3KeyInfoCallback *key_info_cb) 374 | { 375 | ne_request *req; 376 | int err, retry; 377 | ne_buffer *params; 378 | 379 | if(!s3) return -1; 380 | if(!bucket) return -1; 381 | 382 | params = ne_buffer_create(); 383 | if(prefix) ne_buffer_concat(params,"prefix=",prefix,"/&",NULL); 384 | if(marker) ne_buffer_concat(params,"marker=",marker,"&",NULL); 385 | if(max_keys >= 0) { 386 | char mk[16]; 387 | snprintf(mk,16,"%d",max_keys); 388 | mk[15] = 0; 389 | ne_buffer_concat(params,"max_keys=",max_keys,"&",NULL); 390 | } 391 | if(delimiter) ne_buffer_concat(params,"delimiter=",delimiter,"&",NULL); 392 | 393 | s3_begin_session(s3); 394 | 395 | req = s3_new_request(s3,"GET",bucket,NULL,params->data,NULL); 396 | 397 | ne_buffer_destroy(params); 398 | 399 | // send to server 400 | do { 401 | err = ne_begin_request(req); 402 | if(err != NE_OK) err = -EIO; 403 | else { 404 | if(ne_get_status(req)->code != 200) { 405 | s3_handle_error_response(s3,req); 406 | err = -EACCES; 407 | } else { 408 | s3->key_info.key_info_cb = key_info_cb; 409 | s3_parse_xml_response(s3, 410 | req, 411 | s3_xml_key_info_startelm, 412 | s3_xml_key_info_cdata, 413 | s3_xml_key_info_endelm, 414 | &s3->key_info 415 | ); 416 | } 417 | retry = ne_end_request(req); 418 | } 419 | } while(retry == NE_RETRY); 420 | 421 | ne_request_destroy(req); 422 | s3_end_session(s3); 423 | 424 | return err; 425 | } 426 | 427 | int s3_put_object(S3 *s3,const char *bucket,const char *key,const char *content_type,int content_length,const S3ReadCallback *rcb) 428 | { 429 | ne_request *req; 430 | int err, retry; 431 | 432 | if(!s3) return -1; 433 | if(!bucket) return -1; 434 | if(!rcb) return -1; 435 | 436 | s3_begin_session(s3); 437 | 438 | req = s3_new_request(s3,"PUT",bucket,key,NULL,content_type); 439 | 440 | ne_print_request_header(req,"Content-Length","%d",content_length); 441 | 442 | #ifdef NE_LFS 443 | ne_set_request_body_provider64(req,content_length,rcb->callback,rcb->userdata); 444 | #else 445 | ne_set_request_body_provider(req,content_length,rcb->callback,rcb->userdata); 446 | #endif 447 | 448 | //ne_set_request_body_buffer(req,"hello",5); 449 | // send to server 450 | do { 451 | err = ne_begin_request(req); 452 | if(err != NE_OK) err = -EIO; 453 | else { 454 | if(ne_get_status(req)->code != 200) { 455 | s3_handle_error_response(s3,req); 456 | err = -EACCES; 457 | } 458 | retry = ne_end_request(req); 459 | } 460 | } while(retry == NE_RETRY); 461 | 462 | ne_request_destroy(req); 463 | s3_end_session(s3); 464 | 465 | return err; 466 | } 467 | 468 | int s3_get_object(S3 *s3,const char *bucket,const char *key,const S3WriteCallback *wcb) 469 | { 470 | ne_request *req; 471 | int err, retry; 472 | 473 | if(!s3) return -1; 474 | if(!bucket) return -1; 475 | if(!wcb) return -1; 476 | 477 | s3_begin_session(s3); 478 | 479 | req = s3_new_request(s3,"GET",bucket,key,NULL,NULL); 480 | // send to server 481 | do { 482 | err = ne_begin_request(req); 483 | if(err != NE_OK) err = -EIO; 484 | else { 485 | if(ne_get_status(req)->code != 200) { 486 | s3_handle_error_response(s3,req); 487 | if(ne_get_status(req)->code == 404) err = -ENOENT; 488 | else err = -EACCES; 489 | } else { 490 | char buffer[4096]; 491 | size_t bytes_read; 492 | 493 | while((bytes_read = ne_read_response_block(req,buffer,4096)) > 0) { 494 | wcb->callback(wcb->userdata,buffer,bytes_read); 495 | } 496 | } 497 | retry = ne_end_request(req); 498 | } 499 | } while(retry == NE_RETRY); 500 | 501 | ne_request_destroy(req); 502 | s3_end_session(s3); 503 | 504 | return err; 505 | } 506 | 507 | int s3_head_object(S3 *s3,const char *bucket,const char *key,S3ObjectInfo *oi) 508 | { 509 | ne_request *req; 510 | int err; 511 | 512 | if(!s3) return -1; 513 | if(!bucket) return -1; 514 | 515 | s3_begin_session(s3); 516 | 517 | req = s3_new_request(s3,"HEAD",bucket,key,NULL,NULL); 518 | 519 | // send to server 520 | err = ne_request_dispatch(req); 521 | if(err != NE_OK) err = -EIO; 522 | 523 | if(ne_get_status(req)->code != 200) { 524 | s3_handle_error_response(s3,req); 525 | if(ne_get_status(req)->code == 404) err = -ENOENT; 526 | else err = -EACCES; 527 | } else if(oi) { 528 | const char *str; 529 | str = ne_get_response_header(req,"Content-Length"); 530 | if(str) oi->content_length = strtol(str,NULL,10); 531 | str = ne_get_response_header(req,"Content-Type"); 532 | if(str) { 533 | strncpy(oi->content_type,str,31); 534 | oi->content_type[31] = 0; 535 | } 536 | str = ne_get_response_header(req,"ETag"); 537 | if(str) { 538 | strncpy(oi->etag,str,79); 539 | oi->etag[79] = 0; 540 | } 541 | } 542 | 543 | ne_request_destroy(req); 544 | s3_end_session(s3); 545 | 546 | return err; 547 | } 548 | 549 | int s3_delete_object(S3 *s3,const char *bucket,const char *key) 550 | { 551 | ne_request *req; 552 | int err, retry; 553 | 554 | if(!s3) return -1; 555 | if(!bucket) return -1; 556 | 557 | s3_begin_session(s3); 558 | 559 | req = s3_new_request(s3,"DELETE",bucket,key,NULL,NULL); 560 | 561 | // send to server 562 | do { 563 | err = ne_begin_request(req); 564 | if(err != NE_OK) err = -EIO; 565 | else { 566 | if(ne_get_status(req)->code != 204) { 567 | s3_handle_error_response(s3,req); 568 | err = -EACCES; 569 | } 570 | retry = ne_end_request(req); 571 | } 572 | } while(retry == NE_RETRY); 573 | 574 | ne_request_destroy(req); 575 | s3_end_session(s3); 576 | 577 | return err; 578 | } 579 | 580 | static ssize_t file_read_cb(FILE *fp,char *buffer,size_t len) 581 | { 582 | size_t bytes_read; 583 | 584 | if(!fp) return -1; 585 | 586 | if(len == 0) { 587 | fseek(fp,0L,0); 588 | return 0; 589 | } 590 | clearerr(fp); 591 | bytes_read = fread(buffer,1,len,fp); 592 | if(bytes_read == 0) { 593 | if(ferror(fp)) return -1; 594 | if(feof(fp)) return 0; 595 | return 0; 596 | } 597 | return bytes_read; 598 | } 599 | 600 | static ssize_t file_write_cb(FILE *fp,char *buffer,size_t len) 601 | { 602 | size_t bytes_written; 603 | 604 | if(!fp) return -1; 605 | 606 | clearerr(fp); 607 | bytes_written = fwrite(buffer,1,len,fp); 608 | if(bytes_written == 0) { 609 | if(ferror(fp)) return -1; 610 | if(feof(fp)) return 0; 611 | return 0; 612 | } 613 | return bytes_written; 614 | } 615 | 616 | const S3ReadCallback *s3_file_rcb(FILE *fp) 617 | { 618 | static S3ReadCallback rcb; 619 | 620 | rcb.callback = (ssize_t (*)(void *,char *,size_t))file_read_cb; 621 | rcb.userdata = (void *)fp; 622 | 623 | return &rcb; 624 | } 625 | 626 | const S3WriteCallback *s3_file_wcb(FILE *fp) 627 | { 628 | static S3WriteCallback wc; 629 | 630 | wc.callback = (ssize_t (*)(void *,char *,size_t))file_write_cb; 631 | wc.userdata = (void *)fp; 632 | 633 | return &wc; 634 | } 635 | 636 | typedef struct _MemInfo { 637 | void *data; 638 | unsigned int ptr; 639 | unsigned int len; 640 | } MemInfo; 641 | 642 | static ssize_t mem_read_cb(MemInfo *mi,char *buffer,size_t len) 643 | { 644 | size_t bytes_read; 645 | 646 | if(len == 0) { 647 | mi->ptr = 0; 648 | return 0; 649 | } 650 | 651 | if(mi->ptr == mi->len) return 0; 652 | 653 | if((mi->len - mi->ptr) < len) { 654 | bytes_read = mi->len - mi->ptr; 655 | memcpy(buffer,mi->data + mi->ptr,bytes_read); 656 | mi->ptr = mi->len; 657 | } else { 658 | bytes_read = len; 659 | memcpy(buffer,mi->data + mi->ptr,len); 660 | mi->ptr += len; 661 | } 662 | 663 | return bytes_read; 664 | } 665 | 666 | static ssize_t mem_write_cb(MemInfo *mi,char *buffer,size_t len) 667 | { 668 | size_t bytes_written; 669 | 670 | if(mi->ptr == mi->len) return 0; 671 | 672 | if(len > (mi->len - mi->ptr)) { 673 | bytes_written = mi->len - mi->ptr; 674 | memcpy(mi->data + mi->ptr,buffer,bytes_written); 675 | mi->ptr = mi->len; 676 | } else { 677 | bytes_written = len; 678 | memcpy(mi->data + mi->ptr,buffer,len); 679 | mi->ptr += len; 680 | } 681 | 682 | return bytes_written; 683 | } 684 | 685 | const S3ReadCallback *s3_mem_rcb(void *mem,unsigned int len) 686 | { 687 | static S3ReadCallback rcb; 688 | static MemInfo info; 689 | 690 | info.data = mem; 691 | info.len = len; 692 | info.ptr = 0; 693 | rcb.callback = (ssize_t (*)(void *,char *,size_t))mem_read_cb; 694 | rcb.userdata = (void *)&info; 695 | 696 | return &rcb; 697 | } 698 | 699 | const S3WriteCallback *s3_mem_wcb(void *mem,unsigned int len) 700 | { 701 | static S3WriteCallback wc; 702 | static MemInfo info; 703 | 704 | info.data = mem; 705 | info.len = len; 706 | info.ptr = 0; 707 | wc.callback = (ssize_t (*)(void *,char *,size_t))mem_write_cb; 708 | wc.userdata = (void *)&info; 709 | 710 | return &wc; 711 | } 712 | -------------------------------------------------------------------------------- /src/libs3.h: -------------------------------------------------------------------------------- 1 | /* 2 | Amazon S3 library 3 | Copyright (C) 2007 Sound 4 | 5 | This program is free software; you can redistribute it and/or 6 | modify it under the terms of the GNU General Public License 7 | as published by the Free Software Foundation; either version 2 8 | of the License, or (at your option) any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program; if not, write to the Free Software 17 | Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 18 | */ 19 | #ifndef __libs3_h 20 | #define __libs3_h 21 | 22 | #include 23 | #include 24 | 25 | #define MAX_BUCKET_NAME 255 26 | #define MAX_KEY_NAME 1024 27 | 28 | typedef struct _S3ReadCallback 29 | { 30 | ssize_t (*callback)(void *,char *,size_t); 31 | void *userdata; 32 | } S3ReadCallback; 33 | 34 | typedef struct _S3WriteCallback 35 | { 36 | ssize_t (*callback)(void *,char *,size_t); 37 | void *userdata; 38 | } S3WriteCallback; 39 | 40 | typedef struct _S3KeyInfo S3KeyInfo; 41 | typedef struct _S3KeyInfoCallback { 42 | void (*callback)(void *,const S3KeyInfo *); 43 | void *userdata; 44 | } S3KeyInfoCallback; 45 | 46 | struct _S3KeyInfo 47 | { 48 | const char *name; 49 | unsigned int last_modified; 50 | const char *etag; 51 | unsigned int size; 52 | const char *storage_class; 53 | const char *owner_id; 54 | const char *owner_display_name; 55 | 56 | // private interface 57 | const S3KeyInfoCallback *key_info_cb; 58 | 59 | ne_buffer *nb_name; 60 | ne_buffer *nb_etag; 61 | ne_buffer *nb_storage_class; 62 | ne_buffer *nb_owner_id; 63 | ne_buffer *nb_owner_display_name; 64 | }; 65 | 66 | typedef struct _S3ObjectInfo 67 | { 68 | char etag[80]; 69 | char content_type[32]; 70 | unsigned int content_length; 71 | } S3ObjectInfo; 72 | 73 | typedef struct _S3 74 | { 75 | char access_id[64]; 76 | char secret_key[64]; 77 | char error[512]; 78 | 79 | ne_session *session; 80 | int session_count; 81 | S3KeyInfo key_info; 82 | } S3; 83 | 84 | 85 | #define AWS_S3_URL "s3.amazonaws.com" 86 | 87 | /** 88 | * Signs the provided string with the AWS id and secret 89 | * @param s3 Pointer to S3 object 90 | * @param string String to sign 91 | * @return Returns the signed string in a allocated buffer. Use free() to free buffer after use. 92 | */ 93 | char *s3_sign_string(const S3 *s3,const char *string); 94 | 95 | /** 96 | * Create a new S3 object 97 | * @param access_id AWS access id 98 | * @param secret_key AWS secret key 99 | * @return Returns a new S3 object 100 | */ 101 | S3 *new_S3(const char *access_id,const char *secret_key); 102 | 103 | 104 | /** 105 | * Frees memory associated with the S3 object 106 | * @param s3 Pointer to S3 object 107 | */ 108 | void free_S3(S3 *s3); 109 | 110 | 111 | /** 112 | * Begins a new session 113 | * @param s3 Pointer to S3 object 114 | */ 115 | void s3_begin_session(S3 *s3); 116 | 117 | /** 118 | * Ends a session 119 | * @param s3 Pointer to S3 object 120 | */ 121 | void s3_end_session(S3 *s3); 122 | 123 | /** 124 | * Creates a bucket 125 | * @param s3 Pointer to S3 object 126 | * @param bucket Name of the bucket to create 127 | * @return Returns 0 if bucket was created, -1 on error 128 | */ 129 | int s3_create_bucket(S3 *s3,const char *bucket); 130 | 131 | /** 132 | * Deletes a bucket 133 | * @param s3 Pointer to S3 object 134 | * @param bucket Name of bucket to delete 135 | * @return Returns 0 if bucket was removed, -1 on error 136 | */ 137 | int s3_delete_bucket(S3 *s3,const char *bucket); 138 | 139 | /** 140 | * Gets a list of keys in the bucket. Keys are provided through a callback 141 | * function. 142 | * @param s3 Pointer to S3 object 143 | * @param bucket Bucket name 144 | * @param prefix Prefix for listing keys, or NULL 145 | * @param marker Marker for listing keys starting at marker, or NULL 146 | * @param max_keys Maximum number of keys to list, or -1. 147 | * @param delimiter Delimiter used to group keys between prefix and delimiter into 1 entry, or NULL 148 | * @param key_info_cb Pointer to a \a KeyInfoCallback structure which is called per key 149 | * @return Returns 0 or -1 on error 150 | */ 151 | int s3_get_bucket(S3 *s3,const char *bucket, 152 | const char *prefix,const char *marker,int max_keys,const char *delimiter, 153 | const S3KeyInfoCallback *key_info_cb); 154 | 155 | 156 | /** 157 | * Stores data to S3 158 | * @param s3 Pointer to S3 object 159 | * @param bucket Bucket name 160 | * @param key Key name 161 | * @param content_type Content type 162 | * @param content_length Content length 163 | * @param rcb Pointer to \a S3ReadCallback structure used to feed data to server 164 | * @return Returns 0 or -1 on error 165 | */ 166 | int s3_put_object(S3 *s3,const char *bucket,const char *key,const char *content_type,int content_length,const S3ReadCallback *rcb); 167 | 168 | /** 169 | * Retrieves data from S3 170 | * @param s3 Pointer to S3 object 171 | * @param bucket Bucket name 172 | * @param key Key name 173 | * @param wcb Pointer to \a S3WriteCallback structure used to save the retrieved data 174 | * @return Return 0 or -1 on error 175 | */ 176 | int s3_get_object(S3 *s3,const char *bucket,const char *key,const S3WriteCallback *wcb); 177 | 178 | /** 179 | * Performs a GET on an object but does not retrieve the body 180 | * @param s3 Pointer to S3 object 181 | * @param bucket Bucket name 182 | * @param key Key name 183 | * @param oi Pointers to \a S3ObjectInfo to store information about the object 184 | * @return Returns 0 or -1 on error 185 | */ 186 | int s3_head_object(S3 *s3,const char *bucket,const char *key,S3ObjectInfo *oi); 187 | 188 | /** 189 | * Deletes an object 190 | * @param s3 Pointers to S3 object 191 | * @param bucket Bucket name 192 | * @param key Key name 193 | * @return Returns 0 or -1 on error 194 | */ 195 | int s3_delete_object(S3 *s3,const char *bucket,const char *key); 196 | 197 | /** 198 | * Convenience function for using a file as a read callback 199 | * @param fp Pointer to FILE* 200 | * @return Returns a \a S3ReadCallback 201 | */ 202 | const S3ReadCallback *s3_file_rcb(FILE *fp); 203 | 204 | /** 205 | * Convenience function for using a file as a write callback 206 | * @param fp Pointer to FILE* 207 | * @return Returns a \a S3writeCallback 208 | */ 209 | const S3WriteCallback *s3_file_wcb(FILE *fp); 210 | 211 | /** 212 | * Convenience function for using a buffer as a read callback 213 | * @param mem Pointer to buffer 214 | * @param len Length of the buffer 215 | * @return Returns a \a S3ReadCallback 216 | */ 217 | const S3ReadCallback *s3_mem_rcb(void *mem,unsigned int len); 218 | 219 | /** 220 | * Convenience function for using a buffer as a write callback 221 | * @param mem Pointer to buffer 222 | * @param len Length of the buffer 223 | * @return Returns a \a S3WriteCallback 224 | */ 225 | const S3WriteCallback *s3_mem_wcb(void *mem,unsigned int len); 226 | 227 | #endif 228 | -------------------------------------------------------------------------------- /src/s3nbd.c: -------------------------------------------------------------------------------- 1 | /*************************************************************************** 2 | * Copyright (C) 2007 by Sound * 3 | * sound@sagaforce.com * 4 | * * 5 | * This program is free software; you can redistribute it and/or modify * 6 | * it under the terms of the GNU General Public License as published by * 7 | * the Free Software Foundation; either version 2 of the License, or * 8 | * (at your option) any later version. * 9 | * * 10 | * This program is distributed in the hope that it will be useful, * 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of * 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 13 | * GNU General Public License for more details. * 14 | * * 15 | * You should have received a copy of the GNU General Public License * 16 | * along with this program; if not, write to the * 17 | * Free Software Foundation, Inc., * 18 | * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * 19 | ***************************************************************************/ 20 | 21 | 22 | #ifdef HAVE_CONFIG_H 23 | #include 24 | #endif 25 | 26 | #include 27 | #include 28 | #include 29 | #include 30 | #include 31 | #include 32 | 33 | #include 34 | 35 | #include 36 | #include 37 | 38 | #include 39 | #include 40 | 41 | #include 42 | #include 43 | 44 | #include 45 | 46 | #include "libs3.h" 47 | 48 | #if __BYTE_ORDER == __BIG_ENDIAN 49 | #define ntohll(x) 50 | #define htonll(x) 51 | #else 52 | 53 | uint64_t bswap64(uint64_t n) { 54 | uint8_t *c = (uint8_t *)&n; 55 | 56 | c[0] ^= c[7]; 57 | c[1] ^= c[6]; 58 | c[2] ^= c[5]; 59 | c[3] ^= c[4]; 60 | c[7] ^= c[0]; 61 | c[6] ^= c[1]; 62 | c[5] ^= c[2]; 63 | c[4] ^= c[3]; 64 | c[0] ^= c[7]; 65 | c[1] ^= c[6]; 66 | c[2] ^= c[5]; 67 | c[3] ^= c[4]; 68 | 69 | return *(uint64_t *)c; 70 | } 71 | 72 | #define ntohll(x) bswap64(x) 73 | #define htonll(x) bswap64(x) 74 | 75 | #endif 76 | 77 | static char aws_access_id[256]; 78 | static char aws_secret_key[256]; 79 | static char aws_bucket[256]; 80 | 81 | static uint64_t bd_volume_size = 0x1FFFFFFFFFFLL; 82 | 83 | static int encrypt = 0; 84 | static BF_KEY bf_key; 85 | 86 | inline static int read_sock(int sock,void *buffer,size_t len) 87 | { 88 | size_t bytes_read; 89 | while(len > 0) { 90 | bytes_read = read(sock,buffer,len); 91 | if(errno == EAGAIN) { 92 | continue; 93 | } 94 | len -= bytes_read; 95 | buffer += bytes_read; 96 | } 97 | return 0; 98 | } 99 | 100 | inline static int write_sock(int sock,void *buffer,size_t len) 101 | { 102 | size_t bytes_written; 103 | while(len > 0) { 104 | bytes_written = write(sock,buffer,len); 105 | if(errno == EAGAIN) { 106 | continue; 107 | } 108 | len -= bytes_written; 109 | buffer += bytes_written; 110 | } 111 | return 0; 112 | } 113 | 114 | #define BLOCK_SIZE 4096 115 | 116 | static void encrypt_block(unsigned char *block,const unsigned char *ivec) 117 | { 118 | int num = 0; 119 | unsigned char dec_block[BLOCK_SIZE]; 120 | unsigned char ivec_copy[8]; 121 | memcpy(ivec_copy,ivec,8); 122 | memcpy(dec_block,block,BLOCK_SIZE); 123 | BF_cfb64_encrypt(dec_block,block,BLOCK_SIZE,&bf_key,ivec_copy,&num,BF_ENCRYPT); 124 | } 125 | 126 | static void decrypt_block(unsigned char *block,const unsigned char *ivec) 127 | { 128 | int num = 0; 129 | unsigned char enc_block[BLOCK_SIZE]; 130 | unsigned char ivec_copy[8]; 131 | memcpy(ivec_copy,ivec,8); 132 | memcpy(enc_block,block,BLOCK_SIZE); 133 | BF_cfb64_encrypt(enc_block,block,BLOCK_SIZE,&bf_key,ivec_copy,&num,BF_DECRYPT); 134 | } 135 | 136 | static int s3nbd_read_block(S3 *s3,const char *bucket,char *buffer,uint64_t blockno,size_t size,off_t offset) 137 | { 138 | int res; 139 | unsigned char block[BLOCK_SIZE]; 140 | char key[32]; 141 | 142 | if(offset + size > BLOCK_SIZE) return -1; 143 | 144 | snprintf(key,32,"nbd/%.16llx",blockno); key[31] = 0; 145 | #if __DEBUG__ 146 | printf(" s3_get() path=/%s/%s, block=%llu, size=%d, offset=%lld\n",bucket,key,blockno,BLOCK_SIZE,offset); 147 | #endif 148 | res = s3_get_object(s3,bucket,key,s3_mem_wcb(block,BLOCK_SIZE)); 149 | if(res == -ENOENT) { 150 | #if __DEBUG__ 151 | printf(" s3_is_sparse() path=/%s/%s\n",bucket,key); 152 | #endif 153 | memset(block,0,BLOCK_SIZE); 154 | } else if(res != 0) { 155 | fprintf(stderr,"%s\n",s3->error); 156 | return -1; 157 | } else if(encrypt) decrypt_block(block,(unsigned char *)&blockno); 158 | // copy relevant portion 159 | memcpy(buffer,block + offset,size); 160 | 161 | return 0; 162 | } 163 | 164 | static int s3nbd_read(S3 *s3,const char *bucket,char *buffer,size_t size,off_t offset) 165 | { 166 | uint64_t i, start_block, end_block; 167 | unsigned int bytes_to_read, remaining; 168 | int res; 169 | 170 | // compute start and end block 171 | start_block = offset / BLOCK_SIZE; 172 | end_block = (offset + size - 1) / BLOCK_SIZE; 173 | 174 | #if __DEBUG__ 175 | printf("read() size=%d, offset=%lld\n",size,offset); 176 | #endif 177 | remaining = size; 178 | if(start_block == end_block) { 179 | res = s3nbd_read_block(s3,bucket,buffer,start_block,size,offset & (BLOCK_SIZE - 1)); 180 | } else { 181 | s3_begin_session(s3); 182 | 183 | // copy start block portion 184 | bytes_to_read = BLOCK_SIZE - (offset & (BLOCK_SIZE - 1)); 185 | res = s3nbd_read_block(s3,bucket,buffer,start_block,bytes_to_read,offset & (BLOCK_SIZE - 1)); 186 | buffer += bytes_to_read; 187 | remaining -= bytes_to_read; 188 | 189 | // copy each block in between 190 | for(i = start_block + 1; i < end_block; i++) { 191 | s3nbd_read_block(s3,bucket,buffer,i,BLOCK_SIZE,0); 192 | buffer += BLOCK_SIZE; 193 | remaining -= BLOCK_SIZE; 194 | } 195 | 196 | // copy end block portion 197 | res = s3nbd_read_block(s3,bucket,buffer,end_block,remaining,0); 198 | 199 | s3_end_session(s3); 200 | } 201 | 202 | return res; 203 | } 204 | 205 | // size must be multiple of 4 206 | static int is_zero_block(unsigned char *buffer,size_t size) 207 | { 208 | uint32_t *d; 209 | 210 | d = (uint32_t *)buffer; 211 | size &= ~3; 212 | while(size > 3) { 213 | if(*d++) return 0; 214 | size -= 4; 215 | } 216 | return 1; 217 | } 218 | 219 | static int s3nbd_write_block(S3 *s3,const char *bucket,char *buffer,uint64_t blockno,size_t size,off_t offset) 220 | { 221 | int res; 222 | unsigned char block[BLOCK_SIZE]; 223 | char key[32]; 224 | 225 | if(offset + size > BLOCK_SIZE) return -1; 226 | 227 | snprintf(key,32,"nbd/%.16llx",blockno); key[31] = 0; 228 | if(size != BLOCK_SIZE) { 229 | res = s3_get_object(s3,bucket,key,s3_mem_wcb(block,BLOCK_SIZE)); 230 | if(res == -ENOENT) { 231 | memset(block,0,BLOCK_SIZE); 232 | #if __DEBUG__ 233 | printf(" s3_get() path=/%s/%s, size=%d\n",bucket,key,BLOCK_SIZE); 234 | #endif 235 | } else if(res != 0) return -1; 236 | else if(encrypt) decrypt_block(block,(unsigned char *)&blockno); 237 | #if __DEBUG__ 238 | printf(" s3_get() path=/%s/%s, size=%d\n",bucket,key,BLOCK_SIZE); 239 | #endif 240 | } else memset(block,0,BLOCK_SIZE); 241 | 242 | memcpy(block + offset,buffer,size); 243 | if(is_zero_block(block,BLOCK_SIZE)) { 244 | s3_delete_object(s3,bucket,key); 245 | #if __DEBUG__ 246 | printf(" s3_delete() path=/%s/%s\n",bucket,key); 247 | #endif 248 | } else { 249 | if(encrypt) encrypt_block(block,(unsigned char *)&blockno); 250 | s3_put_object(s3,bucket,key,"binary/octet-stream",BLOCK_SIZE,s3_mem_rcb(block,BLOCK_SIZE)); 251 | #if __DEBUG__ 252 | printf(" s3put() path=/%s/%s, block=%llu, size=%d, offset=%lld\n",bucket,key,blockno,BLOCK_SIZE,offset); 253 | #endif 254 | } 255 | 256 | return 0; 257 | } 258 | 259 | static int s3nbd_write(S3 *s3,const char *bucket,char *buffer,size_t size,off_t offset) 260 | { 261 | uint64_t i, start_block, end_block; 262 | int res = 0; 263 | unsigned int bytes_to_write, remaining; 264 | 265 | start_block = offset / BLOCK_SIZE; 266 | end_block = (offset + size - 1) / BLOCK_SIZE; 267 | 268 | #if __DEBUG__ 269 | printf("write() size=%d, offset=%lld\n",size,offset); 270 | #endif 271 | remaining = size; 272 | if(start_block == end_block) { 273 | res = s3nbd_write_block(s3,bucket,buffer,start_block,size,offset & (BLOCK_SIZE - 1)); 274 | } else { 275 | s3_begin_session(s3); 276 | 277 | bytes_to_write = BLOCK_SIZE - (offset & (BLOCK_SIZE - 1)); 278 | res = s3nbd_write_block(s3,bucket,buffer,start_block,bytes_to_write,offset & (BLOCK_SIZE - 1)); 279 | buffer += bytes_to_write; 280 | remaining -= bytes_to_write; 281 | 282 | for(i = start_block + 1; i < end_block; i++) { 283 | res = s3nbd_write_block(s3,bucket,buffer,i,BLOCK_SIZE,0); 284 | buffer += BLOCK_SIZE; 285 | remaining -= BLOCK_SIZE; 286 | } 287 | 288 | res = s3nbd_write_block(s3,bucket,buffer,end_block,remaining,0); 289 | 290 | s3_end_session(s3); 291 | } 292 | 293 | return res; 294 | } 295 | 296 | int s3nbd_server(int sock) 297 | { 298 | // negotiation?? 299 | char zeros[128]; 300 | uint64_t magic, size; 301 | char block[32768]; 302 | struct nbd_request request; 303 | struct nbd_reply reply; 304 | S3 *s3; 305 | 306 | s3 = new_S3(aws_access_id,aws_secret_key); 307 | 308 | if(write_sock(sock,"NBDMAGIC",8) < 0) { 309 | fprintf(stderr,"Negotiation failed.\n"); 310 | return -1; 311 | } 312 | 313 | magic = htonll(0x00420281861253LL); 314 | if(write_sock(sock,&magic,sizeof(magic)) < 0) { 315 | fprintf(stderr,"Negotiation failed.\n"); 316 | return -1; 317 | } 318 | 319 | size = htonll(bd_volume_size); 320 | if(write_sock(sock,&size,8) < 0) { 321 | fprintf(stderr,"Negotiation failed.\n"); 322 | return -1; 323 | } 324 | 325 | memset(zeros,10,128); 326 | if(write_sock(sock,zeros,128) < 0) { 327 | fprintf(stderr,"Negotiation failed.\n"); 328 | return -1; 329 | } 330 | 331 | #if __DEBUG__ 332 | printf("Server up.\n"); 333 | #endif 334 | 335 | // enter the main loop 336 | for(;;) { 337 | if(read_sock(sock,&request,sizeof(struct nbd_request)) < 0) { 338 | fprintf(stderr,"Read failure.\n"); 339 | return -1; 340 | } 341 | 342 | if(ntohl(request.magic) != NBD_REQUEST_MAGIC) { 343 | fprintf(stderr,"Protocol error.\n"); 344 | return -1; 345 | } 346 | 347 | switch(ntohl(request.type)) { 348 | case NBD_CMD_READ: 349 | { 350 | uint32_t len; 351 | uint64_t from; 352 | 353 | reply.magic = htonl(NBD_REPLY_MAGIC); 354 | reply.error = htonl(0); 355 | memcpy(reply.handle,request.handle,8); 356 | write_sock(sock,&reply,sizeof(struct nbd_reply)); 357 | 358 | len = ntohl(request.len); 359 | from = ntohll(request.from); 360 | while(len > 32768) { 361 | s3nbd_read(s3,aws_bucket,block,32768,from); 362 | write_sock(sock,block,32768); 363 | len -= 32768; 364 | from += 32768; 365 | } 366 | s3nbd_read(s3,aws_bucket,block,len,from); 367 | write_sock(sock,block,len); 368 | } 369 | break; 370 | case NBD_CMD_WRITE: 371 | { 372 | uint32_t len; 373 | uint64_t from; 374 | 375 | len = ntohl(request.len); 376 | from = ntohll(request.from); 377 | while(len > 32768) { 378 | read_sock(sock,block,32768); 379 | s3nbd_write(s3,aws_bucket,block,32768,from); 380 | len -= 32768; 381 | from += 32768; 382 | } 383 | read_sock(sock,block,len); 384 | s3nbd_write(s3,aws_bucket,block,len,from); 385 | 386 | reply.magic = htonl(NBD_REPLY_MAGIC); 387 | reply.error = htonl(0); 388 | memcpy(reply.handle,request.handle,8); 389 | write_sock(sock,&reply,sizeof(struct nbd_reply)); 390 | } 391 | break; 392 | case NBD_CMD_DISC: 393 | goto disc; 394 | default: 395 | fprintf(stderr,"Protocol error.\n"); 396 | return -1; 397 | } 398 | } 399 | 400 | disc: 401 | #if __DEBUG__ 402 | printf("Client disconnected.\n"); 403 | #endif 404 | free_S3(s3); 405 | 406 | return 0; 407 | } 408 | 409 | 410 | int main(int argc, char *argv[]) 411 | { 412 | int sockfd, res, yes = 1, c, len; 413 | int port = 5353; 414 | struct sockaddr_in server_addr; 415 | struct option long_options[] = 416 | { 417 | { "port", 1, 0, 'P' }, 418 | { "id", 1, 0, 'i' }, 419 | { "secret", 1, 0, 's' }, 420 | { "bucket", 1, 0, 'b' }, 421 | { "size", 1, 0, 'v' }, 422 | { "encrypt", 0, 0, 'e' }, 423 | { 0, 0, 0, 0 } 424 | }; 425 | int option_index = 0; 426 | S3 *s3; 427 | const char *env; 428 | 429 | aws_access_id[0] = 0; 430 | aws_secret_key[0] = 0; 431 | aws_bucket[0] = 0; 432 | 433 | // check environment variables 434 | env = getenv("AWS_ACCESS_ID"); 435 | if(env) { 436 | strncpy(aws_access_id,env,256); 437 | aws_access_id[255] = 0; 438 | } 439 | 440 | env = getenv("AWS_SECRET_KEY"); 441 | if(env) { 442 | strncpy(aws_secret_key,env,256); 443 | aws_secret_key[255] = 0; 444 | } 445 | 446 | env = getenv("AWS_BUCKET"); 447 | if(env) { 448 | strncpy(aws_bucket,env,256); 449 | aws_bucket[255] = 0; 450 | } 451 | 452 | while((c = getopt_long(argc,argv,"p:i:s:b:v:e",long_options,&option_index)) != -1) { 453 | switch(c) { 454 | case 'p': 455 | port = strtol(optarg,NULL,0); 456 | break; 457 | case 'i': 458 | strncpy(aws_access_id,optarg,256); 459 | aws_access_id[255] = 0; 460 | break; 461 | case 's': 462 | strncpy(aws_secret_key,optarg,256); 463 | aws_secret_key[255] = 0; 464 | break; 465 | case 'v': 466 | bd_volume_size = strtoll(optarg,NULL,10); 467 | bd_volume_size *= (1024 * 1024); 468 | break; 469 | case 'b': 470 | strncpy(aws_bucket,optarg,256); 471 | aws_bucket[255] = 0; 472 | break; 473 | case 'e': 474 | encrypt = 1; 475 | break; 476 | default: 477 | fprintf(stderr,"Usage: s3nbd [options..]\n"); 478 | fprintf(stderr,"Options:\n"); 479 | fprintf(stderr," -p PORT, --port=PORT Listen on port (default: 5353).\n"); 480 | fprintf(stderr," -i ID, --id=ID Specify AWS ID.\n"); 481 | fprintf(stderr," -s SECRET, --secret=SECRET AWS secret key.\n"); 482 | fprintf(stderr," -b BUCKET, --bucket=BUCKET AWS bucket to use.\n"); 483 | fprintf(stderr," -v SIZE, --size=SIZE Set volume size (MB).\n"); 484 | fprintf(stderr," -e, --encrypt Enable encryption (experimental).\n"); 485 | fprintf(stderr,"\n"); 486 | exit(1); 487 | } 488 | } 489 | 490 | // prompt for access id 491 | if(aws_access_id[0] == 0) { 492 | printf("AWS ID: "); 493 | fflush(stdout); 494 | fgets(aws_access_id,256,stdin); 495 | aws_access_id[255] = 0; 496 | len = strlen(aws_access_id); 497 | while(len && aws_access_id[--len] == '\n') 498 | aws_access_id[len] = 0; 499 | } 500 | 501 | if(aws_secret_key[0] == 0) { 502 | printf("AWS Secret Key: "); 503 | fflush(stdout); 504 | fgets(aws_secret_key,256,stdin); 505 | aws_secret_key[255] = 0; 506 | len = strlen(aws_secret_key); 507 | while(len && aws_secret_key[--len] == '\n') 508 | aws_secret_key[len] = 0; 509 | } 510 | 511 | if(aws_bucket[0] == 0) { 512 | printf("AWS Bucket: "); 513 | fflush(stdout); 514 | fgets(aws_bucket,256,stdin); 515 | aws_bucket[255] = 0; 516 | len = strlen(aws_bucket); 517 | while(len && aws_bucket[--len] == '\n') 518 | aws_bucket[len] = 0; 519 | } 520 | 521 | if(encrypt) { 522 | char enc_key[57]; 523 | printf("Warning, encryption is experimental.\n"); 524 | printf("And NEVER forget your password.\n"); 525 | printf("Encryption password: "); 526 | fflush(stdout); 527 | fgets(enc_key,56,stdin); 528 | enc_key[56] = 0; 529 | BF_set_key(&bf_key,strlen(enc_key),(unsigned char *)enc_key); 530 | memset(enc_key,0,56); 531 | } 532 | 533 | // test credentials 534 | s3 = new_S3(aws_access_id,aws_secret_key); 535 | res = s3_head_object(s3,aws_bucket,"test",NULL); 536 | if(res != 0 && res != -ENOENT) { 537 | fprintf(stderr,"It seems that we cannot connect to amazon S3. Please check access id, secret key and bucket.\n"); 538 | free_S3(s3); 539 | return -1; 540 | } 541 | free_S3(s3); 542 | 543 | // make socket 544 | sockfd = socket(AF_INET,SOCK_STREAM,0); 545 | if(sockfd < 0) { 546 | fprintf(stderr,"Failed to create socket.\n"); 547 | return -1; 548 | } 549 | 550 | memset(&server_addr,0,sizeof(struct sockaddr_in)); 551 | server_addr.sin_family = AF_INET; 552 | server_addr.sin_addr.s_addr = htonl(INADDR_ANY); 553 | server_addr.sin_port = htons(5353); 554 | 555 | setsockopt(sockfd,SOL_SOCKET,SO_REUSEADDR,&yes,sizeof(int)); 556 | 557 | res = bind(sockfd,(struct sockaddr *)&server_addr, sizeof(struct sockaddr)); 558 | if(res < 0) { 559 | fprintf(stderr,"Failed to bind socket.\n"); 560 | return -1; 561 | } 562 | 563 | res = listen(sockfd,0); 564 | if(res < 0) { 565 | fprintf(stderr,"Failed to listen on socket.\n"); 566 | return -1; 567 | } 568 | 569 | for(;;) { 570 | int sock; 571 | struct sockaddr_in client_addr; 572 | socklen_t sin_size; 573 | 574 | sock = accept(sockfd,(struct sockaddr *)&client_addr,&sin_size); 575 | if(sock < 0) { 576 | fprintf(stderr,"Failed to accept connection.\n"); 577 | continue; 578 | } 579 | 580 | s3nbd_server(sock); 581 | } 582 | 583 | return 0; 584 | } 585 | --------------------------------------------------------------------------------