Codebase list libnss-nisplus / 8ecae38
Initial import Thorsten Kukuk 8 years ago
37 changed file(s) with 28158 addition(s) and 0 deletion(s). Raw diff Collapse all Expand all
0 # http://www.gnu.org/software/automake
1
2 Makefile.in
3
4 # http://www.gnu.org/software/autoconf
5
6 /autom4te.cache
7 /aclocal.m4
8 /compile
9 /configure
10 /depcomp
11 /install-sh
12 /missing
13 /stamp-h1
14
15 # files generated by configure
16 .deps
17 .libs
18 Makefile
19 config.h
20 libnsl.pc
21 *.o
22 *.lo
23 *.la
24 *.a
25 *~
26 *.rej
27 *.orig
28 core
29 config.log
30 config.status
31 libnss_nis-*.tar.bz2
32 libnss_nis-*.tar.gz
33 libtool
34 src/nss_loader-test
35
(New empty file)
0 GNU LESSER GENERAL PUBLIC LICENSE
1 Version 2.1, February 1999
2
3 Copyright (C) 1991, 1999 Free Software Foundation, Inc.
4 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
5 Everyone is permitted to copy and distribute verbatim copies
6 of this license document, but changing it is not allowed.
7
8 [This is the first released version of the Lesser GPL. It also counts
9 as the successor of the GNU Library Public License, version 2, hence
10 the version number 2.1.]
11
12 Preamble
13
14 The licenses for most software are designed to take away your
15 freedom to share and change it. By contrast, the GNU General Public
16 Licenses are intended to guarantee your freedom to share and change
17 free software--to make sure the software is free for all its users.
18
19 This license, the Lesser General Public License, applies to some
20 specially designated software packages--typically libraries--of the
21 Free Software Foundation and other authors who decide to use it. You
22 can use it too, but we suggest you first think carefully about whether
23 this license or the ordinary General Public License is the better
24 strategy to use in any particular case, based on the explanations below.
25
26 When we speak of free software, we are referring to freedom of use,
27 not price. Our General Public Licenses are designed to make sure that
28 you have the freedom to distribute copies of free software (and charge
29 for this service if you wish); that you receive source code or can get
30 it if you want it; that you can change the software and use pieces of
31 it in new free programs; and that you are informed that you can do
32 these things.
33
34 To protect your rights, we need to make restrictions that forbid
35 distributors to deny you these rights or to ask you to surrender these
36 rights. These restrictions translate to certain responsibilities for
37 you if you distribute copies of the library or if you modify it.
38
39 For example, if you distribute copies of the library, whether gratis
40 or for a fee, you must give the recipients all the rights that we gave
41 you. You must make sure that they, too, receive or can get the source
42 code. If you link other code with the library, you must provide
43 complete object files to the recipients, so that they can relink them
44 with the library after making changes to the library and recompiling
45 it. And you must show them these terms so they know their rights.
46
47 We protect your rights with a two-step method: (1) we copyright the
48 library, and (2) we offer you this license, which gives you legal
49 permission to copy, distribute and/or modify the library.
50
51 To protect each distributor, we want to make it very clear that
52 there is no warranty for the free library. Also, if the library is
53 modified by someone else and passed on, the recipients should know
54 that what they have is not the original version, so that the original
55 author's reputation will not be affected by problems that might be
56 introduced by others.
57
58 Finally, software patents pose a constant threat to the existence of
59 any free program. We wish to make sure that a company cannot
60 effectively restrict the users of a free program by obtaining a
61 restrictive license from a patent holder. Therefore, we insist that
62 any patent license obtained for a version of the library must be
63 consistent with the full freedom of use specified in this license.
64
65 Most GNU software, including some libraries, is covered by the
66 ordinary GNU General Public License. This license, the GNU Lesser
67 General Public License, applies to certain designated libraries, and
68 is quite different from the ordinary General Public License. We use
69 this license for certain libraries in order to permit linking those
70 libraries into non-free programs.
71
72 When a program is linked with a library, whether statically or using
73 a shared library, the combination of the two is legally speaking a
74 combined work, a derivative of the original library. The ordinary
75 General Public License therefore permits such linking only if the
76 entire combination fits its criteria of freedom. The Lesser General
77 Public License permits more lax criteria for linking other code with
78 the library.
79
80 We call this license the "Lesser" General Public License because it
81 does Less to protect the user's freedom than the ordinary General
82 Public License. It also provides other free software developers Less
83 of an advantage over competing non-free programs. These disadvantages
84 are the reason we use the ordinary General Public License for many
85 libraries. However, the Lesser license provides advantages in certain
86 special circumstances.
87
88 For example, on rare occasions, there may be a special need to
89 encourage the widest possible use of a certain library, so that it becomes
90 a de-facto standard. To achieve this, non-free programs must be
91 allowed to use the library. A more frequent case is that a free
92 library does the same job as widely used non-free libraries. In this
93 case, there is little to gain by limiting the free library to free
94 software only, so we use the Lesser General Public License.
95
96 In other cases, permission to use a particular library in non-free
97 programs enables a greater number of people to use a large body of
98 free software. For example, permission to use the GNU C Library in
99 non-free programs enables many more people to use the whole GNU
100 operating system, as well as its variant, the GNU/Linux operating
101 system.
102
103 Although the Lesser General Public License is Less protective of the
104 users' freedom, it does ensure that the user of a program that is
105 linked with the Library has the freedom and the wherewithal to run
106 that program using a modified version of the Library.
107
108 The precise terms and conditions for copying, distribution and
109 modification follow. Pay close attention to the difference between a
110 "work based on the library" and a "work that uses the library". The
111 former contains code derived from the library, whereas the latter must
112 be combined with the library in order to run.
113
114 GNU LESSER GENERAL PUBLIC LICENSE
115 TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
116
117 0. This License Agreement applies to any software library or other
118 program which contains a notice placed by the copyright holder or
119 other authorized party saying it may be distributed under the terms of
120 this Lesser General Public License (also called "this License").
121 Each licensee is addressed as "you".
122
123 A "library" means a collection of software functions and/or data
124 prepared so as to be conveniently linked with application programs
125 (which use some of those functions and data) to form executables.
126
127 The "Library", below, refers to any such software library or work
128 which has been distributed under these terms. A "work based on the
129 Library" means either the Library or any derivative work under
130 copyright law: that is to say, a work containing the Library or a
131 portion of it, either verbatim or with modifications and/or translated
132 straightforwardly into another language. (Hereinafter, translation is
133 included without limitation in the term "modification".)
134
135 "Source code" for a work means the preferred form of the work for
136 making modifications to it. For a library, complete source code means
137 all the source code for all modules it contains, plus any associated
138 interface definition files, plus the scripts used to control compilation
139 and installation of the library.
140
141 Activities other than copying, distribution and modification are not
142 covered by this License; they are outside its scope. The act of
143 running a program using the Library is not restricted, and output from
144 such a program is covered only if its contents constitute a work based
145 on the Library (independent of the use of the Library in a tool for
146 writing it). Whether that is true depends on what the Library does
147 and what the program that uses the Library does.
148
149 1. You may copy and distribute verbatim copies of the Library's
150 complete source code as you receive it, in any medium, provided that
151 you conspicuously and appropriately publish on each copy an
152 appropriate copyright notice and disclaimer of warranty; keep intact
153 all the notices that refer to this License and to the absence of any
154 warranty; and distribute a copy of this License along with the
155 Library.
156
157 You may charge a fee for the physical act of transferring a copy,
158 and you may at your option offer warranty protection in exchange for a
159 fee.
160
161 2. You may modify your copy or copies of the Library or any portion
162 of it, thus forming a work based on the Library, and copy and
163 distribute such modifications or work under the terms of Section 1
164 above, provided that you also meet all of these conditions:
165
166 a) The modified work must itself be a software library.
167
168 b) You must cause the files modified to carry prominent notices
169 stating that you changed the files and the date of any change.
170
171 c) You must cause the whole of the work to be licensed at no
172 charge to all third parties under the terms of this License.
173
174 d) If a facility in the modified Library refers to a function or a
175 table of data to be supplied by an application program that uses
176 the facility, other than as an argument passed when the facility
177 is invoked, then you must make a good faith effort to ensure that,
178 in the event an application does not supply such function or
179 table, the facility still operates, and performs whatever part of
180 its purpose remains meaningful.
181
182 (For example, a function in a library to compute square roots has
183 a purpose that is entirely well-defined independent of the
184 application. Therefore, Subsection 2d requires that any
185 application-supplied function or table used by this function must
186 be optional: if the application does not supply it, the square
187 root function must still compute square roots.)
188
189 These requirements apply to the modified work as a whole. If
190 identifiable sections of that work are not derived from the Library,
191 and can be reasonably considered independent and separate works in
192 themselves, then this License, and its terms, do not apply to those
193 sections when you distribute them as separate works. But when you
194 distribute the same sections as part of a whole which is a work based
195 on the Library, the distribution of the whole must be on the terms of
196 this License, whose permissions for other licensees extend to the
197 entire whole, and thus to each and every part regardless of who wrote
198 it.
199
200 Thus, it is not the intent of this section to claim rights or contest
201 your rights to work written entirely by you; rather, the intent is to
202 exercise the right to control the distribution of derivative or
203 collective works based on the Library.
204
205 In addition, mere aggregation of another work not based on the Library
206 with the Library (or with a work based on the Library) on a volume of
207 a storage or distribution medium does not bring the other work under
208 the scope of this License.
209
210 3. You may opt to apply the terms of the ordinary GNU General Public
211 License instead of this License to a given copy of the Library. To do
212 this, you must alter all the notices that refer to this License, so
213 that they refer to the ordinary GNU General Public License, version 2,
214 instead of to this License. (If a newer version than version 2 of the
215 ordinary GNU General Public License has appeared, then you can specify
216 that version instead if you wish.) Do not make any other change in
217 these notices.
218
219 Once this change is made in a given copy, it is irreversible for
220 that copy, so the ordinary GNU General Public License applies to all
221 subsequent copies and derivative works made from that copy.
222
223 This option is useful when you wish to copy part of the code of
224 the Library into a program that is not a library.
225
226 4. You may copy and distribute the Library (or a portion or
227 derivative of it, under Section 2) in object code or executable form
228 under the terms of Sections 1 and 2 above provided that you accompany
229 it with the complete corresponding machine-readable source code, which
230 must be distributed under the terms of Sections 1 and 2 above on a
231 medium customarily used for software interchange.
232
233 If distribution of object code is made by offering access to copy
234 from a designated place, then offering equivalent access to copy the
235 source code from the same place satisfies the requirement to
236 distribute the source code, even though third parties are not
237 compelled to copy the source along with the object code.
238
239 5. A program that contains no derivative of any portion of the
240 Library, but is designed to work with the Library by being compiled or
241 linked with it, is called a "work that uses the Library". Such a
242 work, in isolation, is not a derivative work of the Library, and
243 therefore falls outside the scope of this License.
244
245 However, linking a "work that uses the Library" with the Library
246 creates an executable that is a derivative of the Library (because it
247 contains portions of the Library), rather than a "work that uses the
248 library". The executable is therefore covered by this License.
249 Section 6 states terms for distribution of such executables.
250
251 When a "work that uses the Library" uses material from a header file
252 that is part of the Library, the object code for the work may be a
253 derivative work of the Library even though the source code is not.
254 Whether this is true is especially significant if the work can be
255 linked without the Library, or if the work is itself a library. The
256 threshold for this to be true is not precisely defined by law.
257
258 If such an object file uses only numerical parameters, data
259 structure layouts and accessors, and small macros and small inline
260 functions (ten lines or less in length), then the use of the object
261 file is unrestricted, regardless of whether it is legally a derivative
262 work. (Executables containing this object code plus portions of the
263 Library will still fall under Section 6.)
264
265 Otherwise, if the work is a derivative of the Library, you may
266 distribute the object code for the work under the terms of Section 6.
267 Any executables containing that work also fall under Section 6,
268 whether or not they are linked directly with the Library itself.
269
270 6. As an exception to the Sections above, you may also combine or
271 link a "work that uses the Library" with the Library to produce a
272 work containing portions of the Library, and distribute that work
273 under terms of your choice, provided that the terms permit
274 modification of the work for the customer's own use and reverse
275 engineering for debugging such modifications.
276
277 You must give prominent notice with each copy of the work that the
278 Library is used in it and that the Library and its use are covered by
279 this License. You must supply a copy of this License. If the work
280 during execution displays copyright notices, you must include the
281 copyright notice for the Library among them, as well as a reference
282 directing the user to the copy of this License. Also, you must do one
283 of these things:
284
285 a) Accompany the work with the complete corresponding
286 machine-readable source code for the Library including whatever
287 changes were used in the work (which must be distributed under
288 Sections 1 and 2 above); and, if the work is an executable linked
289 with the Library, with the complete machine-readable "work that
290 uses the Library", as object code and/or source code, so that the
291 user can modify the Library and then relink to produce a modified
292 executable containing the modified Library. (It is understood
293 that the user who changes the contents of definitions files in the
294 Library will not necessarily be able to recompile the application
295 to use the modified definitions.)
296
297 b) Use a suitable shared library mechanism for linking with the
298 Library. A suitable mechanism is one that (1) uses at run time a
299 copy of the library already present on the user's computer system,
300 rather than copying library functions into the executable, and (2)
301 will operate properly with a modified version of the library, if
302 the user installs one, as long as the modified version is
303 interface-compatible with the version that the work was made with.
304
305 c) Accompany the work with a written offer, valid for at
306 least three years, to give the same user the materials
307 specified in Subsection 6a, above, for a charge no more
308 than the cost of performing this distribution.
309
310 d) If distribution of the work is made by offering access to copy
311 from a designated place, offer equivalent access to copy the above
312 specified materials from the same place.
313
314 e) Verify that the user has already received a copy of these
315 materials or that you have already sent this user a copy.
316
317 For an executable, the required form of the "work that uses the
318 Library" must include any data and utility programs needed for
319 reproducing the executable from it. However, as a special exception,
320 the materials to be distributed need not include anything that is
321 normally distributed (in either source or binary form) with the major
322 components (compiler, kernel, and so on) of the operating system on
323 which the executable runs, unless that component itself accompanies
324 the executable.
325
326 It may happen that this requirement contradicts the license
327 restrictions of other proprietary libraries that do not normally
328 accompany the operating system. Such a contradiction means you cannot
329 use both them and the Library together in an executable that you
330 distribute.
331
332 7. You may place library facilities that are a work based on the
333 Library side-by-side in a single library together with other library
334 facilities not covered by this License, and distribute such a combined
335 library, provided that the separate distribution of the work based on
336 the Library and of the other library facilities is otherwise
337 permitted, and provided that you do these two things:
338
339 a) Accompany the combined library with a copy of the same work
340 based on the Library, uncombined with any other library
341 facilities. This must be distributed under the terms of the
342 Sections above.
343
344 b) Give prominent notice with the combined library of the fact
345 that part of it is a work based on the Library, and explaining
346 where to find the accompanying uncombined form of the same work.
347
348 8. You may not copy, modify, sublicense, link with, or distribute
349 the Library except as expressly provided under this License. Any
350 attempt otherwise to copy, modify, sublicense, link with, or
351 distribute the Library is void, and will automatically terminate your
352 rights under this License. However, parties who have received copies,
353 or rights, from you under this License will not have their licenses
354 terminated so long as such parties remain in full compliance.
355
356 9. You are not required to accept this License, since you have not
357 signed it. However, nothing else grants you permission to modify or
358 distribute the Library or its derivative works. These actions are
359 prohibited by law if you do not accept this License. Therefore, by
360 modifying or distributing the Library (or any work based on the
361 Library), you indicate your acceptance of this License to do so, and
362 all its terms and conditions for copying, distributing or modifying
363 the Library or works based on it.
364
365 10. Each time you redistribute the Library (or any work based on the
366 Library), the recipient automatically receives a license from the
367 original licensor to copy, distribute, link with or modify the Library
368 subject to these terms and conditions. You may not impose any further
369 restrictions on the recipients' exercise of the rights granted herein.
370 You are not responsible for enforcing compliance by third parties with
371 this License.
372
373 11. If, as a consequence of a court judgment or allegation of patent
374 infringement or for any other reason (not limited to patent issues),
375 conditions are imposed on you (whether by court order, agreement or
376 otherwise) that contradict the conditions of this License, they do not
377 excuse you from the conditions of this License. If you cannot
378 distribute so as to satisfy simultaneously your obligations under this
379 License and any other pertinent obligations, then as a consequence you
380 may not distribute the Library at all. For example, if a patent
381 license would not permit royalty-free redistribution of the Library by
382 all those who receive copies directly or indirectly through you, then
383 the only way you could satisfy both it and this License would be to
384 refrain entirely from distribution of the Library.
385
386 If any portion of this section is held invalid or unenforceable under any
387 particular circumstance, the balance of the section is intended to apply,
388 and the section as a whole is intended to apply in other circumstances.
389
390 It is not the purpose of this section to induce you to infringe any
391 patents or other property right claims or to contest validity of any
392 such claims; this section has the sole purpose of protecting the
393 integrity of the free software distribution system which is
394 implemented by public license practices. Many people have made
395 generous contributions to the wide range of software distributed
396 through that system in reliance on consistent application of that
397 system; it is up to the author/donor to decide if he or she is willing
398 to distribute software through any other system and a licensee cannot
399 impose that choice.
400
401 This section is intended to make thoroughly clear what is believed to
402 be a consequence of the rest of this License.
403
404 12. If the distribution and/or use of the Library is restricted in
405 certain countries either by patents or by copyrighted interfaces, the
406 original copyright holder who places the Library under this License may add
407 an explicit geographical distribution limitation excluding those countries,
408 so that distribution is permitted only in or among countries not thus
409 excluded. In such case, this License incorporates the limitation as if
410 written in the body of this License.
411
412 13. The Free Software Foundation may publish revised and/or new
413 versions of the Lesser General Public License from time to time.
414 Such new versions will be similar in spirit to the present version,
415 but may differ in detail to address new problems or concerns.
416
417 Each version is given a distinguishing version number. If the Library
418 specifies a version number of this License which applies to it and
419 "any later version", you have the option of following the terms and
420 conditions either of that version or of any later version published by
421 the Free Software Foundation. If the Library does not specify a
422 license version number, you may choose any version ever published by
423 the Free Software Foundation.
424
425 14. If you wish to incorporate parts of the Library into other free
426 programs whose distribution conditions are incompatible with these,
427 write to the author to ask for permission. For software which is
428 copyrighted by the Free Software Foundation, write to the Free
429 Software Foundation; we sometimes make exceptions for this. Our
430 decision will be guided by the two goals of preserving the free status
431 of all derivatives of our free software and of promoting the sharing
432 and reuse of software generally.
433
434 NO WARRANTY
435
436 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO
437 WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW.
438 EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR
439 OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY
440 KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE
441 IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
442 PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE
443 LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME
444 THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
445
446 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN
447 WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY
448 AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU
449 FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR
450 CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE
451 LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING
452 RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
453 FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
454 SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
455 DAMAGES.
456
457 END OF TERMS AND CONDITIONS
458
459 How to Apply These Terms to Your New Libraries
460
461 If you develop a new library, and you want it to be of the greatest
462 possible use to the public, we recommend making it free software that
463 everyone can redistribute and change. You can do so by permitting
464 redistribution under these terms (or, alternatively, under the terms of the
465 ordinary General Public License).
466
467 To apply these terms, attach the following notices to the library. It is
468 safest to attach them to the start of each source file to most effectively
469 convey the exclusion of warranty; and each file should have at least the
470 "copyright" line and a pointer to where the full notice is found.
471
472 <one line to give the library's name and a brief idea of what it does.>
473 Copyright (C) <year> <name of author>
474
475 This library is free software; you can redistribute it and/or
476 modify it under the terms of the GNU Lesser General Public
477 License as published by the Free Software Foundation; either
478 version 2.1 of the License, or (at your option) any later version.
479
480 This library is distributed in the hope that it will be useful,
481 but WITHOUT ANY WARRANTY; without even the implied warranty of
482 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
483 Lesser General Public License for more details.
484
485 You should have received a copy of the GNU Lesser General Public
486 License along with this library; if not, write to the Free Software
487 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
488
489 Also add information on how to contact you by electronic and paper mail.
490
491 You should also get your employer (if you work as a programmer) or your
492 school, if any, to sign a "copyright disclaimer" for the library, if
493 necessary. Here is a sample; alter the names:
494
495 Yoyodyne, Inc., hereby disclaims all copyright interest in the
496 library `Frob' (a library for tweaking knobs) written by James Random Hacker.
497
498 <signature of Ty Coon>, 1 April 1990
499 Ty Coon, President of Vice
500
501 That's all there is to it!
0 2015-07-06 Thorsten Kukuk <kukuk@thkukuk.de>
1
2 * Initial import from glibc
0 Installation Instructions
1 *************************
2
3 Copyright (C) 1994-1996, 1999-2002, 2004-2013 Free Software Foundation,
4 Inc.
5
6 Copying and distribution of this file, with or without modification,
7 are permitted in any medium without royalty provided the copyright
8 notice and this notice are preserved. This file is offered as-is,
9 without warranty of any kind.
10
11 Basic Installation
12 ==================
13
14 Briefly, the shell commands `./configure; make; make install' should
15 configure, build, and install this package. The following
16 more-detailed instructions are generic; see the `README' file for
17 instructions specific to this package. Some packages provide this
18 `INSTALL' file but do not implement all of the features documented
19 below. The lack of an optional feature in a given package is not
20 necessarily a bug. More recommendations for GNU packages can be found
21 in *note Makefile Conventions: (standards)Makefile Conventions.
22
23 The `configure' shell script attempts to guess correct values for
24 various system-dependent variables used during compilation. It uses
25 those values to create a `Makefile' in each directory of the package.
26 It may also create one or more `.h' files containing system-dependent
27 definitions. Finally, it creates a shell script `config.status' that
28 you can run in the future to recreate the current configuration, and a
29 file `config.log' containing compiler output (useful mainly for
30 debugging `configure').
31
32 It can also use an optional file (typically called `config.cache'
33 and enabled with `--cache-file=config.cache' or simply `-C') that saves
34 the results of its tests to speed up reconfiguring. Caching is
35 disabled by default to prevent problems with accidental use of stale
36 cache files.
37
38 If you need to do unusual things to compile the package, please try
39 to figure out how `configure' could check whether to do them, and mail
40 diffs or instructions to the address given in the `README' so they can
41 be considered for the next release. If you are using the cache, and at
42 some point `config.cache' contains results you don't want to keep, you
43 may remove or edit it.
44
45 The file `configure.ac' (or `configure.in') is used to create
46 `configure' by a program called `autoconf'. You need `configure.ac' if
47 you want to change it or regenerate `configure' using a newer version
48 of `autoconf'.
49
50 The simplest way to compile this package is:
51
52 1. `cd' to the directory containing the package's source code and type
53 `./configure' to configure the package for your system.
54
55 Running `configure' might take a while. While running, it prints
56 some messages telling which features it is checking for.
57
58 2. Type `make' to compile the package.
59
60 3. Optionally, type `make check' to run any self-tests that come with
61 the package, generally using the just-built uninstalled binaries.
62
63 4. Type `make install' to install the programs and any data files and
64 documentation. When installing into a prefix owned by root, it is
65 recommended that the package be configured and built as a regular
66 user, and only the `make install' phase executed with root
67 privileges.
68
69 5. Optionally, type `make installcheck' to repeat any self-tests, but
70 this time using the binaries in their final installed location.
71 This target does not install anything. Running this target as a
72 regular user, particularly if the prior `make install' required
73 root privileges, verifies that the installation completed
74 correctly.
75
76 6. You can remove the program binaries and object files from the
77 source code directory by typing `make clean'. To also remove the
78 files that `configure' created (so you can compile the package for
79 a different kind of computer), type `make distclean'. There is
80 also a `make maintainer-clean' target, but that is intended mainly
81 for the package's developers. If you use it, you may have to get
82 all sorts of other programs in order to regenerate files that came
83 with the distribution.
84
85 7. Often, you can also type `make uninstall' to remove the installed
86 files again. In practice, not all packages have tested that
87 uninstallation works correctly, even though it is required by the
88 GNU Coding Standards.
89
90 8. Some packages, particularly those that use Automake, provide `make
91 distcheck', which can by used by developers to test that all other
92 targets like `make install' and `make uninstall' work correctly.
93 This target is generally not run by end users.
94
95 Compilers and Options
96 =====================
97
98 Some systems require unusual options for compilation or linking that
99 the `configure' script does not know about. Run `./configure --help'
100 for details on some of the pertinent environment variables.
101
102 You can give `configure' initial values for configuration parameters
103 by setting variables in the command line or in the environment. Here
104 is an example:
105
106 ./configure CC=c99 CFLAGS=-g LIBS=-lposix
107
108 *Note Defining Variables::, for more details.
109
110 Compiling For Multiple Architectures
111 ====================================
112
113 You can compile the package for more than one kind of computer at the
114 same time, by placing the object files for each architecture in their
115 own directory. To do this, you can use GNU `make'. `cd' to the
116 directory where you want the object files and executables to go and run
117 the `configure' script. `configure' automatically checks for the
118 source code in the directory that `configure' is in and in `..'. This
119 is known as a "VPATH" build.
120
121 With a non-GNU `make', it is safer to compile the package for one
122 architecture at a time in the source code directory. After you have
123 installed the package for one architecture, use `make distclean' before
124 reconfiguring for another architecture.
125
126 On MacOS X 10.5 and later systems, you can create libraries and
127 executables that work on multiple system types--known as "fat" or
128 "universal" binaries--by specifying multiple `-arch' options to the
129 compiler but only a single `-arch' option to the preprocessor. Like
130 this:
131
132 ./configure CC="gcc -arch i386 -arch x86_64 -arch ppc -arch ppc64" \
133 CXX="g++ -arch i386 -arch x86_64 -arch ppc -arch ppc64" \
134 CPP="gcc -E" CXXCPP="g++ -E"
135
136 This is not guaranteed to produce working output in all cases, you
137 may have to build one architecture at a time and combine the results
138 using the `lipo' tool if you have problems.
139
140 Installation Names
141 ==================
142
143 By default, `make install' installs the package's commands under
144 `/usr/local/bin', include files under `/usr/local/include', etc. You
145 can specify an installation prefix other than `/usr/local' by giving
146 `configure' the option `--prefix=PREFIX', where PREFIX must be an
147 absolute file name.
148
149 You can specify separate installation prefixes for
150 architecture-specific files and architecture-independent files. If you
151 pass the option `--exec-prefix=PREFIX' to `configure', the package uses
152 PREFIX as the prefix for installing programs and libraries.
153 Documentation and other data files still use the regular prefix.
154
155 In addition, if you use an unusual directory layout you can give
156 options like `--bindir=DIR' to specify different values for particular
157 kinds of files. Run `configure --help' for a list of the directories
158 you can set and what kinds of files go in them. In general, the
159 default for these options is expressed in terms of `${prefix}', so that
160 specifying just `--prefix' will affect all of the other directory
161 specifications that were not explicitly provided.
162
163 The most portable way to affect installation locations is to pass the
164 correct locations to `configure'; however, many packages provide one or
165 both of the following shortcuts of passing variable assignments to the
166 `make install' command line to change installation locations without
167 having to reconfigure or recompile.
168
169 The first method involves providing an override variable for each
170 affected directory. For example, `make install
171 prefix=/alternate/directory' will choose an alternate location for all
172 directory configuration variables that were expressed in terms of
173 `${prefix}'. Any directories that were specified during `configure',
174 but not in terms of `${prefix}', must each be overridden at install
175 time for the entire installation to be relocated. The approach of
176 makefile variable overrides for each directory variable is required by
177 the GNU Coding Standards, and ideally causes no recompilation.
178 However, some platforms have known limitations with the semantics of
179 shared libraries that end up requiring recompilation when using this
180 method, particularly noticeable in packages that use GNU Libtool.
181
182 The second method involves providing the `DESTDIR' variable. For
183 example, `make install DESTDIR=/alternate/directory' will prepend
184 `/alternate/directory' before all installation names. The approach of
185 `DESTDIR' overrides is not required by the GNU Coding Standards, and
186 does not work on platforms that have drive letters. On the other hand,
187 it does better at avoiding recompilation issues, and works well even
188 when some directory options were not specified in terms of `${prefix}'
189 at `configure' time.
190
191 Optional Features
192 =================
193
194 If the package supports it, you can cause programs to be installed
195 with an extra prefix or suffix on their names by giving `configure' the
196 option `--program-prefix=PREFIX' or `--program-suffix=SUFFIX'.
197
198 Some packages pay attention to `--enable-FEATURE' options to
199 `configure', where FEATURE indicates an optional part of the package.
200 They may also pay attention to `--with-PACKAGE' options, where PACKAGE
201 is something like `gnu-as' or `x' (for the X Window System). The
202 `README' should mention any `--enable-' and `--with-' options that the
203 package recognizes.
204
205 For packages that use the X Window System, `configure' can usually
206 find the X include and library files automatically, but if it doesn't,
207 you can use the `configure' options `--x-includes=DIR' and
208 `--x-libraries=DIR' to specify their locations.
209
210 Some packages offer the ability to configure how verbose the
211 execution of `make' will be. For these packages, running `./configure
212 --enable-silent-rules' sets the default to minimal output, which can be
213 overridden with `make V=1'; while running `./configure
214 --disable-silent-rules' sets the default to verbose, which can be
215 overridden with `make V=0'.
216
217 Particular systems
218 ==================
219
220 On HP-UX, the default C compiler is not ANSI C compatible. If GNU
221 CC is not installed, it is recommended to use the following options in
222 order to use an ANSI C compiler:
223
224 ./configure CC="cc -Ae -D_XOPEN_SOURCE=500"
225
226 and if that doesn't work, install pre-built binaries of GCC for HP-UX.
227
228 HP-UX `make' updates targets which have the same time stamps as
229 their prerequisites, which makes it generally unusable when shipped
230 generated files such as `configure' are involved. Use GNU `make'
231 instead.
232
233 On OSF/1 a.k.a. Tru64, some versions of the default C compiler cannot
234 parse its `<wchar.h>' header file. The option `-nodtk' can be used as
235 a workaround. If GNU CC is not installed, it is therefore recommended
236 to try
237
238 ./configure CC="cc"
239
240 and if that doesn't work, try
241
242 ./configure CC="cc -nodtk"
243
244 On Solaris, don't put `/usr/ucb' early in your `PATH'. This
245 directory contains several dysfunctional programs; working variants of
246 these programs are available in `/usr/bin'. So, if you need `/usr/ucb'
247 in your `PATH', put it _after_ `/usr/bin'.
248
249 On Haiku, software installed for all users goes in `/boot/common',
250 not `/usr/local'. It is recommended to use the following options:
251
252 ./configure --prefix=/boot/common
253
254 Specifying the System Type
255 ==========================
256
257 There may be some features `configure' cannot figure out
258 automatically, but needs to determine by the type of machine the package
259 will run on. Usually, assuming the package is built to be run on the
260 _same_ architectures, `configure' can figure that out, but if it prints
261 a message saying it cannot guess the machine type, give it the
262 `--build=TYPE' option. TYPE can either be a short name for the system
263 type, such as `sun4', or a canonical name which has the form:
264
265 CPU-COMPANY-SYSTEM
266
267 where SYSTEM can have one of these forms:
268
269 OS
270 KERNEL-OS
271
272 See the file `config.sub' for the possible values of each field. If
273 `config.sub' isn't included in this package, then this package doesn't
274 need to know the machine type.
275
276 If you are _building_ compiler tools for cross-compiling, you should
277 use the option `--target=TYPE' to select the type of system they will
278 produce code for.
279
280 If you want to _use_ a cross compiler, that generates code for a
281 platform different from the build platform, you should specify the
282 "host" platform (i.e., that on which the generated programs will
283 eventually be run) with `--host=TYPE'.
284
285 Sharing Defaults
286 ================
287
288 If you want to set default values for `configure' scripts to share,
289 you can create a site shell script called `config.site' that gives
290 default values for variables like `CC', `cache_file', and `prefix'.
291 `configure' looks for `PREFIX/share/config.site' if it exists, then
292 `PREFIX/etc/config.site' if it exists. Or, you can set the
293 `CONFIG_SITE' environment variable to the location of the site script.
294 A warning: not all `configure' scripts look for a site script.
295
296 Defining Variables
297 ==================
298
299 Variables not defined in a site shell script can be set in the
300 environment passed to `configure'. However, some packages may run
301 configure again during the build, and the customized values of these
302 variables may be lost. In order to avoid this problem, you should set
303 them in the `configure' command line, using `VAR=value'. For example:
304
305 ./configure CC=/usr/local2/bin/gcc
306
307 causes the specified `gcc' to be used as the C compiler (unless it is
308 overridden in the site shell script).
309
310 Unfortunately, this technique does not work for `CONFIG_SHELL' due to
311 an Autoconf limitation. Until the limitation is lifted, you can use
312 this workaround:
313
314 CONFIG_SHELL=/bin/bash ./configure CONFIG_SHELL=/bin/bash
315
316 `configure' Invocation
317 ======================
318
319 `configure' recognizes the following options to control how it
320 operates.
321
322 `--help'
323 `-h'
324 Print a summary of all of the options to `configure', and exit.
325
326 `--help=short'
327 `--help=recursive'
328 Print a summary of the options unique to this package's
329 `configure', and exit. The `short' variant lists options used
330 only in the top level, while the `recursive' variant lists options
331 also present in any nested packages.
332
333 `--version'
334 `-V'
335 Print the version of Autoconf used to generate the `configure'
336 script, and exit.
337
338 `--cache-file=FILE'
339 Enable the cache: use and save the results of the tests in FILE,
340 traditionally `config.cache'. FILE defaults to `/dev/null' to
341 disable caching.
342
343 `--config-cache'
344 `-C'
345 Alias for `--cache-file=config.cache'.
346
347 `--quiet'
348 `--silent'
349 `-q'
350 Do not print messages saying which checks are being made. To
351 suppress all normal output, redirect it to `/dev/null' (any error
352 messages will still be shown).
353
354 `--srcdir=DIR'
355 Look for the package's source code in directory DIR. Usually
356 `configure' can determine that directory automatically.
357
358 `--prefix=DIR'
359 Use DIR as the installation prefix. *note Installation Names::
360 for more details, including other options available for fine-tuning
361 the installation locations.
362
363 `--no-create'
364 `-n'
365 Run the configure checks, but stop before creating any output
366 files.
367
368 `configure' also accepts some other, not widely useful, options. Run
369 `configure --help' for more details.
0 #
1 # Copyright (c) 2015 Thorsten Kukuk, Germany
2 #
3 # Author: Thorsten Kukuk <kukuk@thkukuk.de>
4 #
5 AUTOMAKE_OPTIONS = 1.9 gnu dist-bzip2 check-news
6 ACLOCAL_AMFLAGS=-I m4
7 CLEANFILES = *~
8
9 SUBDIRS = src
0 libnss_nisplus NEWS -- history of user-visible changes.
1
2 Version 1.0
3 * Initial release
0
1 See the file COPYING for copying restrictions.
2
3 This package contains the NSS NIS+ plugin for glibc.
4
5 This code was formerly part of glibc, but is now standalone to
6 be able to link against TI-RPC for IPv6 support.
7 The NIS+ stuff is deprecated and shouldn't be used anymore.
0 #!/bin/sh -x
1
2 rm -fv ltmain.sh config.sub config.guess config.h.in
3 aclocal -I m4
4 autoheader
5 libtoolize --automake --copy
6 automake --add-missing --copy --force
7 autoreconf
8 chmod 755 configure
0 #! /bin/sh
1 # Attempt to guess a canonical system name.
2 # Copyright 1992-2013 Free Software Foundation, Inc.
3
4 timestamp='2013-06-10'
5
6 # This file is free software; you can redistribute it and/or modify it
7 # under the terms of the GNU General Public License as published by
8 # the Free Software Foundation; either version 3 of the License, or
9 # (at your option) any later version.
10 #
11 # This program is distributed in the hope that it will be useful, but
12 # WITHOUT ANY WARRANTY; without even the implied warranty of
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 # 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, see <http://www.gnu.org/licenses/>.
18 #
19 # As a special exception to the GNU General Public License, if you
20 # distribute this file as part of a program that contains a
21 # configuration script generated by Autoconf, you may include it under
22 # the same distribution terms that you use for the rest of that
23 # program. This Exception is an additional permission under section 7
24 # of the GNU General Public License, version 3 ("GPLv3").
25 #
26 # Originally written by Per Bothner.
27 #
28 # You can get the latest version of this script from:
29 # http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD
30 #
31 # Please send patches with a ChangeLog entry to config-patches@gnu.org.
32
33
34 me=`echo "$0" | sed -e 's,.*/,,'`
35
36 usage="\
37 Usage: $0 [OPTION]
38
39 Output the configuration name of the system \`$me' is run on.
40
41 Operation modes:
42 -h, --help print this help, then exit
43 -t, --time-stamp print date of last modification, then exit
44 -v, --version print version number, then exit
45
46 Report bugs and patches to <config-patches@gnu.org>."
47
48 version="\
49 GNU config.guess ($timestamp)
50
51 Originally written by Per Bothner.
52 Copyright 1992-2013 Free Software Foundation, Inc.
53
54 This is free software; see the source for copying conditions. There is NO
55 warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
56
57 help="
58 Try \`$me --help' for more information."
59
60 # Parse command line
61 while test $# -gt 0 ; do
62 case $1 in
63 --time-stamp | --time* | -t )
64 echo "$timestamp" ; exit ;;
65 --version | -v )
66 echo "$version" ; exit ;;
67 --help | --h* | -h )
68 echo "$usage"; exit ;;
69 -- ) # Stop option processing
70 shift; break ;;
71 - ) # Use stdin as input.
72 break ;;
73 -* )
74 echo "$me: invalid option $1$help" >&2
75 exit 1 ;;
76 * )
77 break ;;
78 esac
79 done
80
81 if test $# != 0; then
82 echo "$me: too many arguments$help" >&2
83 exit 1
84 fi
85
86 trap 'exit 1' 1 2 15
87
88 # CC_FOR_BUILD -- compiler used by this script. Note that the use of a
89 # compiler to aid in system detection is discouraged as it requires
90 # temporary files to be created and, as you can see below, it is a
91 # headache to deal with in a portable fashion.
92
93 # Historically, `CC_FOR_BUILD' used to be named `HOST_CC'. We still
94 # use `HOST_CC' if defined, but it is deprecated.
95
96 # Portable tmp directory creation inspired by the Autoconf team.
97
98 set_cc_for_build='
99 trap "exitcode=\$?; (rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null) && exit \$exitcode" 0 ;
100 trap "rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null; exit 1" 1 2 13 15 ;
101 : ${TMPDIR=/tmp} ;
102 { tmp=`(umask 077 && mktemp -d "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } ||
103 { test -n "$RANDOM" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir $tmp) ; } ||
104 { tmp=$TMPDIR/cg-$$ && (umask 077 && mkdir $tmp) && echo "Warning: creating insecure temp directory" >&2 ; } ||
105 { echo "$me: cannot create a temporary directory in $TMPDIR" >&2 ; exit 1 ; } ;
106 dummy=$tmp/dummy ;
107 tmpfiles="$dummy.c $dummy.o $dummy.rel $dummy" ;
108 case $CC_FOR_BUILD,$HOST_CC,$CC in
109 ,,) echo "int x;" > $dummy.c ;
110 for c in cc gcc c89 c99 ; do
111 if ($c -c -o $dummy.o $dummy.c) >/dev/null 2>&1 ; then
112 CC_FOR_BUILD="$c"; break ;
113 fi ;
114 done ;
115 if test x"$CC_FOR_BUILD" = x ; then
116 CC_FOR_BUILD=no_compiler_found ;
117 fi
118 ;;
119 ,,*) CC_FOR_BUILD=$CC ;;
120 ,*,*) CC_FOR_BUILD=$HOST_CC ;;
121 esac ; set_cc_for_build= ;'
122
123 # This is needed to find uname on a Pyramid OSx when run in the BSD universe.
124 # (ghazi@noc.rutgers.edu 1994-08-24)
125 if (test -f /.attbin/uname) >/dev/null 2>&1 ; then
126 PATH=$PATH:/.attbin ; export PATH
127 fi
128
129 UNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown
130 UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown
131 UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown
132 UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown
133
134 case "${UNAME_SYSTEM}" in
135 Linux|GNU|GNU/*)
136 # If the system lacks a compiler, then just pick glibc.
137 # We could probably try harder.
138 LIBC=gnu
139
140 eval $set_cc_for_build
141 cat <<-EOF > $dummy.c
142 #include <features.h>
143 #if defined(__UCLIBC__)
144 LIBC=uclibc
145 #elif defined(__dietlibc__)
146 LIBC=dietlibc
147 #else
148 LIBC=gnu
149 #endif
150 EOF
151 eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^LIBC'`
152 ;;
153 esac
154
155 case "${UNAME_MACHINE}" in
156 i?86)
157 test -z "$VENDOR" && VENDOR=pc
158 ;;
159 *)
160 test -z "$VENDOR" && VENDOR=unknown
161 ;;
162 esac
163 test -f /etc/SuSE-release -o -f /.buildenv && VENDOR=suse
164
165 # Note: order is significant - the case branches are not exclusive.
166
167 case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
168 *:NetBSD:*:*)
169 # NetBSD (nbsd) targets should (where applicable) match one or
170 # more of the tuples: *-*-netbsdelf*, *-*-netbsdaout*,
171 # *-*-netbsdecoff* and *-*-netbsd*. For targets that recently
172 # switched to ELF, *-*-netbsd* would select the old
173 # object file format. This provides both forward
174 # compatibility and a consistent mechanism for selecting the
175 # object file format.
176 #
177 # Note: NetBSD doesn't particularly care about the vendor
178 # portion of the name. We always set it to "unknown".
179 sysctl="sysctl -n hw.machine_arch"
180 UNAME_MACHINE_ARCH=`(/sbin/$sysctl 2>/dev/null || \
181 /usr/sbin/$sysctl 2>/dev/null || echo unknown)`
182 case "${UNAME_MACHINE_ARCH}" in
183 armeb) machine=armeb-unknown ;;
184 arm*) machine=arm-unknown ;;
185 sh3el) machine=shl-unknown ;;
186 sh3eb) machine=sh-unknown ;;
187 sh5el) machine=sh5le-unknown ;;
188 *) machine=${UNAME_MACHINE_ARCH}-unknown ;;
189 esac
190 # The Operating System including object format, if it has switched
191 # to ELF recently, or will in the future.
192 case "${UNAME_MACHINE_ARCH}" in
193 arm*|i386|m68k|ns32k|sh3*|sparc|vax)
194 eval $set_cc_for_build
195 if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \
196 | grep -q __ELF__
197 then
198 # Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout).
199 # Return netbsd for either. FIX?
200 os=netbsd
201 else
202 os=netbsdelf
203 fi
204 ;;
205 *)
206 os=netbsd
207 ;;
208 esac
209 # The OS release
210 # Debian GNU/NetBSD machines have a different userland, and
211 # thus, need a distinct triplet. However, they do not need
212 # kernel version information, so it can be replaced with a
213 # suitable tag, in the style of linux-gnu.
214 case "${UNAME_VERSION}" in
215 Debian*)
216 release='-gnu'
217 ;;
218 *)
219 release=`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'`
220 ;;
221 esac
222 # Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM:
223 # contains redundant information, the shorter form:
224 # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used.
225 echo "${machine}-${os}${release}"
226 exit ;;
227 *:Bitrig:*:*)
228 UNAME_MACHINE_ARCH=`arch | sed 's/Bitrig.//'`
229 echo ${UNAME_MACHINE_ARCH}-${VENDOR}-bitrig${UNAME_RELEASE}
230 exit ;;
231 *:OpenBSD:*:*)
232 UNAME_MACHINE_ARCH=`arch | sed 's/OpenBSD.//'`
233 echo ${UNAME_MACHINE_ARCH}-${VENDOR}-openbsd${UNAME_RELEASE}
234 exit ;;
235 *:ekkoBSD:*:*)
236 echo ${UNAME_MACHINE}-${VENDOR}-ekkobsd${UNAME_RELEASE}
237 exit ;;
238 *:SolidBSD:*:*)
239 echo ${UNAME_MACHINE}-${VENDOR}-solidbsd${UNAME_RELEASE}
240 exit ;;
241 macppc:MirBSD:*:*)
242 echo powerpc-${VENDOR}-mirbsd${UNAME_RELEASE}
243 exit ;;
244 *:MirBSD:*:*)
245 echo ${UNAME_MACHINE}-${VENDOR}-mirbsd${UNAME_RELEASE}
246 exit ;;
247 alpha:OSF1:*:*)
248 case $UNAME_RELEASE in
249 *4.0)
250 UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'`
251 ;;
252 *5.*)
253 UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $4}'`
254 ;;
255 esac
256 # According to Compaq, /usr/sbin/psrinfo has been available on
257 # OSF/1 and Tru64 systems produced since 1995. I hope that
258 # covers most systems running today. This code pipes the CPU
259 # types through head -n 1, so we only detect the type of CPU 0.
260 ALPHA_CPU_TYPE=`/usr/sbin/psrinfo -v | sed -n -e 's/^ The alpha \(.*\) processor.*$/\1/p' | head -n 1`
261 case "$ALPHA_CPU_TYPE" in
262 "EV4 (21064)")
263 UNAME_MACHINE="alpha" ;;
264 "EV4.5 (21064)")
265 UNAME_MACHINE="alpha" ;;
266 "LCA4 (21066/21068)")
267 UNAME_MACHINE="alpha" ;;
268 "EV5 (21164)")
269 UNAME_MACHINE="alphaev5" ;;
270 "EV5.6 (21164A)")
271 UNAME_MACHINE="alphaev56" ;;
272 "EV5.6 (21164PC)")
273 UNAME_MACHINE="alphapca56" ;;
274 "EV5.7 (21164PC)")
275 UNAME_MACHINE="alphapca57" ;;
276 "EV6 (21264)")
277 UNAME_MACHINE="alphaev6" ;;
278 "EV6.7 (21264A)")
279 UNAME_MACHINE="alphaev67" ;;
280 "EV6.8CB (21264C)")
281 UNAME_MACHINE="alphaev68" ;;
282 "EV6.8AL (21264B)")
283 UNAME_MACHINE="alphaev68" ;;
284 "EV6.8CX (21264D)")
285 UNAME_MACHINE="alphaev68" ;;
286 "EV6.9A (21264/EV69A)")
287 UNAME_MACHINE="alphaev69" ;;
288 "EV7 (21364)")
289 UNAME_MACHINE="alphaev7" ;;
290 "EV7.9 (21364A)")
291 UNAME_MACHINE="alphaev79" ;;
292 esac
293 # A Pn.n version is a patched version.
294 # A Vn.n version is a released version.
295 # A Tn.n version is a released field test version.
296 # A Xn.n version is an unreleased experimental baselevel.
297 # 1.2 uses "1.2" for uname -r.
298 echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[PVTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
299 # Reset EXIT trap before exiting to avoid spurious non-zero exit code.
300 exitcode=$?
301 trap '' 0
302 exit $exitcode ;;
303 Alpha\ *:Windows_NT*:*)
304 # How do we know it's Interix rather than the generic POSIX subsystem?
305 # Should we change UNAME_MACHINE based on the output of uname instead
306 # of the specific Alpha model?
307 echo alpha-pc-interix
308 exit ;;
309 21064:Windows_NT:50:3)
310 echo alpha-dec-winnt3.5
311 exit ;;
312 Amiga*:UNIX_System_V:4.0:*)
313 echo m68k-${VENDOR}-sysv4
314 exit ;;
315 *:[Aa]miga[Oo][Ss]:*:*)
316 echo ${UNAME_MACHINE}-${VENDOR}-amigaos
317 exit ;;
318 *:[Mm]orph[Oo][Ss]:*:*)
319 echo ${UNAME_MACHINE}-${VENDOR}-morphos
320 exit ;;
321 *:OS/390:*:*)
322 echo i370-ibm-openedition
323 exit ;;
324 *:z/VM:*:*)
325 echo s390-ibm-zvmoe
326 exit ;;
327 *:OS400:*:*)
328 echo powerpc-ibm-os400
329 exit ;;
330 arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*)
331 echo arm-acorn-riscix${UNAME_RELEASE}
332 exit ;;
333 arm*:riscos:*:*|arm*:RISCOS:*:*)
334 echo arm-${VENDOR}-riscos
335 exit ;;
336 SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*)
337 echo hppa1.1-hitachi-hiuxmpp
338 exit ;;
339 Pyramid*:OSx*:*:* | MIS*:OSx*:*:* | MIS*:SMP_DC-OSx*:*:*)
340 # akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE.
341 if test "`(/bin/universe) 2>/dev/null`" = att ; then
342 echo pyramid-pyramid-sysv3
343 else
344 echo pyramid-pyramid-bsd
345 fi
346 exit ;;
347 NILE*:*:*:dcosx)
348 echo pyramid-pyramid-svr4
349 exit ;;
350 DRS?6000:unix:4.0:6*)
351 echo sparc-icl-nx6
352 exit ;;
353 DRS?6000:UNIX_SV:4.2*:7* | DRS?6000:isis:4.2*:7*)
354 case `/usr/bin/uname -p` in
355 sparc) echo sparc-icl-nx7; exit ;;
356 esac ;;
357 s390x:SunOS:*:*)
358 echo ${UNAME_MACHINE}-ibm-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
359 exit ;;
360 sun4H:SunOS:5.*:*)
361 echo sparc-hal-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
362 exit ;;
363 sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*)
364 echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
365 exit ;;
366 i86pc:AuroraUX:5.*:* | i86xen:AuroraUX:5.*:*)
367 echo i386-pc-auroraux${UNAME_RELEASE}
368 exit ;;
369 i86pc:SunOS:5.*:* | i86xen:SunOS:5.*:*)
370 eval $set_cc_for_build
371 SUN_ARCH="i386"
372 # If there is a compiler, see if it is configured for 64-bit objects.
373 # Note that the Sun cc does not turn __LP64__ into 1 like gcc does.
374 # This test works for both compilers.
375 if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then
376 if (echo '#ifdef __amd64'; echo IS_64BIT_ARCH; echo '#endif') | \
377 (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \
378 grep IS_64BIT_ARCH >/dev/null
379 then
380 SUN_ARCH="x86_64"
381 fi
382 fi
383 echo ${SUN_ARCH}-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
384 exit ;;
385 sun4*:SunOS:6*:*)
386 # According to config.sub, this is the proper way to canonicalize
387 # SunOS6. Hard to guess exactly what SunOS6 will be like, but
388 # it's likely to be more like Solaris than SunOS4.
389 echo sparc-sun-solaris3`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
390 exit ;;
391 sun4*:SunOS:*:*)
392 case "`/usr/bin/arch -k`" in
393 Series*|S4*)
394 UNAME_RELEASE=`uname -v`
395 ;;
396 esac
397 # Japanese Language versions have a version number like `4.1.3-JL'.
398 echo sparc-sun-sunos`echo ${UNAME_RELEASE}|sed -e 's/-/_/'`
399 exit ;;
400 sun3*:SunOS:*:*)
401 echo m68k-sun-sunos${UNAME_RELEASE}
402 exit ;;
403 sun*:*:4.2BSD:*)
404 UNAME_RELEASE=`(sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null`
405 test "x${UNAME_RELEASE}" = "x" && UNAME_RELEASE=3
406 case "`/bin/arch`" in
407 sun3)
408 echo m68k-sun-sunos${UNAME_RELEASE}
409 ;;
410 sun4)
411 echo sparc-sun-sunos${UNAME_RELEASE}
412 ;;
413 esac
414 exit ;;
415 aushp:SunOS:*:*)
416 echo sparc-auspex-sunos${UNAME_RELEASE}
417 exit ;;
418 # The situation for MiNT is a little confusing. The machine name
419 # can be virtually everything (everything which is not
420 # "atarist" or "atariste" at least should have a processor
421 # > m68000). The system name ranges from "MiNT" over "FreeMiNT"
422 # to the lowercase version "mint" (or "freemint"). Finally
423 # the system name "TOS" denotes a system which is actually not
424 # MiNT. But MiNT is downward compatible to TOS, so this should
425 # be no problem.
426 atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*)
427 echo m68k-atari-mint${UNAME_RELEASE}
428 exit ;;
429 atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*)
430 echo m68k-atari-mint${UNAME_RELEASE}
431 exit ;;
432 *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*)
433 echo m68k-atari-mint${UNAME_RELEASE}
434 exit ;;
435 milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*)
436 echo m68k-milan-mint${UNAME_RELEASE}
437 exit ;;
438 hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*)
439 echo m68k-hades-mint${UNAME_RELEASE}
440 exit ;;
441 *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*)
442 echo m68k-${VENDOR}-mint${UNAME_RELEASE}
443 exit ;;
444 m68k:machten:*:*)
445 echo m68k-apple-machten${UNAME_RELEASE}
446 exit ;;
447 powerpc:machten:*:*)
448 echo powerpc-apple-machten${UNAME_RELEASE}
449 exit ;;
450 RISC*:Mach:*:*)
451 echo mips-dec-mach_bsd4.3
452 exit ;;
453 RISC*:ULTRIX:*:*)
454 echo mips-dec-ultrix${UNAME_RELEASE}
455 exit ;;
456 VAX*:ULTRIX*:*:*)
457 echo vax-dec-ultrix${UNAME_RELEASE}
458 exit ;;
459 2020:CLIX:*:* | 2430:CLIX:*:*)
460 echo clipper-intergraph-clix${UNAME_RELEASE}
461 exit ;;
462 mips:*:*:UMIPS | mips:*:*:RISCos)
463 eval $set_cc_for_build
464 sed 's/^ //' << EOF >$dummy.c
465 #ifdef __cplusplus
466 #include <stdio.h> /* for printf() prototype */
467 int main (int argc, char *argv[]) {
468 #else
469 int main (argc, argv) int argc; char *argv[]; {
470 #endif
471 #if defined (host_mips) && defined (MIPSEB)
472 #if defined (SYSTYPE_SYSV)
473 printf ("mips-mips-riscos%ssysv\n", argv[1]); exit (0);
474 #endif
475 #if defined (SYSTYPE_SVR4)
476 printf ("mips-mips-riscos%ssvr4\n", argv[1]); exit (0);
477 #endif
478 #if defined (SYSTYPE_BSD43) || defined(SYSTYPE_BSD)
479 printf ("mips-mips-riscos%sbsd\n", argv[1]); exit (0);
480 #endif
481 #endif
482 exit (-1);
483 }
484 EOF
485 $CC_FOR_BUILD -o $dummy $dummy.c &&
486 dummyarg=`echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` &&
487 SYSTEM_NAME=`$dummy $dummyarg` &&
488 { echo "$SYSTEM_NAME"; exit; }
489 echo mips-mips-riscos${UNAME_RELEASE}
490 exit ;;
491 Motorola:PowerMAX_OS:*:*)
492 echo powerpc-motorola-powermax
493 exit ;;
494 Motorola:*:4.3:PL8-*)
495 echo powerpc-harris-powermax
496 exit ;;
497 Night_Hawk:*:*:PowerMAX_OS | Synergy:PowerMAX_OS:*:*)
498 echo powerpc-harris-powermax
499 exit ;;
500 Night_Hawk:Power_UNIX:*:*)
501 echo powerpc-harris-powerunix
502 exit ;;
503 m88k:CX/UX:7*:*)
504 echo m88k-harris-cxux7
505 exit ;;
506 m88k:*:4*:R4*)
507 echo m88k-motorola-sysv4
508 exit ;;
509 m88k:*:3*:R3*)
510 echo m88k-motorola-sysv3
511 exit ;;
512 AViiON:dgux:*:*)
513 # DG/UX returns AViiON for all architectures
514 UNAME_PROCESSOR=`/usr/bin/uname -p`
515 if [ $UNAME_PROCESSOR = mc88100 ] || [ $UNAME_PROCESSOR = mc88110 ]
516 then
517 if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx ] || \
518 [ ${TARGET_BINARY_INTERFACE}x = x ]
519 then
520 echo m88k-dg-dgux${UNAME_RELEASE}
521 else
522 echo m88k-dg-dguxbcs${UNAME_RELEASE}
523 fi
524 else
525 echo i586-dg-dgux${UNAME_RELEASE}
526 fi
527 exit ;;
528 M88*:DolphinOS:*:*) # DolphinOS (SVR3)
529 echo m88k-dolphin-sysv3
530 exit ;;
531 M88*:*:R3*:*)
532 # Delta 88k system running SVR3
533 echo m88k-motorola-sysv3
534 exit ;;
535 XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3)
536 echo m88k-tektronix-sysv3
537 exit ;;
538 Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD)
539 echo m68k-tektronix-bsd
540 exit ;;
541 *:IRIX*:*:*)
542 echo mips-sgi-irix`echo ${UNAME_RELEASE}|sed -e 's/-/_/g'`
543 exit ;;
544 ????????:AIX?:[12].1:2) # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX.
545 echo romp-ibm-aix # uname -m gives an 8 hex-code CPU id
546 exit ;; # Note that: echo "'`uname -s`'" gives 'AIX '
547 i*86:AIX:*:*)
548 echo i386-ibm-aix
549 exit ;;
550 ia64:AIX:*:*)
551 if [ -x /usr/bin/oslevel ] ; then
552 IBM_REV=`/usr/bin/oslevel`
553 else
554 IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE}
555 fi
556 echo ${UNAME_MACHINE}-ibm-aix${IBM_REV}
557 exit ;;
558 *:AIX:2:3)
559 if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then
560 eval $set_cc_for_build
561 sed 's/^ //' << EOF >$dummy.c
562 #include <sys/systemcfg.h>
563
564 main()
565 {
566 if (!__power_pc())
567 exit(1);
568 puts("powerpc-ibm-aix3.2.5");
569 exit(0);
570 }
571 EOF
572 if $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy`
573 then
574 echo "$SYSTEM_NAME"
575 else
576 echo rs6000-ibm-aix3.2.5
577 fi
578 elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then
579 echo rs6000-ibm-aix3.2.4
580 else
581 echo rs6000-ibm-aix3.2
582 fi
583 exit ;;
584 *:AIX:*:[4567])
585 IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'`
586 if /usr/sbin/lsattr -El ${IBM_CPU_ID} | grep ' POWER' >/dev/null 2>&1; then
587 IBM_ARCH=rs6000
588 else
589 IBM_ARCH=powerpc
590 fi
591 if [ -x /usr/bin/oslevel ] ; then
592 IBM_REV=`/usr/bin/oslevel`
593 else
594 IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE}
595 fi
596 echo ${IBM_ARCH}-ibm-aix${IBM_REV}
597 exit ;;
598 *:AIX:*:*)
599 echo rs6000-ibm-aix
600 exit ;;
601 ibmrt:4.4BSD:*|romp-ibm:BSD:*)
602 echo romp-ibm-bsd4.4
603 exit ;;
604 ibmrt:*BSD:*|romp-ibm:BSD:*) # covers RT/PC BSD and
605 echo romp-ibm-bsd${UNAME_RELEASE} # 4.3 with uname added to
606 exit ;; # report: romp-ibm BSD 4.3
607 *:BOSX:*:*)
608 echo rs6000-bull-bosx
609 exit ;;
610 DPX/2?00:B.O.S.:*:*)
611 echo m68k-bull-sysv3
612 exit ;;
613 9000/[34]??:4.3bsd:1.*:*)
614 echo m68k-hp-bsd
615 exit ;;
616 hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*)
617 echo m68k-hp-bsd4.4
618 exit ;;
619 9000/[34678]??:HP-UX:*:*)
620 HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'`
621 case "${UNAME_MACHINE}" in
622 9000/31? ) HP_ARCH=m68000 ;;
623 9000/[34]?? ) HP_ARCH=m68k ;;
624 9000/[678][0-9][0-9])
625 if [ -x /usr/bin/getconf ]; then
626 sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null`
627 sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null`
628 case "${sc_cpu_version}" in
629 523) HP_ARCH="hppa1.0" ;; # CPU_PA_RISC1_0
630 528) HP_ARCH="hppa1.1" ;; # CPU_PA_RISC1_1
631 532) # CPU_PA_RISC2_0
632 case "${sc_kernel_bits}" in
633 32) HP_ARCH="hppa2.0n" ;;
634 64) HP_ARCH="hppa2.0w" ;;
635 '') HP_ARCH="hppa2.0" ;; # HP-UX 10.20
636 esac ;;
637 esac
638 fi
639 if [ "${HP_ARCH}" = "" ]; then
640 eval $set_cc_for_build
641 sed 's/^ //' << EOF >$dummy.c
642
643 #define _HPUX_SOURCE
644 #include <stdlib.h>
645 #include <unistd.h>
646
647 int main ()
648 {
649 #if defined(_SC_KERNEL_BITS)
650 long bits = sysconf(_SC_KERNEL_BITS);
651 #endif
652 long cpu = sysconf (_SC_CPU_VERSION);
653
654 switch (cpu)
655 {
656 case CPU_PA_RISC1_0: puts ("hppa1.0"); break;
657 case CPU_PA_RISC1_1: puts ("hppa1.1"); break;
658 case CPU_PA_RISC2_0:
659 #if defined(_SC_KERNEL_BITS)
660 switch (bits)
661 {
662 case 64: puts ("hppa2.0w"); break;
663 case 32: puts ("hppa2.0n"); break;
664 default: puts ("hppa2.0"); break;
665 } break;
666 #else /* !defined(_SC_KERNEL_BITS) */
667 puts ("hppa2.0"); break;
668 #endif
669 default: puts ("hppa1.0"); break;
670 }
671 exit (0);
672 }
673 EOF
674 (CCOPTS= $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null) && HP_ARCH=`$dummy`
675 test -z "$HP_ARCH" && HP_ARCH=hppa
676 fi ;;
677 esac
678 if [ ${HP_ARCH} = "hppa2.0w" ]
679 then
680 eval $set_cc_for_build
681
682 # hppa2.0w-hp-hpux* has a 64-bit kernel and a compiler generating
683 # 32-bit code. hppa64-hp-hpux* has the same kernel and a compiler
684 # generating 64-bit code. GNU and HP use different nomenclature:
685 #
686 # $ CC_FOR_BUILD=cc ./config.guess
687 # => hppa2.0w-hp-hpux11.23
688 # $ CC_FOR_BUILD="cc +DA2.0w" ./config.guess
689 # => hppa64-hp-hpux11.23
690
691 if echo __LP64__ | (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) |
692 grep -q __LP64__
693 then
694 HP_ARCH="hppa2.0w"
695 else
696 HP_ARCH="hppa64"
697 fi
698 fi
699 echo ${HP_ARCH}-hp-hpux${HPUX_REV}
700 exit ;;
701 ia64:HP-UX:*:*)
702 HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'`
703 echo ia64-hp-hpux${HPUX_REV}
704 exit ;;
705 3050*:HI-UX:*:*)
706 eval $set_cc_for_build
707 sed 's/^ //' << EOF >$dummy.c
708 #include <unistd.h>
709 int
710 main ()
711 {
712 long cpu = sysconf (_SC_CPU_VERSION);
713 /* The order matters, because CPU_IS_HP_MC68K erroneously returns
714 true for CPU_PA_RISC1_0. CPU_IS_PA_RISC returns correct
715 results, however. */
716 if (CPU_IS_PA_RISC (cpu))
717 {
718 switch (cpu)
719 {
720 case CPU_PA_RISC1_0: puts ("hppa1.0-hitachi-hiuxwe2"); break;
721 case CPU_PA_RISC1_1: puts ("hppa1.1-hitachi-hiuxwe2"); break;
722 case CPU_PA_RISC2_0: puts ("hppa2.0-hitachi-hiuxwe2"); break;
723 default: puts ("hppa-hitachi-hiuxwe2"); break;
724 }
725 }
726 else if (CPU_IS_HP_MC68K (cpu))
727 puts ("m68k-hitachi-hiuxwe2");
728 else puts ("unknown-hitachi-hiuxwe2");
729 exit (0);
730 }
731 EOF
732 $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy` &&
733 { echo "$SYSTEM_NAME"; exit; }
734 echo unknown-hitachi-hiuxwe2
735 exit ;;
736 9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:* )
737 echo hppa1.1-hp-bsd
738 exit ;;
739 9000/8??:4.3bsd:*:*)
740 echo hppa1.0-hp-bsd
741 exit ;;
742 *9??*:MPE/iX:*:* | *3000*:MPE/iX:*:*)
743 echo hppa1.0-hp-mpeix
744 exit ;;
745 hp7??:OSF1:*:* | hp8?[79]:OSF1:*:* )
746 echo hppa1.1-hp-osf
747 exit ;;
748 hp8??:OSF1:*:*)
749 echo hppa1.0-hp-osf
750 exit ;;
751 i*86:OSF1:*:*)
752 if [ -x /usr/sbin/sysversion ] ; then
753 echo ${UNAME_MACHINE}-${VENDOR}-osf1mk
754 else
755 echo ${UNAME_MACHINE}-${VENDOR}-osf1
756 fi
757 exit ;;
758 parisc*:Lites*:*:*)
759 echo hppa1.1-hp-lites
760 exit ;;
761 C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*)
762 echo c1-convex-bsd
763 exit ;;
764 C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*)
765 if getsysinfo -f scalar_acc
766 then echo c32-convex-bsd
767 else echo c2-convex-bsd
768 fi
769 exit ;;
770 C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*)
771 echo c34-convex-bsd
772 exit ;;
773 C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*)
774 echo c38-convex-bsd
775 exit ;;
776 C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*)
777 echo c4-convex-bsd
778 exit ;;
779 CRAY*Y-MP:*:*:*)
780 echo ymp-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
781 exit ;;
782 CRAY*[A-Z]90:*:*:*)
783 echo ${UNAME_MACHINE}-cray-unicos${UNAME_RELEASE} \
784 | sed -e 's/CRAY.*\([A-Z]90\)/\1/' \
785 -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ \
786 -e 's/\.[^.]*$/.X/'
787 exit ;;
788 CRAY*TS:*:*:*)
789 echo t90-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
790 exit ;;
791 CRAY*T3E:*:*:*)
792 echo alphaev5-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
793 exit ;;
794 CRAY*SV1:*:*:*)
795 echo sv1-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
796 exit ;;
797 *:UNICOS/mp:*:*)
798 echo craynv-cray-unicosmp${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
799 exit ;;
800 F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*)
801 FUJITSU_PROC=`uname -m | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
802 FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'`
803 FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'`
804 echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
805 exit ;;
806 5000:UNIX_System_V:4.*:*)
807 FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'`
808 FUJITSU_REL=`echo ${UNAME_RELEASE} | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/ /_/'`
809 echo "sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
810 exit ;;
811 i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*)
812 echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE}
813 exit ;;
814 sparc*:BSD/OS:*:*)
815 echo sparc-${VENDOR}-bsdi${UNAME_RELEASE}
816 exit ;;
817 *:BSD/OS:*:*)
818 echo ${UNAME_MACHINE}-${VENDOR}-bsdi${UNAME_RELEASE}
819 exit ;;
820 *:FreeBSD:*:*)
821 UNAME_PROCESSOR=`/usr/bin/uname -p`
822 case ${UNAME_PROCESSOR} in
823 amd64)
824 echo x86_64-${VENDOR}-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;;
825 *)
826 echo ${UNAME_PROCESSOR}-${VENDOR}-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;;
827 esac
828 exit ;;
829 i*:CYGWIN*:*)
830 echo ${UNAME_MACHINE}-pc-cygwin
831 exit ;;
832 *:MINGW64*:*)
833 echo ${UNAME_MACHINE}-pc-mingw64
834 exit ;;
835 *:MINGW*:*)
836 echo ${UNAME_MACHINE}-pc-mingw32
837 exit ;;
838 i*:MSYS*:*)
839 echo ${UNAME_MACHINE}-pc-msys
840 exit ;;
841 i*:windows32*:*)
842 # uname -m includes "-pc" on this system.
843 echo ${UNAME_MACHINE}-mingw32
844 exit ;;
845 i*:PW*:*)
846 echo ${UNAME_MACHINE}-pc-pw32
847 exit ;;
848 *:Interix*:*)
849 case ${UNAME_MACHINE} in
850 x86)
851 echo i586-pc-interix${UNAME_RELEASE}
852 exit ;;
853 authenticamd | genuineintel | EM64T)
854 echo x86_64-${VENDOR}-interix${UNAME_RELEASE}
855 exit ;;
856 IA64)
857 echo ia64-${VENDOR}-interix${UNAME_RELEASE}
858 exit ;;
859 esac ;;
860 [345]86:Windows_95:* | [345]86:Windows_98:* | [345]86:Windows_NT:*)
861 echo i${UNAME_MACHINE}-pc-mks
862 exit ;;
863 8664:Windows_NT:*)
864 echo x86_64-pc-mks
865 exit ;;
866 i*:Windows_NT*:* | Pentium*:Windows_NT*:*)
867 # How do we know it's Interix rather than the generic POSIX subsystem?
868 # It also conflicts with pre-2.0 versions of AT&T UWIN. Should we
869 # UNAME_MACHINE based on the output of uname instead of i386?
870 echo i586-pc-interix
871 exit ;;
872 i*:UWIN*:*)
873 echo ${UNAME_MACHINE}-pc-uwin
874 exit ;;
875 amd64:CYGWIN*:*:* | x86_64:CYGWIN*:*:*)
876 echo x86_64-${VENDOR}-cygwin
877 exit ;;
878 p*:CYGWIN*:*)
879 echo powerpcle-${VENDOR}-cygwin
880 exit ;;
881 prep*:SunOS:5.*:*)
882 echo powerpcle-${VENDOR}-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
883 exit ;;
884 *:GNU:*:*)
885 # the GNU system
886 echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-${VENDOR}-${LIBC}`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'`
887 exit ;;
888 *:GNU/*:*:*)
889 # other systems with GNU libc and userland
890 echo ${UNAME_MACHINE}-${VENDOR}-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr '[A-Z]' '[a-z]'``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-${LIBC}
891 exit ;;
892 i*86:Minix:*:*)
893 echo ${UNAME_MACHINE}-pc-minix
894 exit ;;
895 aarch64:Linux:*:*)
896 echo ${UNAME_MACHINE}-${VENDOR}-linux-${LIBC}
897 exit ;;
898 aarch64_be:Linux:*:*)
899 UNAME_MACHINE=aarch64_be
900 echo ${UNAME_MACHINE}-${VENDOR}-linux-${LIBC}
901 exit ;;
902 alpha:Linux:*:*)
903 case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in
904 EV5) UNAME_MACHINE=alphaev5 ;;
905 EV56) UNAME_MACHINE=alphaev56 ;;
906 PCA56) UNAME_MACHINE=alphapca56 ;;
907 PCA57) UNAME_MACHINE=alphapca56 ;;
908 EV6) UNAME_MACHINE=alphaev6 ;;
909 EV67) UNAME_MACHINE=alphaev67 ;;
910 EV68*) UNAME_MACHINE=alphaev68 ;;
911 esac
912 objdump --private-headers /bin/sh | grep -q ld.so.1
913 if test "$?" = 0 ; then LIBC="gnulibc1" ; fi
914 echo ${UNAME_MACHINE}-${VENDOR}-linux-${LIBC}
915 exit ;;
916 arc:Linux:*:* | arceb:Linux:*:*)
917 echo ${UNAME_MACHINE}-${VENDOR}-linux-${LIBC}
918 exit ;;
919 arm*:Linux:*:*)
920 eval $set_cc_for_build
921 if echo __ARM_EABI__ | $CC_FOR_BUILD -E - 2>/dev/null \
922 | grep -q __ARM_EABI__
923 then
924 echo ${UNAME_MACHINE}-${VENDOR}-linux-${LIBC}
925 else
926 if echo __ARM_PCS_VFP | $CC_FOR_BUILD -E - 2>/dev/null \
927 | grep -q __ARM_PCS_VFP
928 then
929 echo ${UNAME_MACHINE}-${VENDOR}-linux-${LIBC}eabi
930 else
931 echo ${UNAME_MACHINE}-${VENDOR}-linux-${LIBC}eabihf
932 fi
933 fi
934 exit ;;
935 avr32*:Linux:*:*)
936 echo ${UNAME_MACHINE}-${VENDOR}-linux-${LIBC}
937 exit ;;
938 cris:Linux:*:*)
939 echo ${UNAME_MACHINE}-axis-linux-${LIBC}
940 exit ;;
941 crisv32:Linux:*:*)
942 echo ${UNAME_MACHINE}-axis-linux-${LIBC}
943 exit ;;
944 frv:Linux:*:*)
945 echo ${UNAME_MACHINE}-${VENDOR}-linux-${LIBC}
946 exit ;;
947 hexagon:Linux:*:*)
948 echo ${UNAME_MACHINE}-${VENDOR}-linux-${LIBC}
949 exit ;;
950 i*86:Linux:*:*)
951 echo ${UNAME_MACHINE}-pc-linux-${LIBC}
952 exit ;;
953 ia64:Linux:*:*)
954 echo ${UNAME_MACHINE}-${VENDOR}-linux-${LIBC}
955 exit ;;
956 m32r*:Linux:*:*)
957 echo ${UNAME_MACHINE}-${VENDOR}-linux-${LIBC}
958 exit ;;
959 m68*:Linux:*:*)
960 echo ${UNAME_MACHINE}-${VENDOR}-linux-${LIBC}
961 exit ;;
962 mips:Linux:*:* | mips64:Linux:*:*)
963 eval $set_cc_for_build
964 sed 's/^ //' << EOF >$dummy.c
965 #undef CPU
966 #undef ${UNAME_MACHINE}
967 #undef ${UNAME_MACHINE}el
968 #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL)
969 CPU=${UNAME_MACHINE}el
970 #else
971 #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB)
972 CPU=${UNAME_MACHINE}
973 #else
974 CPU=
975 #endif
976 #endif
977 EOF
978 eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^CPU'`
979 test x"${CPU}" != x && { echo "${CPU}-${VENDOR}-linux-${LIBC}"; exit; }
980 ;;
981 or1k:Linux:*:*)
982 echo ${UNAME_MACHINE}-${VENDOR}-linux-${LIBC}
983 exit ;;
984 or32:Linux:*:*)
985 echo ${UNAME_MACHINE}-${VENDOR}-linux-${LIBC}
986 exit ;;
987 padre:Linux:*:*)
988 echo sparc-${VENDOR}-linux-${LIBC}
989 exit ;;
990 parisc64:Linux:*:* | hppa64:Linux:*:*)
991 echo hppa64-${VENDOR}-linux-${LIBC}
992 exit ;;
993 parisc:Linux:*:* | hppa:Linux:*:*)
994 # Look for CPU level
995 case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in
996 PA7*) echo hppa1.1-${VENDOR}-linux-${LIBC} ;;
997 PA8*) echo hppa2.0-${VENDOR}-linux-${LIBC} ;;
998 *) echo hppa-${VENDOR}-linux-${LIBC} ;;
999 esac
1000 exit ;;
1001 ppc64:Linux:*:*)
1002 echo powerpc64-${VENDOR}-linux-${LIBC}
1003 exit ;;
1004 ppc:Linux:*:*)
1005 echo powerpc-${VENDOR}-linux-${LIBC}
1006 exit ;;
1007 ppc64le:Linux:*:*)
1008 echo powerpc64le-${VENDOR}-linux-${LIBC}
1009 exit ;;
1010 ppcle:Linux:*:*)
1011 echo powerpcle-${VENDOR}-linux-${LIBC}
1012 exit ;;
1013 s390:Linux:*:* | s390x:Linux:*:*)
1014 echo ${UNAME_MACHINE}-ibm-linux-${LIBC}
1015 exit ;;
1016 sh64*:Linux:*:*)
1017 echo ${UNAME_MACHINE}-${VENDOR}-linux-${LIBC}
1018 exit ;;
1019 sh*:Linux:*:*)
1020 echo ${UNAME_MACHINE}-${VENDOR}-linux-${LIBC}
1021 exit ;;
1022 sparc:Linux:*:* | sparc64:Linux:*:*)
1023 echo ${UNAME_MACHINE}-${VENDOR}-linux-${LIBC}
1024 exit ;;
1025 tile*:Linux:*:*)
1026 echo ${UNAME_MACHINE}-${VENDOR}-linux-${LIBC}
1027 exit ;;
1028 vax:Linux:*:*)
1029 echo ${UNAME_MACHINE}-dec-linux-${LIBC}
1030 exit ;;
1031 x86_64:Linux:*:*)
1032 echo ${UNAME_MACHINE}-${VENDOR}-linux-${LIBC}
1033 exit ;;
1034 xtensa*:Linux:*:*)
1035 echo ${UNAME_MACHINE}-${VENDOR}-linux-${LIBC}
1036 exit ;;
1037 i*86:DYNIX/ptx:4*:*)
1038 # ptx 4.0 does uname -s correctly, with DYNIX/ptx in there.
1039 # earlier versions are messed up and put the nodename in both
1040 # sysname and nodename.
1041 echo i386-sequent-sysv4
1042 exit ;;
1043 i*86:UNIX_SV:4.2MP:2.*)
1044 # Unixware is an offshoot of SVR4, but it has its own version
1045 # number series starting with 2...
1046 # I am not positive that other SVR4 systems won't match this,
1047 # I just have to hope. -- rms.
1048 # Use sysv4.2uw... so that sysv4* matches it.
1049 echo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION}
1050 exit ;;
1051 i*86:OS/2:*:*)
1052 # If we were able to find `uname', then EMX Unix compatibility
1053 # is probably installed.
1054 echo ${UNAME_MACHINE}-pc-os2-emx
1055 exit ;;
1056 i*86:XTS-300:*:STOP)
1057 echo ${UNAME_MACHINE}-${VENDOR}-stop
1058 exit ;;
1059 i*86:atheos:*:*)
1060 echo ${UNAME_MACHINE}-${VENDOR}-atheos
1061 exit ;;
1062 i*86:syllable:*:*)
1063 echo ${UNAME_MACHINE}-pc-syllable
1064 exit ;;
1065 i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.[02]*:*)
1066 echo i386-${VENODR}-lynxos${UNAME_RELEASE}
1067 exit ;;
1068 i*86:*DOS:*:*)
1069 echo ${UNAME_MACHINE}-pc-msdosdjgpp
1070 exit ;;
1071 i*86:*:4.*:* | i*86:SYSTEM_V:4.*:*)
1072 UNAME_REL=`echo ${UNAME_RELEASE} | sed 's/\/MP$//'`
1073 if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then
1074 echo ${UNAME_MACHINE}-univel-sysv${UNAME_REL}
1075 else
1076 echo ${UNAME_MACHINE}-pc-sysv${UNAME_REL}
1077 fi
1078 exit ;;
1079 i*86:*:5:[678]*)
1080 # UnixWare 7.x, OpenUNIX and OpenServer 6.
1081 case `/bin/uname -X | grep "^Machine"` in
1082 *486*) UNAME_MACHINE=i486 ;;
1083 *Pentium) UNAME_MACHINE=i586 ;;
1084 *Pent*|*Celeron) UNAME_MACHINE=i686 ;;
1085 esac
1086 echo ${UNAME_MACHINE}-${VENDOR}-sysv${UNAME_RELEASE}${UNAME_SYSTEM}${UNAME_VERSION}
1087 exit ;;
1088 i*86:*:3.2:*)
1089 if test -f /usr/options/cb.name; then
1090 UNAME_REL=`sed -n 's/.*Version //p' </usr/options/cb.name`
1091 echo ${UNAME_MACHINE}-pc-isc$UNAME_REL
1092 elif /bin/uname -X 2>/dev/null >/dev/null ; then
1093 UNAME_REL=`(/bin/uname -X|grep Release|sed -e 's/.*= //')`
1094 (/bin/uname -X|grep i80486 >/dev/null) && UNAME_MACHINE=i486
1095 (/bin/uname -X|grep '^Machine.*Pentium' >/dev/null) \
1096 && UNAME_MACHINE=i586
1097 (/bin/uname -X|grep '^Machine.*Pent *II' >/dev/null) \
1098 && UNAME_MACHINE=i686
1099 (/bin/uname -X|grep '^Machine.*Pentium Pro' >/dev/null) \
1100 && UNAME_MACHINE=i686
1101 echo ${UNAME_MACHINE}-pc-sco$UNAME_REL
1102 else
1103 echo ${UNAME_MACHINE}-pc-sysv32
1104 fi
1105 exit ;;
1106 pc:*:*:*)
1107 # Left here for compatibility:
1108 # uname -m prints for DJGPP always 'pc', but it prints nothing about
1109 # the processor, so we play safe by assuming i586.
1110 # Note: whatever this is, it MUST be the same as what config.sub
1111 # prints for the "djgpp" host, or else GDB configury will decide that
1112 # this is a cross-build.
1113 echo i586-pc-msdosdjgpp
1114 exit ;;
1115 Intel:Mach:3*:*)
1116 echo i386-pc-mach3
1117 exit ;;
1118 paragon:*:*:*)
1119 echo i860-intel-osf1
1120 exit ;;
1121 i860:*:4.*:*) # i860-SVR4
1122 if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then
1123 echo i860-stardent-sysv${UNAME_RELEASE} # Stardent Vistra i860-SVR4
1124 else # Add other i860-SVR4 vendors below as they are discovered.
1125 echo i860-${VENODR}-sysv${UNAME_RELEASE} # Unknown i860-SVR4
1126 fi
1127 exit ;;
1128 mini*:CTIX:SYS*5:*)
1129 # "miniframe"
1130 echo m68010-convergent-sysv
1131 exit ;;
1132 mc68k:UNIX:SYSTEM5:3.51m)
1133 echo m68k-convergent-sysv
1134 exit ;;
1135 M680?0:D-NIX:5.3:*)
1136 echo m68k-diab-dnix
1137 exit ;;
1138 M68*:*:R3V[5678]*:*)
1139 test -r /sysV68 && { echo 'm68k-motorola-sysv'; exit; } ;;
1140 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)
1141 OS_REL=''
1142 test -r /etc/.relid \
1143 && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid`
1144 /bin/uname -p 2>/dev/null | grep 86 >/dev/null \
1145 && { echo i486-ncr-sysv4.3${OS_REL}; exit; }
1146 /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \
1147 && { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;;
1148 3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*)
1149 /bin/uname -p 2>/dev/null | grep 86 >/dev/null \
1150 && { echo i486-ncr-sysv4; exit; } ;;
1151 NCR*:*:4.2:* | MPRAS*:*:4.2:*)
1152 OS_REL='.3'
1153 test -r /etc/.relid \
1154 && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid`
1155 /bin/uname -p 2>/dev/null | grep 86 >/dev/null \
1156 && { echo i486-ncr-sysv4.3${OS_REL}; exit; }
1157 /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \
1158 && { echo i586-ncr-sysv4.3${OS_REL}; exit; }
1159 /bin/uname -p 2>/dev/null | /bin/grep pteron >/dev/null \
1160 && { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;;
1161 m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*)
1162 echo m68k-${VENDOR}-lynxos${UNAME_RELEASE}
1163 exit ;;
1164 mc68030:UNIX_System_V:4.*:*)
1165 echo m68k-atari-sysv4
1166 exit ;;
1167 TSUNAMI:LynxOS:2.*:*)
1168 echo sparc-${VENDOR}-lynxos${UNAME_RELEASE}
1169 exit ;;
1170 rs6000:LynxOS:2.*:*)
1171 echo rs6000-${VENDOR}-lynxos${UNAME_RELEASE}
1172 exit ;;
1173 PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.[02]*:*)
1174 echo powerpc-${VENDOR}-lynxos${UNAME_RELEASE}
1175 exit ;;
1176 SM[BE]S:UNIX_SV:*:*)
1177 echo mips-dde-sysv${UNAME_RELEASE}
1178 exit ;;
1179 RM*:ReliantUNIX-*:*:*)
1180 echo mips-sni-sysv4
1181 exit ;;
1182 RM*:SINIX-*:*:*)
1183 echo mips-sni-sysv4
1184 exit ;;
1185 *:SINIX-*:*:*)
1186 if uname -p 2>/dev/null >/dev/null ; then
1187 UNAME_MACHINE=`(uname -p) 2>/dev/null`
1188 echo ${UNAME_MACHINE}-sni-sysv4
1189 else
1190 echo ns32k-sni-sysv
1191 fi
1192 exit ;;
1193 PENTIUM:*:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort
1194 # says <Richard.M.Bartel@ccMail.Census.GOV>
1195 echo i586-unisys-sysv4
1196 exit ;;
1197 *:UNIX_System_V:4*:FTX*)
1198 # From Gerald Hewes <hewes@openmarket.com>.
1199 # How about differentiating between stratus architectures? -djm
1200 echo hppa1.1-stratus-sysv4
1201 exit ;;
1202 *:*:*:FTX*)
1203 # From seanf@swdc.stratus.com.
1204 echo i860-stratus-sysv4
1205 exit ;;
1206 i*86:VOS:*:*)
1207 # From Paul.Green@stratus.com.
1208 echo ${UNAME_MACHINE}-stratus-vos
1209 exit ;;
1210 *:VOS:*:*)
1211 # From Paul.Green@stratus.com.
1212 echo hppa1.1-stratus-vos
1213 exit ;;
1214 mc68*:A/UX:*:*)
1215 echo m68k-apple-aux${UNAME_RELEASE}
1216 exit ;;
1217 news*:NEWS-OS:6*:*)
1218 echo mips-sony-newsos6
1219 exit ;;
1220 R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*)
1221 if [ -d /usr/nec ]; then
1222 echo mips-nec-sysv${UNAME_RELEASE}
1223 else
1224 echo mips-${VENDOR}-sysv${UNAME_RELEASE}
1225 fi
1226 exit ;;
1227 BeBox:BeOS:*:*) # BeOS running on hardware made by Be, PPC only.
1228 echo powerpc-be-beos
1229 exit ;;
1230 BeMac:BeOS:*:*) # BeOS running on Mac or Mac clone, PPC only.
1231 echo powerpc-apple-beos
1232 exit ;;
1233 BePC:BeOS:*:*) # BeOS running on Intel PC compatible.
1234 echo i586-pc-beos
1235 exit ;;
1236 BePC:Haiku:*:*) # Haiku running on Intel PC compatible.
1237 echo i586-pc-haiku
1238 exit ;;
1239 x86_64:Haiku:*:*)
1240 echo x86_64-${VENDOR}-haiku
1241 exit ;;
1242 SX-4:SUPER-UX:*:*)
1243 echo sx4-nec-superux${UNAME_RELEASE}
1244 exit ;;
1245 SX-5:SUPER-UX:*:*)
1246 echo sx5-nec-superux${UNAME_RELEASE}
1247 exit ;;
1248 SX-6:SUPER-UX:*:*)
1249 echo sx6-nec-superux${UNAME_RELEASE}
1250 exit ;;
1251 SX-7:SUPER-UX:*:*)
1252 echo sx7-nec-superux${UNAME_RELEASE}
1253 exit ;;
1254 SX-8:SUPER-UX:*:*)
1255 echo sx8-nec-superux${UNAME_RELEASE}
1256 exit ;;
1257 SX-8R:SUPER-UX:*:*)
1258 echo sx8r-nec-superux${UNAME_RELEASE}
1259 exit ;;
1260 Power*:Rhapsody:*:*)
1261 echo powerpc-apple-rhapsody${UNAME_RELEASE}
1262 exit ;;
1263 *:Rhapsody:*:*)
1264 echo ${UNAME_MACHINE}-apple-rhapsody${UNAME_RELEASE}
1265 exit ;;
1266 *:Darwin:*:*)
1267 UNAME_PROCESSOR=`uname -p` || UNAME_PROCESSOR=unknown
1268 eval $set_cc_for_build
1269 if test "$UNAME_PROCESSOR" = unknown ; then
1270 UNAME_PROCESSOR=powerpc
1271 fi
1272 if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then
1273 if (echo '#ifdef __LP64__'; echo IS_64BIT_ARCH; echo '#endif') | \
1274 (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \
1275 grep IS_64BIT_ARCH >/dev/null
1276 then
1277 case $UNAME_PROCESSOR in
1278 i386) UNAME_PROCESSOR=x86_64 ;;
1279 powerpc) UNAME_PROCESSOR=powerpc64 ;;
1280 esac
1281 fi
1282 fi
1283 echo ${UNAME_PROCESSOR}-apple-darwin${UNAME_RELEASE}
1284 exit ;;
1285 *:procnto*:*:* | *:QNX:[0123456789]*:*)
1286 UNAME_PROCESSOR=`uname -p`
1287 if test "$UNAME_PROCESSOR" = "x86"; then
1288 UNAME_PROCESSOR=i386
1289 UNAME_MACHINE=pc
1290 fi
1291 echo ${UNAME_PROCESSOR}-${UNAME_MACHINE}-nto-qnx${UNAME_RELEASE}
1292 exit ;;
1293 *:QNX:*:4*)
1294 echo i386-pc-qnx
1295 exit ;;
1296 NEO-?:NONSTOP_KERNEL:*:*)
1297 echo neo-tandem-nsk${UNAME_RELEASE}
1298 exit ;;
1299 NSE-*:NONSTOP_KERNEL:*:*)
1300 echo nse-tandem-nsk${UNAME_RELEASE}
1301 exit ;;
1302 NSR-?:NONSTOP_KERNEL:*:*)
1303 echo nsr-tandem-nsk${UNAME_RELEASE}
1304 exit ;;
1305 *:NonStop-UX:*:*)
1306 echo mips-compaq-nonstopux
1307 exit ;;
1308 BS2000:POSIX*:*:*)
1309 echo bs2000-siemens-sysv
1310 exit ;;
1311 DS/*:UNIX_System_V:*:*)
1312 echo ${UNAME_MACHINE}-${UNAME_SYSTEM}-${UNAME_RELEASE}
1313 exit ;;
1314 *:Plan9:*:*)
1315 # "uname -m" is not consistent, so use $cputype instead. 386
1316 # is converted to i386 for consistency with other x86
1317 # operating systems.
1318 if test "$cputype" = "386"; then
1319 UNAME_MACHINE=i386
1320 else
1321 UNAME_MACHINE="$cputype"
1322 fi
1323 echo ${UNAME_MACHINE}-${VENDOR}-plan9
1324 exit ;;
1325 *:TOPS-10:*:*)
1326 echo pdp10-${VENDOR}-tops10
1327 exit ;;
1328 *:TENEX:*:*)
1329 echo pdp10-${VENDOR}-tenex
1330 exit ;;
1331 KS10:TOPS-20:*:* | KL10:TOPS-20:*:* | TYPE4:TOPS-20:*:*)
1332 echo pdp10-dec-tops20
1333 exit ;;
1334 XKL-1:TOPS-20:*:* | TYPE5:TOPS-20:*:*)
1335 echo pdp10-xkl-tops20
1336 exit ;;
1337 *:TOPS-20:*:*)
1338 echo pdp10-${VENDOR}-tops20
1339 exit ;;
1340 *:ITS:*:*)
1341 echo pdp10-${VENDOR}-its
1342 exit ;;
1343 SEI:*:*:SEIUX)
1344 echo mips-sei-seiux${UNAME_RELEASE}
1345 exit ;;
1346 *:DragonFly:*:*)
1347 echo ${UNAME_MACHINE}-${VENDOR}-dragonfly`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`
1348 exit ;;
1349 *:*VMS:*:*)
1350 UNAME_MACHINE=`(uname -p) 2>/dev/null`
1351 case "${UNAME_MACHINE}" in
1352 A*) echo alpha-dec-vms ; exit ;;
1353 I*) echo ia64-dec-vms ; exit ;;
1354 V*) echo vax-dec-vms ; exit ;;
1355 esac ;;
1356 *:XENIX:*:SysV)
1357 echo i386-pc-xenix
1358 exit ;;
1359 i*86:skyos:*:*)
1360 echo ${UNAME_MACHINE}-pc-skyos`echo ${UNAME_RELEASE}` | sed -e 's/ .*$//'
1361 exit ;;
1362 i*86:rdos:*:*)
1363 echo ${UNAME_MACHINE}-pc-rdos
1364 exit ;;
1365 i*86:AROS:*:*)
1366 echo ${UNAME_MACHINE}-pc-aros
1367 exit ;;
1368 x86_64:VMkernel:*:*)
1369 echo ${UNAME_MACHINE}-${VENDOR}-esx
1370 exit ;;
1371 esac
1372
1373 eval $set_cc_for_build
1374 cat >$dummy.c <<EOF
1375 #ifdef _SEQUENT_
1376 # include <sys/types.h>
1377 # include <sys/utsname.h>
1378 #endif
1379 main ()
1380 {
1381 #if defined (sony)
1382 #if defined (MIPSEB)
1383 /* BFD wants "bsd" instead of "newsos". Perhaps BFD should be changed,
1384 I don't know.... */
1385 printf ("mips-sony-bsd\n"); exit (0);
1386 #else
1387 #include <sys/param.h>
1388 printf ("m68k-sony-newsos%s\n",
1389 #ifdef NEWSOS4
1390 "4"
1391 #else
1392 ""
1393 #endif
1394 ); exit (0);
1395 #endif
1396 #endif
1397
1398 #if defined (__arm) && defined (__acorn) && defined (__unix)
1399 printf ("arm-acorn-riscix\n"); exit (0);
1400 #endif
1401
1402 #if defined (hp300) && !defined (hpux)
1403 printf ("m68k-hp-bsd\n"); exit (0);
1404 #endif
1405
1406 #if defined (NeXT)
1407 #if !defined (__ARCHITECTURE__)
1408 #define __ARCHITECTURE__ "m68k"
1409 #endif
1410 int version;
1411 version=`(hostinfo | sed -n 's/.*NeXT Mach \([0-9]*\).*/\1/p') 2>/dev/null`;
1412 if (version < 4)
1413 printf ("%s-next-nextstep%d\n", __ARCHITECTURE__, version);
1414 else
1415 printf ("%s-next-openstep%d\n", __ARCHITECTURE__, version);
1416 exit (0);
1417 #endif
1418
1419 #if defined (MULTIMAX) || defined (n16)
1420 #if defined (UMAXV)
1421 printf ("ns32k-encore-sysv\n"); exit (0);
1422 #else
1423 #if defined (CMU)
1424 printf ("ns32k-encore-mach\n"); exit (0);
1425 #else
1426 printf ("ns32k-encore-bsd\n"); exit (0);
1427 #endif
1428 #endif
1429 #endif
1430
1431 #if defined (__386BSD__)
1432 printf ("i386-pc-bsd\n"); exit (0);
1433 #endif
1434
1435 #if defined (sequent)
1436 #if defined (i386)
1437 printf ("i386-sequent-dynix\n"); exit (0);
1438 #endif
1439 #if defined (ns32000)
1440 printf ("ns32k-sequent-dynix\n"); exit (0);
1441 #endif
1442 #endif
1443
1444 #if defined (_SEQUENT_)
1445 struct utsname un;
1446
1447 uname(&un);
1448
1449 if (strncmp(un.version, "V2", 2) == 0) {
1450 printf ("i386-sequent-ptx2\n"); exit (0);
1451 }
1452 if (strncmp(un.version, "V1", 2) == 0) { /* XXX is V1 correct? */
1453 printf ("i386-sequent-ptx1\n"); exit (0);
1454 }
1455 printf ("i386-sequent-ptx\n"); exit (0);
1456
1457 #endif
1458
1459 #if defined (vax)
1460 # if !defined (ultrix)
1461 # include <sys/param.h>
1462 # if defined (BSD)
1463 # if BSD == 43
1464 printf ("vax-dec-bsd4.3\n"); exit (0);
1465 # else
1466 # if BSD == 199006
1467 printf ("vax-dec-bsd4.3reno\n"); exit (0);
1468 # else
1469 printf ("vax-dec-bsd\n"); exit (0);
1470 # endif
1471 # endif
1472 # else
1473 printf ("vax-dec-bsd\n"); exit (0);
1474 # endif
1475 # else
1476 printf ("vax-dec-ultrix\n"); exit (0);
1477 # endif
1478 #endif
1479
1480 #if defined (alliant) && defined (i860)
1481 printf ("i860-alliant-bsd\n"); exit (0);
1482 #endif
1483
1484 exit (1);
1485 }
1486 EOF
1487
1488 $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null && SYSTEM_NAME=`$dummy` &&
1489 { echo "$SYSTEM_NAME"; exit; }
1490
1491 # Apollos put the system type in the environment.
1492
1493 test -d /usr/apollo && { echo ${ISP}-apollo-${SYSTYPE}; exit; }
1494
1495 # Convex versions that predate uname can use getsysinfo(1)
1496
1497 if [ -x /usr/convex/getsysinfo ]
1498 then
1499 case `getsysinfo -f cpu_type` in
1500 c1*)
1501 echo c1-convex-bsd
1502 exit ;;
1503 c2*)
1504 if getsysinfo -f scalar_acc
1505 then echo c32-convex-bsd
1506 else echo c2-convex-bsd
1507 fi
1508 exit ;;
1509 c34*)
1510 echo c34-convex-bsd
1511 exit ;;
1512 c38*)
1513 echo c38-convex-bsd
1514 exit ;;
1515 c4*)
1516 echo c4-convex-bsd
1517 exit ;;
1518 esac
1519 fi
1520
1521 cat >&2 <<EOF
1522 $0: unable to guess system type
1523
1524 This script, last modified $timestamp, has failed to recognize
1525 the operating system you are using. It is advised that you
1526 download the most up to date version of the config scripts from
1527
1528 http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD
1529 and
1530 http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub;hb=HEAD
1531
1532 If the version you run ($0) is already up to date, please
1533 send the following data and any information you think might be
1534 pertinent to <config-patches@gnu.org> in order to provide the needed
1535 information to handle your system.
1536
1537 config.guess timestamp = $timestamp
1538
1539 uname -m = `(uname -m) 2>/dev/null || echo unknown`
1540 uname -r = `(uname -r) 2>/dev/null || echo unknown`
1541 uname -s = `(uname -s) 2>/dev/null || echo unknown`
1542 uname -v = `(uname -v) 2>/dev/null || echo unknown`
1543
1544 /usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null`
1545 /bin/uname -X = `(/bin/uname -X) 2>/dev/null`
1546
1547 hostinfo = `(hostinfo) 2>/dev/null`
1548 /bin/universe = `(/bin/universe) 2>/dev/null`
1549 /usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null`
1550 /bin/arch = `(/bin/arch) 2>/dev/null`
1551 /usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null`
1552 /usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null`
1553
1554 UNAME_MACHINE = ${UNAME_MACHINE}
1555 UNAME_RELEASE = ${UNAME_RELEASE}
1556 UNAME_SYSTEM = ${UNAME_SYSTEM}
1557 UNAME_VERSION = ${UNAME_VERSION}
1558 EOF
1559
1560 exit 1
1561
1562 # Local variables:
1563 # eval: (add-hook 'write-file-hooks 'time-stamp)
1564 # time-stamp-start: "timestamp='"
1565 # time-stamp-format: "%:y-%02m-%02d"
1566 # time-stamp-end: "'"
1567 # End:
0 /* config.h.in. Generated from configure.ac by autoheader. */
1
2 /* Define to 1 if you have the <dlfcn.h> header file. */
3 #undef HAVE_DLFCN_H
4
5 /* Define to 1 if you have the <inttypes.h> header file. */
6 #undef HAVE_INTTYPES_H
7
8 /* Define to 1 if you have the <memory.h> header file. */
9 #undef HAVE_MEMORY_H
10
11 /* Define to 1 if you have the <stdint.h> header file. */
12 #undef HAVE_STDINT_H
13
14 /* Define to 1 if you have the <stdlib.h> header file. */
15 #undef HAVE_STDLIB_H
16
17 /* Define to 1 if you have the <strings.h> header file. */
18 #undef HAVE_STRINGS_H
19
20 /* Define to 1 if you have the <string.h> header file. */
21 #undef HAVE_STRING_H
22
23 /* Define to 1 if you have the <sys/stat.h> header file. */
24 #undef HAVE_SYS_STAT_H
25
26 /* Define to 1 if you have the <sys/types.h> header file. */
27 #undef HAVE_SYS_TYPES_H
28
29 /* Define to 1 if you have the <unistd.h> header file. */
30 #undef HAVE_UNISTD_H
31
32 /* Define to the sub-directory in which libtool stores uninstalled libraries.
33 */
34 #undef LT_OBJDIR
35
36 /* Define to 1 if your C compiler doesn't accept -c and -o together. */
37 #undef NO_MINUS_C_MINUS_O
38
39 /* Name of package */
40 #undef PACKAGE
41
42 /* Define to the address where bug reports for this package should be sent. */
43 #undef PACKAGE_BUGREPORT
44
45 /* Define to the full name of this package. */
46 #undef PACKAGE_NAME
47
48 /* Define to the full name and version of this package. */
49 #undef PACKAGE_STRING
50
51 /* Define to the one symbol short name of this package. */
52 #undef PACKAGE_TARNAME
53
54 /* Define to the home page for this package. */
55 #undef PACKAGE_URL
56
57 /* Define to the version of this package. */
58 #undef PACKAGE_VERSION
59
60 /* Define to 1 if you have the ANSI C header files. */
61 #undef STDC_HEADERS
62
63 /* Enable extensions on AIX 3, Interix. */
64 #ifndef _ALL_SOURCE
65 # undef _ALL_SOURCE
66 #endif
67 /* Enable GNU extensions on systems that have them. */
68 #ifndef _GNU_SOURCE
69 # undef _GNU_SOURCE
70 #endif
71 /* Enable threading extensions on Solaris. */
72 #ifndef _POSIX_PTHREAD_SEMANTICS
73 # undef _POSIX_PTHREAD_SEMANTICS
74 #endif
75 /* Enable extensions on HP NonStop. */
76 #ifndef _TANDEM_SOURCE
77 # undef _TANDEM_SOURCE
78 #endif
79 /* Enable general extensions on Solaris. */
80 #ifndef __EXTENSIONS__
81 # undef __EXTENSIONS__
82 #endif
83
84
85 /* Version number of package */
86 #undef VERSION
87
88 /* Define to 1 if on MINIX. */
89 #undef _MINIX
90
91 /* Define to 2 if the system does not provide POSIX.1 features except with
92 this defined. */
93 #undef _POSIX_1_SOURCE
94
95 /* Define to 1 if you need to in order for `stat' and other things to work. */
96 #undef _POSIX_SOURCE
0 #! /bin/sh
1 # Configuration validation subroutine script.
2 # Copyright 1992-2013 Free Software Foundation, Inc.
3
4 timestamp='2013-04-24'
5
6 # This file is free software; you can redistribute it and/or modify it
7 # under the terms of the GNU General Public License as published by
8 # the Free Software Foundation; either version 3 of the License, or
9 # (at your option) any later version.
10 #
11 # This program is distributed in the hope that it will be useful, but
12 # WITHOUT ANY WARRANTY; without even the implied warranty of
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 # 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, see <http://www.gnu.org/licenses/>.
18 #
19 # As a special exception to the GNU General Public License, if you
20 # distribute this file as part of a program that contains a
21 # configuration script generated by Autoconf, you may include it under
22 # the same distribution terms that you use for the rest of that
23 # program. This Exception is an additional permission under section 7
24 # of the GNU General Public License, version 3 ("GPLv3").
25
26
27 # Please send patches with a ChangeLog entry to config-patches@gnu.org.
28 #
29 # Configuration subroutine to validate and canonicalize a configuration type.
30 # Supply the specified configuration type as an argument.
31 # If it is invalid, we print an error message on stderr and exit with code 1.
32 # Otherwise, we print the canonical config type on stdout and succeed.
33
34 # You can get the latest version of this script from:
35 # http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub;hb=HEAD
36
37 # This file is supposed to be the same for all GNU packages
38 # and recognize all the CPU types, system types and aliases
39 # that are meaningful with *any* GNU software.
40 # Each package is responsible for reporting which valid configurations
41 # it does not support. The user should be able to distinguish
42 # a failure to support a valid configuration from a meaningless
43 # configuration.
44
45 # The goal of this file is to map all the various variations of a given
46 # machine specification into a single specification in the form:
47 # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM
48 # or in some cases, the newer four-part form:
49 # CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM
50 # It is wrong to echo any other type of specification.
51
52 me=`echo "$0" | sed -e 's,.*/,,'`
53
54 usage="\
55 Usage: $0 [OPTION] CPU-MFR-OPSYS
56 $0 [OPTION] ALIAS
57
58 Canonicalize a configuration name.
59
60 Operation modes:
61 -h, --help print this help, then exit
62 -t, --time-stamp print date of last modification, then exit
63 -v, --version print version number, then exit
64
65 Report bugs and patches to <config-patches@gnu.org>."
66
67 version="\
68 GNU config.sub ($timestamp)
69
70 Copyright 1992-2013 Free Software Foundation, Inc.
71
72 This is free software; see the source for copying conditions. There is NO
73 warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
74
75 help="
76 Try \`$me --help' for more information."
77
78 # Parse command line
79 while test $# -gt 0 ; do
80 case $1 in
81 --time-stamp | --time* | -t )
82 echo "$timestamp" ; exit ;;
83 --version | -v )
84 echo "$version" ; exit ;;
85 --help | --h* | -h )
86 echo "$usage"; exit ;;
87 -- ) # Stop option processing
88 shift; break ;;
89 - ) # Use stdin as input.
90 break ;;
91 -* )
92 echo "$me: invalid option $1$help"
93 exit 1 ;;
94
95 *local*)
96 # First pass through any local machine types.
97 echo $1
98 exit ;;
99
100 * )
101 break ;;
102 esac
103 done
104
105 case $# in
106 0) echo "$me: missing argument$help" >&2
107 exit 1;;
108 1) ;;
109 *) echo "$me: too many arguments$help" >&2
110 exit 1;;
111 esac
112
113 # Separate what the user gave into CPU-COMPANY and OS or KERNEL-OS (if any).
114 # Here we must recognize all the valid KERNEL-OS combinations.
115 maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'`
116 case $maybe_os in
117 nto-qnx* | linux-gnu* | linux-android* | linux-dietlibc | linux-newlib* | \
118 linux-musl* | linux-uclibc* | uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | \
119 knetbsd*-gnu* | netbsd*-gnu* | \
120 kopensolaris*-gnu* | \
121 storm-chaos* | os2-emx* | rtmk-nova*)
122 os=-$maybe_os
123 basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'`
124 ;;
125 android-linux)
126 os=-linux-android
127 basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'`-unknown
128 ;;
129 *)
130 basic_machine=`echo $1 | sed 's/-[^-]*$//'`
131 if [ $basic_machine != $1 ]
132 then os=`echo $1 | sed 's/.*-/-/'`
133 else os=; fi
134 ;;
135 esac
136
137 ### Let's recognize common machines as not being operating systems so
138 ### that things like config.sub decstation-3100 work. We also
139 ### recognize some manufacturers as not being operating systems, so we
140 ### can provide default operating systems below.
141 case $os in
142 -sun*os*)
143 # Prevent following clause from handling this invalid input.
144 ;;
145 -dec* | -mips* | -sequent* | -encore* | -pc532* | -sgi* | -sony* | \
146 -att* | -7300* | -3300* | -delta* | -motorola* | -sun[234]* | \
147 -unicom* | -ibm* | -next | -hp | -isi* | -apollo | -altos* | \
148 -convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\
149 -c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \
150 -harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \
151 -apple | -axis | -knuth | -cray | -microblaze*)
152 os=
153 basic_machine=$1
154 ;;
155 -bluegene*)
156 os=-cnk
157 ;;
158 -sim | -cisco | -oki | -wec | -winbond)
159 os=
160 basic_machine=$1
161 ;;
162 -scout)
163 ;;
164 -wrs)
165 os=-vxworks
166 basic_machine=$1
167 ;;
168 -chorusos*)
169 os=-chorusos
170 basic_machine=$1
171 ;;
172 -chorusrdb)
173 os=-chorusrdb
174 basic_machine=$1
175 ;;
176 -hiux*)
177 os=-hiuxwe2
178 ;;
179 -sco6)
180 os=-sco5v6
181 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
182 ;;
183 -sco5)
184 os=-sco3.2v5
185 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
186 ;;
187 -sco4)
188 os=-sco3.2v4
189 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
190 ;;
191 -sco3.2.[4-9]*)
192 os=`echo $os | sed -e 's/sco3.2./sco3.2v/'`
193 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
194 ;;
195 -sco3.2v[4-9]*)
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 -sco5v6*)
200 # Don't forget version if it is 3.2v4 or newer.
201 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
202 ;;
203 -sco*)
204 os=-sco3.2v2
205 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
206 ;;
207 -udk*)
208 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
209 ;;
210 -isc)
211 os=-isc2.2
212 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
213 ;;
214 -clix*)
215 basic_machine=clipper-intergraph
216 ;;
217 -isc*)
218 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
219 ;;
220 -lynx*178)
221 os=-lynxos178
222 ;;
223 -lynx*5)
224 os=-lynxos5
225 ;;
226 -lynx*)
227 os=-lynxos
228 ;;
229 -ptx*)
230 basic_machine=`echo $1 | sed -e 's/86-.*/86-sequent/'`
231 ;;
232 -windowsnt*)
233 os=`echo $os | sed -e 's/windowsnt/winnt/'`
234 ;;
235 -psos*)
236 os=-psos
237 ;;
238 -mint | -mint[0-9]*)
239 basic_machine=m68k-atari
240 os=-mint
241 ;;
242 esac
243
244 # Decode aliases for certain CPU-COMPANY combinations.
245 case $basic_machine in
246 # Recognize the basic CPU types without company name.
247 # Some are omitted here because they have special meanings below.
248 1750a | 580 \
249 | a29k \
250 | aarch64 | aarch64_be \
251 | alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \
252 | alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \
253 | am33_2.0 \
254 | arc | arceb \
255 | arm | arm[bl]e | arme[lb] | armv[2-8] | armv[3-8][lb] | armv7[arm] \
256 | avr | avr32 \
257 | be32 | be64 \
258 | bfin \
259 | c4x | clipper \
260 | d10v | d30v | dlx | dsp16xx \
261 | epiphany \
262 | fido | fr30 | frv \
263 | h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \
264 | hexagon \
265 | i370 | i860 | i960 | ia64 \
266 | ip2k | iq2000 \
267 | le32 | le64 \
268 | lm32 \
269 | m32c | m32r | m32rle | m68000 | m68k | m88k \
270 | maxq | mb | microblaze | microblazeel | mcore | mep | metag \
271 | mips | mipsbe | mipseb | mipsel | mipsle \
272 | mips16 \
273 | mips64 | mips64el \
274 | mips64octeon | mips64octeonel \
275 | mips64orion | mips64orionel \
276 | mips64r5900 | mips64r5900el \
277 | mips64vr | mips64vrel \
278 | mips64vr4100 | mips64vr4100el \
279 | mips64vr4300 | mips64vr4300el \
280 | mips64vr5000 | mips64vr5000el \
281 | mips64vr5900 | mips64vr5900el \
282 | mipsisa32 | mipsisa32el \
283 | mipsisa32r2 | mipsisa32r2el \
284 | mipsisa64 | mipsisa64el \
285 | mipsisa64r2 | mipsisa64r2el \
286 | mipsisa64sb1 | mipsisa64sb1el \
287 | mipsisa64sr71k | mipsisa64sr71kel \
288 | mipsr5900 | mipsr5900el \
289 | mipstx39 | mipstx39el \
290 | mn10200 | mn10300 \
291 | moxie \
292 | mt \
293 | msp430 \
294 | nds32 | nds32le | nds32be \
295 | nios | nios2 | nios2eb | nios2el \
296 | ns16k | ns32k \
297 | open8 \
298 | or1k | or32 \
299 | pdp10 | pdp11 | pj | pjl \
300 | powerpc | powerpc64 | powerpc64le | powerpcle \
301 | pyramid \
302 | rl78 | rx \
303 | score \
304 | sh | sh[1234] | sh[24]a | sh[24]aeb | sh[23]e | sh[34]eb | sheb | shbe | shle | sh[1234]le | sh3ele \
305 | sh64 | sh64le \
306 | sparc | sparc64 | sparc64b | sparc64v | sparc86x | sparclet | sparclite \
307 | sparcv8 | sparcv9 | sparcv9b | sparcv9v \
308 | spu \
309 | tahoe | tic4x | tic54x | tic55x | tic6x | tic80 | tron \
310 | ubicom32 \
311 | v850 | v850e | v850e1 | v850e2 | v850es | v850e2v3 \
312 | we32k \
313 | x86 | xc16x | xstormy16 | xtensa \
314 | z8k | z80)
315 basic_machine=$basic_machine-unknown
316 ;;
317 c54x)
318 basic_machine=tic54x-unknown
319 ;;
320 c55x)
321 basic_machine=tic55x-unknown
322 ;;
323 c6x)
324 basic_machine=tic6x-unknown
325 ;;
326 m6811 | m68hc11 | m6812 | m68hc12 | m68hcs12x | picochip)
327 basic_machine=$basic_machine-unknown
328 os=-none
329 ;;
330 m88110 | m680[12346]0 | m683?2 | m68360 | m5200 | v70 | w65 | z8k)
331 ;;
332 ms1)
333 basic_machine=mt-unknown
334 ;;
335
336 strongarm | thumb | xscale)
337 basic_machine=arm-unknown
338 ;;
339 xgate)
340 basic_machine=$basic_machine-unknown
341 os=-none
342 ;;
343 xscaleeb)
344 basic_machine=armeb-unknown
345 ;;
346
347 xscaleel)
348 basic_machine=armel-unknown
349 ;;
350
351 # We use `pc' rather than `unknown'
352 # because (1) that's what they normally are, and
353 # (2) the word "unknown" tends to confuse beginning users.
354 i*86 | x86_64)
355 basic_machine=$basic_machine-pc
356 ;;
357 # Object if more than one company name word.
358 *-*-*)
359 echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2
360 exit 1
361 ;;
362 # Recognize the basic CPU types with company name.
363 580-* \
364 | a29k-* \
365 | aarch64-* | aarch64_be-* \
366 | alpha-* | alphaev[4-8]-* | alphaev56-* | alphaev6[78]-* \
367 | alpha64-* | alpha64ev[4-8]-* | alpha64ev56-* | alpha64ev6[78]-* \
368 | alphapca5[67]-* | alpha64pca5[67]-* | arc-* | arceb-* \
369 | arm-* | armbe-* | armle-* | armeb-* | armv*-* \
370 | avr-* | avr32-* \
371 | be32-* | be64-* \
372 | bfin-* | bs2000-* \
373 | c[123]* | c30-* | [cjt]90-* | c4x-* \
374 | clipper-* | craynv-* | cydra-* \
375 | d10v-* | d30v-* | dlx-* \
376 | elxsi-* \
377 | f30[01]-* | f700-* | fido-* | fr30-* | frv-* | fx80-* \
378 | h8300-* | h8500-* \
379 | hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \
380 | hexagon-* \
381 | i*86-* | i860-* | i960-* | ia64-* \
382 | ip2k-* | iq2000-* \
383 | le32-* | le64-* \
384 | lm32-* \
385 | m32c-* | m32r-* | m32rle-* \
386 | m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \
387 | m88110-* | m88k-* | maxq-* | mcore-* | metag-* \
388 | microblaze-* | microblazeel-* \
389 | mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \
390 | mips16-* \
391 | mips64-* | mips64el-* \
392 | mips64octeon-* | mips64octeonel-* \
393 | mips64orion-* | mips64orionel-* \
394 | mips64r5900-* | mips64r5900el-* \
395 | mips64vr-* | mips64vrel-* \
396 | mips64vr4100-* | mips64vr4100el-* \
397 | mips64vr4300-* | mips64vr4300el-* \
398 | mips64vr5000-* | mips64vr5000el-* \
399 | mips64vr5900-* | mips64vr5900el-* \
400 | mipsisa32-* | mipsisa32el-* \
401 | mipsisa32r2-* | mipsisa32r2el-* \
402 | mipsisa64-* | mipsisa64el-* \
403 | mipsisa64r2-* | mipsisa64r2el-* \
404 | mipsisa64sb1-* | mipsisa64sb1el-* \
405 | mipsisa64sr71k-* | mipsisa64sr71kel-* \
406 | mipsr5900-* | mipsr5900el-* \
407 | mipstx39-* | mipstx39el-* \
408 | mmix-* \
409 | mt-* \
410 | msp430-* \
411 | nds32-* | nds32le-* | nds32be-* \
412 | nios-* | nios2-* | nios2eb-* | nios2el-* \
413 | none-* | np1-* | ns16k-* | ns32k-* \
414 | open8-* \
415 | orion-* \
416 | pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \
417 | powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* \
418 | pyramid-* \
419 | rl78-* | romp-* | rs6000-* | rx-* \
420 | sh-* | sh[1234]-* | sh[24]a-* | sh[24]aeb-* | sh[23]e-* | sh[34]eb-* | sheb-* | shbe-* \
421 | shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \
422 | sparc-* | sparc64-* | sparc64b-* | sparc64v-* | sparc86x-* | sparclet-* \
423 | sparclite-* \
424 | sparcv8-* | sparcv9-* | sparcv9b-* | sparcv9v-* | sv1-* | sx?-* \
425 | tahoe-* \
426 | tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* \
427 | tile*-* \
428 | tron-* \
429 | ubicom32-* \
430 | v850-* | v850e-* | v850e1-* | v850es-* | v850e2-* | v850e2v3-* \
431 | vax-* \
432 | we32k-* \
433 | x86-* | x86_64-* | xc16x-* | xps100-* \
434 | xstormy16-* | xtensa*-* \
435 | ymp-* \
436 | z8k-* | z80-*)
437 ;;
438 # Recognize the basic CPU types without company name, with glob match.
439 xtensa*)
440 basic_machine=$basic_machine-unknown
441 ;;
442 # Recognize the various machine names and aliases which stand
443 # for a CPU type and a company and sometimes even an OS.
444 386bsd)
445 basic_machine=i386-unknown
446 os=-bsd
447 ;;
448 3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc)
449 basic_machine=m68000-att
450 ;;
451 3b*)
452 basic_machine=we32k-att
453 ;;
454 a29khif)
455 basic_machine=a29k-amd
456 os=-udi
457 ;;
458 abacus)
459 basic_machine=abacus-unknown
460 ;;
461 adobe68k)
462 basic_machine=m68010-adobe
463 os=-scout
464 ;;
465 alliant | fx80)
466 basic_machine=fx80-alliant
467 ;;
468 altos | altos3068)
469 basic_machine=m68k-altos
470 ;;
471 am29k)
472 basic_machine=a29k-none
473 os=-bsd
474 ;;
475 amd64)
476 basic_machine=x86_64-pc
477 ;;
478 amd64-*)
479 basic_machine=x86_64-`echo $basic_machine | sed 's/^[^-]*-//'`
480 ;;
481 amdahl)
482 basic_machine=580-amdahl
483 os=-sysv
484 ;;
485 amiga | amiga-*)
486 basic_machine=m68k-unknown
487 ;;
488 amigaos | amigados)
489 basic_machine=m68k-unknown
490 os=-amigaos
491 ;;
492 amigaunix | amix)
493 basic_machine=m68k-unknown
494 os=-sysv4
495 ;;
496 apollo68)
497 basic_machine=m68k-apollo
498 os=-sysv
499 ;;
500 apollo68bsd)
501 basic_machine=m68k-apollo
502 os=-bsd
503 ;;
504 aros)
505 basic_machine=i386-pc
506 os=-aros
507 ;;
508 aux)
509 basic_machine=m68k-apple
510 os=-aux
511 ;;
512 balance)
513 basic_machine=ns32k-sequent
514 os=-dynix
515 ;;
516 blackfin)
517 basic_machine=bfin-unknown
518 os=-linux
519 ;;
520 blackfin-*)
521 basic_machine=bfin-`echo $basic_machine | sed 's/^[^-]*-//'`
522 os=-linux
523 ;;
524 bluegene*)
525 basic_machine=powerpc-ibm
526 os=-cnk
527 ;;
528 c54x-*)
529 basic_machine=tic54x-`echo $basic_machine | sed 's/^[^-]*-//'`
530 ;;
531 c55x-*)
532 basic_machine=tic55x-`echo $basic_machine | sed 's/^[^-]*-//'`
533 ;;
534 c6x-*)
535 basic_machine=tic6x-`echo $basic_machine | sed 's/^[^-]*-//'`
536 ;;
537 c90)
538 basic_machine=c90-cray
539 os=-unicos
540 ;;
541 cegcc)
542 basic_machine=arm-unknown
543 os=-cegcc
544 ;;
545 convex-c1)
546 basic_machine=c1-convex
547 os=-bsd
548 ;;
549 convex-c2)
550 basic_machine=c2-convex
551 os=-bsd
552 ;;
553 convex-c32)
554 basic_machine=c32-convex
555 os=-bsd
556 ;;
557 convex-c34)
558 basic_machine=c34-convex
559 os=-bsd
560 ;;
561 convex-c38)
562 basic_machine=c38-convex
563 os=-bsd
564 ;;
565 cray | j90)
566 basic_machine=j90-cray
567 os=-unicos
568 ;;
569 craynv)
570 basic_machine=craynv-cray
571 os=-unicosmp
572 ;;
573 cr16 | cr16-*)
574 basic_machine=cr16-unknown
575 os=-elf
576 ;;
577 crds | unos)
578 basic_machine=m68k-crds
579 ;;
580 crisv32 | crisv32-* | etraxfs*)
581 basic_machine=crisv32-axis
582 ;;
583 cris | cris-* | etrax*)
584 basic_machine=cris-axis
585 ;;
586 crx)
587 basic_machine=crx-unknown
588 os=-elf
589 ;;
590 da30 | da30-*)
591 basic_machine=m68k-da30
592 ;;
593 decstation | decstation-3100 | pmax | pmax-* | pmin | dec3100 | decstatn)
594 basic_machine=mips-dec
595 ;;
596 decsystem10* | dec10*)
597 basic_machine=pdp10-dec
598 os=-tops10
599 ;;
600 decsystem20* | dec20*)
601 basic_machine=pdp10-dec
602 os=-tops20
603 ;;
604 delta | 3300 | motorola-3300 | motorola-delta \
605 | 3300-motorola | delta-motorola)
606 basic_machine=m68k-motorola
607 ;;
608 delta88)
609 basic_machine=m88k-motorola
610 os=-sysv3
611 ;;
612 dicos)
613 basic_machine=i686-pc
614 os=-dicos
615 ;;
616 djgpp)
617 basic_machine=i586-pc
618 os=-msdosdjgpp
619 ;;
620 dpx20 | dpx20-*)
621 basic_machine=rs6000-bull
622 os=-bosx
623 ;;
624 dpx2* | dpx2*-bull)
625 basic_machine=m68k-bull
626 os=-sysv3
627 ;;
628 ebmon29k)
629 basic_machine=a29k-amd
630 os=-ebmon
631 ;;
632 elxsi)
633 basic_machine=elxsi-elxsi
634 os=-bsd
635 ;;
636 encore | umax | mmax)
637 basic_machine=ns32k-encore
638 ;;
639 es1800 | OSE68k | ose68k | ose | OSE)
640 basic_machine=m68k-ericsson
641 os=-ose
642 ;;
643 fx2800)
644 basic_machine=i860-alliant
645 ;;
646 genix)
647 basic_machine=ns32k-ns
648 ;;
649 gmicro)
650 basic_machine=tron-gmicro
651 os=-sysv
652 ;;
653 go32)
654 basic_machine=i386-pc
655 os=-go32
656 ;;
657 h3050r* | hiux*)
658 basic_machine=hppa1.1-hitachi
659 os=-hiuxwe2
660 ;;
661 h8300hms)
662 basic_machine=h8300-hitachi
663 os=-hms
664 ;;
665 h8300xray)
666 basic_machine=h8300-hitachi
667 os=-xray
668 ;;
669 h8500hms)
670 basic_machine=h8500-hitachi
671 os=-hms
672 ;;
673 harris)
674 basic_machine=m88k-harris
675 os=-sysv3
676 ;;
677 hp300-*)
678 basic_machine=m68k-hp
679 ;;
680 hp300bsd)
681 basic_machine=m68k-hp
682 os=-bsd
683 ;;
684 hp300hpux)
685 basic_machine=m68k-hp
686 os=-hpux
687 ;;
688 hp3k9[0-9][0-9] | hp9[0-9][0-9])
689 basic_machine=hppa1.0-hp
690 ;;
691 hp9k2[0-9][0-9] | hp9k31[0-9])
692 basic_machine=m68000-hp
693 ;;
694 hp9k3[2-9][0-9])
695 basic_machine=m68k-hp
696 ;;
697 hp9k6[0-9][0-9] | hp6[0-9][0-9])
698 basic_machine=hppa1.0-hp
699 ;;
700 hp9k7[0-79][0-9] | hp7[0-79][0-9])
701 basic_machine=hppa1.1-hp
702 ;;
703 hp9k78[0-9] | hp78[0-9])
704 # FIXME: really hppa2.0-hp
705 basic_machine=hppa1.1-hp
706 ;;
707 hp9k8[67]1 | hp8[67]1 | hp9k80[24] | hp80[24] | hp9k8[78]9 | hp8[78]9 | hp9k893 | hp893)
708 # FIXME: really hppa2.0-hp
709 basic_machine=hppa1.1-hp
710 ;;
711 hp9k8[0-9][13679] | hp8[0-9][13679])
712 basic_machine=hppa1.1-hp
713 ;;
714 hp9k8[0-9][0-9] | hp8[0-9][0-9])
715 basic_machine=hppa1.0-hp
716 ;;
717 hppa-next)
718 os=-nextstep3
719 ;;
720 hppaosf)
721 basic_machine=hppa1.1-hp
722 os=-osf
723 ;;
724 hppro)
725 basic_machine=hppa1.1-hp
726 os=-proelf
727 ;;
728 i370-ibm* | ibm*)
729 basic_machine=i370-ibm
730 ;;
731 i*86v32)
732 basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
733 os=-sysv32
734 ;;
735 i*86v4*)
736 basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
737 os=-sysv4
738 ;;
739 i*86v)
740 basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
741 os=-sysv
742 ;;
743 i*86sol2)
744 basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
745 os=-solaris2
746 ;;
747 i386mach)
748 basic_machine=i386-mach
749 os=-mach
750 ;;
751 i386-vsta | vsta)
752 basic_machine=i386-unknown
753 os=-vsta
754 ;;
755 iris | iris4d)
756 basic_machine=mips-sgi
757 case $os in
758 -irix*)
759 ;;
760 *)
761 os=-irix4
762 ;;
763 esac
764 ;;
765 isi68 | isi)
766 basic_machine=m68k-isi
767 os=-sysv
768 ;;
769 m68knommu)
770 basic_machine=m68k-unknown
771 os=-linux
772 ;;
773 m68knommu-*)
774 basic_machine=m68k-`echo $basic_machine | sed 's/^[^-]*-//'`
775 os=-linux
776 ;;
777 m88k-omron*)
778 basic_machine=m88k-omron
779 ;;
780 magnum | m3230)
781 basic_machine=mips-mips
782 os=-sysv
783 ;;
784 merlin)
785 basic_machine=ns32k-utek
786 os=-sysv
787 ;;
788 microblaze*)
789 basic_machine=microblaze-xilinx
790 ;;
791 mingw64)
792 basic_machine=x86_64-pc
793 os=-mingw64
794 ;;
795 mingw32)
796 basic_machine=i386-pc
797 os=-mingw32
798 ;;
799 mingw32ce)
800 basic_machine=arm-unknown
801 os=-mingw32ce
802 ;;
803 miniframe)
804 basic_machine=m68000-convergent
805 ;;
806 *mint | -mint[0-9]* | *MiNT | *MiNT[0-9]*)
807 basic_machine=m68k-atari
808 os=-mint
809 ;;
810 mips3*-*)
811 basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`
812 ;;
813 mips3*)
814 basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`-unknown
815 ;;
816 monitor)
817 basic_machine=m68k-rom68k
818 os=-coff
819 ;;
820 morphos)
821 basic_machine=powerpc-unknown
822 os=-morphos
823 ;;
824 msdos)
825 basic_machine=i386-pc
826 os=-msdos
827 ;;
828 ms1-*)
829 basic_machine=`echo $basic_machine | sed -e 's/ms1-/mt-/'`
830 ;;
831 msys)
832 basic_machine=i386-pc
833 os=-msys
834 ;;
835 mvs)
836 basic_machine=i370-ibm
837 os=-mvs
838 ;;
839 nacl)
840 basic_machine=le32-unknown
841 os=-nacl
842 ;;
843 ncr3000)
844 basic_machine=i486-ncr
845 os=-sysv4
846 ;;
847 netbsd386)
848 basic_machine=i386-unknown
849 os=-netbsd
850 ;;
851 netwinder)
852 basic_machine=armv4l-rebel
853 os=-linux
854 ;;
855 news | news700 | news800 | news900)
856 basic_machine=m68k-sony
857 os=-newsos
858 ;;
859 news1000)
860 basic_machine=m68030-sony
861 os=-newsos
862 ;;
863 news-3600 | risc-news)
864 basic_machine=mips-sony
865 os=-newsos
866 ;;
867 necv70)
868 basic_machine=v70-nec
869 os=-sysv
870 ;;
871 next | m*-next )
872 basic_machine=m68k-next
873 case $os in
874 -nextstep* )
875 ;;
876 -ns2*)
877 os=-nextstep2
878 ;;
879 *)
880 os=-nextstep3
881 ;;
882 esac
883 ;;
884 nh3000)
885 basic_machine=m68k-harris
886 os=-cxux
887 ;;
888 nh[45]000)
889 basic_machine=m88k-harris
890 os=-cxux
891 ;;
892 nindy960)
893 basic_machine=i960-intel
894 os=-nindy
895 ;;
896 mon960)
897 basic_machine=i960-intel
898 os=-mon960
899 ;;
900 nonstopux)
901 basic_machine=mips-compaq
902 os=-nonstopux
903 ;;
904 np1)
905 basic_machine=np1-gould
906 ;;
907 neo-tandem)
908 basic_machine=neo-tandem
909 ;;
910 nse-tandem)
911 basic_machine=nse-tandem
912 ;;
913 nsr-tandem)
914 basic_machine=nsr-tandem
915 ;;
916 op50n-* | op60c-*)
917 basic_machine=hppa1.1-oki
918 os=-proelf
919 ;;
920 openrisc | openrisc-*)
921 basic_machine=or32-unknown
922 ;;
923 os400)
924 basic_machine=powerpc-ibm
925 os=-os400
926 ;;
927 OSE68000 | ose68000)
928 basic_machine=m68000-ericsson
929 os=-ose
930 ;;
931 os68k)
932 basic_machine=m68k-none
933 os=-os68k
934 ;;
935 pa-hitachi)
936 basic_machine=hppa1.1-hitachi
937 os=-hiuxwe2
938 ;;
939 paragon)
940 basic_machine=i860-intel
941 os=-osf
942 ;;
943 parisc)
944 basic_machine=hppa-unknown
945 os=-linux
946 ;;
947 parisc-*)
948 basic_machine=hppa-`echo $basic_machine | sed 's/^[^-]*-//'`
949 os=-linux
950 ;;
951 pbd)
952 basic_machine=sparc-tti
953 ;;
954 pbb)
955 basic_machine=m68k-tti
956 ;;
957 pc532 | pc532-*)
958 basic_machine=ns32k-pc532
959 ;;
960 pc98)
961 basic_machine=i386-pc
962 ;;
963 pc98-*)
964 basic_machine=i386-`echo $basic_machine | sed 's/^[^-]*-//'`
965 ;;
966 pentium | p5 | k5 | k6 | nexgen | viac3)
967 basic_machine=i586-pc
968 ;;
969 pentiumpro | p6 | 6x86 | athlon | athlon_*)
970 basic_machine=i686-pc
971 ;;
972 pentiumii | pentium2 | pentiumiii | pentium3)
973 basic_machine=i686-pc
974 ;;
975 pentium4)
976 basic_machine=i786-pc
977 ;;
978 pentium-* | p5-* | k5-* | k6-* | nexgen-* | viac3-*)
979 basic_machine=i586-`echo $basic_machine | sed 's/^[^-]*-//'`
980 ;;
981 pentiumpro-* | p6-* | 6x86-* | athlon-*)
982 basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'`
983 ;;
984 pentiumii-* | pentium2-* | pentiumiii-* | pentium3-*)
985 basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'`
986 ;;
987 pentium4-*)
988 basic_machine=i786-`echo $basic_machine | sed 's/^[^-]*-//'`
989 ;;
990 pn)
991 basic_machine=pn-gould
992 ;;
993 power) basic_machine=power-ibm
994 ;;
995 ppc | ppcbe) basic_machine=powerpc-unknown
996 ;;
997 ppc-* | ppcbe-*)
998 basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'`
999 ;;
1000 ppcle | powerpclittle | ppc-le | powerpc-little)
1001 basic_machine=powerpcle-unknown
1002 ;;
1003 ppcle-* | powerpclittle-*)
1004 basic_machine=powerpcle-`echo $basic_machine | sed 's/^[^-]*-//'`
1005 ;;
1006 ppc64) basic_machine=powerpc64-unknown
1007 ;;
1008 ppc64-*) basic_machine=powerpc64-`echo $basic_machine | sed 's/^[^-]*-//'`
1009 ;;
1010 ppc64le | powerpc64little | ppc64-le | powerpc64-little)
1011 basic_machine=powerpc64le-unknown
1012 ;;
1013 ppc64le-* | powerpc64little-*)
1014 basic_machine=powerpc64le-`echo $basic_machine | sed 's/^[^-]*-//'`
1015 ;;
1016 ps2)
1017 basic_machine=i386-ibm
1018 ;;
1019 pw32)
1020 basic_machine=i586-unknown
1021 os=-pw32
1022 ;;
1023 rdos | rdos64)
1024 basic_machine=x86_64-pc
1025 os=-rdos
1026 ;;
1027 rdos32)
1028 basic_machine=i386-pc
1029 os=-rdos
1030 ;;
1031 rom68k)
1032 basic_machine=m68k-rom68k
1033 os=-coff
1034 ;;
1035 rm[46]00)
1036 basic_machine=mips-siemens
1037 ;;
1038 rtpc | rtpc-*)
1039 basic_machine=romp-ibm
1040 ;;
1041 s390 | s390-*)
1042 basic_machine=s390-ibm
1043 ;;
1044 s390x | s390x-*)
1045 basic_machine=s390x-ibm
1046 ;;
1047 sa29200)
1048 basic_machine=a29k-amd
1049 os=-udi
1050 ;;
1051 sb1)
1052 basic_machine=mipsisa64sb1-unknown
1053 ;;
1054 sb1el)
1055 basic_machine=mipsisa64sb1el-unknown
1056 ;;
1057 sde)
1058 basic_machine=mipsisa32-sde
1059 os=-elf
1060 ;;
1061 sei)
1062 basic_machine=mips-sei
1063 os=-seiux
1064 ;;
1065 sequent)
1066 basic_machine=i386-sequent
1067 ;;
1068 sh)
1069 basic_machine=sh-hitachi
1070 os=-hms
1071 ;;
1072 sh5el)
1073 basic_machine=sh5le-unknown
1074 ;;
1075 sh64)
1076 basic_machine=sh64-unknown
1077 ;;
1078 sparclite-wrs | simso-wrs)
1079 basic_machine=sparclite-wrs
1080 os=-vxworks
1081 ;;
1082 sps7)
1083 basic_machine=m68k-bull
1084 os=-sysv2
1085 ;;
1086 spur)
1087 basic_machine=spur-unknown
1088 ;;
1089 st2000)
1090 basic_machine=m68k-tandem
1091 ;;
1092 stratus)
1093 basic_machine=i860-stratus
1094 os=-sysv4
1095 ;;
1096 strongarm-* | thumb-*)
1097 basic_machine=arm-`echo $basic_machine | sed 's/^[^-]*-//'`
1098 ;;
1099 sun2)
1100 basic_machine=m68000-sun
1101 ;;
1102 sun2os3)
1103 basic_machine=m68000-sun
1104 os=-sunos3
1105 ;;
1106 sun2os4)
1107 basic_machine=m68000-sun
1108 os=-sunos4
1109 ;;
1110 sun3os3)
1111 basic_machine=m68k-sun
1112 os=-sunos3
1113 ;;
1114 sun3os4)
1115 basic_machine=m68k-sun
1116 os=-sunos4
1117 ;;
1118 sun4os3)
1119 basic_machine=sparc-sun
1120 os=-sunos3
1121 ;;
1122 sun4os4)
1123 basic_machine=sparc-sun
1124 os=-sunos4
1125 ;;
1126 sun4sol2)
1127 basic_machine=sparc-sun
1128 os=-solaris2
1129 ;;
1130 sun3 | sun3-*)
1131 basic_machine=m68k-sun
1132 ;;
1133 sun4)
1134 basic_machine=sparc-sun
1135 ;;
1136 sun386 | sun386i | roadrunner)
1137 basic_machine=i386-sun
1138 ;;
1139 sv1)
1140 basic_machine=sv1-cray
1141 os=-unicos
1142 ;;
1143 symmetry)
1144 basic_machine=i386-sequent
1145 os=-dynix
1146 ;;
1147 t3e)
1148 basic_machine=alphaev5-cray
1149 os=-unicos
1150 ;;
1151 t90)
1152 basic_machine=t90-cray
1153 os=-unicos
1154 ;;
1155 tile*)
1156 basic_machine=$basic_machine-unknown
1157 os=-linux-gnu
1158 ;;
1159 tx39)
1160 basic_machine=mipstx39-unknown
1161 ;;
1162 tx39el)
1163 basic_machine=mipstx39el-unknown
1164 ;;
1165 toad1)
1166 basic_machine=pdp10-xkl
1167 os=-tops20
1168 ;;
1169 tower | tower-32)
1170 basic_machine=m68k-ncr
1171 ;;
1172 tpf)
1173 basic_machine=s390x-ibm
1174 os=-tpf
1175 ;;
1176 udi29k)
1177 basic_machine=a29k-amd
1178 os=-udi
1179 ;;
1180 ultra3)
1181 basic_machine=a29k-nyu
1182 os=-sym1
1183 ;;
1184 v810 | necv810)
1185 basic_machine=v810-nec
1186 os=-none
1187 ;;
1188 vaxv)
1189 basic_machine=vax-dec
1190 os=-sysv
1191 ;;
1192 vms)
1193 basic_machine=vax-dec
1194 os=-vms
1195 ;;
1196 vpp*|vx|vx-*)
1197 basic_machine=f301-fujitsu
1198 ;;
1199 vxworks960)
1200 basic_machine=i960-wrs
1201 os=-vxworks
1202 ;;
1203 vxworks68)
1204 basic_machine=m68k-wrs
1205 os=-vxworks
1206 ;;
1207 vxworks29k)
1208 basic_machine=a29k-wrs
1209 os=-vxworks
1210 ;;
1211 w65*)
1212 basic_machine=w65-wdc
1213 os=-none
1214 ;;
1215 w89k-*)
1216 basic_machine=hppa1.1-winbond
1217 os=-proelf
1218 ;;
1219 xbox)
1220 basic_machine=i686-pc
1221 os=-mingw32
1222 ;;
1223 xps | xps100)
1224 basic_machine=xps100-honeywell
1225 ;;
1226 xscale-* | xscalee[bl]-*)
1227 basic_machine=`echo $basic_machine | sed 's/^xscale/arm/'`
1228 ;;
1229 ymp)
1230 basic_machine=ymp-cray
1231 os=-unicos
1232 ;;
1233 z8k-*-coff)
1234 basic_machine=z8k-unknown
1235 os=-sim
1236 ;;
1237 z80-*-coff)
1238 basic_machine=z80-unknown
1239 os=-sim
1240 ;;
1241 none)
1242 basic_machine=none-none
1243 os=-none
1244 ;;
1245
1246 # Here we handle the default manufacturer of certain CPU types. It is in
1247 # some cases the only manufacturer, in others, it is the most popular.
1248 w89k)
1249 basic_machine=hppa1.1-winbond
1250 ;;
1251 op50n)
1252 basic_machine=hppa1.1-oki
1253 ;;
1254 op60c)
1255 basic_machine=hppa1.1-oki
1256 ;;
1257 romp)
1258 basic_machine=romp-ibm
1259 ;;
1260 mmix)
1261 basic_machine=mmix-knuth
1262 ;;
1263 rs6000)
1264 basic_machine=rs6000-ibm
1265 ;;
1266 vax)
1267 basic_machine=vax-dec
1268 ;;
1269 pdp10)
1270 # there are many clones, so DEC is not a safe bet
1271 basic_machine=pdp10-unknown
1272 ;;
1273 pdp11)
1274 basic_machine=pdp11-dec
1275 ;;
1276 we32k)
1277 basic_machine=we32k-att
1278 ;;
1279 sh[1234] | sh[24]a | sh[24]aeb | sh[34]eb | sh[1234]le | sh[23]ele)
1280 basic_machine=sh-unknown
1281 ;;
1282 sparc | sparcv8 | sparcv9 | sparcv9b | sparcv9v)
1283 basic_machine=sparc-sun
1284 ;;
1285 cydra)
1286 basic_machine=cydra-cydrome
1287 ;;
1288 orion)
1289 basic_machine=orion-highlevel
1290 ;;
1291 orion105)
1292 basic_machine=clipper-highlevel
1293 ;;
1294 mac | mpw | mac-mpw)
1295 basic_machine=m68k-apple
1296 ;;
1297 pmac | pmac-mpw)
1298 basic_machine=powerpc-apple
1299 ;;
1300 *-unknown)
1301 # Make sure to match an already-canonicalized machine name.
1302 ;;
1303 *)
1304 echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2
1305 exit 1
1306 ;;
1307 esac
1308
1309 # Here we canonicalize certain aliases for manufacturers.
1310 case $basic_machine in
1311 *-digital*)
1312 basic_machine=`echo $basic_machine | sed 's/digital.*/dec/'`
1313 ;;
1314 *-commodore*)
1315 basic_machine=`echo $basic_machine | sed 's/commodore.*/cbm/'`
1316 ;;
1317 *)
1318 ;;
1319 esac
1320
1321 # Decode manufacturer-specific aliases for certain operating systems.
1322
1323 if [ x"$os" != x"" ]
1324 then
1325 case $os in
1326 # First match some system type aliases
1327 # that might get confused with valid system types.
1328 # -solaris* is a basic system type, with this one exception.
1329 -auroraux)
1330 os=-auroraux
1331 ;;
1332 -solaris1 | -solaris1.*)
1333 os=`echo $os | sed -e 's|solaris1|sunos4|'`
1334 ;;
1335 -solaris)
1336 os=-solaris2
1337 ;;
1338 -svr4*)
1339 os=-sysv4
1340 ;;
1341 -unixware*)
1342 os=-sysv4.2uw
1343 ;;
1344 -gnu/linux*)
1345 os=`echo $os | sed -e 's|gnu/linux|linux-gnu|'`
1346 ;;
1347 # First accept the basic system types.
1348 # The portable systems comes first.
1349 # Each alternative MUST END IN A *, to match a version number.
1350 # -sysv* is not here because it comes later, after sysvr4.
1351 -gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \
1352 | -*vms* | -sco* | -esix* | -isc* | -aix* | -cnk* | -sunos | -sunos[34]*\
1353 | -hpux* | -unos* | -osf* | -luna* | -dgux* | -auroraux* | -solaris* \
1354 | -sym* | -kopensolaris* | -plan9* \
1355 | -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \
1356 | -aos* | -aros* \
1357 | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \
1358 | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \
1359 | -hiux* | -386bsd* | -knetbsd* | -mirbsd* | -netbsd* \
1360 | -bitrig* | -openbsd* | -solidbsd* \
1361 | -ekkobsd* | -kfreebsd* | -freebsd* | -riscix* | -lynxos* \
1362 | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \
1363 | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \
1364 | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \
1365 | -chorusos* | -chorusrdb* | -cegcc* \
1366 | -cygwin* | -msys* | -pe* | -psos* | -moss* | -proelf* | -rtems* \
1367 | -mingw32* | -mingw64* | -linux-gnu* | -linux-android* \
1368 | -linux-newlib* | -linux-musl* | -linux-uclibc* \
1369 | -uxpv* | -beos* | -mpeix* | -udk* \
1370 | -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \
1371 | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \
1372 | -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \
1373 | -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \
1374 | -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \
1375 | -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly* \
1376 | -skyos* | -haiku* | -rdos* | -toppers* | -drops* | -es*)
1377 # Remember, each alternative MUST END IN *, to match a version number.
1378 ;;
1379 -qnx*)
1380 case $basic_machine in
1381 x86-* | i*86-*)
1382 ;;
1383 *)
1384 os=-nto$os
1385 ;;
1386 esac
1387 ;;
1388 -nto-qnx*)
1389 ;;
1390 -nto*)
1391 os=`echo $os | sed -e 's|nto|nto-qnx|'`
1392 ;;
1393 -sim | -es1800* | -hms* | -xray | -os68k* | -none* | -v88r* \
1394 | -windows* | -osx | -abug | -netware* | -os9* | -beos* | -haiku* \
1395 | -macos* | -mpw* | -magic* | -mmixware* | -mon960* | -lnews*)
1396 ;;
1397 -mac*)
1398 os=`echo $os | sed -e 's|mac|macos|'`
1399 ;;
1400 -linux-dietlibc)
1401 os=-linux-dietlibc
1402 ;;
1403 -linux*)
1404 os=`echo $os | sed -e 's|linux|linux-gnu|'`
1405 ;;
1406 -sunos5*)
1407 os=`echo $os | sed -e 's|sunos5|solaris2|'`
1408 ;;
1409 -sunos6*)
1410 os=`echo $os | sed -e 's|sunos6|solaris3|'`
1411 ;;
1412 -opened*)
1413 os=-openedition
1414 ;;
1415 -os400*)
1416 os=-os400
1417 ;;
1418 -wince*)
1419 os=-wince
1420 ;;
1421 -osfrose*)
1422 os=-osfrose
1423 ;;
1424 -osf*)
1425 os=-osf
1426 ;;
1427 -utek*)
1428 os=-bsd
1429 ;;
1430 -dynix*)
1431 os=-bsd
1432 ;;
1433 -acis*)
1434 os=-aos
1435 ;;
1436 -atheos*)
1437 os=-atheos
1438 ;;
1439 -syllable*)
1440 os=-syllable
1441 ;;
1442 -386bsd)
1443 os=-bsd
1444 ;;
1445 -ctix* | -uts*)
1446 os=-sysv
1447 ;;
1448 -nova*)
1449 os=-rtmk-nova
1450 ;;
1451 -ns2 )
1452 os=-nextstep2
1453 ;;
1454 -nsk*)
1455 os=-nsk
1456 ;;
1457 # Preserve the version number of sinix5.
1458 -sinix5.*)
1459 os=`echo $os | sed -e 's|sinix|sysv|'`
1460 ;;
1461 -sinix*)
1462 os=-sysv4
1463 ;;
1464 -tpf*)
1465 os=-tpf
1466 ;;
1467 -triton*)
1468 os=-sysv3
1469 ;;
1470 -oss*)
1471 os=-sysv3
1472 ;;
1473 -svr4)
1474 os=-sysv4
1475 ;;
1476 -svr3)
1477 os=-sysv3
1478 ;;
1479 -sysvr4)
1480 os=-sysv4
1481 ;;
1482 # This must come after -sysvr4.
1483 -sysv*)
1484 ;;
1485 -ose*)
1486 os=-ose
1487 ;;
1488 -es1800*)
1489 os=-ose
1490 ;;
1491 -xenix)
1492 os=-xenix
1493 ;;
1494 -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*)
1495 os=-mint
1496 ;;
1497 -aros*)
1498 os=-aros
1499 ;;
1500 -zvmoe)
1501 os=-zvmoe
1502 ;;
1503 -dicos*)
1504 os=-dicos
1505 ;;
1506 -nacl*)
1507 ;;
1508 -none)
1509 ;;
1510 *)
1511 # Get rid of the `-' at the beginning of $os.
1512 os=`echo $os | sed 's/[^-]*-//'`
1513 echo Invalid configuration \`$1\': system \`$os\' not recognized 1>&2
1514 exit 1
1515 ;;
1516 esac
1517 else
1518
1519 # Here we handle the default operating systems that come with various machines.
1520 # The value should be what the vendor currently ships out the door with their
1521 # machine or put another way, the most popular os provided with the machine.
1522
1523 # Note that if you're going to try to match "-MANUFACTURER" here (say,
1524 # "-sun"), then you have to tell the case statement up towards the top
1525 # that MANUFACTURER isn't an operating system. Otherwise, code above
1526 # will signal an error saying that MANUFACTURER isn't an operating
1527 # system, and we'll never get to this point.
1528
1529 case $basic_machine in
1530 score-*)
1531 os=-elf
1532 ;;
1533 spu-*)
1534 os=-elf
1535 ;;
1536 *-acorn)
1537 os=-riscix1.2
1538 ;;
1539 arm*-rebel)
1540 os=-linux
1541 ;;
1542 arm*-semi)
1543 os=-aout
1544 ;;
1545 c4x-* | tic4x-*)
1546 os=-coff
1547 ;;
1548 hexagon-*)
1549 os=-elf
1550 ;;
1551 tic54x-*)
1552 os=-coff
1553 ;;
1554 tic55x-*)
1555 os=-coff
1556 ;;
1557 tic6x-*)
1558 os=-coff
1559 ;;
1560 # This must come before the *-dec entry.
1561 pdp10-*)
1562 os=-tops20
1563 ;;
1564 pdp11-*)
1565 os=-none
1566 ;;
1567 *-dec | vax-*)
1568 os=-ultrix4.2
1569 ;;
1570 m68*-apollo)
1571 os=-domain
1572 ;;
1573 i386-sun)
1574 os=-sunos4.0.2
1575 ;;
1576 m68000-sun)
1577 os=-sunos3
1578 ;;
1579 m68*-cisco)
1580 os=-aout
1581 ;;
1582 mep-*)
1583 os=-elf
1584 ;;
1585 mips*-cisco)
1586 os=-elf
1587 ;;
1588 mips*-*)
1589 os=-elf
1590 ;;
1591 or1k-*)
1592 os=-elf
1593 ;;
1594 or32-*)
1595 os=-coff
1596 ;;
1597 *-tti) # must be before sparc entry or we get the wrong os.
1598 os=-sysv3
1599 ;;
1600 sparc-* | *-sun)
1601 os=-sunos4.1.1
1602 ;;
1603 *-be)
1604 os=-beos
1605 ;;
1606 *-haiku)
1607 os=-haiku
1608 ;;
1609 *-ibm)
1610 os=-aix
1611 ;;
1612 *-knuth)
1613 os=-mmixware
1614 ;;
1615 *-wec)
1616 os=-proelf
1617 ;;
1618 *-winbond)
1619 os=-proelf
1620 ;;
1621 *-oki)
1622 os=-proelf
1623 ;;
1624 *-hp)
1625 os=-hpux
1626 ;;
1627 *-hitachi)
1628 os=-hiux
1629 ;;
1630 i860-* | *-att | *-ncr | *-altos | *-motorola | *-convergent)
1631 os=-sysv
1632 ;;
1633 *-cbm)
1634 os=-amigaos
1635 ;;
1636 *-dg)
1637 os=-dgux
1638 ;;
1639 *-dolphin)
1640 os=-sysv3
1641 ;;
1642 m68k-ccur)
1643 os=-rtu
1644 ;;
1645 m88k-omron*)
1646 os=-luna
1647 ;;
1648 *-next )
1649 os=-nextstep
1650 ;;
1651 *-sequent)
1652 os=-ptx
1653 ;;
1654 *-crds)
1655 os=-unos
1656 ;;
1657 *-ns)
1658 os=-genix
1659 ;;
1660 i370-*)
1661 os=-mvs
1662 ;;
1663 *-next)
1664 os=-nextstep3
1665 ;;
1666 *-gould)
1667 os=-sysv
1668 ;;
1669 *-highlevel)
1670 os=-bsd
1671 ;;
1672 *-encore)
1673 os=-bsd
1674 ;;
1675 *-sgi)
1676 os=-irix
1677 ;;
1678 *-siemens)
1679 os=-sysv4
1680 ;;
1681 *-masscomp)
1682 os=-rtu
1683 ;;
1684 f30[01]-fujitsu | f700-fujitsu)
1685 os=-uxpv
1686 ;;
1687 *-rom68k)
1688 os=-coff
1689 ;;
1690 *-*bug)
1691 os=-coff
1692 ;;
1693 *-apple)
1694 os=-macos
1695 ;;
1696 *-atari*)
1697 os=-mint
1698 ;;
1699 *)
1700 os=-none
1701 ;;
1702 esac
1703 fi
1704
1705 # Here we handle the case where we know the os, and the CPU type, but not the
1706 # manufacturer. We pick the logical manufacturer.
1707 vendor=unknown
1708 case $basic_machine in
1709 *-unknown)
1710 case $os in
1711 -riscix*)
1712 vendor=acorn
1713 ;;
1714 -sunos*)
1715 vendor=sun
1716 ;;
1717 -cnk*|-aix*)
1718 vendor=ibm
1719 ;;
1720 -beos*)
1721 vendor=be
1722 ;;
1723 -hpux*)
1724 vendor=hp
1725 ;;
1726 -mpeix*)
1727 vendor=hp
1728 ;;
1729 -hiux*)
1730 vendor=hitachi
1731 ;;
1732 -unos*)
1733 vendor=crds
1734 ;;
1735 -dgux*)
1736 vendor=dg
1737 ;;
1738 -luna*)
1739 vendor=omron
1740 ;;
1741 -genix*)
1742 vendor=ns
1743 ;;
1744 -mvs* | -opened*)
1745 vendor=ibm
1746 ;;
1747 -os400*)
1748 vendor=ibm
1749 ;;
1750 -ptx*)
1751 vendor=sequent
1752 ;;
1753 -tpf*)
1754 vendor=ibm
1755 ;;
1756 -vxsim* | -vxworks* | -windiss*)
1757 vendor=wrs
1758 ;;
1759 -aux*)
1760 vendor=apple
1761 ;;
1762 -hms*)
1763 vendor=hitachi
1764 ;;
1765 -mpw* | -macos*)
1766 vendor=apple
1767 ;;
1768 -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*)
1769 vendor=atari
1770 ;;
1771 -vos*)
1772 vendor=stratus
1773 ;;
1774 esac
1775 basic_machine=`echo $basic_machine | sed "s/unknown/$vendor/"`
1776 ;;
1777 esac
1778
1779 echo $basic_machine$os
1780 exit
1781
1782 # Local variables:
1783 # eval: (add-hook 'write-file-hooks 'time-stamp)
1784 # time-stamp-start: "timestamp='"
1785 # time-stamp-format: "%:y-%02m-%02d"
1786 # time-stamp-end: "'"
1787 # End:
0 dnl Process this file with autoconf to produce a configure script.
1 AC_INIT(libnss_nisplus, 1.0)
2 AM_INIT_AUTOMAKE
3 AC_CONFIG_SRCDIR([src/nisplus-pwd.c])
4 AM_CONFIG_HEADER(config.h)
5 AC_CONFIG_MACRO_DIR([m4])
6 AC_PREFIX_DEFAULT(/usr)
7
8 AC_SUBST(PACKAGE)
9 AC_SUBST(VERSION)
10
11 dnl Checks for programs.
12 AC_PROG_CC
13 AC_GNU_SOURCE
14 AM_PROG_CC_C_O
15 dnl If we're using gcc, we want warning flags
16 dnl test -n "$GCC" && WARNFLAGS="-Wall"
17 test -n "$GCC" && WARNFLAGS="-W -Wall -Wbad-function-cast -Wcast-align -Winline -Wnested-externs -Wshadow -Wmissing-declarations -Wmissing-prototypes -Wstrict-prototypes -Wundef -Werror"
18 AC_SUBST(WARNFLAGS)
19 AC_PROG_CPP
20 AC_ISC_POSIX
21 AC_PROG_INSTALL
22 AC_PROG_MAKE_SET
23 AC_PROG_LIBTOOL
24 LT_INIT
25
26 dnl Checks for libraries.
27 PKG_CHECK_MODULES([LIBNSL], [libnsl], [], [AC_CHECK_LIB([nsl],[yp_match],[LIBNSL_LIBS="-lnsl"],[LIBNSL_LIBS=""])])
28
29 AC_OUTPUT([Makefile src/Makefile])
0
1 # libtool (GNU libtool) 2.4.2
2 # Written by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996
3
4 # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, 2006,
5 # 2007, 2008, 2009, 2010, 2011 Free Software Foundation, Inc.
6 # This is free software; see the source for copying conditions. There is NO
7 # warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
8
9 # GNU Libtool is free software; you can redistribute it and/or modify
10 # it under the terms of the GNU General Public License as published by
11 # the Free Software Foundation; either version 2 of the License, or
12 # (at your option) any later version.
13 #
14 # As a special exception to the GNU General Public License,
15 # if you distribute this file as part of a program or library that
16 # is built using GNU Libtool, you may include this file under the
17 # same distribution terms that you use for the rest of that program.
18 #
19 # GNU Libtool is distributed in the hope that it will be useful, but
20 # WITHOUT ANY WARRANTY; without even the implied warranty of
21 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
22 # General Public License for more details.
23 #
24 # You should have received a copy of the GNU General Public License
25 # along with GNU Libtool; see the file COPYING. If not, a copy
26 # can be downloaded from http://www.gnu.org/licenses/gpl.html,
27 # or obtained by writing to the Free Software Foundation, Inc.,
28 # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
29
30 # Usage: $progname [OPTION]... [MODE-ARG]...
31 #
32 # Provide generalized library-building support services.
33 #
34 # --config show all configuration variables
35 # --debug enable verbose shell tracing
36 # -n, --dry-run display commands without modifying any files
37 # --features display basic configuration information and exit
38 # --mode=MODE use operation mode MODE
39 # --preserve-dup-deps don't remove duplicate dependency libraries
40 # --quiet, --silent don't print informational messages
41 # --no-quiet, --no-silent
42 # print informational messages (default)
43 # --no-warn don't display warning messages
44 # --tag=TAG use configuration variables from tag TAG
45 # -v, --verbose print more informational messages than default
46 # --no-verbose don't print the extra informational messages
47 # --version print version information
48 # -h, --help, --help-all print short, long, or detailed help message
49 #
50 # MODE must be one of the following:
51 #
52 # clean remove files from the build directory
53 # compile compile a source file into a libtool object
54 # execute automatically set library path, then run a program
55 # finish complete the installation of libtool libraries
56 # install install libraries or executables
57 # link create a library or an executable
58 # uninstall remove libraries from an installed directory
59 #
60 # MODE-ARGS vary depending on the MODE. When passed as first option,
61 # `--mode=MODE' may be abbreviated as `MODE' or a unique abbreviation of that.
62 # Try `$progname --help --mode=MODE' for a more detailed description of MODE.
63 #
64 # When reporting a bug, please describe a test case to reproduce it and
65 # include the following information:
66 #
67 # host-triplet: $host
68 # shell: $SHELL
69 # compiler: $LTCC
70 # compiler flags: $LTCFLAGS
71 # linker: $LD (gnu? $with_gnu_ld)
72 # $progname: (GNU libtool) 2.4.2
73 # automake: $automake_version
74 # autoconf: $autoconf_version
75 #
76 # Report bugs to <bug-libtool@gnu.org>.
77 # GNU libtool home page: <http://www.gnu.org/software/libtool/>.
78 # General help using GNU software: <http://www.gnu.org/gethelp/>.
79
80 PROGRAM=libtool
81 PACKAGE=libtool
82 VERSION=2.4.2
83 TIMESTAMP=""
84 package_revision=1.3337
85
86 # Be Bourne compatible
87 if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
88 emulate sh
89 NULLCMD=:
90 # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which
91 # is contrary to our usage. Disable this feature.
92 alias -g '${1+"$@"}'='"$@"'
93 setopt NO_GLOB_SUBST
94 else
95 case `(set -o) 2>/dev/null` in *posix*) set -o posix;; esac
96 fi
97 BIN_SH=xpg4; export BIN_SH # for Tru64
98 DUALCASE=1; export DUALCASE # for MKS sh
99
100 # A function that is used when there is no print builtin or printf.
101 func_fallback_echo ()
102 {
103 eval 'cat <<_LTECHO_EOF
104 $1
105 _LTECHO_EOF'
106 }
107
108 # NLS nuisances: We save the old values to restore during execute mode.
109 lt_user_locale=
110 lt_safe_locale=
111 for lt_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES
112 do
113 eval "if test \"\${$lt_var+set}\" = set; then
114 save_$lt_var=\$$lt_var
115 $lt_var=C
116 export $lt_var
117 lt_user_locale=\"$lt_var=\\\$save_\$lt_var; \$lt_user_locale\"
118 lt_safe_locale=\"$lt_var=C; \$lt_safe_locale\"
119 fi"
120 done
121 LC_ALL=C
122 LANGUAGE=C
123 export LANGUAGE LC_ALL
124
125 $lt_unset CDPATH
126
127
128 # Work around backward compatibility issue on IRIX 6.5. On IRIX 6.4+, sh
129 # is ksh but when the shell is invoked as "sh" and the current value of
130 # the _XPG environment variable is not equal to 1 (one), the special
131 # positional parameter $0, within a function call, is the name of the
132 # function.
133 progpath="$0"
134
135
136
137 : ${CP="cp -f"}
138 test "${ECHO+set}" = set || ECHO=${as_echo-'printf %s\n'}
139 : ${MAKE="make"}
140 : ${MKDIR="mkdir"}
141 : ${MV="mv -f"}
142 : ${RM="rm -f"}
143 : ${SHELL="${CONFIG_SHELL-/bin/sh}"}
144 : ${Xsed="$SED -e 1s/^X//"}
145
146 # Global variables:
147 EXIT_SUCCESS=0
148 EXIT_FAILURE=1
149 EXIT_MISMATCH=63 # $? = 63 is used to indicate version mismatch to missing.
150 EXIT_SKIP=77 # $? = 77 is used to indicate a skipped test to automake.
151
152 exit_status=$EXIT_SUCCESS
153
154 # Make sure IFS has a sensible default
155 lt_nl='
156 '
157 IFS=" $lt_nl"
158
159 dirname="s,/[^/]*$,,"
160 basename="s,^.*/,,"
161
162 # func_dirname file append nondir_replacement
163 # Compute the dirname of FILE. If nonempty, add APPEND to the result,
164 # otherwise set result to NONDIR_REPLACEMENT.
165 func_dirname ()
166 {
167 func_dirname_result=`$ECHO "${1}" | $SED "$dirname"`
168 if test "X$func_dirname_result" = "X${1}"; then
169 func_dirname_result="${3}"
170 else
171 func_dirname_result="$func_dirname_result${2}"
172 fi
173 } # func_dirname may be replaced by extended shell implementation
174
175
176 # func_basename file
177 func_basename ()
178 {
179 func_basename_result=`$ECHO "${1}" | $SED "$basename"`
180 } # func_basename may be replaced by extended shell implementation
181
182
183 # func_dirname_and_basename file append nondir_replacement
184 # perform func_basename and func_dirname in a single function
185 # call:
186 # dirname: Compute the dirname of FILE. If nonempty,
187 # add APPEND to the result, otherwise set result
188 # to NONDIR_REPLACEMENT.
189 # value returned in "$func_dirname_result"
190 # basename: Compute filename of FILE.
191 # value retuned in "$func_basename_result"
192 # Implementation must be kept synchronized with func_dirname
193 # and func_basename. For efficiency, we do not delegate to
194 # those functions but instead duplicate the functionality here.
195 func_dirname_and_basename ()
196 {
197 # Extract subdirectory from the argument.
198 func_dirname_result=`$ECHO "${1}" | $SED -e "$dirname"`
199 if test "X$func_dirname_result" = "X${1}"; then
200 func_dirname_result="${3}"
201 else
202 func_dirname_result="$func_dirname_result${2}"
203 fi
204 func_basename_result=`$ECHO "${1}" | $SED -e "$basename"`
205 } # func_dirname_and_basename may be replaced by extended shell implementation
206
207
208 # func_stripname prefix suffix name
209 # strip PREFIX and SUFFIX off of NAME.
210 # PREFIX and SUFFIX must not contain globbing or regex special
211 # characters, hashes, percent signs, but SUFFIX may contain a leading
212 # dot (in which case that matches only a dot).
213 # func_strip_suffix prefix name
214 func_stripname ()
215 {
216 case ${2} in
217 .*) func_stripname_result=`$ECHO "${3}" | $SED "s%^${1}%%; s%\\\\${2}\$%%"`;;
218 *) func_stripname_result=`$ECHO "${3}" | $SED "s%^${1}%%; s%${2}\$%%"`;;
219 esac
220 } # func_stripname may be replaced by extended shell implementation
221
222
223 # These SED scripts presuppose an absolute path with a trailing slash.
224 pathcar='s,^/\([^/]*\).*$,\1,'
225 pathcdr='s,^/[^/]*,,'
226 removedotparts=':dotsl
227 s@/\./@/@g
228 t dotsl
229 s,/\.$,/,'
230 collapseslashes='s@/\{1,\}@/@g'
231 finalslash='s,/*$,/,'
232
233 # func_normal_abspath PATH
234 # Remove doubled-up and trailing slashes, "." path components,
235 # and cancel out any ".." path components in PATH after making
236 # it an absolute path.
237 # value returned in "$func_normal_abspath_result"
238 func_normal_abspath ()
239 {
240 # Start from root dir and reassemble the path.
241 func_normal_abspath_result=
242 func_normal_abspath_tpath=$1
243 func_normal_abspath_altnamespace=
244 case $func_normal_abspath_tpath in
245 "")
246 # Empty path, that just means $cwd.
247 func_stripname '' '/' "`pwd`"
248 func_normal_abspath_result=$func_stripname_result
249 return
250 ;;
251 # The next three entries are used to spot a run of precisely
252 # two leading slashes without using negated character classes;
253 # we take advantage of case's first-match behaviour.
254 ///*)
255 # Unusual form of absolute path, do nothing.
256 ;;
257 //*)
258 # Not necessarily an ordinary path; POSIX reserves leading '//'
259 # and for example Cygwin uses it to access remote file shares
260 # over CIFS/SMB, so we conserve a leading double slash if found.
261 func_normal_abspath_altnamespace=/
262 ;;
263 /*)
264 # Absolute path, do nothing.
265 ;;
266 *)
267 # Relative path, prepend $cwd.
268 func_normal_abspath_tpath=`pwd`/$func_normal_abspath_tpath
269 ;;
270 esac
271 # Cancel out all the simple stuff to save iterations. We also want
272 # the path to end with a slash for ease of parsing, so make sure
273 # there is one (and only one) here.
274 func_normal_abspath_tpath=`$ECHO "$func_normal_abspath_tpath" | $SED \
275 -e "$removedotparts" -e "$collapseslashes" -e "$finalslash"`
276 while :; do
277 # Processed it all yet?
278 if test "$func_normal_abspath_tpath" = / ; then
279 # If we ascended to the root using ".." the result may be empty now.
280 if test -z "$func_normal_abspath_result" ; then
281 func_normal_abspath_result=/
282 fi
283 break
284 fi
285 func_normal_abspath_tcomponent=`$ECHO "$func_normal_abspath_tpath" | $SED \
286 -e "$pathcar"`
287 func_normal_abspath_tpath=`$ECHO "$func_normal_abspath_tpath" | $SED \
288 -e "$pathcdr"`
289 # Figure out what to do with it
290 case $func_normal_abspath_tcomponent in
291 "")
292 # Trailing empty path component, ignore it.
293 ;;
294 ..)
295 # Parent dir; strip last assembled component from result.
296 func_dirname "$func_normal_abspath_result"
297 func_normal_abspath_result=$func_dirname_result
298 ;;
299 *)
300 # Actual path component, append it.
301 func_normal_abspath_result=$func_normal_abspath_result/$func_normal_abspath_tcomponent
302 ;;
303 esac
304 done
305 # Restore leading double-slash if one was found on entry.
306 func_normal_abspath_result=$func_normal_abspath_altnamespace$func_normal_abspath_result
307 }
308
309 # func_relative_path SRCDIR DSTDIR
310 # generates a relative path from SRCDIR to DSTDIR, with a trailing
311 # slash if non-empty, suitable for immediately appending a filename
312 # without needing to append a separator.
313 # value returned in "$func_relative_path_result"
314 func_relative_path ()
315 {
316 func_relative_path_result=
317 func_normal_abspath "$1"
318 func_relative_path_tlibdir=$func_normal_abspath_result
319 func_normal_abspath "$2"
320 func_relative_path_tbindir=$func_normal_abspath_result
321
322 # Ascend the tree starting from libdir
323 while :; do
324 # check if we have found a prefix of bindir
325 case $func_relative_path_tbindir in
326 $func_relative_path_tlibdir)
327 # found an exact match
328 func_relative_path_tcancelled=
329 break
330 ;;
331 $func_relative_path_tlibdir*)
332 # found a matching prefix
333 func_stripname "$func_relative_path_tlibdir" '' "$func_relative_path_tbindir"
334 func_relative_path_tcancelled=$func_stripname_result
335 if test -z "$func_relative_path_result"; then
336 func_relative_path_result=.
337 fi
338 break
339 ;;
340 *)
341 func_dirname $func_relative_path_tlibdir
342 func_relative_path_tlibdir=${func_dirname_result}
343 if test "x$func_relative_path_tlibdir" = x ; then
344 # Have to descend all the way to the root!
345 func_relative_path_result=../$func_relative_path_result
346 func_relative_path_tcancelled=$func_relative_path_tbindir
347 break
348 fi
349 func_relative_path_result=../$func_relative_path_result
350 ;;
351 esac
352 done
353
354 # Now calculate path; take care to avoid doubling-up slashes.
355 func_stripname '' '/' "$func_relative_path_result"
356 func_relative_path_result=$func_stripname_result
357 func_stripname '/' '/' "$func_relative_path_tcancelled"
358 if test "x$func_stripname_result" != x ; then
359 func_relative_path_result=${func_relative_path_result}/${func_stripname_result}
360 fi
361
362 # Normalisation. If bindir is libdir, return empty string,
363 # else relative path ending with a slash; either way, target
364 # file name can be directly appended.
365 if test ! -z "$func_relative_path_result"; then
366 func_stripname './' '' "$func_relative_path_result/"
367 func_relative_path_result=$func_stripname_result
368 fi
369 }
370
371 # The name of this program:
372 func_dirname_and_basename "$progpath"
373 progname=$func_basename_result
374
375 # Make sure we have an absolute path for reexecution:
376 case $progpath in
377 [\\/]*|[A-Za-z]:\\*) ;;
378 *[\\/]*)
379 progdir=$func_dirname_result
380 progdir=`cd "$progdir" && pwd`
381 progpath="$progdir/$progname"
382 ;;
383 *)
384 save_IFS="$IFS"
385 IFS=${PATH_SEPARATOR-:}
386 for progdir in $PATH; do
387 IFS="$save_IFS"
388 test -x "$progdir/$progname" && break
389 done
390 IFS="$save_IFS"
391 test -n "$progdir" || progdir=`pwd`
392 progpath="$progdir/$progname"
393 ;;
394 esac
395
396 # Sed substitution that helps us do robust quoting. It backslashifies
397 # metacharacters that are still active within double-quoted strings.
398 Xsed="${SED}"' -e 1s/^X//'
399 sed_quote_subst='s/\([`"$\\]\)/\\\1/g'
400
401 # Same as above, but do not quote variable references.
402 double_quote_subst='s/\(["`\\]\)/\\\1/g'
403
404 # Sed substitution that turns a string into a regex matching for the
405 # string literally.
406 sed_make_literal_regex='s,[].[^$\\*\/],\\&,g'
407
408 # Sed substitution that converts a w32 file name or path
409 # which contains forward slashes, into one that contains
410 # (escaped) backslashes. A very naive implementation.
411 lt_sed_naive_backslashify='s|\\\\*|\\|g;s|/|\\|g;s|\\|\\\\|g'
412
413 # Re-`\' parameter expansions in output of double_quote_subst that were
414 # `\'-ed in input to the same. If an odd number of `\' preceded a '$'
415 # in input to double_quote_subst, that '$' was protected from expansion.
416 # Since each input `\' is now two `\'s, look for any number of runs of
417 # four `\'s followed by two `\'s and then a '$'. `\' that '$'.
418 bs='\\'
419 bs2='\\\\'
420 bs4='\\\\\\\\'
421 dollar='\$'
422 sed_double_backslash="\
423 s/$bs4/&\\
424 /g
425 s/^$bs2$dollar/$bs&/
426 s/\\([^$bs]\\)$bs2$dollar/\\1$bs2$bs$dollar/g
427 s/\n//g"
428
429 # Standard options:
430 opt_dry_run=false
431 opt_help=false
432 opt_quiet=false
433 opt_verbose=false
434 opt_warning=:
435
436 # func_echo arg...
437 # Echo program name prefixed message, along with the current mode
438 # name if it has been set yet.
439 func_echo ()
440 {
441 $ECHO "$progname: ${opt_mode+$opt_mode: }$*"
442 }
443
444 # func_verbose arg...
445 # Echo program name prefixed message in verbose mode only.
446 func_verbose ()
447 {
448 $opt_verbose && func_echo ${1+"$@"}
449
450 # A bug in bash halts the script if the last line of a function
451 # fails when set -e is in force, so we need another command to
452 # work around that:
453 :
454 }
455
456 # func_echo_all arg...
457 # Invoke $ECHO with all args, space-separated.
458 func_echo_all ()
459 {
460 $ECHO "$*"
461 }
462
463 # func_error arg...
464 # Echo program name prefixed message to standard error.
465 func_error ()
466 {
467 $ECHO "$progname: ${opt_mode+$opt_mode: }"${1+"$@"} 1>&2
468 }
469
470 # func_warning arg...
471 # Echo program name prefixed warning message to standard error.
472 func_warning ()
473 {
474 $opt_warning && $ECHO "$progname: ${opt_mode+$opt_mode: }warning: "${1+"$@"} 1>&2
475
476 # bash bug again:
477 :
478 }
479
480 # func_fatal_error arg...
481 # Echo program name prefixed message to standard error, and exit.
482 func_fatal_error ()
483 {
484 func_error ${1+"$@"}
485 exit $EXIT_FAILURE
486 }
487
488 # func_fatal_help arg...
489 # Echo program name prefixed message to standard error, followed by
490 # a help hint, and exit.
491 func_fatal_help ()
492 {
493 func_error ${1+"$@"}
494 func_fatal_error "$help"
495 }
496 help="Try \`$progname --help' for more information." ## default
497
498
499 # func_grep expression filename
500 # Check whether EXPRESSION matches any line of FILENAME, without output.
501 func_grep ()
502 {
503 $GREP "$1" "$2" >/dev/null 2>&1
504 }
505
506
507 # func_mkdir_p directory-path
508 # Make sure the entire path to DIRECTORY-PATH is available.
509 func_mkdir_p ()
510 {
511 my_directory_path="$1"
512 my_dir_list=
513
514 if test -n "$my_directory_path" && test "$opt_dry_run" != ":"; then
515
516 # Protect directory names starting with `-'
517 case $my_directory_path in
518 -*) my_directory_path="./$my_directory_path" ;;
519 esac
520
521 # While some portion of DIR does not yet exist...
522 while test ! -d "$my_directory_path"; do
523 # ...make a list in topmost first order. Use a colon delimited
524 # list incase some portion of path contains whitespace.
525 my_dir_list="$my_directory_path:$my_dir_list"
526
527 # If the last portion added has no slash in it, the list is done
528 case $my_directory_path in */*) ;; *) break ;; esac
529
530 # ...otherwise throw away the child directory and loop
531 my_directory_path=`$ECHO "$my_directory_path" | $SED -e "$dirname"`
532 done
533 my_dir_list=`$ECHO "$my_dir_list" | $SED 's,:*$,,'`
534
535 save_mkdir_p_IFS="$IFS"; IFS=':'
536 for my_dir in $my_dir_list; do
537 IFS="$save_mkdir_p_IFS"
538 # mkdir can fail with a `File exist' error if two processes
539 # try to create one of the directories concurrently. Don't
540 # stop in that case!
541 $MKDIR "$my_dir" 2>/dev/null || :
542 done
543 IFS="$save_mkdir_p_IFS"
544
545 # Bail out if we (or some other process) failed to create a directory.
546 test -d "$my_directory_path" || \
547 func_fatal_error "Failed to create \`$1'"
548 fi
549 }
550
551
552 # func_mktempdir [string]
553 # Make a temporary directory that won't clash with other running
554 # libtool processes, and avoids race conditions if possible. If
555 # given, STRING is the basename for that directory.
556 func_mktempdir ()
557 {
558 my_template="${TMPDIR-/tmp}/${1-$progname}"
559
560 if test "$opt_dry_run" = ":"; then
561 # Return a directory name, but don't create it in dry-run mode
562 my_tmpdir="${my_template}-$$"
563 else
564
565 # If mktemp works, use that first and foremost
566 my_tmpdir=`mktemp -d "${my_template}-XXXXXXXX" 2>/dev/null`
567
568 if test ! -d "$my_tmpdir"; then
569 # Failing that, at least try and use $RANDOM to avoid a race
570 my_tmpdir="${my_template}-${RANDOM-0}$$"
571
572 save_mktempdir_umask=`umask`
573 umask 0077
574 $MKDIR "$my_tmpdir"
575 umask $save_mktempdir_umask
576 fi
577
578 # If we're not in dry-run mode, bomb out on failure
579 test -d "$my_tmpdir" || \
580 func_fatal_error "cannot create temporary directory \`$my_tmpdir'"
581 fi
582
583 $ECHO "$my_tmpdir"
584 }
585
586
587 # func_quote_for_eval arg
588 # Aesthetically quote ARG to be evaled later.
589 # This function returns two values: FUNC_QUOTE_FOR_EVAL_RESULT
590 # is double-quoted, suitable for a subsequent eval, whereas
591 # FUNC_QUOTE_FOR_EVAL_UNQUOTED_RESULT has merely all characters
592 # which are still active within double quotes backslashified.
593 func_quote_for_eval ()
594 {
595 case $1 in
596 *[\\\`\"\$]*)
597 func_quote_for_eval_unquoted_result=`$ECHO "$1" | $SED "$sed_quote_subst"` ;;
598 *)
599 func_quote_for_eval_unquoted_result="$1" ;;
600 esac
601
602 case $func_quote_for_eval_unquoted_result in
603 # Double-quote args containing shell metacharacters to delay
604 # word splitting, command substitution and and variable
605 # expansion for a subsequent eval.
606 # Many Bourne shells cannot handle close brackets correctly
607 # in scan sets, so we specify it separately.
608 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
609 func_quote_for_eval_result="\"$func_quote_for_eval_unquoted_result\""
610 ;;
611 *)
612 func_quote_for_eval_result="$func_quote_for_eval_unquoted_result"
613 esac
614 }
615
616
617 # func_quote_for_expand arg
618 # Aesthetically quote ARG to be evaled later; same as above,
619 # but do not quote variable references.
620 func_quote_for_expand ()
621 {
622 case $1 in
623 *[\\\`\"]*)
624 my_arg=`$ECHO "$1" | $SED \
625 -e "$double_quote_subst" -e "$sed_double_backslash"` ;;
626 *)
627 my_arg="$1" ;;
628 esac
629
630 case $my_arg in
631 # Double-quote args containing shell metacharacters to delay
632 # word splitting and command substitution for a subsequent eval.
633 # Many Bourne shells cannot handle close brackets correctly
634 # in scan sets, so we specify it separately.
635 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
636 my_arg="\"$my_arg\""
637 ;;
638 esac
639
640 func_quote_for_expand_result="$my_arg"
641 }
642
643
644 # func_show_eval cmd [fail_exp]
645 # Unless opt_silent is true, then output CMD. Then, if opt_dryrun is
646 # not true, evaluate CMD. If the evaluation of CMD fails, and FAIL_EXP
647 # is given, then evaluate it.
648 func_show_eval ()
649 {
650 my_cmd="$1"
651 my_fail_exp="${2-:}"
652
653 ${opt_silent-false} || {
654 func_quote_for_expand "$my_cmd"
655 eval "func_echo $func_quote_for_expand_result"
656 }
657
658 if ${opt_dry_run-false}; then :; else
659 eval "$my_cmd"
660 my_status=$?
661 if test "$my_status" -eq 0; then :; else
662 eval "(exit $my_status); $my_fail_exp"
663 fi
664 fi
665 }
666
667
668 # func_show_eval_locale cmd [fail_exp]
669 # Unless opt_silent is true, then output CMD. Then, if opt_dryrun is
670 # not true, evaluate CMD. If the evaluation of CMD fails, and FAIL_EXP
671 # is given, then evaluate it. Use the saved locale for evaluation.
672 func_show_eval_locale ()
673 {
674 my_cmd="$1"
675 my_fail_exp="${2-:}"
676
677 ${opt_silent-false} || {
678 func_quote_for_expand "$my_cmd"
679 eval "func_echo $func_quote_for_expand_result"
680 }
681
682 if ${opt_dry_run-false}; then :; else
683 eval "$lt_user_locale
684 $my_cmd"
685 my_status=$?
686 eval "$lt_safe_locale"
687 if test "$my_status" -eq 0; then :; else
688 eval "(exit $my_status); $my_fail_exp"
689 fi
690 fi
691 }
692
693 # func_tr_sh
694 # Turn $1 into a string suitable for a shell variable name.
695 # Result is stored in $func_tr_sh_result. All characters
696 # not in the set a-zA-Z0-9_ are replaced with '_'. Further,
697 # if $1 begins with a digit, a '_' is prepended as well.
698 func_tr_sh ()
699 {
700 case $1 in
701 [0-9]* | *[!a-zA-Z0-9_]*)
702 func_tr_sh_result=`$ECHO "$1" | $SED 's/^\([0-9]\)/_\1/; s/[^a-zA-Z0-9_]/_/g'`
703 ;;
704 * )
705 func_tr_sh_result=$1
706 ;;
707 esac
708 }
709
710
711 # func_version
712 # Echo version message to standard output and exit.
713 func_version ()
714 {
715 $opt_debug
716
717 $SED -n '/(C)/!b go
718 :more
719 /\./!{
720 N
721 s/\n# / /
722 b more
723 }
724 :go
725 /^# '$PROGRAM' (GNU /,/# warranty; / {
726 s/^# //
727 s/^# *$//
728 s/\((C)\)[ 0-9,-]*\( [1-9][0-9]*\)/\1\2/
729 p
730 }' < "$progpath"
731 exit $?
732 }
733
734 # func_usage
735 # Echo short help message to standard output and exit.
736 func_usage ()
737 {
738 $opt_debug
739
740 $SED -n '/^# Usage:/,/^# *.*--help/ {
741 s/^# //
742 s/^# *$//
743 s/\$progname/'$progname'/
744 p
745 }' < "$progpath"
746 echo
747 $ECHO "run \`$progname --help | more' for full usage"
748 exit $?
749 }
750
751 # func_help [NOEXIT]
752 # Echo long help message to standard output and exit,
753 # unless 'noexit' is passed as argument.
754 func_help ()
755 {
756 $opt_debug
757
758 $SED -n '/^# Usage:/,/# Report bugs to/ {
759 :print
760 s/^# //
761 s/^# *$//
762 s*\$progname*'$progname'*
763 s*\$host*'"$host"'*
764 s*\$SHELL*'"$SHELL"'*
765 s*\$LTCC*'"$LTCC"'*
766 s*\$LTCFLAGS*'"$LTCFLAGS"'*
767 s*\$LD*'"$LD"'*
768 s/\$with_gnu_ld/'"$with_gnu_ld"'/
769 s/\$automake_version/'"`(${AUTOMAKE-automake} --version) 2>/dev/null |$SED 1q`"'/
770 s/\$autoconf_version/'"`(${AUTOCONF-autoconf} --version) 2>/dev/null |$SED 1q`"'/
771 p
772 d
773 }
774 /^# .* home page:/b print
775 /^# General help using/b print
776 ' < "$progpath"
777 ret=$?
778 if test -z "$1"; then
779 exit $ret
780 fi
781 }
782
783 # func_missing_arg argname
784 # Echo program name prefixed message to standard error and set global
785 # exit_cmd.
786 func_missing_arg ()
787 {
788 $opt_debug
789
790 func_error "missing argument for $1."
791 exit_cmd=exit
792 }
793
794
795 # func_split_short_opt shortopt
796 # Set func_split_short_opt_name and func_split_short_opt_arg shell
797 # variables after splitting SHORTOPT after the 2nd character.
798 func_split_short_opt ()
799 {
800 my_sed_short_opt='1s/^\(..\).*$/\1/;q'
801 my_sed_short_rest='1s/^..\(.*\)$/\1/;q'
802
803 func_split_short_opt_name=`$ECHO "$1" | $SED "$my_sed_short_opt"`
804 func_split_short_opt_arg=`$ECHO "$1" | $SED "$my_sed_short_rest"`
805 } # func_split_short_opt may be replaced by extended shell implementation
806
807
808 # func_split_long_opt longopt
809 # Set func_split_long_opt_name and func_split_long_opt_arg shell
810 # variables after splitting LONGOPT at the `=' sign.
811 func_split_long_opt ()
812 {
813 my_sed_long_opt='1s/^\(--[^=]*\)=.*/\1/;q'
814 my_sed_long_arg='1s/^--[^=]*=//'
815
816 func_split_long_opt_name=`$ECHO "$1" | $SED "$my_sed_long_opt"`
817 func_split_long_opt_arg=`$ECHO "$1" | $SED "$my_sed_long_arg"`
818 } # func_split_long_opt may be replaced by extended shell implementation
819
820 exit_cmd=:
821
822
823
824
825
826 magic="%%%MAGIC variable%%%"
827 magic_exe="%%%MAGIC EXE variable%%%"
828
829 # Global variables.
830 nonopt=
831 preserve_args=
832 lo2o="s/\\.lo\$/.${objext}/"
833 o2lo="s/\\.${objext}\$/.lo/"
834 extracted_archives=
835 extracted_serial=0
836
837 # If this variable is set in any of the actions, the command in it
838 # will be execed at the end. This prevents here-documents from being
839 # left over by shells.
840 exec_cmd=
841
842 # func_append var value
843 # Append VALUE to the end of shell variable VAR.
844 func_append ()
845 {
846 eval "${1}=\$${1}\${2}"
847 } # func_append may be replaced by extended shell implementation
848
849 # func_append_quoted var value
850 # Quote VALUE and append to the end of shell variable VAR, separated
851 # by a space.
852 func_append_quoted ()
853 {
854 func_quote_for_eval "${2}"
855 eval "${1}=\$${1}\\ \$func_quote_for_eval_result"
856 } # func_append_quoted may be replaced by extended shell implementation
857
858
859 # func_arith arithmetic-term...
860 func_arith ()
861 {
862 func_arith_result=`expr "${@}"`
863 } # func_arith may be replaced by extended shell implementation
864
865
866 # func_len string
867 # STRING may not start with a hyphen.
868 func_len ()
869 {
870 func_len_result=`expr "${1}" : ".*" 2>/dev/null || echo $max_cmd_len`
871 } # func_len may be replaced by extended shell implementation
872
873
874 # func_lo2o object
875 func_lo2o ()
876 {
877 func_lo2o_result=`$ECHO "${1}" | $SED "$lo2o"`
878 } # func_lo2o may be replaced by extended shell implementation
879
880
881 # func_xform libobj-or-source
882 func_xform ()
883 {
884 func_xform_result=`$ECHO "${1}" | $SED 's/\.[^.]*$/.lo/'`
885 } # func_xform may be replaced by extended shell implementation
886
887
888 # func_fatal_configuration arg...
889 # Echo program name prefixed message to standard error, followed by
890 # a configuration failure hint, and exit.
891 func_fatal_configuration ()
892 {
893 func_error ${1+"$@"}
894 func_error "See the $PACKAGE documentation for more information."
895 func_fatal_error "Fatal configuration error."
896 }
897
898
899 # func_config
900 # Display the configuration for all the tags in this script.
901 func_config ()
902 {
903 re_begincf='^# ### BEGIN LIBTOOL'
904 re_endcf='^# ### END LIBTOOL'
905
906 # Default configuration.
907 $SED "1,/$re_begincf CONFIG/d;/$re_endcf CONFIG/,\$d" < "$progpath"
908
909 # Now print the configurations for the tags.
910 for tagname in $taglist; do
911 $SED -n "/$re_begincf TAG CONFIG: $tagname\$/,/$re_endcf TAG CONFIG: $tagname\$/p" < "$progpath"
912 done
913
914 exit $?
915 }
916
917 # func_features
918 # Display the features supported by this script.
919 func_features ()
920 {
921 echo "host: $host"
922 if test "$build_libtool_libs" = yes; then
923 echo "enable shared libraries"
924 else
925 echo "disable shared libraries"
926 fi
927 if test "$build_old_libs" = yes; then
928 echo "enable static libraries"
929 else
930 echo "disable static libraries"
931 fi
932
933 exit $?
934 }
935
936 # func_enable_tag tagname
937 # Verify that TAGNAME is valid, and either flag an error and exit, or
938 # enable the TAGNAME tag. We also add TAGNAME to the global $taglist
939 # variable here.
940 func_enable_tag ()
941 {
942 # Global variable:
943 tagname="$1"
944
945 re_begincf="^# ### BEGIN LIBTOOL TAG CONFIG: $tagname\$"
946 re_endcf="^# ### END LIBTOOL TAG CONFIG: $tagname\$"
947 sed_extractcf="/$re_begincf/,/$re_endcf/p"
948
949 # Validate tagname.
950 case $tagname in
951 *[!-_A-Za-z0-9,/]*)
952 func_fatal_error "invalid tag name: $tagname"
953 ;;
954 esac
955
956 # Don't test for the "default" C tag, as we know it's
957 # there but not specially marked.
958 case $tagname in
959 CC) ;;
960 *)
961 if $GREP "$re_begincf" "$progpath" >/dev/null 2>&1; then
962 taglist="$taglist $tagname"
963
964 # Evaluate the configuration. Be careful to quote the path
965 # and the sed script, to avoid splitting on whitespace, but
966 # also don't use non-portable quotes within backquotes within
967 # quotes we have to do it in 2 steps:
968 extractedcf=`$SED -n -e "$sed_extractcf" < "$progpath"`
969 eval "$extractedcf"
970 else
971 func_error "ignoring unknown tag $tagname"
972 fi
973 ;;
974 esac
975 }
976
977 # func_check_version_match
978 # Ensure that we are using m4 macros, and libtool script from the same
979 # release of libtool.
980 func_check_version_match ()
981 {
982 if test "$package_revision" != "$macro_revision"; then
983 if test "$VERSION" != "$macro_version"; then
984 if test -z "$macro_version"; then
985 cat >&2 <<_LT_EOF
986 $progname: Version mismatch error. This is $PACKAGE $VERSION, but the
987 $progname: definition of this LT_INIT comes from an older release.
988 $progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION
989 $progname: and run autoconf again.
990 _LT_EOF
991 else
992 cat >&2 <<_LT_EOF
993 $progname: Version mismatch error. This is $PACKAGE $VERSION, but the
994 $progname: definition of this LT_INIT comes from $PACKAGE $macro_version.
995 $progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION
996 $progname: and run autoconf again.
997 _LT_EOF
998 fi
999 else
1000 cat >&2 <<_LT_EOF
1001 $progname: Version mismatch error. This is $PACKAGE $VERSION, revision $package_revision,
1002 $progname: but the definition of this LT_INIT comes from revision $macro_revision.
1003 $progname: You should recreate aclocal.m4 with macros from revision $package_revision
1004 $progname: of $PACKAGE $VERSION and run autoconf again.
1005 _LT_EOF
1006 fi
1007
1008 exit $EXIT_MISMATCH
1009 fi
1010 }
1011
1012
1013 # Shorthand for --mode=foo, only valid as the first argument
1014 case $1 in
1015 clean|clea|cle|cl)
1016 shift; set dummy --mode clean ${1+"$@"}; shift
1017 ;;
1018 compile|compil|compi|comp|com|co|c)
1019 shift; set dummy --mode compile ${1+"$@"}; shift
1020 ;;
1021 execute|execut|execu|exec|exe|ex|e)
1022 shift; set dummy --mode execute ${1+"$@"}; shift
1023 ;;
1024 finish|finis|fini|fin|fi|f)
1025 shift; set dummy --mode finish ${1+"$@"}; shift
1026 ;;
1027 install|instal|insta|inst|ins|in|i)
1028 shift; set dummy --mode install ${1+"$@"}; shift
1029 ;;
1030 link|lin|li|l)
1031 shift; set dummy --mode link ${1+"$@"}; shift
1032 ;;
1033 uninstall|uninstal|uninsta|uninst|unins|unin|uni|un|u)
1034 shift; set dummy --mode uninstall ${1+"$@"}; shift
1035 ;;
1036 esac
1037
1038
1039
1040 # Option defaults:
1041 opt_debug=:
1042 opt_dry_run=false
1043 opt_config=false
1044 opt_preserve_dup_deps=false
1045 opt_features=false
1046 opt_finish=false
1047 opt_help=false
1048 opt_help_all=false
1049 opt_silent=:
1050 opt_warning=:
1051 opt_verbose=:
1052 opt_silent=false
1053 opt_verbose=false
1054
1055
1056 # Parse options once, thoroughly. This comes as soon as possible in the
1057 # script to make things like `--version' happen as quickly as we can.
1058 {
1059 # this just eases exit handling
1060 while test $# -gt 0; do
1061 opt="$1"
1062 shift
1063 case $opt in
1064 --debug|-x) opt_debug='set -x'
1065 func_echo "enabling shell trace mode"
1066 $opt_debug
1067 ;;
1068 --dry-run|--dryrun|-n)
1069 opt_dry_run=:
1070 ;;
1071 --config)
1072 opt_config=:
1073 func_config
1074 ;;
1075 --dlopen|-dlopen)
1076 optarg="$1"
1077 opt_dlopen="${opt_dlopen+$opt_dlopen
1078 }$optarg"
1079 shift
1080 ;;
1081 --preserve-dup-deps)
1082 opt_preserve_dup_deps=:
1083 ;;
1084 --features)
1085 opt_features=:
1086 func_features
1087 ;;
1088 --finish)
1089 opt_finish=:
1090 set dummy --mode finish ${1+"$@"}; shift
1091 ;;
1092 --help)
1093 opt_help=:
1094 ;;
1095 --help-all)
1096 opt_help_all=:
1097 opt_help=': help-all'
1098 ;;
1099 --mode)
1100 test $# = 0 && func_missing_arg $opt && break
1101 optarg="$1"
1102 opt_mode="$optarg"
1103 case $optarg in
1104 # Valid mode arguments:
1105 clean|compile|execute|finish|install|link|relink|uninstall) ;;
1106
1107 # Catch anything else as an error
1108 *) func_error "invalid argument for $opt"
1109 exit_cmd=exit
1110 break
1111 ;;
1112 esac
1113 shift
1114 ;;
1115 --no-silent|--no-quiet)
1116 opt_silent=false
1117 func_append preserve_args " $opt"
1118 ;;
1119 --no-warning|--no-warn)
1120 opt_warning=false
1121 func_append preserve_args " $opt"
1122 ;;
1123 --no-verbose)
1124 opt_verbose=false
1125 func_append preserve_args " $opt"
1126 ;;
1127 --silent|--quiet)
1128 opt_silent=:
1129 func_append preserve_args " $opt"
1130 opt_verbose=false
1131 ;;
1132 --verbose|-v)
1133 opt_verbose=:
1134 func_append preserve_args " $opt"
1135 opt_silent=false
1136 ;;
1137 --tag)
1138 test $# = 0 && func_missing_arg $opt && break
1139 optarg="$1"
1140 opt_tag="$optarg"
1141 func_append preserve_args " $opt $optarg"
1142 func_enable_tag "$optarg"
1143 shift
1144 ;;
1145
1146 -\?|-h) func_usage ;;
1147 --help) func_help ;;
1148 --version) func_version ;;
1149
1150 # Separate optargs to long options:
1151 --*=*)
1152 func_split_long_opt "$opt"
1153 set dummy "$func_split_long_opt_name" "$func_split_long_opt_arg" ${1+"$@"}
1154 shift
1155 ;;
1156
1157 # Separate non-argument short options:
1158 -\?*|-h*|-n*|-v*)
1159 func_split_short_opt "$opt"
1160 set dummy "$func_split_short_opt_name" "-$func_split_short_opt_arg" ${1+"$@"}
1161 shift
1162 ;;
1163
1164 --) break ;;
1165 -*) func_fatal_help "unrecognized option \`$opt'" ;;
1166 *) set dummy "$opt" ${1+"$@"}; shift; break ;;
1167 esac
1168 done
1169
1170 # Validate options:
1171
1172 # save first non-option argument
1173 if test "$#" -gt 0; then
1174 nonopt="$opt"
1175 shift
1176 fi
1177
1178 # preserve --debug
1179 test "$opt_debug" = : || func_append preserve_args " --debug"
1180
1181 case $host in
1182 *cygwin* | *mingw* | *pw32* | *cegcc*)
1183 # don't eliminate duplications in $postdeps and $predeps
1184 opt_duplicate_compiler_generated_deps=:
1185 ;;
1186 *)
1187 opt_duplicate_compiler_generated_deps=$opt_preserve_dup_deps
1188 ;;
1189 esac
1190
1191 $opt_help || {
1192 # Sanity checks first:
1193 func_check_version_match
1194
1195 if test "$build_libtool_libs" != yes && test "$build_old_libs" != yes; then
1196 func_fatal_configuration "not configured to build any kind of library"
1197 fi
1198
1199 # Darwin sucks
1200 eval std_shrext=\"$shrext_cmds\"
1201
1202 # Only execute mode is allowed to have -dlopen flags.
1203 if test -n "$opt_dlopen" && test "$opt_mode" != execute; then
1204 func_error "unrecognized option \`-dlopen'"
1205 $ECHO "$help" 1>&2
1206 exit $EXIT_FAILURE
1207 fi
1208
1209 # Change the help message to a mode-specific one.
1210 generic_help="$help"
1211 help="Try \`$progname --help --mode=$opt_mode' for more information."
1212 }
1213
1214
1215 # Bail if the options were screwed
1216 $exit_cmd $EXIT_FAILURE
1217 }
1218
1219
1220
1221
1222 ## ----------- ##
1223 ## Main. ##
1224 ## ----------- ##
1225
1226 # func_lalib_p file
1227 # True iff FILE is a libtool `.la' library or `.lo' object file.
1228 # This function is only a basic sanity check; it will hardly flush out
1229 # determined imposters.
1230 func_lalib_p ()
1231 {
1232 test -f "$1" &&
1233 $SED -e 4q "$1" 2>/dev/null \
1234 | $GREP "^# Generated by .*$PACKAGE" > /dev/null 2>&1
1235 }
1236
1237 # func_lalib_unsafe_p file
1238 # True iff FILE is a libtool `.la' library or `.lo' object file.
1239 # This function implements the same check as func_lalib_p without
1240 # resorting to external programs. To this end, it redirects stdin and
1241 # closes it afterwards, without saving the original file descriptor.
1242 # As a safety measure, use it only where a negative result would be
1243 # fatal anyway. Works if `file' does not exist.
1244 func_lalib_unsafe_p ()
1245 {
1246 lalib_p=no
1247 if test -f "$1" && test -r "$1" && exec 5<&0 <"$1"; then
1248 for lalib_p_l in 1 2 3 4
1249 do
1250 read lalib_p_line
1251 case "$lalib_p_line" in
1252 \#\ Generated\ by\ *$PACKAGE* ) lalib_p=yes; break;;
1253 esac
1254 done
1255 exec 0<&5 5<&-
1256 fi
1257 test "$lalib_p" = yes
1258 }
1259
1260 # func_ltwrapper_script_p file
1261 # True iff FILE is a libtool wrapper script
1262 # This function is only a basic sanity check; it will hardly flush out
1263 # determined imposters.
1264 func_ltwrapper_script_p ()
1265 {
1266 func_lalib_p "$1"
1267 }
1268
1269 # func_ltwrapper_executable_p file
1270 # True iff FILE is a libtool wrapper executable
1271 # This function is only a basic sanity check; it will hardly flush out
1272 # determined imposters.
1273 func_ltwrapper_executable_p ()
1274 {
1275 func_ltwrapper_exec_suffix=
1276 case $1 in
1277 *.exe) ;;
1278 *) func_ltwrapper_exec_suffix=.exe ;;
1279 esac
1280 $GREP "$magic_exe" "$1$func_ltwrapper_exec_suffix" >/dev/null 2>&1
1281 }
1282
1283 # func_ltwrapper_scriptname file
1284 # Assumes file is an ltwrapper_executable
1285 # uses $file to determine the appropriate filename for a
1286 # temporary ltwrapper_script.
1287 func_ltwrapper_scriptname ()
1288 {
1289 func_dirname_and_basename "$1" "" "."
1290 func_stripname '' '.exe' "$func_basename_result"
1291 func_ltwrapper_scriptname_result="$func_dirname_result/$objdir/${func_stripname_result}_ltshwrapper"
1292 }
1293
1294 # func_ltwrapper_p file
1295 # True iff FILE is a libtool wrapper script or wrapper executable
1296 # This function is only a basic sanity check; it will hardly flush out
1297 # determined imposters.
1298 func_ltwrapper_p ()
1299 {
1300 func_ltwrapper_script_p "$1" || func_ltwrapper_executable_p "$1"
1301 }
1302
1303
1304 # func_execute_cmds commands fail_cmd
1305 # Execute tilde-delimited COMMANDS.
1306 # If FAIL_CMD is given, eval that upon failure.
1307 # FAIL_CMD may read-access the current command in variable CMD!
1308 func_execute_cmds ()
1309 {
1310 $opt_debug
1311 save_ifs=$IFS; IFS='~'
1312 for cmd in $1; do
1313 IFS=$save_ifs
1314 eval cmd=\"$cmd\"
1315 func_show_eval "$cmd" "${2-:}"
1316 done
1317 IFS=$save_ifs
1318 }
1319
1320
1321 # func_source file
1322 # Source FILE, adding directory component if necessary.
1323 # Note that it is not necessary on cygwin/mingw to append a dot to
1324 # FILE even if both FILE and FILE.exe exist: automatic-append-.exe
1325 # behavior happens only for exec(3), not for open(2)! Also, sourcing
1326 # `FILE.' does not work on cygwin managed mounts.
1327 func_source ()
1328 {
1329 $opt_debug
1330 case $1 in
1331 */* | *\\*) . "$1" ;;
1332 *) . "./$1" ;;
1333 esac
1334 }
1335
1336
1337 # func_resolve_sysroot PATH
1338 # Replace a leading = in PATH with a sysroot. Store the result into
1339 # func_resolve_sysroot_result
1340 func_resolve_sysroot ()
1341 {
1342 func_resolve_sysroot_result=$1
1343 case $func_resolve_sysroot_result in
1344 =*)
1345 func_stripname '=' '' "$func_resolve_sysroot_result"
1346 func_resolve_sysroot_result=$lt_sysroot$func_stripname_result
1347 ;;
1348 esac
1349 }
1350
1351 # func_replace_sysroot PATH
1352 # If PATH begins with the sysroot, replace it with = and
1353 # store the result into func_replace_sysroot_result.
1354 func_replace_sysroot ()
1355 {
1356 case "$lt_sysroot:$1" in
1357 ?*:"$lt_sysroot"*)
1358 func_stripname "$lt_sysroot" '' "$1"
1359 func_replace_sysroot_result="=$func_stripname_result"
1360 ;;
1361 *)
1362 # Including no sysroot.
1363 func_replace_sysroot_result=$1
1364 ;;
1365 esac
1366 }
1367
1368 # func_infer_tag arg
1369 # Infer tagged configuration to use if any are available and
1370 # if one wasn't chosen via the "--tag" command line option.
1371 # Only attempt this if the compiler in the base compile
1372 # command doesn't match the default compiler.
1373 # arg is usually of the form 'gcc ...'
1374 func_infer_tag ()
1375 {
1376 $opt_debug
1377 if test -n "$available_tags" && test -z "$tagname"; then
1378 CC_quoted=
1379 for arg in $CC; do
1380 func_append_quoted CC_quoted "$arg"
1381 done
1382 CC_expanded=`func_echo_all $CC`
1383 CC_quoted_expanded=`func_echo_all $CC_quoted`
1384 case $@ in
1385 # Blanks in the command may have been stripped by the calling shell,
1386 # but not from the CC environment variable when configure was run.
1387 " $CC "* | "$CC "* | " $CC_expanded "* | "$CC_expanded "* | \
1388 " $CC_quoted"* | "$CC_quoted "* | " $CC_quoted_expanded "* | "$CC_quoted_expanded "*) ;;
1389 # Blanks at the start of $base_compile will cause this to fail
1390 # if we don't check for them as well.
1391 *)
1392 for z in $available_tags; do
1393 if $GREP "^# ### BEGIN LIBTOOL TAG CONFIG: $z$" < "$progpath" > /dev/null; then
1394 # Evaluate the configuration.
1395 eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^# ### END LIBTOOL TAG CONFIG: '$z'$/p' < $progpath`"
1396 CC_quoted=
1397 for arg in $CC; do
1398 # Double-quote args containing other shell metacharacters.
1399 func_append_quoted CC_quoted "$arg"
1400 done
1401 CC_expanded=`func_echo_all $CC`
1402 CC_quoted_expanded=`func_echo_all $CC_quoted`
1403 case "$@ " in
1404 " $CC "* | "$CC "* | " $CC_expanded "* | "$CC_expanded "* | \
1405 " $CC_quoted"* | "$CC_quoted "* | " $CC_quoted_expanded "* | "$CC_quoted_expanded "*)
1406 # The compiler in the base compile command matches
1407 # the one in the tagged configuration.
1408 # Assume this is the tagged configuration we want.
1409 tagname=$z
1410 break
1411 ;;
1412 esac
1413 fi
1414 done
1415 # If $tagname still isn't set, then no tagged configuration
1416 # was found and let the user know that the "--tag" command
1417 # line option must be used.
1418 if test -z "$tagname"; then
1419 func_echo "unable to infer tagged configuration"
1420 func_fatal_error "specify a tag with \`--tag'"
1421 # else
1422 # func_verbose "using $tagname tagged configuration"
1423 fi
1424 ;;
1425 esac
1426 fi
1427 }
1428
1429
1430
1431 # func_write_libtool_object output_name pic_name nonpic_name
1432 # Create a libtool object file (analogous to a ".la" file),
1433 # but don't create it if we're doing a dry run.
1434 func_write_libtool_object ()
1435 {
1436 write_libobj=${1}
1437 if test "$build_libtool_libs" = yes; then
1438 write_lobj=\'${2}\'
1439 else
1440 write_lobj=none
1441 fi
1442
1443 if test "$build_old_libs" = yes; then
1444 write_oldobj=\'${3}\'
1445 else
1446 write_oldobj=none
1447 fi
1448
1449 $opt_dry_run || {
1450 cat >${write_libobj}T <<EOF
1451 # $write_libobj - a libtool object file
1452 # Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION
1453 #
1454 # Please DO NOT delete this file!
1455 # It is necessary for linking the library.
1456
1457 # Name of the PIC object.
1458 pic_object=$write_lobj
1459
1460 # Name of the non-PIC object
1461 non_pic_object=$write_oldobj
1462
1463 EOF
1464 $MV "${write_libobj}T" "${write_libobj}"
1465 }
1466 }
1467
1468
1469 ##################################################
1470 # FILE NAME AND PATH CONVERSION HELPER FUNCTIONS #
1471 ##################################################
1472
1473 # func_convert_core_file_wine_to_w32 ARG
1474 # Helper function used by file name conversion functions when $build is *nix,
1475 # and $host is mingw, cygwin, or some other w32 environment. Relies on a
1476 # correctly configured wine environment available, with the winepath program
1477 # in $build's $PATH.
1478 #
1479 # ARG is the $build file name to be converted to w32 format.
1480 # Result is available in $func_convert_core_file_wine_to_w32_result, and will
1481 # be empty on error (or when ARG is empty)
1482 func_convert_core_file_wine_to_w32 ()
1483 {
1484 $opt_debug
1485 func_convert_core_file_wine_to_w32_result="$1"
1486 if test -n "$1"; then
1487 # Unfortunately, winepath does not exit with a non-zero error code, so we
1488 # are forced to check the contents of stdout. On the other hand, if the
1489 # command is not found, the shell will set an exit code of 127 and print
1490 # *an error message* to stdout. So we must check for both error code of
1491 # zero AND non-empty stdout, which explains the odd construction:
1492 func_convert_core_file_wine_to_w32_tmp=`winepath -w "$1" 2>/dev/null`
1493 if test "$?" -eq 0 && test -n "${func_convert_core_file_wine_to_w32_tmp}"; then
1494 func_convert_core_file_wine_to_w32_result=`$ECHO "$func_convert_core_file_wine_to_w32_tmp" |
1495 $SED -e "$lt_sed_naive_backslashify"`
1496 else
1497 func_convert_core_file_wine_to_w32_result=
1498 fi
1499 fi
1500 }
1501 # end: func_convert_core_file_wine_to_w32
1502
1503
1504 # func_convert_core_path_wine_to_w32 ARG
1505 # Helper function used by path conversion functions when $build is *nix, and
1506 # $host is mingw, cygwin, or some other w32 environment. Relies on a correctly
1507 # configured wine environment available, with the winepath program in $build's
1508 # $PATH. Assumes ARG has no leading or trailing path separator characters.
1509 #
1510 # ARG is path to be converted from $build format to win32.
1511 # Result is available in $func_convert_core_path_wine_to_w32_result.
1512 # Unconvertible file (directory) names in ARG are skipped; if no directory names
1513 # are convertible, then the result may be empty.
1514 func_convert_core_path_wine_to_w32 ()
1515 {
1516 $opt_debug
1517 # unfortunately, winepath doesn't convert paths, only file names
1518 func_convert_core_path_wine_to_w32_result=""
1519 if test -n "$1"; then
1520 oldIFS=$IFS
1521 IFS=:
1522 for func_convert_core_path_wine_to_w32_f in $1; do
1523 IFS=$oldIFS
1524 func_convert_core_file_wine_to_w32 "$func_convert_core_path_wine_to_w32_f"
1525 if test -n "$func_convert_core_file_wine_to_w32_result" ; then
1526 if test -z "$func_convert_core_path_wine_to_w32_result"; then
1527 func_convert_core_path_wine_to_w32_result="$func_convert_core_file_wine_to_w32_result"
1528 else
1529 func_append func_convert_core_path_wine_to_w32_result ";$func_convert_core_file_wine_to_w32_result"
1530 fi
1531 fi
1532 done
1533 IFS=$oldIFS
1534 fi
1535 }
1536 # end: func_convert_core_path_wine_to_w32
1537
1538
1539 # func_cygpath ARGS...
1540 # Wrapper around calling the cygpath program via LT_CYGPATH. This is used when
1541 # when (1) $build is *nix and Cygwin is hosted via a wine environment; or (2)
1542 # $build is MSYS and $host is Cygwin, or (3) $build is Cygwin. In case (1) or
1543 # (2), returns the Cygwin file name or path in func_cygpath_result (input
1544 # file name or path is assumed to be in w32 format, as previously converted
1545 # from $build's *nix or MSYS format). In case (3), returns the w32 file name
1546 # or path in func_cygpath_result (input file name or path is assumed to be in
1547 # Cygwin format). Returns an empty string on error.
1548 #
1549 # ARGS are passed to cygpath, with the last one being the file name or path to
1550 # be converted.
1551 #
1552 # Specify the absolute *nix (or w32) name to cygpath in the LT_CYGPATH
1553 # environment variable; do not put it in $PATH.
1554 func_cygpath ()
1555 {
1556 $opt_debug
1557 if test -n "$LT_CYGPATH" && test -f "$LT_CYGPATH"; then
1558 func_cygpath_result=`$LT_CYGPATH "$@" 2>/dev/null`
1559 if test "$?" -ne 0; then
1560 # on failure, ensure result is empty
1561 func_cygpath_result=
1562 fi
1563 else
1564 func_cygpath_result=
1565 func_error "LT_CYGPATH is empty or specifies non-existent file: \`$LT_CYGPATH'"
1566 fi
1567 }
1568 #end: func_cygpath
1569
1570
1571 # func_convert_core_msys_to_w32 ARG
1572 # Convert file name or path ARG from MSYS format to w32 format. Return
1573 # result in func_convert_core_msys_to_w32_result.
1574 func_convert_core_msys_to_w32 ()
1575 {
1576 $opt_debug
1577 # awkward: cmd appends spaces to result
1578 func_convert_core_msys_to_w32_result=`( cmd //c echo "$1" ) 2>/dev/null |
1579 $SED -e 's/[ ]*$//' -e "$lt_sed_naive_backslashify"`
1580 }
1581 #end: func_convert_core_msys_to_w32
1582
1583
1584 # func_convert_file_check ARG1 ARG2
1585 # Verify that ARG1 (a file name in $build format) was converted to $host
1586 # format in ARG2. Otherwise, emit an error message, but continue (resetting
1587 # func_to_host_file_result to ARG1).
1588 func_convert_file_check ()
1589 {
1590 $opt_debug
1591 if test -z "$2" && test -n "$1" ; then
1592 func_error "Could not determine host file name corresponding to"
1593 func_error " \`$1'"
1594 func_error "Continuing, but uninstalled executables may not work."
1595 # Fallback:
1596 func_to_host_file_result="$1"
1597 fi
1598 }
1599 # end func_convert_file_check
1600
1601
1602 # func_convert_path_check FROM_PATHSEP TO_PATHSEP FROM_PATH TO_PATH
1603 # Verify that FROM_PATH (a path in $build format) was converted to $host
1604 # format in TO_PATH. Otherwise, emit an error message, but continue, resetting
1605 # func_to_host_file_result to a simplistic fallback value (see below).
1606 func_convert_path_check ()
1607 {
1608 $opt_debug
1609 if test -z "$4" && test -n "$3"; then
1610 func_error "Could not determine the host path corresponding to"
1611 func_error " \`$3'"
1612 func_error "Continuing, but uninstalled executables may not work."
1613 # Fallback. This is a deliberately simplistic "conversion" and
1614 # should not be "improved". See libtool.info.
1615 if test "x$1" != "x$2"; then
1616 lt_replace_pathsep_chars="s|$1|$2|g"
1617 func_to_host_path_result=`echo "$3" |
1618 $SED -e "$lt_replace_pathsep_chars"`
1619 else
1620 func_to_host_path_result="$3"
1621 fi
1622 fi
1623 }
1624 # end func_convert_path_check
1625
1626
1627 # func_convert_path_front_back_pathsep FRONTPAT BACKPAT REPL ORIG
1628 # Modifies func_to_host_path_result by prepending REPL if ORIG matches FRONTPAT
1629 # and appending REPL if ORIG matches BACKPAT.
1630 func_convert_path_front_back_pathsep ()
1631 {
1632 $opt_debug
1633 case $4 in
1634 $1 ) func_to_host_path_result="$3$func_to_host_path_result"
1635 ;;
1636 esac
1637 case $4 in
1638 $2 ) func_append func_to_host_path_result "$3"
1639 ;;
1640 esac
1641 }
1642 # end func_convert_path_front_back_pathsep
1643
1644
1645 ##################################################
1646 # $build to $host FILE NAME CONVERSION FUNCTIONS #
1647 ##################################################
1648 # invoked via `$to_host_file_cmd ARG'
1649 #
1650 # In each case, ARG is the path to be converted from $build to $host format.
1651 # Result will be available in $func_to_host_file_result.
1652
1653
1654 # func_to_host_file ARG
1655 # Converts the file name ARG from $build format to $host format. Return result
1656 # in func_to_host_file_result.
1657 func_to_host_file ()
1658 {
1659 $opt_debug
1660 $to_host_file_cmd "$1"
1661 }
1662 # end func_to_host_file
1663
1664
1665 # func_to_tool_file ARG LAZY
1666 # converts the file name ARG from $build format to toolchain format. Return
1667 # result in func_to_tool_file_result. If the conversion in use is listed
1668 # in (the comma separated) LAZY, no conversion takes place.
1669 func_to_tool_file ()
1670 {
1671 $opt_debug
1672 case ,$2, in
1673 *,"$to_tool_file_cmd",*)
1674 func_to_tool_file_result=$1
1675 ;;
1676 *)
1677 $to_tool_file_cmd "$1"
1678 func_to_tool_file_result=$func_to_host_file_result
1679 ;;
1680 esac
1681 }
1682 # end func_to_tool_file
1683
1684
1685 # func_convert_file_noop ARG
1686 # Copy ARG to func_to_host_file_result.
1687 func_convert_file_noop ()
1688 {
1689 func_to_host_file_result="$1"
1690 }
1691 # end func_convert_file_noop
1692
1693
1694 # func_convert_file_msys_to_w32 ARG
1695 # Convert file name ARG from (mingw) MSYS to (mingw) w32 format; automatic
1696 # conversion to w32 is not available inside the cwrapper. Returns result in
1697 # func_to_host_file_result.
1698 func_convert_file_msys_to_w32 ()
1699 {
1700 $opt_debug
1701 func_to_host_file_result="$1"
1702 if test -n "$1"; then
1703 func_convert_core_msys_to_w32 "$1"
1704 func_to_host_file_result="$func_convert_core_msys_to_w32_result"
1705 fi
1706 func_convert_file_check "$1" "$func_to_host_file_result"
1707 }
1708 # end func_convert_file_msys_to_w32
1709
1710
1711 # func_convert_file_cygwin_to_w32 ARG
1712 # Convert file name ARG from Cygwin to w32 format. Returns result in
1713 # func_to_host_file_result.
1714 func_convert_file_cygwin_to_w32 ()
1715 {
1716 $opt_debug
1717 func_to_host_file_result="$1"
1718 if test -n "$1"; then
1719 # because $build is cygwin, we call "the" cygpath in $PATH; no need to use
1720 # LT_CYGPATH in this case.
1721 func_to_host_file_result=`cygpath -m "$1"`
1722 fi
1723 func_convert_file_check "$1" "$func_to_host_file_result"
1724 }
1725 # end func_convert_file_cygwin_to_w32
1726
1727
1728 # func_convert_file_nix_to_w32 ARG
1729 # Convert file name ARG from *nix to w32 format. Requires a wine environment
1730 # and a working winepath. Returns result in func_to_host_file_result.
1731 func_convert_file_nix_to_w32 ()
1732 {
1733 $opt_debug
1734 func_to_host_file_result="$1"
1735 if test -n "$1"; then
1736 func_convert_core_file_wine_to_w32 "$1"
1737 func_to_host_file_result="$func_convert_core_file_wine_to_w32_result"
1738 fi
1739 func_convert_file_check "$1" "$func_to_host_file_result"
1740 }
1741 # end func_convert_file_nix_to_w32
1742
1743
1744 # func_convert_file_msys_to_cygwin ARG
1745 # Convert file name ARG from MSYS to Cygwin format. Requires LT_CYGPATH set.
1746 # Returns result in func_to_host_file_result.
1747 func_convert_file_msys_to_cygwin ()
1748 {
1749 $opt_debug
1750 func_to_host_file_result="$1"
1751 if test -n "$1"; then
1752 func_convert_core_msys_to_w32 "$1"
1753 func_cygpath -u "$func_convert_core_msys_to_w32_result"
1754 func_to_host_file_result="$func_cygpath_result"
1755 fi
1756 func_convert_file_check "$1" "$func_to_host_file_result"
1757 }
1758 # end func_convert_file_msys_to_cygwin
1759
1760
1761 # func_convert_file_nix_to_cygwin ARG
1762 # Convert file name ARG from *nix to Cygwin format. Requires Cygwin installed
1763 # in a wine environment, working winepath, and LT_CYGPATH set. Returns result
1764 # in func_to_host_file_result.
1765 func_convert_file_nix_to_cygwin ()
1766 {
1767 $opt_debug
1768 func_to_host_file_result="$1"
1769 if test -n "$1"; then
1770 # convert from *nix to w32, then use cygpath to convert from w32 to cygwin.
1771 func_convert_core_file_wine_to_w32 "$1"
1772 func_cygpath -u "$func_convert_core_file_wine_to_w32_result"
1773 func_to_host_file_result="$func_cygpath_result"
1774 fi
1775 func_convert_file_check "$1" "$func_to_host_file_result"
1776 }
1777 # end func_convert_file_nix_to_cygwin
1778
1779
1780 #############################################
1781 # $build to $host PATH CONVERSION FUNCTIONS #
1782 #############################################
1783 # invoked via `$to_host_path_cmd ARG'
1784 #
1785 # In each case, ARG is the path to be converted from $build to $host format.
1786 # The result will be available in $func_to_host_path_result.
1787 #
1788 # Path separators are also converted from $build format to $host format. If
1789 # ARG begins or ends with a path separator character, it is preserved (but
1790 # converted to $host format) on output.
1791 #
1792 # All path conversion functions are named using the following convention:
1793 # file name conversion function : func_convert_file_X_to_Y ()
1794 # path conversion function : func_convert_path_X_to_Y ()
1795 # where, for any given $build/$host combination the 'X_to_Y' value is the
1796 # same. If conversion functions are added for new $build/$host combinations,
1797 # the two new functions must follow this pattern, or func_init_to_host_path_cmd
1798 # will break.
1799
1800
1801 # func_init_to_host_path_cmd
1802 # Ensures that function "pointer" variable $to_host_path_cmd is set to the
1803 # appropriate value, based on the value of $to_host_file_cmd.
1804 to_host_path_cmd=
1805 func_init_to_host_path_cmd ()
1806 {
1807 $opt_debug
1808 if test -z "$to_host_path_cmd"; then
1809 func_stripname 'func_convert_file_' '' "$to_host_file_cmd"
1810 to_host_path_cmd="func_convert_path_${func_stripname_result}"
1811 fi
1812 }
1813
1814
1815 # func_to_host_path ARG
1816 # Converts the path ARG from $build format to $host format. Return result
1817 # in func_to_host_path_result.
1818 func_to_host_path ()
1819 {
1820 $opt_debug
1821 func_init_to_host_path_cmd
1822 $to_host_path_cmd "$1"
1823 }
1824 # end func_to_host_path
1825
1826
1827 # func_convert_path_noop ARG
1828 # Copy ARG to func_to_host_path_result.
1829 func_convert_path_noop ()
1830 {
1831 func_to_host_path_result="$1"
1832 }
1833 # end func_convert_path_noop
1834
1835
1836 # func_convert_path_msys_to_w32 ARG
1837 # Convert path ARG from (mingw) MSYS to (mingw) w32 format; automatic
1838 # conversion to w32 is not available inside the cwrapper. Returns result in
1839 # func_to_host_path_result.
1840 func_convert_path_msys_to_w32 ()
1841 {
1842 $opt_debug
1843 func_to_host_path_result="$1"
1844 if test -n "$1"; then
1845 # Remove leading and trailing path separator characters from ARG. MSYS
1846 # behavior is inconsistent here; cygpath turns them into '.;' and ';.';
1847 # and winepath ignores them completely.
1848 func_stripname : : "$1"
1849 func_to_host_path_tmp1=$func_stripname_result
1850 func_convert_core_msys_to_w32 "$func_to_host_path_tmp1"
1851 func_to_host_path_result="$func_convert_core_msys_to_w32_result"
1852 func_convert_path_check : ";" \
1853 "$func_to_host_path_tmp1" "$func_to_host_path_result"
1854 func_convert_path_front_back_pathsep ":*" "*:" ";" "$1"
1855 fi
1856 }
1857 # end func_convert_path_msys_to_w32
1858
1859
1860 # func_convert_path_cygwin_to_w32 ARG
1861 # Convert path ARG from Cygwin to w32 format. Returns result in
1862 # func_to_host_file_result.
1863 func_convert_path_cygwin_to_w32 ()
1864 {
1865 $opt_debug
1866 func_to_host_path_result="$1"
1867 if test -n "$1"; then
1868 # See func_convert_path_msys_to_w32:
1869 func_stripname : : "$1"
1870 func_to_host_path_tmp1=$func_stripname_result
1871 func_to_host_path_result=`cygpath -m -p "$func_to_host_path_tmp1"`
1872 func_convert_path_check : ";" \
1873 "$func_to_host_path_tmp1" "$func_to_host_path_result"
1874 func_convert_path_front_back_pathsep ":*" "*:" ";" "$1"
1875 fi
1876 }
1877 # end func_convert_path_cygwin_to_w32
1878
1879
1880 # func_convert_path_nix_to_w32 ARG
1881 # Convert path ARG from *nix to w32 format. Requires a wine environment and
1882 # a working winepath. Returns result in func_to_host_file_result.
1883 func_convert_path_nix_to_w32 ()
1884 {
1885 $opt_debug
1886 func_to_host_path_result="$1"
1887 if test -n "$1"; then
1888 # See func_convert_path_msys_to_w32:
1889 func_stripname : : "$1"
1890 func_to_host_path_tmp1=$func_stripname_result
1891 func_convert_core_path_wine_to_w32 "$func_to_host_path_tmp1"
1892 func_to_host_path_result="$func_convert_core_path_wine_to_w32_result"
1893 func_convert_path_check : ";" \
1894 "$func_to_host_path_tmp1" "$func_to_host_path_result"
1895 func_convert_path_front_back_pathsep ":*" "*:" ";" "$1"
1896 fi
1897 }
1898 # end func_convert_path_nix_to_w32
1899
1900
1901 # func_convert_path_msys_to_cygwin ARG
1902 # Convert path ARG from MSYS to Cygwin format. Requires LT_CYGPATH set.
1903 # Returns result in func_to_host_file_result.
1904 func_convert_path_msys_to_cygwin ()
1905 {
1906 $opt_debug
1907 func_to_host_path_result="$1"
1908 if test -n "$1"; then
1909 # See func_convert_path_msys_to_w32:
1910 func_stripname : : "$1"
1911 func_to_host_path_tmp1=$func_stripname_result
1912 func_convert_core_msys_to_w32 "$func_to_host_path_tmp1"
1913 func_cygpath -u -p "$func_convert_core_msys_to_w32_result"
1914 func_to_host_path_result="$func_cygpath_result"
1915 func_convert_path_check : : \
1916 "$func_to_host_path_tmp1" "$func_to_host_path_result"
1917 func_convert_path_front_back_pathsep ":*" "*:" : "$1"
1918 fi
1919 }
1920 # end func_convert_path_msys_to_cygwin
1921
1922
1923 # func_convert_path_nix_to_cygwin ARG
1924 # Convert path ARG from *nix to Cygwin format. Requires Cygwin installed in a
1925 # a wine environment, working winepath, and LT_CYGPATH set. Returns result in
1926 # func_to_host_file_result.
1927 func_convert_path_nix_to_cygwin ()
1928 {
1929 $opt_debug
1930 func_to_host_path_result="$1"
1931 if test -n "$1"; then
1932 # Remove leading and trailing path separator characters from
1933 # ARG. msys behavior is inconsistent here, cygpath turns them
1934 # into '.;' and ';.', and winepath ignores them completely.
1935 func_stripname : : "$1"
1936 func_to_host_path_tmp1=$func_stripname_result
1937 func_convert_core_path_wine_to_w32 "$func_to_host_path_tmp1"
1938 func_cygpath -u -p "$func_convert_core_path_wine_to_w32_result"
1939 func_to_host_path_result="$func_cygpath_result"
1940 func_convert_path_check : : \
1941 "$func_to_host_path_tmp1" "$func_to_host_path_result"
1942 func_convert_path_front_back_pathsep ":*" "*:" : "$1"
1943 fi
1944 }
1945 # end func_convert_path_nix_to_cygwin
1946
1947
1948 # func_mode_compile arg...
1949 func_mode_compile ()
1950 {
1951 $opt_debug
1952 # Get the compilation command and the source file.
1953 base_compile=
1954 srcfile="$nonopt" # always keep a non-empty value in "srcfile"
1955 suppress_opt=yes
1956 suppress_output=
1957 arg_mode=normal
1958 libobj=
1959 later=
1960 pie_flag=
1961
1962 for arg
1963 do
1964 case $arg_mode in
1965 arg )
1966 # do not "continue". Instead, add this to base_compile
1967 lastarg="$arg"
1968 arg_mode=normal
1969 ;;
1970
1971 target )
1972 libobj="$arg"
1973 arg_mode=normal
1974 continue
1975 ;;
1976
1977 normal )
1978 # Accept any command-line options.
1979 case $arg in
1980 -o)
1981 test -n "$libobj" && \
1982 func_fatal_error "you cannot specify \`-o' more than once"
1983 arg_mode=target
1984 continue
1985 ;;
1986
1987 -pie | -fpie | -fPIE)
1988 func_append pie_flag " $arg"
1989 continue
1990 ;;
1991
1992 -shared | -static | -prefer-pic | -prefer-non-pic)
1993 func_append later " $arg"
1994 continue
1995 ;;
1996
1997 -no-suppress)
1998 suppress_opt=no
1999 continue
2000 ;;
2001
2002 -Xcompiler)
2003 arg_mode=arg # the next one goes into the "base_compile" arg list
2004 continue # The current "srcfile" will either be retained or
2005 ;; # replaced later. I would guess that would be a bug.
2006
2007 -Wc,*)
2008 func_stripname '-Wc,' '' "$arg"
2009 args=$func_stripname_result
2010 lastarg=
2011 save_ifs="$IFS"; IFS=','
2012 for arg in $args; do
2013 IFS="$save_ifs"
2014 func_append_quoted lastarg "$arg"
2015 done
2016 IFS="$save_ifs"
2017 func_stripname ' ' '' "$lastarg"
2018 lastarg=$func_stripname_result
2019
2020 # Add the arguments to base_compile.
2021 func_append base_compile " $lastarg"
2022 continue
2023 ;;
2024
2025 *)
2026 # Accept the current argument as the source file.
2027 # The previous "srcfile" becomes the current argument.
2028 #
2029 lastarg="$srcfile"
2030 srcfile="$arg"
2031 ;;
2032 esac # case $arg
2033 ;;
2034 esac # case $arg_mode
2035
2036 # Aesthetically quote the previous argument.
2037 func_append_quoted base_compile "$lastarg"
2038 done # for arg
2039
2040 case $arg_mode in
2041 arg)
2042 func_fatal_error "you must specify an argument for -Xcompile"
2043 ;;
2044 target)
2045 func_fatal_error "you must specify a target with \`-o'"
2046 ;;
2047 *)
2048 # Get the name of the library object.
2049 test -z "$libobj" && {
2050 func_basename "$srcfile"
2051 libobj="$func_basename_result"
2052 }
2053 ;;
2054 esac
2055
2056 # Recognize several different file suffixes.
2057 # If the user specifies -o file.o, it is replaced with file.lo
2058 case $libobj in
2059 *.[cCFSifmso] | \
2060 *.ada | *.adb | *.ads | *.asm | \
2061 *.c++ | *.cc | *.ii | *.class | *.cpp | *.cxx | \
2062 *.[fF][09]? | *.for | *.java | *.go | *.obj | *.sx | *.cu | *.cup)
2063 func_xform "$libobj"
2064 libobj=$func_xform_result
2065 ;;
2066 esac
2067
2068 case $libobj in
2069 *.lo) func_lo2o "$libobj"; obj=$func_lo2o_result ;;
2070 *)
2071 func_fatal_error "cannot determine name of library object from \`$libobj'"
2072 ;;
2073 esac
2074
2075 func_infer_tag $base_compile
2076
2077 for arg in $later; do
2078 case $arg in
2079 -shared)
2080 test "$build_libtool_libs" != yes && \
2081 func_fatal_configuration "can not build a shared library"
2082 build_old_libs=no
2083 continue
2084 ;;
2085
2086 -static)
2087 build_libtool_libs=no
2088 build_old_libs=yes
2089 continue
2090 ;;
2091
2092 -prefer-pic)
2093 pic_mode=yes
2094 continue
2095 ;;
2096
2097 -prefer-non-pic)
2098 pic_mode=no
2099 continue
2100 ;;
2101 esac
2102 done
2103
2104 func_quote_for_eval "$libobj"
2105 test "X$libobj" != "X$func_quote_for_eval_result" \
2106 && $ECHO "X$libobj" | $GREP '[]~#^*{};<>?"'"'"' &()|`$[]' \
2107 && func_warning "libobj name \`$libobj' may not contain shell special characters."
2108 func_dirname_and_basename "$obj" "/" ""
2109 objname="$func_basename_result"
2110 xdir="$func_dirname_result"
2111 lobj=${xdir}$objdir/$objname
2112
2113 test -z "$base_compile" && \
2114 func_fatal_help "you must specify a compilation command"
2115
2116 # Delete any leftover library objects.
2117 if test "$build_old_libs" = yes; then
2118 removelist="$obj $lobj $libobj ${libobj}T"
2119 else
2120 removelist="$lobj $libobj ${libobj}T"
2121 fi
2122
2123 # On Cygwin there's no "real" PIC flag so we must build both object types
2124 case $host_os in
2125 cygwin* | mingw* | pw32* | os2* | cegcc*)
2126 pic_mode=default
2127 ;;
2128 esac
2129 if test "$pic_mode" = no && test "$deplibs_check_method" != pass_all; then
2130 # non-PIC code in shared libraries is not supported
2131 pic_mode=default
2132 fi
2133
2134 # Calculate the filename of the output object if compiler does
2135 # not support -o with -c
2136 if test "$compiler_c_o" = no; then
2137 output_obj=`$ECHO "$srcfile" | $SED 's%^.*/%%; s%\.[^.]*$%%'`.${objext}
2138 lockfile="$output_obj.lock"
2139 else
2140 output_obj=
2141 need_locks=no
2142 lockfile=
2143 fi
2144
2145 # Lock this critical section if it is needed
2146 # We use this script file to make the link, it avoids creating a new file
2147 if test "$need_locks" = yes; then
2148 until $opt_dry_run || ln "$progpath" "$lockfile" 2>/dev/null; do
2149 func_echo "Waiting for $lockfile to be removed"
2150 sleep 2
2151 done
2152 elif test "$need_locks" = warn; then
2153 if test -f "$lockfile"; then
2154 $ECHO "\
2155 *** ERROR, $lockfile exists and contains:
2156 `cat $lockfile 2>/dev/null`
2157
2158 This indicates that another process is trying to use the same
2159 temporary object file, and libtool could not work around it because
2160 your compiler does not support \`-c' and \`-o' together. If you
2161 repeat this compilation, it may succeed, by chance, but you had better
2162 avoid parallel builds (make -j) in this platform, or get a better
2163 compiler."
2164
2165 $opt_dry_run || $RM $removelist
2166 exit $EXIT_FAILURE
2167 fi
2168 func_append removelist " $output_obj"
2169 $ECHO "$srcfile" > "$lockfile"
2170 fi
2171
2172 $opt_dry_run || $RM $removelist
2173 func_append removelist " $lockfile"
2174 trap '$opt_dry_run || $RM $removelist; exit $EXIT_FAILURE' 1 2 15
2175
2176 func_to_tool_file "$srcfile" func_convert_file_msys_to_w32
2177 srcfile=$func_to_tool_file_result
2178 func_quote_for_eval "$srcfile"
2179 qsrcfile=$func_quote_for_eval_result
2180
2181 # Only build a PIC object if we are building libtool libraries.
2182 if test "$build_libtool_libs" = yes; then
2183 # Without this assignment, base_compile gets emptied.
2184 fbsd_hideous_sh_bug=$base_compile
2185
2186 if test "$pic_mode" != no; then
2187 command="$base_compile $qsrcfile $pic_flag"
2188 else
2189 # Don't build PIC code
2190 command="$base_compile $qsrcfile"
2191 fi
2192
2193 func_mkdir_p "$xdir$objdir"
2194
2195 if test -z "$output_obj"; then
2196 # Place PIC objects in $objdir
2197 func_append command " -o $lobj"
2198 fi
2199
2200 func_show_eval_locale "$command" \
2201 'test -n "$output_obj" && $RM $removelist; exit $EXIT_FAILURE'
2202
2203 if test "$need_locks" = warn &&
2204 test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then
2205 $ECHO "\
2206 *** ERROR, $lockfile contains:
2207 `cat $lockfile 2>/dev/null`
2208
2209 but it should contain:
2210 $srcfile
2211
2212 This indicates that another process is trying to use the same
2213 temporary object file, and libtool could not work around it because
2214 your compiler does not support \`-c' and \`-o' together. If you
2215 repeat this compilation, it may succeed, by chance, but you had better
2216 avoid parallel builds (make -j) in this platform, or get a better
2217 compiler."
2218
2219 $opt_dry_run || $RM $removelist
2220 exit $EXIT_FAILURE
2221 fi
2222
2223 # Just move the object if needed, then go on to compile the next one
2224 if test -n "$output_obj" && test "X$output_obj" != "X$lobj"; then
2225 func_show_eval '$MV "$output_obj" "$lobj"' \
2226 'error=$?; $opt_dry_run || $RM $removelist; exit $error'
2227 fi
2228
2229 # Allow error messages only from the first compilation.
2230 if test "$suppress_opt" = yes; then
2231 suppress_output=' >/dev/null 2>&1'
2232 fi
2233 fi
2234
2235 # Only build a position-dependent object if we build old libraries.
2236 if test "$build_old_libs" = yes; then
2237 if test "$pic_mode" != yes; then
2238 # Don't build PIC code
2239 command="$base_compile $qsrcfile$pie_flag"
2240 else
2241 command="$base_compile $qsrcfile $pic_flag"
2242 fi
2243 if test "$compiler_c_o" = yes; then
2244 func_append command " -o $obj"
2245 fi
2246
2247 # Suppress compiler output if we already did a PIC compilation.
2248 func_append command "$suppress_output"
2249 func_show_eval_locale "$command" \
2250 '$opt_dry_run || $RM $removelist; exit $EXIT_FAILURE'
2251
2252 if test "$need_locks" = warn &&
2253 test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then
2254 $ECHO "\
2255 *** ERROR, $lockfile contains:
2256 `cat $lockfile 2>/dev/null`
2257
2258 but it should contain:
2259 $srcfile
2260
2261 This indicates that another process is trying to use the same
2262 temporary object file, and libtool could not work around it because
2263 your compiler does not support \`-c' and \`-o' together. If you
2264 repeat this compilation, it may succeed, by chance, but you had better
2265 avoid parallel builds (make -j) in this platform, or get a better
2266 compiler."
2267
2268 $opt_dry_run || $RM $removelist
2269 exit $EXIT_FAILURE
2270 fi
2271
2272 # Just move the object if needed
2273 if test -n "$output_obj" && test "X$output_obj" != "X$obj"; then
2274 func_show_eval '$MV "$output_obj" "$obj"' \
2275 'error=$?; $opt_dry_run || $RM $removelist; exit $error'
2276 fi
2277 fi
2278
2279 $opt_dry_run || {
2280 func_write_libtool_object "$libobj" "$objdir/$objname" "$objname"
2281
2282 # Unlock the critical section if it was locked
2283 if test "$need_locks" != no; then
2284 removelist=$lockfile
2285 $RM "$lockfile"
2286 fi
2287 }
2288
2289 exit $EXIT_SUCCESS
2290 }
2291
2292 $opt_help || {
2293 test "$opt_mode" = compile && func_mode_compile ${1+"$@"}
2294 }
2295
2296 func_mode_help ()
2297 {
2298 # We need to display help for each of the modes.
2299 case $opt_mode in
2300 "")
2301 # Generic help is extracted from the usage comments
2302 # at the start of this file.
2303 func_help
2304 ;;
2305
2306 clean)
2307 $ECHO \
2308 "Usage: $progname [OPTION]... --mode=clean RM [RM-OPTION]... FILE...
2309
2310 Remove files from the build directory.
2311
2312 RM is the name of the program to use to delete files associated with each FILE
2313 (typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed
2314 to RM.
2315
2316 If FILE is a libtool library, object or program, all the files associated
2317 with it are deleted. Otherwise, only FILE itself is deleted using RM."
2318 ;;
2319
2320 compile)
2321 $ECHO \
2322 "Usage: $progname [OPTION]... --mode=compile COMPILE-COMMAND... SOURCEFILE
2323
2324 Compile a source file into a libtool library object.
2325
2326 This mode accepts the following additional options:
2327
2328 -o OUTPUT-FILE set the output file name to OUTPUT-FILE
2329 -no-suppress do not suppress compiler output for multiple passes
2330 -prefer-pic try to build PIC objects only
2331 -prefer-non-pic try to build non-PIC objects only
2332 -shared do not build a \`.o' file suitable for static linking
2333 -static only build a \`.o' file suitable for static linking
2334 -Wc,FLAG pass FLAG directly to the compiler
2335
2336 COMPILE-COMMAND is a command to be used in creating a \`standard' object file
2337 from the given SOURCEFILE.
2338
2339 The output file name is determined by removing the directory component from
2340 SOURCEFILE, then substituting the C source code suffix \`.c' with the
2341 library object suffix, \`.lo'."
2342 ;;
2343
2344 execute)
2345 $ECHO \
2346 "Usage: $progname [OPTION]... --mode=execute COMMAND [ARGS]...
2347
2348 Automatically set library path, then run a program.
2349
2350 This mode accepts the following additional options:
2351
2352 -dlopen FILE add the directory containing FILE to the library path
2353
2354 This mode sets the library path environment variable according to \`-dlopen'
2355 flags.
2356
2357 If any of the ARGS are libtool executable wrappers, then they are translated
2358 into their corresponding uninstalled binary, and any of their required library
2359 directories are added to the library path.
2360
2361 Then, COMMAND is executed, with ARGS as arguments."
2362 ;;
2363
2364 finish)
2365 $ECHO \
2366 "Usage: $progname [OPTION]... --mode=finish [LIBDIR]...
2367
2368 Complete the installation of libtool libraries.
2369
2370 Each LIBDIR is a directory that contains libtool libraries.
2371
2372 The commands that this mode executes may require superuser privileges. Use
2373 the \`--dry-run' option if you just want to see what would be executed."
2374 ;;
2375
2376 install)
2377 $ECHO \
2378 "Usage: $progname [OPTION]... --mode=install INSTALL-COMMAND...
2379
2380 Install executables or libraries.
2381
2382 INSTALL-COMMAND is the installation command. The first component should be
2383 either the \`install' or \`cp' program.
2384
2385 The following components of INSTALL-COMMAND are treated specially:
2386
2387 -inst-prefix-dir PREFIX-DIR Use PREFIX-DIR as a staging area for installation
2388
2389 The rest of the components are interpreted as arguments to that command (only
2390 BSD-compatible install options are recognized)."
2391 ;;
2392
2393 link)
2394 $ECHO \
2395 "Usage: $progname [OPTION]... --mode=link LINK-COMMAND...
2396
2397 Link object files or libraries together to form another library, or to
2398 create an executable program.
2399
2400 LINK-COMMAND is a command using the C compiler that you would use to create
2401 a program from several object files.
2402
2403 The following components of LINK-COMMAND are treated specially:
2404
2405 -all-static do not do any dynamic linking at all
2406 -avoid-version do not add a version suffix if possible
2407 -bindir BINDIR specify path to binaries directory (for systems where
2408 libraries must be found in the PATH setting at runtime)
2409 -dlopen FILE \`-dlpreopen' FILE if it cannot be dlopened at runtime
2410 -dlpreopen FILE link in FILE and add its symbols to lt_preloaded_symbols
2411 -export-dynamic allow symbols from OUTPUT-FILE to be resolved with dlsym(3)
2412 -export-symbols SYMFILE
2413 try to export only the symbols listed in SYMFILE
2414 -export-symbols-regex REGEX
2415 try to export only the symbols matching REGEX
2416 -LLIBDIR search LIBDIR for required installed libraries
2417 -lNAME OUTPUT-FILE requires the installed library libNAME
2418 -module build a library that can dlopened
2419 -no-fast-install disable the fast-install mode
2420 -no-install link a not-installable executable
2421 -no-undefined declare that a library does not refer to external symbols
2422 -o OUTPUT-FILE create OUTPUT-FILE from the specified objects
2423 -objectlist FILE Use a list of object files found in FILE to specify objects
2424 -precious-files-regex REGEX
2425 don't remove output files matching REGEX
2426 -release RELEASE specify package release information
2427 -rpath LIBDIR the created library will eventually be installed in LIBDIR
2428 -R[ ]LIBDIR add LIBDIR to the runtime path of programs and libraries
2429 -shared only do dynamic linking of libtool libraries
2430 -shrext SUFFIX override the standard shared library file extension
2431 -static do not do any dynamic linking of uninstalled libtool libraries
2432 -static-libtool-libs
2433 do not do any dynamic linking of libtool libraries
2434 -version-info CURRENT[:REVISION[:AGE]]
2435 specify library version info [each variable defaults to 0]
2436 -weak LIBNAME declare that the target provides the LIBNAME interface
2437 -Wc,FLAG
2438 -Xcompiler FLAG pass linker-specific FLAG directly to the compiler
2439 -Wl,FLAG
2440 -Xlinker FLAG pass linker-specific FLAG directly to the linker
2441 -XCClinker FLAG pass link-specific FLAG to the compiler driver (CC)
2442
2443 All other options (arguments beginning with \`-') are ignored.
2444
2445 Every other argument is treated as a filename. Files ending in \`.la' are
2446 treated as uninstalled libtool libraries, other files are standard or library
2447 object files.
2448
2449 If the OUTPUT-FILE ends in \`.la', then a libtool library is created,
2450 only library objects (\`.lo' files) may be specified, and \`-rpath' is
2451 required, except when creating a convenience library.
2452
2453 If OUTPUT-FILE ends in \`.a' or \`.lib', then a standard library is created
2454 using \`ar' and \`ranlib', or on Windows using \`lib'.
2455
2456 If OUTPUT-FILE ends in \`.lo' or \`.${objext}', then a reloadable object file
2457 is created, otherwise an executable program is created."
2458 ;;
2459
2460 uninstall)
2461 $ECHO \
2462 "Usage: $progname [OPTION]... --mode=uninstall RM [RM-OPTION]... FILE...
2463
2464 Remove libraries from an installation directory.
2465
2466 RM is the name of the program to use to delete files associated with each FILE
2467 (typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed
2468 to RM.
2469
2470 If FILE is a libtool library, all the files associated with it are deleted.
2471 Otherwise, only FILE itself is deleted using RM."
2472 ;;
2473
2474 *)
2475 func_fatal_help "invalid operation mode \`$opt_mode'"
2476 ;;
2477 esac
2478
2479 echo
2480 $ECHO "Try \`$progname --help' for more information about other modes."
2481 }
2482
2483 # Now that we've collected a possible --mode arg, show help if necessary
2484 if $opt_help; then
2485 if test "$opt_help" = :; then
2486 func_mode_help
2487 else
2488 {
2489 func_help noexit
2490 for opt_mode in compile link execute install finish uninstall clean; do
2491 func_mode_help
2492 done
2493 } | sed -n '1p; 2,$s/^Usage:/ or: /p'
2494 {
2495 func_help noexit
2496 for opt_mode in compile link execute install finish uninstall clean; do
2497 echo
2498 func_mode_help
2499 done
2500 } |
2501 sed '1d
2502 /^When reporting/,/^Report/{
2503 H
2504 d
2505 }
2506 $x
2507 /information about other modes/d
2508 /more detailed .*MODE/d
2509 s/^Usage:.*--mode=\([^ ]*\) .*/Description of \1 mode:/'
2510 fi
2511 exit $?
2512 fi
2513
2514
2515 # func_mode_execute arg...
2516 func_mode_execute ()
2517 {
2518 $opt_debug
2519 # The first argument is the command name.
2520 cmd="$nonopt"
2521 test -z "$cmd" && \
2522 func_fatal_help "you must specify a COMMAND"
2523
2524 # Handle -dlopen flags immediately.
2525 for file in $opt_dlopen; do
2526 test -f "$file" \
2527 || func_fatal_help "\`$file' is not a file"
2528
2529 dir=
2530 case $file in
2531 *.la)
2532 func_resolve_sysroot "$file"
2533 file=$func_resolve_sysroot_result
2534
2535 # Check to see that this really is a libtool archive.
2536 func_lalib_unsafe_p "$file" \
2537 || func_fatal_help "\`$lib' is not a valid libtool archive"
2538
2539 # Read the libtool library.
2540 dlname=
2541 library_names=
2542 func_source "$file"
2543
2544 # Skip this library if it cannot be dlopened.
2545 if test -z "$dlname"; then
2546 # Warn if it was a shared library.
2547 test -n "$library_names" && \
2548 func_warning "\`$file' was not linked with \`-export-dynamic'"
2549 continue
2550 fi
2551
2552 func_dirname "$file" "" "."
2553 dir="$func_dirname_result"
2554
2555 if test -f "$dir/$objdir/$dlname"; then
2556 func_append dir "/$objdir"
2557 else
2558 if test ! -f "$dir/$dlname"; then
2559 func_fatal_error "cannot find \`$dlname' in \`$dir' or \`$dir/$objdir'"
2560 fi
2561 fi
2562 ;;
2563
2564 *.lo)
2565 # Just add the directory containing the .lo file.
2566 func_dirname "$file" "" "."
2567 dir="$func_dirname_result"
2568 ;;
2569
2570 *)
2571 func_warning "\`-dlopen' is ignored for non-libtool libraries and objects"
2572 continue
2573 ;;
2574 esac
2575
2576 # Get the absolute pathname.
2577 absdir=`cd "$dir" && pwd`
2578 test -n "$absdir" && dir="$absdir"
2579
2580 # Now add the directory to shlibpath_var.
2581 if eval "test -z \"\$$shlibpath_var\""; then
2582 eval "$shlibpath_var=\"\$dir\""
2583 else
2584 eval "$shlibpath_var=\"\$dir:\$$shlibpath_var\""
2585 fi
2586 done
2587
2588 # This variable tells wrapper scripts just to set shlibpath_var
2589 # rather than running their programs.
2590 libtool_execute_magic="$magic"
2591
2592 # Check if any of the arguments is a wrapper script.
2593 args=
2594 for file
2595 do
2596 case $file in
2597 -* | *.la | *.lo ) ;;
2598 *)
2599 # Do a test to see if this is really a libtool program.
2600 if func_ltwrapper_script_p "$file"; then
2601 func_source "$file"
2602 # Transform arg to wrapped name.
2603 file="$progdir/$program"
2604 elif func_ltwrapper_executable_p "$file"; then
2605 func_ltwrapper_scriptname "$file"
2606 func_source "$func_ltwrapper_scriptname_result"
2607 # Transform arg to wrapped name.
2608 file="$progdir/$program"
2609 fi
2610 ;;
2611 esac
2612 # Quote arguments (to preserve shell metacharacters).
2613 func_append_quoted args "$file"
2614 done
2615
2616 if test "X$opt_dry_run" = Xfalse; then
2617 if test -n "$shlibpath_var"; then
2618 # Export the shlibpath_var.
2619 eval "export $shlibpath_var"
2620 fi
2621
2622 # Restore saved environment variables
2623 for lt_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES
2624 do
2625 eval "if test \"\${save_$lt_var+set}\" = set; then
2626 $lt_var=\$save_$lt_var; export $lt_var
2627 else
2628 $lt_unset $lt_var
2629 fi"
2630 done
2631
2632 # Now prepare to actually exec the command.
2633 exec_cmd="\$cmd$args"
2634 else
2635 # Display what would be done.
2636 if test -n "$shlibpath_var"; then
2637 eval "\$ECHO \"\$shlibpath_var=\$$shlibpath_var\""
2638 echo "export $shlibpath_var"
2639 fi
2640 $ECHO "$cmd$args"
2641 exit $EXIT_SUCCESS
2642 fi
2643 }
2644
2645 test "$opt_mode" = execute && func_mode_execute ${1+"$@"}
2646
2647
2648 # func_mode_finish arg...
2649 func_mode_finish ()
2650 {
2651 $opt_debug
2652 libs=
2653 libdirs=
2654 admincmds=
2655
2656 for opt in "$nonopt" ${1+"$@"}
2657 do
2658 if test -d "$opt"; then
2659 func_append libdirs " $opt"
2660
2661 elif test -f "$opt"; then
2662 if func_lalib_unsafe_p "$opt"; then
2663 func_append libs " $opt"
2664 else
2665 func_warning "\`$opt' is not a valid libtool archive"
2666 fi
2667
2668 else
2669 func_fatal_error "invalid argument \`$opt'"
2670 fi
2671 done
2672
2673 if test -n "$libs"; then
2674 if test -n "$lt_sysroot"; then
2675 sysroot_regex=`$ECHO "$lt_sysroot" | $SED "$sed_make_literal_regex"`
2676 sysroot_cmd="s/\([ ']\)$sysroot_regex/\1/g;"
2677 else
2678 sysroot_cmd=
2679 fi
2680
2681 # Remove sysroot references
2682 if $opt_dry_run; then
2683 for lib in $libs; do
2684 echo "removing references to $lt_sysroot and \`=' prefixes from $lib"
2685 done
2686 else
2687 tmpdir=`func_mktempdir`
2688 for lib in $libs; do
2689 sed -e "${sysroot_cmd} s/\([ ']-[LR]\)=/\1/g; s/\([ ']\)=/\1/g" $lib \
2690 > $tmpdir/tmp-la
2691 mv -f $tmpdir/tmp-la $lib
2692 done
2693 ${RM}r "$tmpdir"
2694 fi
2695 fi
2696
2697 if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then
2698 for libdir in $libdirs; do
2699 if test -n "$finish_cmds"; then
2700 # Do each command in the finish commands.
2701 func_execute_cmds "$finish_cmds" 'admincmds="$admincmds
2702 '"$cmd"'"'
2703 fi
2704 if test -n "$finish_eval"; then
2705 # Do the single finish_eval.
2706 eval cmds=\"$finish_eval\"
2707 $opt_dry_run || eval "$cmds" || func_append admincmds "
2708 $cmds"
2709 fi
2710 done
2711 fi
2712
2713 # Exit here if they wanted silent mode.
2714 $opt_silent && exit $EXIT_SUCCESS
2715
2716 if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then
2717 echo "----------------------------------------------------------------------"
2718 echo "Libraries have been installed in:"
2719 for libdir in $libdirs; do
2720 $ECHO " $libdir"
2721 done
2722 echo
2723 echo "If you ever happen to want to link against installed libraries"
2724 echo "in a given directory, LIBDIR, you must either use libtool, and"
2725 echo "specify the full pathname of the library, or use the \`-LLIBDIR'"
2726 echo "flag during linking and do at least one of the following:"
2727 if test -n "$shlibpath_var"; then
2728 echo " - add LIBDIR to the \`$shlibpath_var' environment variable"
2729 echo " during execution"
2730 fi
2731 if test -n "$runpath_var"; then
2732 echo " - add LIBDIR to the \`$runpath_var' environment variable"
2733 echo " during linking"
2734 fi
2735 if test -n "$hardcode_libdir_flag_spec"; then
2736 libdir=LIBDIR
2737 eval flag=\"$hardcode_libdir_flag_spec\"
2738
2739 $ECHO " - use the \`$flag' linker flag"
2740 fi
2741 if test -n "$admincmds"; then
2742 $ECHO " - have your system administrator run these commands:$admincmds"
2743 fi
2744 if test -f /etc/ld.so.conf; then
2745 echo " - have your system administrator add LIBDIR to \`/etc/ld.so.conf'"
2746 fi
2747 echo
2748
2749 echo "See any operating system documentation about shared libraries for"
2750 case $host in
2751 solaris2.[6789]|solaris2.1[0-9])
2752 echo "more information, such as the ld(1), crle(1) and ld.so(8) manual"
2753 echo "pages."
2754 ;;
2755 *)
2756 echo "more information, such as the ld(1) and ld.so(8) manual pages."
2757 ;;
2758 esac
2759 echo "----------------------------------------------------------------------"
2760 fi
2761 exit $EXIT_SUCCESS
2762 }
2763
2764 test "$opt_mode" = finish && func_mode_finish ${1+"$@"}
2765
2766
2767 # func_mode_install arg...
2768 func_mode_install ()
2769 {
2770 $opt_debug
2771 # There may be an optional sh(1) argument at the beginning of
2772 # install_prog (especially on Windows NT).
2773 if test "$nonopt" = "$SHELL" || test "$nonopt" = /bin/sh ||
2774 # Allow the use of GNU shtool's install command.
2775 case $nonopt in *shtool*) :;; *) false;; esac; then
2776 # Aesthetically quote it.
2777 func_quote_for_eval "$nonopt"
2778 install_prog="$func_quote_for_eval_result "
2779 arg=$1
2780 shift
2781 else
2782 install_prog=
2783 arg=$nonopt
2784 fi
2785
2786 # The real first argument should be the name of the installation program.
2787 # Aesthetically quote it.
2788 func_quote_for_eval "$arg"
2789 func_append install_prog "$func_quote_for_eval_result"
2790 install_shared_prog=$install_prog
2791 case " $install_prog " in
2792 *[\\\ /]cp\ *) install_cp=: ;;
2793 *) install_cp=false ;;
2794 esac
2795
2796 # We need to accept at least all the BSD install flags.
2797 dest=
2798 files=
2799 opts=
2800 prev=
2801 install_type=
2802 isdir=no
2803 stripme=
2804 no_mode=:
2805 for arg
2806 do
2807 arg2=
2808 if test -n "$dest"; then
2809 func_append files " $dest"
2810 dest=$arg
2811 continue
2812 fi
2813
2814 case $arg in
2815 -d) isdir=yes ;;
2816 -f)
2817 if $install_cp; then :; else
2818 prev=$arg
2819 fi
2820 ;;
2821 -g | -m | -o)
2822 prev=$arg
2823 ;;
2824 -s)
2825 stripme=" -s"
2826 continue
2827 ;;
2828 -*)
2829 ;;
2830 *)
2831 # If the previous option needed an argument, then skip it.
2832 if test -n "$prev"; then
2833 if test "x$prev" = x-m && test -n "$install_override_mode"; then
2834 arg2=$install_override_mode
2835 no_mode=false
2836 fi
2837 prev=
2838 else
2839 dest=$arg
2840 continue
2841 fi
2842 ;;
2843 esac
2844
2845 # Aesthetically quote the argument.
2846 func_quote_for_eval "$arg"
2847 func_append install_prog " $func_quote_for_eval_result"
2848 if test -n "$arg2"; then
2849 func_quote_for_eval "$arg2"
2850 fi
2851 func_append install_shared_prog " $func_quote_for_eval_result"
2852 done
2853
2854 test -z "$install_prog" && \
2855 func_fatal_help "you must specify an install program"
2856
2857 test -n "$prev" && \
2858 func_fatal_help "the \`$prev' option requires an argument"
2859
2860 if test -n "$install_override_mode" && $no_mode; then
2861 if $install_cp; then :; else
2862 func_quote_for_eval "$install_override_mode"
2863 func_append install_shared_prog " -m $func_quote_for_eval_result"
2864 fi
2865 fi
2866
2867 if test -z "$files"; then
2868 if test -z "$dest"; then
2869 func_fatal_help "no file or destination specified"
2870 else
2871 func_fatal_help "you must specify a destination"
2872 fi
2873 fi
2874
2875 # Strip any trailing slash from the destination.
2876 func_stripname '' '/' "$dest"
2877 dest=$func_stripname_result
2878
2879 # Check to see that the destination is a directory.
2880 test -d "$dest" && isdir=yes
2881 if test "$isdir" = yes; then
2882 destdir="$dest"
2883 destname=
2884 else
2885 func_dirname_and_basename "$dest" "" "."
2886 destdir="$func_dirname_result"
2887 destname="$func_basename_result"
2888
2889 # Not a directory, so check to see that there is only one file specified.
2890 set dummy $files; shift
2891 test "$#" -gt 1 && \
2892 func_fatal_help "\`$dest' is not a directory"
2893 fi
2894 case $destdir in
2895 [\\/]* | [A-Za-z]:[\\/]*) ;;
2896 *)
2897 for file in $files; do
2898 case $file in
2899 *.lo) ;;
2900 *)
2901 func_fatal_help "\`$destdir' must be an absolute directory name"
2902 ;;
2903 esac
2904 done
2905 ;;
2906 esac
2907
2908 # This variable tells wrapper scripts just to set variables rather
2909 # than running their programs.
2910 libtool_install_magic="$magic"
2911
2912 staticlibs=
2913 future_libdirs=
2914 current_libdirs=
2915 for file in $files; do
2916
2917 # Do each installation.
2918 case $file in
2919 *.$libext)
2920 # Do the static libraries later.
2921 func_append staticlibs " $file"
2922 ;;
2923
2924 *.la)
2925 func_resolve_sysroot "$file"
2926 file=$func_resolve_sysroot_result
2927
2928 # Check to see that this really is a libtool archive.
2929 func_lalib_unsafe_p "$file" \
2930 || func_fatal_help "\`$file' is not a valid libtool archive"
2931
2932 library_names=
2933 old_library=
2934 relink_command=
2935 func_source "$file"
2936
2937 # Add the libdir to current_libdirs if it is the destination.
2938 if test "X$destdir" = "X$libdir"; then
2939 case "$current_libdirs " in
2940 *" $libdir "*) ;;
2941 *) func_append current_libdirs " $libdir" ;;
2942 esac
2943 else
2944 # Note the libdir as a future libdir.
2945 case "$future_libdirs " in
2946 *" $libdir "*) ;;
2947 *) func_append future_libdirs " $libdir" ;;
2948 esac
2949 fi
2950
2951 func_dirname "$file" "/" ""
2952 dir="$func_dirname_result"
2953 func_append dir "$objdir"
2954
2955 if test -n "$relink_command"; then
2956 # Determine the prefix the user has applied to our future dir.
2957 inst_prefix_dir=`$ECHO "$destdir" | $SED -e "s%$libdir\$%%"`
2958
2959 # Don't allow the user to place us outside of our expected
2960 # location b/c this prevents finding dependent libraries that
2961 # are installed to the same prefix.
2962 # At present, this check doesn't affect windows .dll's that
2963 # are installed into $libdir/../bin (currently, that works fine)
2964 # but it's something to keep an eye on.
2965 test "$inst_prefix_dir" = "$destdir" && \
2966 func_fatal_error "error: cannot install \`$file' to a directory not ending in $libdir"
2967
2968 if test -n "$inst_prefix_dir"; then
2969 # Stick the inst_prefix_dir data into the link command.
2970 relink_command=`$ECHO "$relink_command" | $SED "s%@inst_prefix_dir@%-inst-prefix-dir $inst_prefix_dir%"`
2971 else
2972 relink_command=`$ECHO "$relink_command" | $SED "s%@inst_prefix_dir@%%"`
2973 fi
2974
2975 func_warning "relinking \`$file'"
2976 func_show_eval "$relink_command" \
2977 'func_fatal_error "error: relink \`$file'\'' with the above command before installing it"'
2978 fi
2979
2980 # See the names of the shared library.
2981 set dummy $library_names; shift
2982 if test -n "$1"; then
2983 realname="$1"
2984 shift
2985
2986 srcname="$realname"
2987 test -n "$relink_command" && srcname="$realname"T
2988
2989 # Install the shared library and build the symlinks.
2990 func_show_eval "$install_shared_prog $dir/$srcname $destdir/$realname" \
2991 'exit $?'
2992 tstripme="$stripme"
2993 case $host_os in
2994 cygwin* | mingw* | pw32* | cegcc*)
2995 case $realname in
2996 *.dll.a)
2997 tstripme=""
2998 ;;
2999 esac
3000 ;;
3001 esac
3002 if test -n "$tstripme" && test -n "$striplib"; then
3003 func_show_eval "$striplib $destdir/$realname" 'exit $?'
3004 fi
3005
3006 if test "$#" -gt 0; then
3007 # Delete the old symlinks, and create new ones.
3008 # Try `ln -sf' first, because the `ln' binary might depend on
3009 # the symlink we replace! Solaris /bin/ln does not understand -f,
3010 # so we also need to try rm && ln -s.
3011 for linkname
3012 do
3013 test "$linkname" != "$realname" \
3014 && func_show_eval "(cd $destdir && { $LN_S -f $realname $linkname || { $RM $linkname && $LN_S $realname $linkname; }; })"
3015 done
3016 fi
3017
3018 # Do each command in the postinstall commands.
3019 lib="$destdir/$realname"
3020 func_execute_cmds "$postinstall_cmds" 'exit $?'
3021 fi
3022
3023 # Install the pseudo-library for information purposes.
3024 func_basename "$file"
3025 name="$func_basename_result"
3026 instname="$dir/$name"i
3027 func_show_eval "$install_prog $instname $destdir/$name" 'exit $?'
3028
3029 # Maybe install the static library, too.
3030 test -n "$old_library" && func_append staticlibs " $dir/$old_library"
3031 ;;
3032
3033 *.lo)
3034 # Install (i.e. copy) a libtool object.
3035
3036 # Figure out destination file name, if it wasn't already specified.
3037 if test -n "$destname"; then
3038 destfile="$destdir/$destname"
3039 else
3040 func_basename "$file"
3041 destfile="$func_basename_result"
3042 destfile="$destdir/$destfile"
3043 fi
3044
3045 # Deduce the name of the destination old-style object file.
3046 case $destfile in
3047 *.lo)
3048 func_lo2o "$destfile"
3049 staticdest=$func_lo2o_result
3050 ;;
3051 *.$objext)
3052 staticdest="$destfile"
3053 destfile=
3054 ;;
3055 *)
3056 func_fatal_help "cannot copy a libtool object to \`$destfile'"
3057 ;;
3058 esac
3059
3060 # Install the libtool object if requested.
3061 test -n "$destfile" && \
3062 func_show_eval "$install_prog $file $destfile" 'exit $?'
3063
3064 # Install the old object if enabled.
3065 if test "$build_old_libs" = yes; then
3066 # Deduce the name of the old-style object file.
3067 func_lo2o "$file"
3068 staticobj=$func_lo2o_result
3069 func_show_eval "$install_prog \$staticobj \$staticdest" 'exit $?'
3070 fi
3071 exit $EXIT_SUCCESS
3072 ;;
3073
3074 *)
3075 # Figure out destination file name, if it wasn't already specified.
3076 if test -n "$destname"; then
3077 destfile="$destdir/$destname"
3078 else
3079 func_basename "$file"
3080 destfile="$func_basename_result"
3081 destfile="$destdir/$destfile"
3082 fi
3083
3084 # If the file is missing, and there is a .exe on the end, strip it
3085 # because it is most likely a libtool script we actually want to
3086 # install
3087 stripped_ext=""
3088 case $file in
3089 *.exe)
3090 if test ! -f "$file"; then
3091 func_stripname '' '.exe' "$file"
3092 file=$func_stripname_result
3093 stripped_ext=".exe"
3094 fi
3095 ;;
3096 esac
3097
3098 # Do a test to see if this is really a libtool program.
3099 case $host in
3100 *cygwin* | *mingw*)
3101 if func_ltwrapper_executable_p "$file"; then
3102 func_ltwrapper_scriptname "$file"
3103 wrapper=$func_ltwrapper_scriptname_result
3104 else
3105 func_stripname '' '.exe' "$file"
3106 wrapper=$func_stripname_result
3107 fi
3108 ;;
3109 *)
3110 wrapper=$file
3111 ;;
3112 esac
3113 if func_ltwrapper_script_p "$wrapper"; then
3114 notinst_deplibs=
3115 relink_command=
3116
3117 func_source "$wrapper"
3118
3119 # Check the variables that should have been set.
3120 test -z "$generated_by_libtool_version" && \
3121 func_fatal_error "invalid libtool wrapper script \`$wrapper'"
3122
3123 finalize=yes
3124 for lib in $notinst_deplibs; do
3125 # Check to see that each library is installed.
3126 libdir=
3127 if test -f "$lib"; then
3128 func_source "$lib"
3129 fi
3130 libfile="$libdir/"`$ECHO "$lib" | $SED 's%^.*/%%g'` ### testsuite: skip nested quoting test
3131 if test -n "$libdir" && test ! -f "$libfile"; then
3132 func_warning "\`$lib' has not been installed in \`$libdir'"
3133 finalize=no
3134 fi
3135 done
3136
3137 relink_command=
3138 func_source "$wrapper"
3139
3140 outputname=
3141 if test "$fast_install" = no && test -n "$relink_command"; then
3142 $opt_dry_run || {
3143 if test "$finalize" = yes; then
3144 tmpdir=`func_mktempdir`
3145 func_basename "$file$stripped_ext"
3146 file="$func_basename_result"
3147 outputname="$tmpdir/$file"
3148 # Replace the output file specification.
3149 relink_command=`$ECHO "$relink_command" | $SED 's%@OUTPUT@%'"$outputname"'%g'`
3150
3151 $opt_silent || {
3152 func_quote_for_expand "$relink_command"
3153 eval "func_echo $func_quote_for_expand_result"
3154 }
3155 if eval "$relink_command"; then :
3156 else
3157 func_error "error: relink \`$file' with the above command before installing it"
3158 $opt_dry_run || ${RM}r "$tmpdir"
3159 continue
3160 fi
3161 file="$outputname"
3162 else
3163 func_warning "cannot relink \`$file'"
3164 fi
3165 }
3166 else
3167 # Install the binary that we compiled earlier.
3168 file=`$ECHO "$file$stripped_ext" | $SED "s%\([^/]*\)$%$objdir/\1%"`
3169 fi
3170 fi
3171
3172 # remove .exe since cygwin /usr/bin/install will append another
3173 # one anyway
3174 case $install_prog,$host in
3175 */usr/bin/install*,*cygwin*)
3176 case $file:$destfile in
3177 *.exe:*.exe)
3178 # this is ok
3179 ;;
3180 *.exe:*)
3181 destfile=$destfile.exe
3182 ;;
3183 *:*.exe)
3184 func_stripname '' '.exe' "$destfile"
3185 destfile=$func_stripname_result
3186 ;;
3187 esac
3188 ;;
3189 esac
3190 func_show_eval "$install_prog\$stripme \$file \$destfile" 'exit $?'
3191 $opt_dry_run || if test -n "$outputname"; then
3192 ${RM}r "$tmpdir"
3193 fi
3194 ;;
3195 esac
3196 done
3197
3198 for file in $staticlibs; do
3199 func_basename "$file"
3200 name="$func_basename_result"
3201
3202 # Set up the ranlib parameters.
3203 oldlib="$destdir/$name"
3204 func_to_tool_file "$oldlib" func_convert_file_msys_to_w32
3205 tool_oldlib=$func_to_tool_file_result
3206
3207 func_show_eval "$install_prog \$file \$oldlib" 'exit $?'
3208
3209 if test -n "$stripme" && test -n "$old_striplib"; then
3210 func_show_eval "$old_striplib $tool_oldlib" 'exit $?'
3211 fi
3212
3213 # Do each command in the postinstall commands.
3214 func_execute_cmds "$old_postinstall_cmds" 'exit $?'
3215 done
3216
3217 test -n "$future_libdirs" && \
3218 func_warning "remember to run \`$progname --finish$future_libdirs'"
3219
3220 if test -n "$current_libdirs"; then
3221 # Maybe just do a dry run.
3222 $opt_dry_run && current_libdirs=" -n$current_libdirs"
3223 exec_cmd='$SHELL $progpath $preserve_args --finish$current_libdirs'
3224 else
3225 exit $EXIT_SUCCESS
3226 fi
3227 }
3228
3229 test "$opt_mode" = install && func_mode_install ${1+"$@"}
3230
3231
3232 # func_generate_dlsyms outputname originator pic_p
3233 # Extract symbols from dlprefiles and create ${outputname}S.o with
3234 # a dlpreopen symbol table.
3235 func_generate_dlsyms ()
3236 {
3237 $opt_debug
3238 my_outputname="$1"
3239 my_originator="$2"
3240 my_pic_p="${3-no}"
3241 my_prefix=`$ECHO "$my_originator" | sed 's%[^a-zA-Z0-9]%_%g'`
3242 my_dlsyms=
3243
3244 if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
3245 if test -n "$NM" && test -n "$global_symbol_pipe"; then
3246 my_dlsyms="${my_outputname}S.c"
3247 else
3248 func_error "not configured to extract global symbols from dlpreopened files"
3249 fi
3250 fi
3251
3252 if test -n "$my_dlsyms"; then
3253 case $my_dlsyms in
3254 "") ;;
3255 *.c)
3256 # Discover the nlist of each of the dlfiles.
3257 nlist="$output_objdir/${my_outputname}.nm"
3258
3259 func_show_eval "$RM $nlist ${nlist}S ${nlist}T"
3260
3261 # Parse the name list into a source file.
3262 func_verbose "creating $output_objdir/$my_dlsyms"
3263
3264 $opt_dry_run || $ECHO > "$output_objdir/$my_dlsyms" "\
3265 /* $my_dlsyms - symbol resolution table for \`$my_outputname' dlsym emulation. */
3266 /* Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION */
3267
3268 #ifdef __cplusplus
3269 extern \"C\" {
3270 #endif
3271
3272 #if defined(__GNUC__) && (((__GNUC__ == 4) && (__GNUC_MINOR__ >= 4)) || (__GNUC__ > 4))
3273 #pragma GCC diagnostic ignored \"-Wstrict-prototypes\"
3274 #endif
3275
3276 /* Keep this code in sync between libtool.m4, ltmain, lt_system.h, and tests. */
3277 #if defined(_WIN32) || defined(__CYGWIN__) || defined(_WIN32_WCE)
3278 /* DATA imports from DLLs on WIN32 con't be const, because runtime
3279 relocations are performed -- see ld's documentation on pseudo-relocs. */
3280 # define LT_DLSYM_CONST
3281 #elif defined(__osf__)
3282 /* This system does not cope well with relocations in const data. */
3283 # define LT_DLSYM_CONST
3284 #else
3285 # define LT_DLSYM_CONST const
3286 #endif
3287
3288 /* External symbol declarations for the compiler. */\
3289 "
3290
3291 if test "$dlself" = yes; then
3292 func_verbose "generating symbol list for \`$output'"
3293
3294 $opt_dry_run || echo ': @PROGRAM@ ' > "$nlist"
3295
3296 # Add our own program objects to the symbol list.
3297 progfiles=`$ECHO "$objs$old_deplibs" | $SP2NL | $SED "$lo2o" | $NL2SP`
3298 for progfile in $progfiles; do
3299 func_to_tool_file "$progfile" func_convert_file_msys_to_w32
3300 func_verbose "extracting global C symbols from \`$func_to_tool_file_result'"
3301 $opt_dry_run || eval "$NM $func_to_tool_file_result | $global_symbol_pipe >> '$nlist'"
3302 done
3303
3304 if test -n "$exclude_expsyms"; then
3305 $opt_dry_run || {
3306 eval '$EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T'
3307 eval '$MV "$nlist"T "$nlist"'
3308 }
3309 fi
3310
3311 if test -n "$export_symbols_regex"; then
3312 $opt_dry_run || {
3313 eval '$EGREP -e "$export_symbols_regex" "$nlist" > "$nlist"T'
3314 eval '$MV "$nlist"T "$nlist"'
3315 }
3316 fi
3317
3318 # Prepare the list of exported symbols
3319 if test -z "$export_symbols"; then
3320 export_symbols="$output_objdir/$outputname.exp"
3321 $opt_dry_run || {
3322 $RM $export_symbols
3323 eval "${SED} -n -e '/^: @PROGRAM@ $/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"'
3324 case $host in
3325 *cygwin* | *mingw* | *cegcc* )
3326 eval "echo EXPORTS "'> "$output_objdir/$outputname.def"'
3327 eval 'cat "$export_symbols" >> "$output_objdir/$outputname.def"'
3328 ;;
3329 esac
3330 }
3331 else
3332 $opt_dry_run || {
3333 eval "${SED} -e 's/\([].[*^$]\)/\\\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$outputname.exp"'
3334 eval '$GREP -f "$output_objdir/$outputname.exp" < "$nlist" > "$nlist"T'
3335 eval '$MV "$nlist"T "$nlist"'
3336 case $host in
3337 *cygwin* | *mingw* | *cegcc* )
3338 eval "echo EXPORTS "'> "$output_objdir/$outputname.def"'
3339 eval 'cat "$nlist" >> "$output_objdir/$outputname.def"'
3340 ;;
3341 esac
3342 }
3343 fi
3344 fi
3345
3346 for dlprefile in $dlprefiles; do
3347 func_verbose "extracting global C symbols from \`$dlprefile'"
3348 func_basename "$dlprefile"
3349 name="$func_basename_result"
3350 case $host in
3351 *cygwin* | *mingw* | *cegcc* )
3352 # if an import library, we need to obtain dlname
3353 if func_win32_import_lib_p "$dlprefile"; then
3354 func_tr_sh "$dlprefile"
3355 eval "curr_lafile=\$libfile_$func_tr_sh_result"
3356 dlprefile_dlbasename=""
3357 if test -n "$curr_lafile" && func_lalib_p "$curr_lafile"; then
3358 # Use subshell, to avoid clobbering current variable values
3359 dlprefile_dlname=`source "$curr_lafile" && echo "$dlname"`
3360 if test -n "$dlprefile_dlname" ; then
3361 func_basename "$dlprefile_dlname"
3362 dlprefile_dlbasename="$func_basename_result"
3363 else
3364 # no lafile. user explicitly requested -dlpreopen <import library>.
3365 $sharedlib_from_linklib_cmd "$dlprefile"
3366 dlprefile_dlbasename=$sharedlib_from_linklib_result
3367 fi
3368 fi
3369 $opt_dry_run || {
3370 if test -n "$dlprefile_dlbasename" ; then
3371 eval '$ECHO ": $dlprefile_dlbasename" >> "$nlist"'
3372 else
3373 func_warning "Could not compute DLL name from $name"
3374 eval '$ECHO ": $name " >> "$nlist"'
3375 fi
3376 func_to_tool_file "$dlprefile" func_convert_file_msys_to_w32
3377 eval "$NM \"$func_to_tool_file_result\" 2>/dev/null | $global_symbol_pipe |
3378 $SED -e '/I __imp/d' -e 's/I __nm_/D /;s/_nm__//' >> '$nlist'"
3379 }
3380 else # not an import lib
3381 $opt_dry_run || {
3382 eval '$ECHO ": $name " >> "$nlist"'
3383 func_to_tool_file "$dlprefile" func_convert_file_msys_to_w32
3384 eval "$NM \"$func_to_tool_file_result\" 2>/dev/null | $global_symbol_pipe >> '$nlist'"
3385 }
3386 fi
3387 ;;
3388 *)
3389 $opt_dry_run || {
3390 eval '$ECHO ": $name " >> "$nlist"'
3391 func_to_tool_file "$dlprefile" func_convert_file_msys_to_w32
3392 eval "$NM \"$func_to_tool_file_result\" 2>/dev/null | $global_symbol_pipe >> '$nlist'"
3393 }
3394 ;;
3395 esac
3396 done
3397
3398 $opt_dry_run || {
3399 # Make sure we have at least an empty file.
3400 test -f "$nlist" || : > "$nlist"
3401
3402 if test -n "$exclude_expsyms"; then
3403 $EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T
3404 $MV "$nlist"T "$nlist"
3405 fi
3406
3407 # Try sorting and uniquifying the output.
3408 if $GREP -v "^: " < "$nlist" |
3409 if sort -k 3 </dev/null >/dev/null 2>&1; then
3410 sort -k 3
3411 else
3412 sort +2
3413 fi |
3414 uniq > "$nlist"S; then
3415 :
3416 else
3417 $GREP -v "^: " < "$nlist" > "$nlist"S
3418 fi
3419
3420 if test -f "$nlist"S; then
3421 eval "$global_symbol_to_cdecl"' < "$nlist"S >> "$output_objdir/$my_dlsyms"'
3422 else
3423 echo '/* NONE */' >> "$output_objdir/$my_dlsyms"
3424 fi
3425
3426 echo >> "$output_objdir/$my_dlsyms" "\
3427
3428 /* The mapping between symbol names and symbols. */
3429 typedef struct {
3430 const char *name;
3431 void *address;
3432 } lt_dlsymlist;
3433 extern LT_DLSYM_CONST lt_dlsymlist
3434 lt_${my_prefix}_LTX_preloaded_symbols[];
3435 LT_DLSYM_CONST lt_dlsymlist
3436 lt_${my_prefix}_LTX_preloaded_symbols[] =
3437 {\
3438 { \"$my_originator\", (void *) 0 },"
3439
3440 case $need_lib_prefix in
3441 no)
3442 eval "$global_symbol_to_c_name_address" < "$nlist" >> "$output_objdir/$my_dlsyms"
3443 ;;
3444 *)
3445 eval "$global_symbol_to_c_name_address_lib_prefix" < "$nlist" >> "$output_objdir/$my_dlsyms"
3446 ;;
3447 esac
3448 echo >> "$output_objdir/$my_dlsyms" "\
3449 {0, (void *) 0}
3450 };
3451
3452 /* This works around a problem in FreeBSD linker */
3453 #ifdef FREEBSD_WORKAROUND
3454 static const void *lt_preloaded_setup() {
3455 return lt_${my_prefix}_LTX_preloaded_symbols;
3456 }
3457 #endif
3458
3459 #ifdef __cplusplus
3460 }
3461 #endif\
3462 "
3463 } # !$opt_dry_run
3464
3465 pic_flag_for_symtable=
3466 case "$compile_command " in
3467 *" -static "*) ;;
3468 *)
3469 case $host in
3470 # compiling the symbol table file with pic_flag works around
3471 # a FreeBSD bug that causes programs to crash when -lm is
3472 # linked before any other PIC object. But we must not use
3473 # pic_flag when linking with -static. The problem exists in
3474 # FreeBSD 2.2.6 and is fixed in FreeBSD 3.1.
3475 *-*-freebsd2.*|*-*-freebsd3.0*|*-*-freebsdelf3.0*)
3476 pic_flag_for_symtable=" $pic_flag -DFREEBSD_WORKAROUND" ;;
3477 *-*-hpux*)
3478 pic_flag_for_symtable=" $pic_flag" ;;
3479 *)
3480 if test "X$my_pic_p" != Xno; then
3481 pic_flag_for_symtable=" $pic_flag"
3482 fi
3483 ;;
3484 esac
3485 ;;
3486 esac
3487 symtab_cflags=
3488 for arg in $LTCFLAGS; do
3489 case $arg in
3490 -pie | -fpie | -fPIE) ;;
3491 *) func_append symtab_cflags " $arg" ;;
3492 esac
3493 done
3494
3495 # Now compile the dynamic symbol file.
3496 func_show_eval '(cd $output_objdir && $LTCC$symtab_cflags -c$no_builtin_flag$pic_flag_for_symtable "$my_dlsyms")' 'exit $?'
3497
3498 # Clean up the generated files.
3499 func_show_eval '$RM "$output_objdir/$my_dlsyms" "$nlist" "${nlist}S" "${nlist}T"'
3500
3501 # Transform the symbol file into the correct name.
3502 symfileobj="$output_objdir/${my_outputname}S.$objext"
3503 case $host in
3504 *cygwin* | *mingw* | *cegcc* )
3505 if test -f "$output_objdir/$my_outputname.def"; then
3506 compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%"`
3507 finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%"`
3508 else
3509 compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$symfileobj%"`
3510 finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$symfileobj%"`
3511 fi
3512 ;;
3513 *)
3514 compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$symfileobj%"`
3515 finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$symfileobj%"`
3516 ;;
3517 esac
3518 ;;
3519 *)
3520 func_fatal_error "unknown suffix for \`$my_dlsyms'"
3521 ;;
3522 esac
3523 else
3524 # We keep going just in case the user didn't refer to
3525 # lt_preloaded_symbols. The linker will fail if global_symbol_pipe
3526 # really was required.
3527
3528 # Nullify the symbol file.
3529 compile_command=`$ECHO "$compile_command" | $SED "s% @SYMFILE@%%"`
3530 finalize_command=`$ECHO "$finalize_command" | $SED "s% @SYMFILE@%%"`
3531 fi
3532 }
3533
3534 # func_win32_libid arg
3535 # return the library type of file 'arg'
3536 #
3537 # Need a lot of goo to handle *both* DLLs and import libs
3538 # Has to be a shell function in order to 'eat' the argument
3539 # that is supplied when $file_magic_command is called.
3540 # Despite the name, also deal with 64 bit binaries.
3541 func_win32_libid ()
3542 {
3543 $opt_debug
3544 win32_libid_type="unknown"
3545 win32_fileres=`file -L $1 2>/dev/null`
3546 case $win32_fileres in
3547 *ar\ archive\ import\ library*) # definitely import
3548 win32_libid_type="x86 archive import"
3549 ;;
3550 *ar\ archive*) # could be an import, or static
3551 # Keep the egrep pattern in sync with the one in _LT_CHECK_MAGIC_METHOD.
3552 if eval $OBJDUMP -f $1 | $SED -e '10q' 2>/dev/null |
3553 $EGREP 'file format (pei*-i386(.*architecture: i386)?|pe-arm-wince|pe-x86-64)' >/dev/null; then
3554 func_to_tool_file "$1" func_convert_file_msys_to_w32
3555 win32_nmres=`eval $NM -f posix -A \"$func_to_tool_file_result\" |
3556 $SED -n -e '
3557 1,100{
3558 / I /{
3559 s,.*,import,
3560 p
3561 q
3562 }
3563 }'`
3564 case $win32_nmres in
3565 import*) win32_libid_type="x86 archive import";;
3566 *) win32_libid_type="x86 archive static";;
3567 esac
3568 fi
3569 ;;
3570 *DLL*)
3571 win32_libid_type="x86 DLL"
3572 ;;
3573 *executable*) # but shell scripts are "executable" too...
3574 case $win32_fileres in
3575 *MS\ Windows\ PE\ Intel*)
3576 win32_libid_type="x86 DLL"
3577 ;;
3578 esac
3579 ;;
3580 esac
3581 $ECHO "$win32_libid_type"
3582 }
3583
3584 # func_cygming_dll_for_implib ARG
3585 #
3586 # Platform-specific function to extract the
3587 # name of the DLL associated with the specified
3588 # import library ARG.
3589 # Invoked by eval'ing the libtool variable
3590 # $sharedlib_from_linklib_cmd
3591 # Result is available in the variable
3592 # $sharedlib_from_linklib_result
3593 func_cygming_dll_for_implib ()
3594 {
3595 $opt_debug
3596 sharedlib_from_linklib_result=`$DLLTOOL --identify-strict --identify "$1"`
3597 }
3598
3599 # func_cygming_dll_for_implib_fallback_core SECTION_NAME LIBNAMEs
3600 #
3601 # The is the core of a fallback implementation of a
3602 # platform-specific function to extract the name of the
3603 # DLL associated with the specified import library LIBNAME.
3604 #
3605 # SECTION_NAME is either .idata$6 or .idata$7, depending
3606 # on the platform and compiler that created the implib.
3607 #
3608 # Echos the name of the DLL associated with the
3609 # specified import library.
3610 func_cygming_dll_for_implib_fallback_core ()
3611 {
3612 $opt_debug
3613 match_literal=`$ECHO "$1" | $SED "$sed_make_literal_regex"`
3614 $OBJDUMP -s --section "$1" "$2" 2>/dev/null |
3615 $SED '/^Contents of section '"$match_literal"':/{
3616 # Place marker at beginning of archive member dllname section
3617 s/.*/====MARK====/
3618 p
3619 d
3620 }
3621 # These lines can sometimes be longer than 43 characters, but
3622 # are always uninteresting
3623 /:[ ]*file format pe[i]\{,1\}-/d
3624 /^In archive [^:]*:/d
3625 # Ensure marker is printed
3626 /^====MARK====/p
3627 # Remove all lines with less than 43 characters
3628 /^.\{43\}/!d
3629 # From remaining lines, remove first 43 characters
3630 s/^.\{43\}//' |
3631 $SED -n '
3632 # Join marker and all lines until next marker into a single line
3633 /^====MARK====/ b para
3634 H
3635 $ b para
3636 b
3637 :para
3638 x
3639 s/\n//g
3640 # Remove the marker
3641 s/^====MARK====//
3642 # Remove trailing dots and whitespace
3643 s/[\. \t]*$//
3644 # Print
3645 /./p' |
3646 # we now have a list, one entry per line, of the stringified
3647 # contents of the appropriate section of all members of the
3648 # archive which possess that section. Heuristic: eliminate
3649 # all those which have a first or second character that is
3650 # a '.' (that is, objdump's representation of an unprintable
3651 # character.) This should work for all archives with less than
3652 # 0x302f exports -- but will fail for DLLs whose name actually
3653 # begins with a literal '.' or a single character followed by
3654 # a '.'.
3655 #
3656 # Of those that remain, print the first one.
3657 $SED -e '/^\./d;/^.\./d;q'
3658 }
3659
3660 # func_cygming_gnu_implib_p ARG
3661 # This predicate returns with zero status (TRUE) if
3662 # ARG is a GNU/binutils-style import library. Returns
3663 # with nonzero status (FALSE) otherwise.
3664 func_cygming_gnu_implib_p ()
3665 {
3666 $opt_debug
3667 func_to_tool_file "$1" func_convert_file_msys_to_w32
3668 func_cygming_gnu_implib_tmp=`$NM "$func_to_tool_file_result" | eval "$global_symbol_pipe" | $EGREP ' (_head_[A-Za-z0-9_]+_[ad]l*|[A-Za-z0-9_]+_[ad]l*_iname)$'`
3669 test -n "$func_cygming_gnu_implib_tmp"
3670 }
3671
3672 # func_cygming_ms_implib_p ARG
3673 # This predicate returns with zero status (TRUE) if
3674 # ARG is an MS-style import library. Returns
3675 # with nonzero status (FALSE) otherwise.
3676 func_cygming_ms_implib_p ()
3677 {
3678 $opt_debug
3679 func_to_tool_file "$1" func_convert_file_msys_to_w32
3680 func_cygming_ms_implib_tmp=`$NM "$func_to_tool_file_result" | eval "$global_symbol_pipe" | $GREP '_NULL_IMPORT_DESCRIPTOR'`
3681 test -n "$func_cygming_ms_implib_tmp"
3682 }
3683
3684 # func_cygming_dll_for_implib_fallback ARG
3685 # Platform-specific function to extract the
3686 # name of the DLL associated with the specified
3687 # import library ARG.
3688 #
3689 # This fallback implementation is for use when $DLLTOOL
3690 # does not support the --identify-strict option.
3691 # Invoked by eval'ing the libtool variable
3692 # $sharedlib_from_linklib_cmd
3693 # Result is available in the variable
3694 # $sharedlib_from_linklib_result
3695 func_cygming_dll_for_implib_fallback ()
3696 {
3697 $opt_debug
3698 if func_cygming_gnu_implib_p "$1" ; then
3699 # binutils import library
3700 sharedlib_from_linklib_result=`func_cygming_dll_for_implib_fallback_core '.idata$7' "$1"`
3701 elif func_cygming_ms_implib_p "$1" ; then
3702 # ms-generated import library
3703 sharedlib_from_linklib_result=`func_cygming_dll_for_implib_fallback_core '.idata$6' "$1"`
3704 else
3705 # unknown
3706 sharedlib_from_linklib_result=""
3707 fi
3708 }
3709
3710
3711 # func_extract_an_archive dir oldlib
3712 func_extract_an_archive ()
3713 {
3714 $opt_debug
3715 f_ex_an_ar_dir="$1"; shift
3716 f_ex_an_ar_oldlib="$1"
3717 if test "$lock_old_archive_extraction" = yes; then
3718 lockfile=$f_ex_an_ar_oldlib.lock
3719 until $opt_dry_run || ln "$progpath" "$lockfile" 2>/dev/null; do
3720 func_echo "Waiting for $lockfile to be removed"
3721 sleep 2
3722 done
3723 fi
3724 func_show_eval "(cd \$f_ex_an_ar_dir && $AR x \"\$f_ex_an_ar_oldlib\")" \
3725 'stat=$?; rm -f "$lockfile"; exit $stat'
3726 if test "$lock_old_archive_extraction" = yes; then
3727 $opt_dry_run || rm -f "$lockfile"
3728 fi
3729 if ($AR t "$f_ex_an_ar_oldlib" | sort | sort -uc >/dev/null 2>&1); then
3730 :
3731 else
3732 func_fatal_error "object name conflicts in archive: $f_ex_an_ar_dir/$f_ex_an_ar_oldlib"
3733 fi
3734 }
3735
3736
3737 # func_extract_archives gentop oldlib ...
3738 func_extract_archives ()
3739 {
3740 $opt_debug
3741 my_gentop="$1"; shift
3742 my_oldlibs=${1+"$@"}
3743 my_oldobjs=""
3744 my_xlib=""
3745 my_xabs=""
3746 my_xdir=""
3747
3748 for my_xlib in $my_oldlibs; do
3749 # Extract the objects.
3750 case $my_xlib in
3751 [\\/]* | [A-Za-z]:[\\/]*) my_xabs="$my_xlib" ;;
3752 *) my_xabs=`pwd`"/$my_xlib" ;;
3753 esac
3754 func_basename "$my_xlib"
3755 my_xlib="$func_basename_result"
3756 my_xlib_u=$my_xlib
3757 while :; do
3758 case " $extracted_archives " in
3759 *" $my_xlib_u "*)
3760 func_arith $extracted_serial + 1
3761 extracted_serial=$func_arith_result
3762 my_xlib_u=lt$extracted_serial-$my_xlib ;;
3763 *) break ;;
3764 esac
3765 done
3766 extracted_archives="$extracted_archives $my_xlib_u"
3767 my_xdir="$my_gentop/$my_xlib_u"
3768
3769 func_mkdir_p "$my_xdir"
3770
3771 case $host in
3772 *-darwin*)
3773 func_verbose "Extracting $my_xabs"
3774 # Do not bother doing anything if just a dry run
3775 $opt_dry_run || {
3776 darwin_orig_dir=`pwd`
3777 cd $my_xdir || exit $?
3778 darwin_archive=$my_xabs
3779 darwin_curdir=`pwd`
3780 darwin_base_archive=`basename "$darwin_archive"`
3781 darwin_arches=`$LIPO -info "$darwin_archive" 2>/dev/null | $GREP Architectures 2>/dev/null || true`
3782 if test -n "$darwin_arches"; then
3783 darwin_arches=`$ECHO "$darwin_arches" | $SED -e 's/.*are://'`
3784 darwin_arch=
3785 func_verbose "$darwin_base_archive has multiple architectures $darwin_arches"
3786 for darwin_arch in $darwin_arches ; do
3787 func_mkdir_p "unfat-$$/${darwin_base_archive}-${darwin_arch}"
3788 $LIPO -thin $darwin_arch -output "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" "${darwin_archive}"
3789 cd "unfat-$$/${darwin_base_archive}-${darwin_arch}"
3790 func_extract_an_archive "`pwd`" "${darwin_base_archive}"
3791 cd "$darwin_curdir"
3792 $RM "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}"
3793 done # $darwin_arches
3794 ## Okay now we've a bunch of thin objects, gotta fatten them up :)
3795 darwin_filelist=`find unfat-$$ -type f -name \*.o -print -o -name \*.lo -print | $SED -e "$basename" | sort -u`
3796 darwin_file=
3797 darwin_files=
3798 for darwin_file in $darwin_filelist; do
3799 darwin_files=`find unfat-$$ -name $darwin_file -print | sort | $NL2SP`
3800 $LIPO -create -output "$darwin_file" $darwin_files
3801 done # $darwin_filelist
3802 $RM -rf unfat-$$
3803 cd "$darwin_orig_dir"
3804 else
3805 cd $darwin_orig_dir
3806 func_extract_an_archive "$my_xdir" "$my_xabs"
3807 fi # $darwin_arches
3808 } # !$opt_dry_run
3809 ;;
3810 *)
3811 func_extract_an_archive "$my_xdir" "$my_xabs"
3812 ;;
3813 esac
3814 my_oldobjs="$my_oldobjs "`find $my_xdir -name \*.$objext -print -o -name \*.lo -print | sort | $NL2SP`
3815 done
3816
3817 func_extract_archives_result="$my_oldobjs"
3818 }
3819
3820
3821 # func_emit_wrapper [arg=no]
3822 #
3823 # Emit a libtool wrapper script on stdout.
3824 # Don't directly open a file because we may want to
3825 # incorporate the script contents within a cygwin/mingw
3826 # wrapper executable. Must ONLY be called from within
3827 # func_mode_link because it depends on a number of variables
3828 # set therein.
3829 #
3830 # ARG is the value that the WRAPPER_SCRIPT_BELONGS_IN_OBJDIR
3831 # variable will take. If 'yes', then the emitted script
3832 # will assume that the directory in which it is stored is
3833 # the $objdir directory. This is a cygwin/mingw-specific
3834 # behavior.
3835 func_emit_wrapper ()
3836 {
3837 func_emit_wrapper_arg1=${1-no}
3838
3839 $ECHO "\
3840 #! $SHELL
3841
3842 # $output - temporary wrapper script for $objdir/$outputname
3843 # Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION
3844 #
3845 # The $output program cannot be directly executed until all the libtool
3846 # libraries that it depends on are installed.
3847 #
3848 # This wrapper script should never be moved out of the build directory.
3849 # If it is, it will not operate correctly.
3850
3851 # Sed substitution that helps us do robust quoting. It backslashifies
3852 # metacharacters that are still active within double-quoted strings.
3853 sed_quote_subst='$sed_quote_subst'
3854
3855 # Be Bourne compatible
3856 if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then
3857 emulate sh
3858 NULLCMD=:
3859 # Zsh 3.x and 4.x performs word splitting on \${1+\"\$@\"}, which
3860 # is contrary to our usage. Disable this feature.
3861 alias -g '\${1+\"\$@\"}'='\"\$@\"'
3862 setopt NO_GLOB_SUBST
3863 else
3864 case \`(set -o) 2>/dev/null\` in *posix*) set -o posix;; esac
3865 fi
3866 BIN_SH=xpg4; export BIN_SH # for Tru64
3867 DUALCASE=1; export DUALCASE # for MKS sh
3868
3869 # The HP-UX ksh and POSIX shell print the target directory to stdout
3870 # if CDPATH is set.
3871 (unset CDPATH) >/dev/null 2>&1 && unset CDPATH
3872
3873 relink_command=\"$relink_command\"
3874
3875 # This environment variable determines our operation mode.
3876 if test \"\$libtool_install_magic\" = \"$magic\"; then
3877 # install mode needs the following variables:
3878 generated_by_libtool_version='$macro_version'
3879 notinst_deplibs='$notinst_deplibs'
3880 else
3881 # When we are sourced in execute mode, \$file and \$ECHO are already set.
3882 if test \"\$libtool_execute_magic\" != \"$magic\"; then
3883 file=\"\$0\""
3884
3885 qECHO=`$ECHO "$ECHO" | $SED "$sed_quote_subst"`
3886 $ECHO "\
3887
3888 # A function that is used when there is no print builtin or printf.
3889 func_fallback_echo ()
3890 {
3891 eval 'cat <<_LTECHO_EOF
3892 \$1
3893 _LTECHO_EOF'
3894 }
3895 ECHO=\"$qECHO\"
3896 fi
3897
3898 # Very basic option parsing. These options are (a) specific to
3899 # the libtool wrapper, (b) are identical between the wrapper
3900 # /script/ and the wrapper /executable/ which is used only on
3901 # windows platforms, and (c) all begin with the string "--lt-"
3902 # (application programs are unlikely to have options which match
3903 # this pattern).
3904 #
3905 # There are only two supported options: --lt-debug and
3906 # --lt-dump-script. There is, deliberately, no --lt-help.
3907 #
3908 # The first argument to this parsing function should be the
3909 # script's $0 value, followed by "$@".
3910 lt_option_debug=
3911 func_parse_lt_options ()
3912 {
3913 lt_script_arg0=\$0
3914 shift
3915 for lt_opt
3916 do
3917 case \"\$lt_opt\" in
3918 --lt-debug) lt_option_debug=1 ;;
3919 --lt-dump-script)
3920 lt_dump_D=\`\$ECHO \"X\$lt_script_arg0\" | $SED -e 's/^X//' -e 's%/[^/]*$%%'\`
3921 test \"X\$lt_dump_D\" = \"X\$lt_script_arg0\" && lt_dump_D=.
3922 lt_dump_F=\`\$ECHO \"X\$lt_script_arg0\" | $SED -e 's/^X//' -e 's%^.*/%%'\`
3923 cat \"\$lt_dump_D/\$lt_dump_F\"
3924 exit 0
3925 ;;
3926 --lt-*)
3927 \$ECHO \"Unrecognized --lt- option: '\$lt_opt'\" 1>&2
3928 exit 1
3929 ;;
3930 esac
3931 done
3932
3933 # Print the debug banner immediately:
3934 if test -n \"\$lt_option_debug\"; then
3935 echo \"${outputname}:${output}:\${LINENO}: libtool wrapper (GNU $PACKAGE$TIMESTAMP) $VERSION\" 1>&2
3936 fi
3937 }
3938
3939 # Used when --lt-debug. Prints its arguments to stdout
3940 # (redirection is the responsibility of the caller)
3941 func_lt_dump_args ()
3942 {
3943 lt_dump_args_N=1;
3944 for lt_arg
3945 do
3946 \$ECHO \"${outputname}:${output}:\${LINENO}: newargv[\$lt_dump_args_N]: \$lt_arg\"
3947 lt_dump_args_N=\`expr \$lt_dump_args_N + 1\`
3948 done
3949 }
3950
3951 # Core function for launching the target application
3952 func_exec_program_core ()
3953 {
3954 "
3955 case $host in
3956 # Backslashes separate directories on plain windows
3957 *-*-mingw | *-*-os2* | *-cegcc*)
3958 $ECHO "\
3959 if test -n \"\$lt_option_debug\"; then
3960 \$ECHO \"${outputname}:${output}:\${LINENO}: newargv[0]: \$progdir\\\\\$program\" 1>&2
3961 func_lt_dump_args \${1+\"\$@\"} 1>&2
3962 fi
3963 exec \"\$progdir\\\\\$program\" \${1+\"\$@\"}
3964 "
3965 ;;
3966
3967 *)
3968 $ECHO "\
3969 if test -n \"\$lt_option_debug\"; then
3970 \$ECHO \"${outputname}:${output}:\${LINENO}: newargv[0]: \$progdir/\$program\" 1>&2
3971 func_lt_dump_args \${1+\"\$@\"} 1>&2
3972 fi
3973 exec \"\$progdir/\$program\" \${1+\"\$@\"}
3974 "
3975 ;;
3976 esac
3977 $ECHO "\
3978 \$ECHO \"\$0: cannot exec \$program \$*\" 1>&2
3979 exit 1
3980 }
3981
3982 # A function to encapsulate launching the target application
3983 # Strips options in the --lt-* namespace from \$@ and
3984 # launches target application with the remaining arguments.
3985 func_exec_program ()
3986 {
3987 case \" \$* \" in
3988 *\\ --lt-*)
3989 for lt_wr_arg
3990 do
3991 case \$lt_wr_arg in
3992 --lt-*) ;;
3993 *) set x \"\$@\" \"\$lt_wr_arg\"; shift;;
3994 esac
3995 shift
3996 done ;;
3997 esac
3998 func_exec_program_core \${1+\"\$@\"}
3999 }
4000
4001 # Parse options
4002 func_parse_lt_options \"\$0\" \${1+\"\$@\"}
4003
4004 # Find the directory that this script lives in.
4005 thisdir=\`\$ECHO \"\$file\" | $SED 's%/[^/]*$%%'\`
4006 test \"x\$thisdir\" = \"x\$file\" && thisdir=.
4007
4008 # Follow symbolic links until we get to the real thisdir.
4009 file=\`ls -ld \"\$file\" | $SED -n 's/.*-> //p'\`
4010 while test -n \"\$file\"; do
4011 destdir=\`\$ECHO \"\$file\" | $SED 's%/[^/]*\$%%'\`
4012
4013 # If there was a directory component, then change thisdir.
4014 if test \"x\$destdir\" != \"x\$file\"; then
4015 case \"\$destdir\" in
4016 [\\\\/]* | [A-Za-z]:[\\\\/]*) thisdir=\"\$destdir\" ;;
4017 *) thisdir=\"\$thisdir/\$destdir\" ;;
4018 esac
4019 fi
4020
4021 file=\`\$ECHO \"\$file\" | $SED 's%^.*/%%'\`
4022 file=\`ls -ld \"\$thisdir/\$file\" | $SED -n 's/.*-> //p'\`
4023 done
4024
4025 # Usually 'no', except on cygwin/mingw when embedded into
4026 # the cwrapper.
4027 WRAPPER_SCRIPT_BELONGS_IN_OBJDIR=$func_emit_wrapper_arg1
4028 if test \"\$WRAPPER_SCRIPT_BELONGS_IN_OBJDIR\" = \"yes\"; then
4029 # special case for '.'
4030 if test \"\$thisdir\" = \".\"; then
4031 thisdir=\`pwd\`
4032 fi
4033 # remove .libs from thisdir
4034 case \"\$thisdir\" in
4035 *[\\\\/]$objdir ) thisdir=\`\$ECHO \"\$thisdir\" | $SED 's%[\\\\/][^\\\\/]*$%%'\` ;;
4036 $objdir ) thisdir=. ;;
4037 esac
4038 fi
4039
4040 # Try to get the absolute directory name.
4041 absdir=\`cd \"\$thisdir\" && pwd\`
4042 test -n \"\$absdir\" && thisdir=\"\$absdir\"
4043 "
4044
4045 if test "$fast_install" = yes; then
4046 $ECHO "\
4047 program=lt-'$outputname'$exeext
4048 progdir=\"\$thisdir/$objdir\"
4049
4050 if test ! -f \"\$progdir/\$program\" ||
4051 { file=\`ls -1dt \"\$progdir/\$program\" \"\$progdir/../\$program\" 2>/dev/null | ${SED} 1q\`; \\
4052 test \"X\$file\" != \"X\$progdir/\$program\"; }; then
4053
4054 file=\"\$\$-\$program\"
4055
4056 if test ! -d \"\$progdir\"; then
4057 $MKDIR \"\$progdir\"
4058 else
4059 $RM \"\$progdir/\$file\"
4060 fi"
4061
4062 $ECHO "\
4063
4064 # relink executable if necessary
4065 if test -n \"\$relink_command\"; then
4066 if relink_command_output=\`eval \$relink_command 2>&1\`; then :
4067 else
4068 $ECHO \"\$relink_command_output\" >&2
4069 $RM \"\$progdir/\$file\"
4070 exit 1
4071 fi
4072 fi
4073
4074 $MV \"\$progdir/\$file\" \"\$progdir/\$program\" 2>/dev/null ||
4075 { $RM \"\$progdir/\$program\";
4076 $MV \"\$progdir/\$file\" \"\$progdir/\$program\"; }
4077 $RM \"\$progdir/\$file\"
4078 fi"
4079 else
4080 $ECHO "\
4081 program='$outputname'
4082 progdir=\"\$thisdir/$objdir\"
4083 "
4084 fi
4085
4086 $ECHO "\
4087
4088 if test -f \"\$progdir/\$program\"; then"
4089
4090 # fixup the dll searchpath if we need to.
4091 #
4092 # Fix the DLL searchpath if we need to. Do this before prepending
4093 # to shlibpath, because on Windows, both are PATH and uninstalled
4094 # libraries must come first.
4095 if test -n "$dllsearchpath"; then
4096 $ECHO "\
4097 # Add the dll search path components to the executable PATH
4098 PATH=$dllsearchpath:\$PATH
4099 "
4100 fi
4101
4102 # Export our shlibpath_var if we have one.
4103 if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then
4104 $ECHO "\
4105 # Add our own library path to $shlibpath_var
4106 $shlibpath_var=\"$temp_rpath\$$shlibpath_var\"
4107
4108 # Some systems cannot cope with colon-terminated $shlibpath_var
4109 # The second colon is a workaround for a bug in BeOS R4 sed
4110 $shlibpath_var=\`\$ECHO \"\$$shlibpath_var\" | $SED 's/::*\$//'\`
4111
4112 export $shlibpath_var
4113 "
4114 fi
4115
4116 $ECHO "\
4117 if test \"\$libtool_execute_magic\" != \"$magic\"; then
4118 # Run the actual program with our arguments.
4119 func_exec_program \${1+\"\$@\"}
4120 fi
4121 else
4122 # The program doesn't exist.
4123 \$ECHO \"\$0: error: \\\`\$progdir/\$program' does not exist\" 1>&2
4124 \$ECHO \"This script is just a wrapper for \$program.\" 1>&2
4125 \$ECHO \"See the $PACKAGE documentation for more information.\" 1>&2
4126 exit 1
4127 fi
4128 fi\
4129 "
4130 }
4131
4132
4133 # func_emit_cwrapperexe_src
4134 # emit the source code for a wrapper executable on stdout
4135 # Must ONLY be called from within func_mode_link because
4136 # it depends on a number of variable set therein.
4137 func_emit_cwrapperexe_src ()
4138 {
4139 cat <<EOF
4140
4141 /* $cwrappersource - temporary wrapper executable for $objdir/$outputname
4142 Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION
4143
4144 The $output program cannot be directly executed until all the libtool
4145 libraries that it depends on are installed.
4146
4147 This wrapper executable should never be moved out of the build directory.
4148 If it is, it will not operate correctly.
4149 */
4150 EOF
4151 cat <<"EOF"
4152 #ifdef _MSC_VER
4153 # define _CRT_SECURE_NO_DEPRECATE 1
4154 #endif
4155 #include <stdio.h>
4156 #include <stdlib.h>
4157 #ifdef _MSC_VER
4158 # include <direct.h>
4159 # include <process.h>
4160 # include <io.h>
4161 #else
4162 # include <unistd.h>
4163 # include <stdint.h>
4164 # ifdef __CYGWIN__
4165 # include <io.h>
4166 # endif
4167 #endif
4168 #include <malloc.h>
4169 #include <stdarg.h>
4170 #include <assert.h>
4171 #include <string.h>
4172 #include <ctype.h>
4173 #include <errno.h>
4174 #include <fcntl.h>
4175 #include <sys/stat.h>
4176
4177 /* declarations of non-ANSI functions */
4178 #if defined(__MINGW32__)
4179 # ifdef __STRICT_ANSI__
4180 int _putenv (const char *);
4181 # endif
4182 #elif defined(__CYGWIN__)
4183 # ifdef __STRICT_ANSI__
4184 char *realpath (const char *, char *);
4185 int putenv (char *);
4186 int setenv (const char *, const char *, int);
4187 # endif
4188 /* #elif defined (other platforms) ... */
4189 #endif
4190
4191 /* portability defines, excluding path handling macros */
4192 #if defined(_MSC_VER)
4193 # define setmode _setmode
4194 # define stat _stat
4195 # define chmod _chmod
4196 # define getcwd _getcwd
4197 # define putenv _putenv
4198 # define S_IXUSR _S_IEXEC
4199 # ifndef _INTPTR_T_DEFINED
4200 # define _INTPTR_T_DEFINED
4201 # define intptr_t int
4202 # endif
4203 #elif defined(__MINGW32__)
4204 # define setmode _setmode
4205 # define stat _stat
4206 # define chmod _chmod
4207 # define getcwd _getcwd
4208 # define putenv _putenv
4209 #elif defined(__CYGWIN__)
4210 # define HAVE_SETENV
4211 # define FOPEN_WB "wb"
4212 /* #elif defined (other platforms) ... */
4213 #endif
4214
4215 #if defined(PATH_MAX)
4216 # define LT_PATHMAX PATH_MAX
4217 #elif defined(MAXPATHLEN)
4218 # define LT_PATHMAX MAXPATHLEN
4219 #else
4220 # define LT_PATHMAX 1024
4221 #endif
4222
4223 #ifndef S_IXOTH
4224 # define S_IXOTH 0
4225 #endif
4226 #ifndef S_IXGRP
4227 # define S_IXGRP 0
4228 #endif
4229
4230 /* path handling portability macros */
4231 #ifndef DIR_SEPARATOR
4232 # define DIR_SEPARATOR '/'
4233 # define PATH_SEPARATOR ':'
4234 #endif
4235
4236 #if defined (_WIN32) || defined (__MSDOS__) || defined (__DJGPP__) || \
4237 defined (__OS2__)
4238 # define HAVE_DOS_BASED_FILE_SYSTEM
4239 # define FOPEN_WB "wb"
4240 # ifndef DIR_SEPARATOR_2
4241 # define DIR_SEPARATOR_2 '\\'
4242 # endif
4243 # ifndef PATH_SEPARATOR_2
4244 # define PATH_SEPARATOR_2 ';'
4245 # endif
4246 #endif
4247
4248 #ifndef DIR_SEPARATOR_2
4249 # define IS_DIR_SEPARATOR(ch) ((ch) == DIR_SEPARATOR)
4250 #else /* DIR_SEPARATOR_2 */
4251 # define IS_DIR_SEPARATOR(ch) \
4252 (((ch) == DIR_SEPARATOR) || ((ch) == DIR_SEPARATOR_2))
4253 #endif /* DIR_SEPARATOR_2 */
4254
4255 #ifndef PATH_SEPARATOR_2
4256 # define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR)
4257 #else /* PATH_SEPARATOR_2 */
4258 # define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR_2)
4259 #endif /* PATH_SEPARATOR_2 */
4260
4261 #ifndef FOPEN_WB
4262 # define FOPEN_WB "w"
4263 #endif
4264 #ifndef _O_BINARY
4265 # define _O_BINARY 0
4266 #endif
4267
4268 #define XMALLOC(type, num) ((type *) xmalloc ((num) * sizeof(type)))
4269 #define XFREE(stale) do { \
4270 if (stale) { free ((void *) stale); stale = 0; } \
4271 } while (0)
4272
4273 #if defined(LT_DEBUGWRAPPER)
4274 static int lt_debug = 1;
4275 #else
4276 static int lt_debug = 0;
4277 #endif
4278
4279 const char *program_name = "libtool-wrapper"; /* in case xstrdup fails */
4280
4281 void *xmalloc (size_t num);
4282 char *xstrdup (const char *string);
4283 const char *base_name (const char *name);
4284 char *find_executable (const char *wrapper);
4285 char *chase_symlinks (const char *pathspec);
4286 int make_executable (const char *path);
4287 int check_executable (const char *path);
4288 char *strendzap (char *str, const char *pat);
4289 void lt_debugprintf (const char *file, int line, const char *fmt, ...);
4290 void lt_fatal (const char *file, int line, const char *message, ...);
4291 static const char *nonnull (const char *s);
4292 static const char *nonempty (const char *s);
4293 void lt_setenv (const char *name, const char *value);
4294 char *lt_extend_str (const char *orig_value, const char *add, int to_end);
4295 void lt_update_exe_path (const char *name, const char *value);
4296 void lt_update_lib_path (const char *name, const char *value);
4297 char **prepare_spawn (char **argv);
4298 void lt_dump_script (FILE *f);
4299 EOF
4300
4301 cat <<EOF
4302 volatile const char * MAGIC_EXE = "$magic_exe";
4303 const char * LIB_PATH_VARNAME = "$shlibpath_var";
4304 EOF
4305
4306 if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then
4307 func_to_host_path "$temp_rpath"
4308 cat <<EOF
4309 const char * LIB_PATH_VALUE = "$func_to_host_path_result";
4310 EOF
4311 else
4312 cat <<"EOF"
4313 const char * LIB_PATH_VALUE = "";
4314 EOF
4315 fi
4316
4317 if test -n "$dllsearchpath"; then
4318 func_to_host_path "$dllsearchpath:"
4319 cat <<EOF
4320 const char * EXE_PATH_VARNAME = "PATH";
4321 const char * EXE_PATH_VALUE = "$func_to_host_path_result";
4322 EOF
4323 else
4324 cat <<"EOF"
4325 const char * EXE_PATH_VARNAME = "";
4326 const char * EXE_PATH_VALUE = "";
4327 EOF
4328 fi
4329
4330 if test "$fast_install" = yes; then
4331 cat <<EOF
4332 const char * TARGET_PROGRAM_NAME = "lt-$outputname"; /* hopefully, no .exe */
4333 EOF
4334 else
4335 cat <<EOF
4336 const char * TARGET_PROGRAM_NAME = "$outputname"; /* hopefully, no .exe */
4337 EOF
4338 fi
4339
4340
4341 cat <<"EOF"
4342
4343 #define LTWRAPPER_OPTION_PREFIX "--lt-"
4344
4345 static const char *ltwrapper_option_prefix = LTWRAPPER_OPTION_PREFIX;
4346 static const char *dumpscript_opt = LTWRAPPER_OPTION_PREFIX "dump-script";
4347 static const char *debug_opt = LTWRAPPER_OPTION_PREFIX "debug";
4348
4349 int
4350 main (int argc, char *argv[])
4351 {
4352 char **newargz;
4353 int newargc;
4354 char *tmp_pathspec;
4355 char *actual_cwrapper_path;
4356 char *actual_cwrapper_name;
4357 char *target_name;
4358 char *lt_argv_zero;
4359 intptr_t rval = 127;
4360
4361 int i;
4362
4363 program_name = (char *) xstrdup (base_name (argv[0]));
4364 newargz = XMALLOC (char *, argc + 1);
4365
4366 /* very simple arg parsing; don't want to rely on getopt
4367 * also, copy all non cwrapper options to newargz, except
4368 * argz[0], which is handled differently
4369 */
4370 newargc=0;
4371 for (i = 1; i < argc; i++)
4372 {
4373 if (strcmp (argv[i], dumpscript_opt) == 0)
4374 {
4375 EOF
4376 case "$host" in
4377 *mingw* | *cygwin* )
4378 # make stdout use "unix" line endings
4379 echo " setmode(1,_O_BINARY);"
4380 ;;
4381 esac
4382
4383 cat <<"EOF"
4384 lt_dump_script (stdout);
4385 return 0;
4386 }
4387 if (strcmp (argv[i], debug_opt) == 0)
4388 {
4389 lt_debug = 1;
4390 continue;
4391 }
4392 if (strcmp (argv[i], ltwrapper_option_prefix) == 0)
4393 {
4394 /* however, if there is an option in the LTWRAPPER_OPTION_PREFIX
4395 namespace, but it is not one of the ones we know about and
4396 have already dealt with, above (inluding dump-script), then
4397 report an error. Otherwise, targets might begin to believe
4398 they are allowed to use options in the LTWRAPPER_OPTION_PREFIX
4399 namespace. The first time any user complains about this, we'll
4400 need to make LTWRAPPER_OPTION_PREFIX a configure-time option
4401 or a configure.ac-settable value.
4402 */
4403 lt_fatal (__FILE__, __LINE__,
4404 "unrecognized %s option: '%s'",
4405 ltwrapper_option_prefix, argv[i]);
4406 }
4407 /* otherwise ... */
4408 newargz[++newargc] = xstrdup (argv[i]);
4409 }
4410 newargz[++newargc] = NULL;
4411
4412 EOF
4413 cat <<EOF
4414 /* The GNU banner must be the first non-error debug message */
4415 lt_debugprintf (__FILE__, __LINE__, "libtool wrapper (GNU $PACKAGE$TIMESTAMP) $VERSION\n");
4416 EOF
4417 cat <<"EOF"
4418 lt_debugprintf (__FILE__, __LINE__, "(main) argv[0]: %s\n", argv[0]);
4419 lt_debugprintf (__FILE__, __LINE__, "(main) program_name: %s\n", program_name);
4420
4421 tmp_pathspec = find_executable (argv[0]);
4422 if (tmp_pathspec == NULL)
4423 lt_fatal (__FILE__, __LINE__, "couldn't find %s", argv[0]);
4424 lt_debugprintf (__FILE__, __LINE__,
4425 "(main) found exe (before symlink chase) at: %s\n",
4426 tmp_pathspec);
4427
4428 actual_cwrapper_path = chase_symlinks (tmp_pathspec);
4429 lt_debugprintf (__FILE__, __LINE__,
4430 "(main) found exe (after symlink chase) at: %s\n",
4431 actual_cwrapper_path);
4432 XFREE (tmp_pathspec);
4433
4434 actual_cwrapper_name = xstrdup (base_name (actual_cwrapper_path));
4435 strendzap (actual_cwrapper_path, actual_cwrapper_name);
4436
4437 /* wrapper name transforms */
4438 strendzap (actual_cwrapper_name, ".exe");
4439 tmp_pathspec = lt_extend_str (actual_cwrapper_name, ".exe", 1);
4440 XFREE (actual_cwrapper_name);
4441 actual_cwrapper_name = tmp_pathspec;
4442 tmp_pathspec = 0;
4443
4444 /* target_name transforms -- use actual target program name; might have lt- prefix */
4445 target_name = xstrdup (base_name (TARGET_PROGRAM_NAME));
4446 strendzap (target_name, ".exe");
4447 tmp_pathspec = lt_extend_str (target_name, ".exe", 1);
4448 XFREE (target_name);
4449 target_name = tmp_pathspec;
4450 tmp_pathspec = 0;
4451
4452 lt_debugprintf (__FILE__, __LINE__,
4453 "(main) libtool target name: %s\n",
4454 target_name);
4455 EOF
4456
4457 cat <<EOF
4458 newargz[0] =
4459 XMALLOC (char, (strlen (actual_cwrapper_path) +
4460 strlen ("$objdir") + 1 + strlen (actual_cwrapper_name) + 1));
4461 strcpy (newargz[0], actual_cwrapper_path);
4462 strcat (newargz[0], "$objdir");
4463 strcat (newargz[0], "/");
4464 EOF
4465
4466 cat <<"EOF"
4467 /* stop here, and copy so we don't have to do this twice */
4468 tmp_pathspec = xstrdup (newargz[0]);
4469
4470 /* do NOT want the lt- prefix here, so use actual_cwrapper_name */
4471 strcat (newargz[0], actual_cwrapper_name);
4472
4473 /* DO want the lt- prefix here if it exists, so use target_name */
4474 lt_argv_zero = lt_extend_str (tmp_pathspec, target_name, 1);
4475 XFREE (tmp_pathspec);
4476 tmp_pathspec = NULL;
4477 EOF
4478
4479 case $host_os in
4480 mingw*)
4481 cat <<"EOF"
4482 {
4483 char* p;
4484 while ((p = strchr (newargz[0], '\\')) != NULL)
4485 {
4486 *p = '/';
4487 }
4488 while ((p = strchr (lt_argv_zero, '\\')) != NULL)
4489 {
4490 *p = '/';
4491 }
4492 }
4493 EOF
4494 ;;
4495 esac
4496
4497 cat <<"EOF"
4498 XFREE (target_name);
4499 XFREE (actual_cwrapper_path);
4500 XFREE (actual_cwrapper_name);
4501
4502 lt_setenv ("BIN_SH", "xpg4"); /* for Tru64 */
4503 lt_setenv ("DUALCASE", "1"); /* for MSK sh */
4504 /* Update the DLL searchpath. EXE_PATH_VALUE ($dllsearchpath) must
4505 be prepended before (that is, appear after) LIB_PATH_VALUE ($temp_rpath)
4506 because on Windows, both *_VARNAMEs are PATH but uninstalled
4507 libraries must come first. */
4508 lt_update_exe_path (EXE_PATH_VARNAME, EXE_PATH_VALUE);
4509 lt_update_lib_path (LIB_PATH_VARNAME, LIB_PATH_VALUE);
4510
4511 lt_debugprintf (__FILE__, __LINE__, "(main) lt_argv_zero: %s\n",
4512 nonnull (lt_argv_zero));
4513 for (i = 0; i < newargc; i++)
4514 {
4515 lt_debugprintf (__FILE__, __LINE__, "(main) newargz[%d]: %s\n",
4516 i, nonnull (newargz[i]));
4517 }
4518
4519 EOF
4520
4521 case $host_os in
4522 mingw*)
4523 cat <<"EOF"
4524 /* execv doesn't actually work on mingw as expected on unix */
4525 newargz = prepare_spawn (newargz);
4526 rval = _spawnv (_P_WAIT, lt_argv_zero, (const char * const *) newargz);
4527 if (rval == -1)
4528 {
4529 /* failed to start process */
4530 lt_debugprintf (__FILE__, __LINE__,
4531 "(main) failed to launch target \"%s\": %s\n",
4532 lt_argv_zero, nonnull (strerror (errno)));
4533 return 127;
4534 }
4535 return rval;
4536 EOF
4537 ;;
4538 *)
4539 cat <<"EOF"
4540 execv (lt_argv_zero, newargz);
4541 return rval; /* =127, but avoids unused variable warning */
4542 EOF
4543 ;;
4544 esac
4545
4546 cat <<"EOF"
4547 }
4548
4549 void *
4550 xmalloc (size_t num)
4551 {
4552 void *p = (void *) malloc (num);
4553 if (!p)
4554 lt_fatal (__FILE__, __LINE__, "memory exhausted");
4555
4556 return p;
4557 }
4558
4559 char *
4560 xstrdup (const char *string)
4561 {
4562 return string ? strcpy ((char *) xmalloc (strlen (string) + 1),
4563 string) : NULL;
4564 }
4565
4566 const char *
4567 base_name (const char *name)
4568 {
4569 const char *base;
4570
4571 #if defined (HAVE_DOS_BASED_FILE_SYSTEM)
4572 /* Skip over the disk name in MSDOS pathnames. */
4573 if (isalpha ((unsigned char) name[0]) && name[1] == ':')
4574 name += 2;
4575 #endif
4576
4577 for (base = name; *name; name++)
4578 if (IS_DIR_SEPARATOR (*name))
4579 base = name + 1;
4580 return base;
4581 }
4582
4583 int
4584 check_executable (const char *path)
4585 {
4586 struct stat st;
4587
4588 lt_debugprintf (__FILE__, __LINE__, "(check_executable): %s\n",
4589 nonempty (path));
4590 if ((!path) || (!*path))
4591 return 0;
4592
4593 if ((stat (path, &st) >= 0)
4594 && (st.st_mode & (S_IXUSR | S_IXGRP | S_IXOTH)))
4595 return 1;
4596 else
4597 return 0;
4598 }
4599
4600 int
4601 make_executable (const char *path)
4602 {
4603 int rval = 0;
4604 struct stat st;
4605
4606 lt_debugprintf (__FILE__, __LINE__, "(make_executable): %s\n",
4607 nonempty (path));
4608 if ((!path) || (!*path))
4609 return 0;
4610
4611 if (stat (path, &st) >= 0)
4612 {
4613 rval = chmod (path, st.st_mode | S_IXOTH | S_IXGRP | S_IXUSR);
4614 }
4615 return rval;
4616 }
4617
4618 /* Searches for the full path of the wrapper. Returns
4619 newly allocated full path name if found, NULL otherwise
4620 Does not chase symlinks, even on platforms that support them.
4621 */
4622 char *
4623 find_executable (const char *wrapper)
4624 {
4625 int has_slash = 0;
4626 const char *p;
4627 const char *p_next;
4628 /* static buffer for getcwd */
4629 char tmp[LT_PATHMAX + 1];
4630 int tmp_len;
4631 char *concat_name;
4632
4633 lt_debugprintf (__FILE__, __LINE__, "(find_executable): %s\n",
4634 nonempty (wrapper));
4635
4636 if ((wrapper == NULL) || (*wrapper == '\0'))
4637 return NULL;
4638
4639 /* Absolute path? */
4640 #if defined (HAVE_DOS_BASED_FILE_SYSTEM)
4641 if (isalpha ((unsigned char) wrapper[0]) && wrapper[1] == ':')
4642 {
4643 concat_name = xstrdup (wrapper);
4644 if (check_executable (concat_name))
4645 return concat_name;
4646 XFREE (concat_name);
4647 }
4648 else
4649 {
4650 #endif
4651 if (IS_DIR_SEPARATOR (wrapper[0]))
4652 {
4653 concat_name = xstrdup (wrapper);
4654 if (check_executable (concat_name))
4655 return concat_name;
4656 XFREE (concat_name);
4657 }
4658 #if defined (HAVE_DOS_BASED_FILE_SYSTEM)
4659 }
4660 #endif
4661
4662 for (p = wrapper; *p; p++)
4663 if (*p == '/')
4664 {
4665 has_slash = 1;
4666 break;
4667 }
4668 if (!has_slash)
4669 {
4670 /* no slashes; search PATH */
4671 const char *path = getenv ("PATH");
4672 if (path != NULL)
4673 {
4674 for (p = path; *p; p = p_next)
4675 {
4676 const char *q;
4677 size_t p_len;
4678 for (q = p; *q; q++)
4679 if (IS_PATH_SEPARATOR (*q))
4680 break;
4681 p_len = q - p;
4682 p_next = (*q == '\0' ? q : q + 1);
4683 if (p_len == 0)
4684 {
4685 /* empty path: current directory */
4686 if (getcwd (tmp, LT_PATHMAX) == NULL)
4687 lt_fatal (__FILE__, __LINE__, "getcwd failed: %s",
4688 nonnull (strerror (errno)));
4689 tmp_len = strlen (tmp);
4690 concat_name =
4691 XMALLOC (char, tmp_len + 1 + strlen (wrapper) + 1);
4692 memcpy (concat_name, tmp, tmp_len);
4693 concat_name[tmp_len] = '/';
4694 strcpy (concat_name + tmp_len + 1, wrapper);
4695 }
4696 else
4697 {
4698 concat_name =
4699 XMALLOC (char, p_len + 1 + strlen (wrapper) + 1);
4700 memcpy (concat_name, p, p_len);
4701 concat_name[p_len] = '/';
4702 strcpy (concat_name + p_len + 1, wrapper);
4703 }
4704 if (check_executable (concat_name))
4705 return concat_name;
4706 XFREE (concat_name);
4707 }
4708 }
4709 /* not found in PATH; assume curdir */
4710 }
4711 /* Relative path | not found in path: prepend cwd */
4712 if (getcwd (tmp, LT_PATHMAX) == NULL)
4713 lt_fatal (__FILE__, __LINE__, "getcwd failed: %s",
4714 nonnull (strerror (errno)));
4715 tmp_len = strlen (tmp);
4716 concat_name = XMALLOC (char, tmp_len + 1 + strlen (wrapper) + 1);
4717 memcpy (concat_name, tmp, tmp_len);
4718 concat_name[tmp_len] = '/';
4719 strcpy (concat_name + tmp_len + 1, wrapper);
4720
4721 if (check_executable (concat_name))
4722 return concat_name;
4723 XFREE (concat_name);
4724 return NULL;
4725 }
4726
4727 char *
4728 chase_symlinks (const char *pathspec)
4729 {
4730 #ifndef S_ISLNK
4731 return xstrdup (pathspec);
4732 #else
4733 char buf[LT_PATHMAX];
4734 struct stat s;
4735 char *tmp_pathspec = xstrdup (pathspec);
4736 char *p;
4737 int has_symlinks = 0;
4738 while (strlen (tmp_pathspec) && !has_symlinks)
4739 {
4740 lt_debugprintf (__FILE__, __LINE__,
4741 "checking path component for symlinks: %s\n",
4742 tmp_pathspec);
4743 if (lstat (tmp_pathspec, &s) == 0)
4744 {
4745 if (S_ISLNK (s.st_mode) != 0)
4746 {
4747 has_symlinks = 1;
4748 break;
4749 }
4750
4751 /* search backwards for last DIR_SEPARATOR */
4752 p = tmp_pathspec + strlen (tmp_pathspec) - 1;
4753 while ((p > tmp_pathspec) && (!IS_DIR_SEPARATOR (*p)))
4754 p--;
4755 if ((p == tmp_pathspec) && (!IS_DIR_SEPARATOR (*p)))
4756 {
4757 /* no more DIR_SEPARATORS left */
4758 break;
4759 }
4760 *p = '\0';
4761 }
4762 else
4763 {
4764 lt_fatal (__FILE__, __LINE__,
4765 "error accessing file \"%s\": %s",
4766 tmp_pathspec, nonnull (strerror (errno)));
4767 }
4768 }
4769 XFREE (tmp_pathspec);
4770
4771 if (!has_symlinks)
4772 {
4773 return xstrdup (pathspec);
4774 }
4775
4776 tmp_pathspec = realpath (pathspec, buf);
4777 if (tmp_pathspec == 0)
4778 {
4779 lt_fatal (__FILE__, __LINE__,
4780 "could not follow symlinks for %s", pathspec);
4781 }
4782 return xstrdup (tmp_pathspec);
4783 #endif
4784 }
4785
4786 char *
4787 strendzap (char *str, const char *pat)
4788 {
4789 size_t len, patlen;
4790
4791 assert (str != NULL);
4792 assert (pat != NULL);
4793
4794 len = strlen (str);
4795 patlen = strlen (pat);
4796
4797 if (patlen <= len)
4798 {
4799 str += len - patlen;
4800 if (strcmp (str, pat) == 0)
4801 *str = '\0';
4802 }
4803 return str;
4804 }
4805
4806 void
4807 lt_debugprintf (const char *file, int line, const char *fmt, ...)
4808 {
4809 va_list args;
4810 if (lt_debug)
4811 {
4812 (void) fprintf (stderr, "%s:%s:%d: ", program_name, file, line);
4813 va_start (args, fmt);
4814 (void) vfprintf (stderr, fmt, args);
4815 va_end (args);
4816 }
4817 }
4818
4819 static void
4820 lt_error_core (int exit_status, const char *file,
4821 int line, const char *mode,
4822 const char *message, va_list ap)
4823 {
4824 fprintf (stderr, "%s:%s:%d: %s: ", program_name, file, line, mode);
4825 vfprintf (stderr, message, ap);
4826 fprintf (stderr, ".\n");
4827
4828 if (exit_status >= 0)
4829 exit (exit_status);
4830 }
4831
4832 void
4833 lt_fatal (const char *file, int line, const char *message, ...)
4834 {
4835 va_list ap;
4836 va_start (ap, message);
4837 lt_error_core (EXIT_FAILURE, file, line, "FATAL", message, ap);
4838 va_end (ap);
4839 }
4840
4841 static const char *
4842 nonnull (const char *s)
4843 {
4844 return s ? s : "(null)";
4845 }
4846
4847 static const char *
4848 nonempty (const char *s)
4849 {
4850 return (s && !*s) ? "(empty)" : nonnull (s);
4851 }
4852
4853 void
4854 lt_setenv (const char *name, const char *value)
4855 {
4856 lt_debugprintf (__FILE__, __LINE__,
4857 "(lt_setenv) setting '%s' to '%s'\n",
4858 nonnull (name), nonnull (value));
4859 {
4860 #ifdef HAVE_SETENV
4861 /* always make a copy, for consistency with !HAVE_SETENV */
4862 char *str = xstrdup (value);
4863 setenv (name, str, 1);
4864 #else
4865 int len = strlen (name) + 1 + strlen (value) + 1;
4866 char *str = XMALLOC (char, len);
4867 sprintf (str, "%s=%s", name, value);
4868 if (putenv (str) != EXIT_SUCCESS)
4869 {
4870 XFREE (str);
4871 }
4872 #endif
4873 }
4874 }
4875
4876 char *
4877 lt_extend_str (const char *orig_value, const char *add, int to_end)
4878 {
4879 char *new_value;
4880 if (orig_value && *orig_value)
4881 {
4882 int orig_value_len = strlen (orig_value);
4883 int add_len = strlen (add);
4884 new_value = XMALLOC (char, add_len + orig_value_len + 1);
4885 if (to_end)
4886 {
4887 strcpy (new_value, orig_value);
4888 strcpy (new_value + orig_value_len, add);
4889 }
4890 else
4891 {
4892 strcpy (new_value, add);
4893 strcpy (new_value + add_len, orig_value);
4894 }
4895 }
4896 else
4897 {
4898 new_value = xstrdup (add);
4899 }
4900 return new_value;
4901 }
4902
4903 void
4904 lt_update_exe_path (const char *name, const char *value)
4905 {
4906 lt_debugprintf (__FILE__, __LINE__,
4907 "(lt_update_exe_path) modifying '%s' by prepending '%s'\n",
4908 nonnull (name), nonnull (value));
4909
4910 if (name && *name && value && *value)
4911 {
4912 char *new_value = lt_extend_str (getenv (name), value, 0);
4913 /* some systems can't cope with a ':'-terminated path #' */
4914 int len = strlen (new_value);
4915 while (((len = strlen (new_value)) > 0) && IS_PATH_SEPARATOR (new_value[len-1]))
4916 {
4917 new_value[len-1] = '\0';
4918 }
4919 lt_setenv (name, new_value);
4920 XFREE (new_value);
4921 }
4922 }
4923
4924 void
4925 lt_update_lib_path (const char *name, const char *value)
4926 {
4927 lt_debugprintf (__FILE__, __LINE__,
4928 "(lt_update_lib_path) modifying '%s' by prepending '%s'\n",
4929 nonnull (name), nonnull (value));
4930
4931 if (name && *name && value && *value)
4932 {
4933 char *new_value = lt_extend_str (getenv (name), value, 0);
4934 lt_setenv (name, new_value);
4935 XFREE (new_value);
4936 }
4937 }
4938
4939 EOF
4940 case $host_os in
4941 mingw*)
4942 cat <<"EOF"
4943
4944 /* Prepares an argument vector before calling spawn().
4945 Note that spawn() does not by itself call the command interpreter
4946 (getenv ("COMSPEC") != NULL ? getenv ("COMSPEC") :
4947 ({ OSVERSIONINFO v; v.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
4948 GetVersionEx(&v);
4949 v.dwPlatformId == VER_PLATFORM_WIN32_NT;
4950 }) ? "cmd.exe" : "command.com").
4951 Instead it simply concatenates the arguments, separated by ' ', and calls
4952 CreateProcess(). We must quote the arguments since Win32 CreateProcess()
4953 interprets characters like ' ', '\t', '\\', '"' (but not '<' and '>') in a
4954 special way:
4955 - Space and tab are interpreted as delimiters. They are not treated as
4956 delimiters if they are surrounded by double quotes: "...".
4957 - Unescaped double quotes are removed from the input. Their only effect is
4958 that within double quotes, space and tab are treated like normal
4959 characters.
4960 - Backslashes not followed by double quotes are not special.
4961 - But 2*n+1 backslashes followed by a double quote become
4962 n backslashes followed by a double quote (n >= 0):
4963 \" -> "
4964 \\\" -> \"
4965 \\\\\" -> \\"
4966 */
4967 #define SHELL_SPECIAL_CHARS "\"\\ \001\002\003\004\005\006\007\010\011\012\013\014\015\016\017\020\021\022\023\024\025\026\027\030\031\032\033\034\035\036\037"
4968 #define SHELL_SPACE_CHARS " \001\002\003\004\005\006\007\010\011\012\013\014\015\016\017\020\021\022\023\024\025\026\027\030\031\032\033\034\035\036\037"
4969 char **
4970 prepare_spawn (char **argv)
4971 {
4972 size_t argc;
4973 char **new_argv;
4974 size_t i;
4975
4976 /* Count number of arguments. */
4977 for (argc = 0; argv[argc] != NULL; argc++)
4978 ;
4979
4980 /* Allocate new argument vector. */
4981 new_argv = XMALLOC (char *, argc + 1);
4982
4983 /* Put quoted arguments into the new argument vector. */
4984 for (i = 0; i < argc; i++)
4985 {
4986 const char *string = argv[i];
4987
4988 if (string[0] == '\0')
4989 new_argv[i] = xstrdup ("\"\"");
4990 else if (strpbrk (string, SHELL_SPECIAL_CHARS) != NULL)
4991 {
4992 int quote_around = (strpbrk (string, SHELL_SPACE_CHARS) != NULL);
4993 size_t length;
4994 unsigned int backslashes;
4995 const char *s;
4996 char *quoted_string;
4997 char *p;
4998
4999 length = 0;
5000 backslashes = 0;
5001 if (quote_around)
5002 length++;
5003 for (s = string; *s != '\0'; s++)
5004 {
5005 char c = *s;
5006 if (c == '"')
5007 length += backslashes + 1;
5008 length++;
5009 if (c == '\\')
5010 backslashes++;
5011 else
5012 backslashes = 0;
5013 }
5014 if (quote_around)
5015 length += backslashes + 1;
5016
5017 quoted_string = XMALLOC (char, length + 1);
5018
5019 p = quoted_string;
5020 backslashes = 0;
5021 if (quote_around)
5022 *p++ = '"';
5023 for (s = string; *s != '\0'; s++)
5024 {
5025 char c = *s;
5026 if (c == '"')
5027 {
5028 unsigned int j;
5029 for (j = backslashes + 1; j > 0; j--)
5030 *p++ = '\\';
5031 }
5032 *p++ = c;
5033 if (c == '\\')
5034 backslashes++;
5035 else
5036 backslashes = 0;
5037 }
5038 if (quote_around)
5039 {
5040 unsigned int j;
5041 for (j = backslashes; j > 0; j--)
5042 *p++ = '\\';
5043 *p++ = '"';
5044 }
5045 *p = '\0';
5046
5047 new_argv[i] = quoted_string;
5048 }
5049 else
5050 new_argv[i] = (char *) string;
5051 }
5052 new_argv[argc] = NULL;
5053
5054 return new_argv;
5055 }
5056 EOF
5057 ;;
5058 esac
5059
5060 cat <<"EOF"
5061 void lt_dump_script (FILE* f)
5062 {
5063 EOF
5064 func_emit_wrapper yes |
5065 $SED -n -e '
5066 s/^\(.\{79\}\)\(..*\)/\1\
5067 \2/
5068 h
5069 s/\([\\"]\)/\\\1/g
5070 s/$/\\n/
5071 s/\([^\n]*\).*/ fputs ("\1", f);/p
5072 g
5073 D'
5074 cat <<"EOF"
5075 }
5076 EOF
5077 }
5078 # end: func_emit_cwrapperexe_src
5079
5080 # func_win32_import_lib_p ARG
5081 # True if ARG is an import lib, as indicated by $file_magic_cmd
5082 func_win32_import_lib_p ()
5083 {
5084 $opt_debug
5085 case `eval $file_magic_cmd \"\$1\" 2>/dev/null | $SED -e 10q` in
5086 *import*) : ;;
5087 *) false ;;
5088 esac
5089 }
5090
5091 # func_mode_link arg...
5092 func_mode_link ()
5093 {
5094 $opt_debug
5095 case $host in
5096 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*)
5097 # It is impossible to link a dll without this setting, and
5098 # we shouldn't force the makefile maintainer to figure out
5099 # which system we are compiling for in order to pass an extra
5100 # flag for every libtool invocation.
5101 # allow_undefined=no
5102
5103 # FIXME: Unfortunately, there are problems with the above when trying
5104 # to make a dll which has undefined symbols, in which case not
5105 # even a static library is built. For now, we need to specify
5106 # -no-undefined on the libtool link line when we can be certain
5107 # that all symbols are satisfied, otherwise we get a static library.
5108 allow_undefined=yes
5109 ;;
5110 *)
5111 allow_undefined=yes
5112 ;;
5113 esac
5114 libtool_args=$nonopt
5115 base_compile="$nonopt $@"
5116 compile_command=$nonopt
5117 finalize_command=$nonopt
5118
5119 compile_rpath=
5120 finalize_rpath=
5121 compile_shlibpath=
5122 finalize_shlibpath=
5123 convenience=
5124 old_convenience=
5125 deplibs=
5126 old_deplibs=
5127 compiler_flags=
5128 linker_flags=
5129 dllsearchpath=
5130 lib_search_path=`pwd`
5131 inst_prefix_dir=
5132 new_inherited_linker_flags=
5133
5134 avoid_version=no
5135 bindir=
5136 dlfiles=
5137 dlprefiles=
5138 dlself=no
5139 export_dynamic=no
5140 export_symbols=
5141 export_symbols_regex=
5142 generated=
5143 libobjs=
5144 ltlibs=
5145 module=no
5146 no_install=no
5147 objs=
5148 non_pic_objects=
5149 precious_files_regex=
5150 prefer_static_libs=no
5151 preload=no
5152 prev=
5153 prevarg=
5154 release=
5155 rpath=
5156 xrpath=
5157 perm_rpath=
5158 temp_rpath=
5159 thread_safe=no
5160 vinfo=
5161 vinfo_number=no
5162 weak_libs=
5163 single_module="${wl}-single_module"
5164 func_infer_tag $base_compile
5165
5166 # We need to know -static, to get the right output filenames.
5167 for arg
5168 do
5169 case $arg in
5170 -shared)
5171 test "$build_libtool_libs" != yes && \
5172 func_fatal_configuration "can not build a shared library"
5173 build_old_libs=no
5174 break
5175 ;;
5176 -all-static | -static | -static-libtool-libs)
5177 case $arg in
5178 -all-static)
5179 if test "$build_libtool_libs" = yes && test -z "$link_static_flag"; then
5180 func_warning "complete static linking is impossible in this configuration"
5181 fi
5182 if test -n "$link_static_flag"; then
5183 dlopen_self=$dlopen_self_static
5184 fi
5185 prefer_static_libs=yes
5186 ;;
5187 -static)
5188 if test -z "$pic_flag" && test -n "$link_static_flag"; then
5189 dlopen_self=$dlopen_self_static
5190 fi
5191 prefer_static_libs=built
5192 ;;
5193 -static-libtool-libs)
5194 if test -z "$pic_flag" && test -n "$link_static_flag"; then
5195 dlopen_self=$dlopen_self_static
5196 fi
5197 prefer_static_libs=yes
5198 ;;
5199 esac
5200 build_libtool_libs=no
5201 build_old_libs=yes
5202 break
5203 ;;
5204 esac
5205 done
5206
5207 # See if our shared archives depend on static archives.
5208 test -n "$old_archive_from_new_cmds" && build_old_libs=yes
5209
5210 # Go through the arguments, transforming them on the way.
5211 while test "$#" -gt 0; do
5212 arg="$1"
5213 shift
5214 func_quote_for_eval "$arg"
5215 qarg=$func_quote_for_eval_unquoted_result
5216 func_append libtool_args " $func_quote_for_eval_result"
5217
5218 # If the previous option needs an argument, assign it.
5219 if test -n "$prev"; then
5220 case $prev in
5221 output)
5222 func_append compile_command " @OUTPUT@"
5223 func_append finalize_command " @OUTPUT@"
5224 ;;
5225 esac
5226
5227 case $prev in
5228 bindir)
5229 bindir="$arg"
5230 prev=
5231 continue
5232 ;;
5233 dlfiles|dlprefiles)
5234 if test "$preload" = no; then
5235 # Add the symbol object into the linking commands.
5236 func_append compile_command " @SYMFILE@"
5237 func_append finalize_command " @SYMFILE@"
5238 preload=yes
5239 fi
5240 case $arg in
5241 *.la | *.lo) ;; # We handle these cases below.
5242 force)
5243 if test "$dlself" = no; then
5244 dlself=needless
5245 export_dynamic=yes
5246 fi
5247 prev=
5248 continue
5249 ;;
5250 self)
5251 if test "$prev" = dlprefiles; then
5252 dlself=yes
5253 elif test "$prev" = dlfiles && test "$dlopen_self" != yes; then
5254 dlself=yes
5255 else
5256 dlself=needless
5257 export_dynamic=yes
5258 fi
5259 prev=
5260 continue
5261 ;;
5262 *)
5263 if test "$prev" = dlfiles; then
5264 func_append dlfiles " $arg"
5265 else
5266 func_append dlprefiles " $arg"
5267 fi
5268 prev=
5269 continue
5270 ;;
5271 esac
5272 ;;
5273 expsyms)
5274 export_symbols="$arg"
5275 test -f "$arg" \
5276 || func_fatal_error "symbol file \`$arg' does not exist"
5277 prev=
5278 continue
5279 ;;
5280 expsyms_regex)
5281 export_symbols_regex="$arg"
5282 prev=
5283 continue
5284 ;;
5285 framework)
5286 case $host in
5287 *-*-darwin*)
5288 case "$deplibs " in
5289 *" $qarg.ltframework "*) ;;
5290 *) func_append deplibs " $qarg.ltframework" # this is fixed later
5291 ;;
5292 esac
5293 ;;
5294 esac
5295 prev=
5296 continue
5297 ;;
5298 inst_prefix)
5299 inst_prefix_dir="$arg"
5300 prev=
5301 continue
5302 ;;
5303 objectlist)
5304 if test -f "$arg"; then
5305 save_arg=$arg
5306 moreargs=
5307 for fil in `cat "$save_arg"`
5308 do
5309 # func_append moreargs " $fil"
5310 arg=$fil
5311 # A libtool-controlled object.
5312
5313 # Check to see that this really is a libtool object.
5314 if func_lalib_unsafe_p "$arg"; then
5315 pic_object=
5316 non_pic_object=
5317
5318 # Read the .lo file
5319 func_source "$arg"
5320
5321 if test -z "$pic_object" ||
5322 test -z "$non_pic_object" ||
5323 test "$pic_object" = none &&
5324 test "$non_pic_object" = none; then
5325 func_fatal_error "cannot find name of object for \`$arg'"
5326 fi
5327
5328 # Extract subdirectory from the argument.
5329 func_dirname "$arg" "/" ""
5330 xdir="$func_dirname_result"
5331
5332 if test "$pic_object" != none; then
5333 # Prepend the subdirectory the object is found in.
5334 pic_object="$xdir$pic_object"
5335
5336 if test "$prev" = dlfiles; then
5337 if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then
5338 func_append dlfiles " $pic_object"
5339 prev=
5340 continue
5341 else
5342 # If libtool objects are unsupported, then we need to preload.
5343 prev=dlprefiles
5344 fi
5345 fi
5346
5347 # CHECK ME: I think I busted this. -Ossama
5348 if test "$prev" = dlprefiles; then
5349 # Preload the old-style object.
5350 func_append dlprefiles " $pic_object"
5351 prev=
5352 fi
5353
5354 # A PIC object.
5355 func_append libobjs " $pic_object"
5356 arg="$pic_object"
5357 fi
5358
5359 # Non-PIC object.
5360 if test "$non_pic_object" != none; then
5361 # Prepend the subdirectory the object is found in.
5362 non_pic_object="$xdir$non_pic_object"
5363
5364 # A standard non-PIC object
5365 func_append non_pic_objects " $non_pic_object"
5366 if test -z "$pic_object" || test "$pic_object" = none ; then
5367 arg="$non_pic_object"
5368 fi
5369 else
5370 # If the PIC object exists, use it instead.
5371 # $xdir was prepended to $pic_object above.
5372 non_pic_object="$pic_object"
5373 func_append non_pic_objects " $non_pic_object"
5374 fi
5375 else
5376 # Only an error if not doing a dry-run.
5377 if $opt_dry_run; then
5378 # Extract subdirectory from the argument.
5379 func_dirname "$arg" "/" ""
5380 xdir="$func_dirname_result"
5381
5382 func_lo2o "$arg"
5383 pic_object=$xdir$objdir/$func_lo2o_result
5384 non_pic_object=$xdir$func_lo2o_result
5385 func_append libobjs " $pic_object"
5386 func_append non_pic_objects " $non_pic_object"
5387 else
5388 func_fatal_error "\`$arg' is not a valid libtool object"
5389 fi
5390 fi
5391 done
5392 else
5393 func_fatal_error "link input file \`$arg' does not exist"
5394 fi
5395 arg=$save_arg
5396 prev=
5397 continue
5398 ;;
5399 precious_regex)
5400 precious_files_regex="$arg"
5401 prev=
5402 continue
5403 ;;
5404 release)
5405 release="-$arg"
5406 prev=
5407 continue
5408 ;;
5409 rpath | xrpath)
5410 # We need an absolute path.
5411 case $arg in
5412 [\\/]* | [A-Za-z]:[\\/]*) ;;
5413 *)
5414 func_fatal_error "only absolute run-paths are allowed"
5415 ;;
5416 esac
5417 if test "$prev" = rpath; then
5418 case "$rpath " in
5419 *" $arg "*) ;;
5420 *) func_append rpath " $arg" ;;
5421 esac
5422 else
5423 case "$xrpath " in
5424 *" $arg "*) ;;
5425 *) func_append xrpath " $arg" ;;
5426 esac
5427 fi
5428 prev=
5429 continue
5430 ;;
5431 shrext)
5432 shrext_cmds="$arg"
5433 prev=
5434 continue
5435 ;;
5436 weak)
5437 func_append weak_libs " $arg"
5438 prev=
5439 continue
5440 ;;
5441 xcclinker)
5442 func_append linker_flags " $qarg"
5443 func_append compiler_flags " $qarg"
5444 prev=
5445 func_append compile_command " $qarg"
5446 func_append finalize_command " $qarg"
5447 continue
5448 ;;
5449 xcompiler)
5450 func_append compiler_flags " $qarg"
5451 prev=
5452 func_append compile_command " $qarg"
5453 func_append finalize_command " $qarg"
5454 continue
5455 ;;
5456 xlinker)
5457 func_append linker_flags " $qarg"
5458 func_append compiler_flags " $wl$qarg"
5459 prev=
5460 func_append compile_command " $wl$qarg"
5461 func_append finalize_command " $wl$qarg"
5462 continue
5463 ;;
5464 *)
5465 eval "$prev=\"\$arg\""
5466 prev=
5467 continue
5468 ;;
5469 esac
5470 fi # test -n "$prev"
5471
5472 prevarg="$arg"
5473
5474 case $arg in
5475 -all-static)
5476 if test -n "$link_static_flag"; then
5477 # See comment for -static flag below, for more details.
5478 func_append compile_command " $link_static_flag"
5479 func_append finalize_command " $link_static_flag"
5480 fi
5481 continue
5482 ;;
5483
5484 -allow-undefined)
5485 # FIXME: remove this flag sometime in the future.
5486 func_fatal_error "\`-allow-undefined' must not be used because it is the default"
5487 ;;
5488
5489 -avoid-version)
5490 avoid_version=yes
5491 continue
5492 ;;
5493
5494 -bindir)
5495 prev=bindir
5496 continue
5497 ;;
5498
5499 -dlopen)
5500 prev=dlfiles
5501 continue
5502 ;;
5503
5504 -dlpreopen)
5505 prev=dlprefiles
5506 continue
5507 ;;
5508
5509 -export-dynamic)
5510 export_dynamic=yes
5511 continue
5512 ;;
5513
5514 -export-symbols | -export-symbols-regex)
5515 if test -n "$export_symbols" || test -n "$export_symbols_regex"; then
5516 func_fatal_error "more than one -exported-symbols argument is not allowed"
5517 fi
5518 if test "X$arg" = "X-export-symbols"; then
5519 prev=expsyms
5520 else
5521 prev=expsyms_regex
5522 fi
5523 continue
5524 ;;
5525
5526 -framework)
5527 prev=framework
5528 continue
5529 ;;
5530
5531 -inst-prefix-dir)
5532 prev=inst_prefix
5533 continue
5534 ;;
5535
5536 # The native IRIX linker understands -LANG:*, -LIST:* and -LNO:*
5537 # so, if we see these flags be careful not to treat them like -L
5538 -L[A-Z][A-Z]*:*)
5539 case $with_gcc/$host in
5540 no/*-*-irix* | /*-*-irix*)
5541 func_append compile_command " $arg"
5542 func_append finalize_command " $arg"
5543 ;;
5544 esac
5545 continue
5546 ;;
5547
5548 -L*)
5549 func_stripname "-L" '' "$arg"
5550 if test -z "$func_stripname_result"; then
5551 if test "$#" -gt 0; then
5552 func_fatal_error "require no space between \`-L' and \`$1'"
5553 else
5554 func_fatal_error "need path for \`-L' option"
5555 fi
5556 fi
5557 func_resolve_sysroot "$func_stripname_result"
5558 dir=$func_resolve_sysroot_result
5559 # We need an absolute path.
5560 case $dir in
5561 [\\/]* | [A-Za-z]:[\\/]*) ;;
5562 *)
5563 absdir=`cd "$dir" && pwd`
5564 test -z "$absdir" && \
5565 func_fatal_error "cannot determine absolute directory name of \`$dir'"
5566 dir="$absdir"
5567 ;;
5568 esac
5569 case "$deplibs " in
5570 *" -L$dir "* | *" $arg "*)
5571 # Will only happen for absolute or sysroot arguments
5572 ;;
5573 *)
5574 # Preserve sysroot, but never include relative directories
5575 case $dir in
5576 [\\/]* | [A-Za-z]:[\\/]* | =*) func_append deplibs " $arg" ;;
5577 *) func_append deplibs " -L$dir" ;;
5578 esac
5579 func_append lib_search_path " $dir"
5580 ;;
5581 esac
5582 case $host in
5583 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*)
5584 testbindir=`$ECHO "$dir" | $SED 's*/lib$*/bin*'`
5585 case :$dllsearchpath: in
5586 *":$dir:"*) ;;
5587 ::) dllsearchpath=$dir;;
5588 *) func_append dllsearchpath ":$dir";;
5589 esac
5590 case :$dllsearchpath: in
5591 *":$testbindir:"*) ;;
5592 ::) dllsearchpath=$testbindir;;
5593 *) func_append dllsearchpath ":$testbindir";;
5594 esac
5595 ;;
5596 esac
5597 continue
5598 ;;
5599
5600 -l*)
5601 if test "X$arg" = "X-lc" || test "X$arg" = "X-lm"; then
5602 case $host in
5603 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-beos* | *-cegcc* | *-*-haiku*)
5604 # These systems don't actually have a C or math library (as such)
5605 continue
5606 ;;
5607 *-*-os2*)
5608 # These systems don't actually have a C library (as such)
5609 test "X$arg" = "X-lc" && continue
5610 ;;
5611 *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
5612 # Do not include libc due to us having libc/libc_r.
5613 test "X$arg" = "X-lc" && continue
5614 ;;
5615 *-*-rhapsody* | *-*-darwin1.[012])
5616 # Rhapsody C and math libraries are in the System framework
5617 func_append deplibs " System.ltframework"
5618 continue
5619 ;;
5620 *-*-sco3.2v5* | *-*-sco5v6*)
5621 # Causes problems with __ctype
5622 test "X$arg" = "X-lc" && continue
5623 ;;
5624 *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*)
5625 # Compiler inserts libc in the correct place for threads to work
5626 test "X$arg" = "X-lc" && continue
5627 ;;
5628 esac
5629 elif test "X$arg" = "X-lc_r"; then
5630 case $host in
5631 *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
5632 # Do not include libc_r directly, use -pthread flag.
5633 continue
5634 ;;
5635 esac
5636 fi
5637 func_append deplibs " $arg"
5638 continue
5639 ;;
5640
5641 -module)
5642 module=yes
5643 continue
5644 ;;
5645
5646 # Tru64 UNIX uses -model [arg] to determine the layout of C++
5647 # classes, name mangling, and exception handling.
5648 # Darwin uses the -arch flag to determine output architecture.
5649 -model|-arch|-isysroot|--sysroot)
5650 func_append compiler_flags " $arg"
5651 func_append compile_command " $arg"
5652 func_append finalize_command " $arg"
5653 prev=xcompiler
5654 continue
5655 ;;
5656
5657 -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe \
5658 |-threads|-fopenmp|-openmp|-mp|-xopenmp|-omp|-qsmp=*)
5659 func_append compiler_flags " $arg"
5660 func_append compile_command " $arg"
5661 func_append finalize_command " $arg"
5662 case "$new_inherited_linker_flags " in
5663 *" $arg "*) ;;
5664 * ) func_append new_inherited_linker_flags " $arg" ;;
5665 esac
5666 continue
5667 ;;
5668
5669 -multi_module)
5670 single_module="${wl}-multi_module"
5671 continue
5672 ;;
5673
5674 -no-fast-install)
5675 fast_install=no
5676 continue
5677 ;;
5678
5679 -no-install)
5680 case $host in
5681 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-darwin* | *-cegcc*)
5682 # The PATH hackery in wrapper scripts is required on Windows
5683 # and Darwin in order for the loader to find any dlls it needs.
5684 func_warning "\`-no-install' is ignored for $host"
5685 func_warning "assuming \`-no-fast-install' instead"
5686 fast_install=no
5687 ;;
5688 *) no_install=yes ;;
5689 esac
5690 continue
5691 ;;
5692
5693 -no-undefined)
5694 allow_undefined=no
5695 continue
5696 ;;
5697
5698 -objectlist)
5699 prev=objectlist
5700 continue
5701 ;;
5702
5703 -o) prev=output ;;
5704
5705 -precious-files-regex)
5706 prev=precious_regex
5707 continue
5708 ;;
5709
5710 -release)
5711 prev=release
5712 continue
5713 ;;
5714
5715 -rpath)
5716 prev=rpath
5717 continue
5718 ;;
5719
5720 -R)
5721 prev=xrpath
5722 continue
5723 ;;
5724
5725 -R*)
5726 func_stripname '-R' '' "$arg"
5727 dir=$func_stripname_result
5728 # We need an absolute path.
5729 case $dir in
5730 [\\/]* | [A-Za-z]:[\\/]*) ;;
5731 =*)
5732 func_stripname '=' '' "$dir"
5733 dir=$lt_sysroot$func_stripname_result
5734 ;;
5735 *)
5736 func_fatal_error "only absolute run-paths are allowed"
5737 ;;
5738 esac
5739 case "$xrpath " in
5740 *" $dir "*) ;;
5741 *) func_append xrpath " $dir" ;;
5742 esac
5743 continue
5744 ;;
5745
5746 -shared)
5747 # The effects of -shared are defined in a previous loop.
5748 continue
5749 ;;
5750
5751 -shrext)
5752 prev=shrext
5753 continue
5754 ;;
5755
5756 -static | -static-libtool-libs)
5757 # The effects of -static are defined in a previous loop.
5758 # We used to do the same as -all-static on platforms that
5759 # didn't have a PIC flag, but the assumption that the effects
5760 # would be equivalent was wrong. It would break on at least
5761 # Digital Unix and AIX.
5762 continue
5763 ;;
5764
5765 -thread-safe)
5766 thread_safe=yes
5767 continue
5768 ;;
5769
5770 -version-info)
5771 prev=vinfo
5772 continue
5773 ;;
5774
5775 -version-number)
5776 prev=vinfo
5777 vinfo_number=yes
5778 continue
5779 ;;
5780
5781 -weak)
5782 prev=weak
5783 continue
5784 ;;
5785
5786 -Wc,*)
5787 func_stripname '-Wc,' '' "$arg"
5788 args=$func_stripname_result
5789 arg=
5790 save_ifs="$IFS"; IFS=','
5791 for flag in $args; do
5792 IFS="$save_ifs"
5793 func_quote_for_eval "$flag"
5794 func_append arg " $func_quote_for_eval_result"
5795 func_append compiler_flags " $func_quote_for_eval_result"
5796 done
5797 IFS="$save_ifs"
5798 func_stripname ' ' '' "$arg"
5799 arg=$func_stripname_result
5800 ;;
5801
5802 -Wl,*)
5803 func_stripname '-Wl,' '' "$arg"
5804 args=$func_stripname_result
5805 arg=
5806 save_ifs="$IFS"; IFS=','
5807 for flag in $args; do
5808 IFS="$save_ifs"
5809 func_quote_for_eval "$flag"
5810 func_append arg " $wl$func_quote_for_eval_result"
5811 func_append compiler_flags " $wl$func_quote_for_eval_result"
5812 func_append linker_flags " $func_quote_for_eval_result"
5813 done
5814 IFS="$save_ifs"
5815 func_stripname ' ' '' "$arg"
5816 arg=$func_stripname_result
5817 ;;
5818
5819 -Xcompiler)
5820 prev=xcompiler
5821 continue
5822 ;;
5823
5824 -Xlinker)
5825 prev=xlinker
5826 continue
5827 ;;
5828
5829 -XCClinker)
5830 prev=xcclinker
5831 continue
5832 ;;
5833
5834 # -msg_* for osf cc
5835 -msg_*)
5836 func_quote_for_eval "$arg"
5837 arg="$func_quote_for_eval_result"
5838 ;;
5839
5840 # Flags to be passed through unchanged, with rationale:
5841 # -64, -mips[0-9] enable 64-bit mode for the SGI compiler
5842 # -r[0-9][0-9]* specify processor for the SGI compiler
5843 # -xarch=*, -xtarget=* enable 64-bit mode for the Sun compiler
5844 # +DA*, +DD* enable 64-bit mode for the HP compiler
5845 # -q* compiler args for the IBM compiler
5846 # -m*, -t[45]*, -txscale* architecture-specific flags for GCC
5847 # -F/path path to uninstalled frameworks, gcc on darwin
5848 # -p, -pg, --coverage, -fprofile-* profiling flags for GCC
5849 # @file GCC response files
5850 # -tp=* Portland pgcc target processor selection
5851 # --sysroot=* for sysroot support
5852 # -O*, -flto*, -fwhopr*, -fuse-linker-plugin GCC link-time optimization
5853 -64|-mips[0-9]|-r[0-9][0-9]*|-xarch=*|-xtarget=*|+DA*|+DD*|-q*|-m*| \
5854 -t[45]*|-txscale*|-p|-pg|--coverage|-fprofile-*|-F*|@*|-tp=*|--sysroot=*| \
5855 -O*|-flto*|-fwhopr*|-fuse-linker-plugin)
5856 func_quote_for_eval "$arg"
5857 arg="$func_quote_for_eval_result"
5858 func_append compile_command " $arg"
5859 func_append finalize_command " $arg"
5860 func_append compiler_flags " $arg"
5861 continue
5862 ;;
5863
5864 # Some other compiler flag.
5865 -* | +*)
5866 func_quote_for_eval "$arg"
5867 arg="$func_quote_for_eval_result"
5868 ;;
5869
5870 *.$objext)
5871 # A standard object.
5872 func_append objs " $arg"
5873 ;;
5874
5875 *.lo)
5876 # A libtool-controlled object.
5877
5878 # Check to see that this really is a libtool object.
5879 if func_lalib_unsafe_p "$arg"; then
5880 pic_object=
5881 non_pic_object=
5882
5883 # Read the .lo file
5884 func_source "$arg"
5885
5886 if test -z "$pic_object" ||
5887 test -z "$non_pic_object" ||
5888 test "$pic_object" = none &&
5889 test "$non_pic_object" = none; then
5890 func_fatal_error "cannot find name of object for \`$arg'"
5891 fi
5892
5893 # Extract subdirectory from the argument.
5894 func_dirname "$arg" "/" ""
5895 xdir="$func_dirname_result"
5896
5897 if test "$pic_object" != none; then
5898 # Prepend the subdirectory the object is found in.
5899 pic_object="$xdir$pic_object"
5900
5901 if test "$prev" = dlfiles; then
5902 if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then
5903 func_append dlfiles " $pic_object"
5904 prev=
5905 continue
5906 else
5907 # If libtool objects are unsupported, then we need to preload.
5908 prev=dlprefiles
5909 fi
5910 fi
5911
5912 # CHECK ME: I think I busted this. -Ossama
5913 if test "$prev" = dlprefiles; then
5914 # Preload the old-style object.
5915 func_append dlprefiles " $pic_object"
5916 prev=
5917 fi
5918
5919 # A PIC object.
5920 func_append libobjs " $pic_object"
5921 arg="$pic_object"
5922 fi
5923
5924 # Non-PIC object.
5925 if test "$non_pic_object" != none; then
5926 # Prepend the subdirectory the object is found in.
5927 non_pic_object="$xdir$non_pic_object"
5928
5929 # A standard non-PIC object
5930 func_append non_pic_objects " $non_pic_object"
5931 if test -z "$pic_object" || test "$pic_object" = none ; then
5932 arg="$non_pic_object"
5933 fi
5934 else
5935 # If the PIC object exists, use it instead.
5936 # $xdir was prepended to $pic_object above.
5937 non_pic_object="$pic_object"
5938 func_append non_pic_objects " $non_pic_object"
5939 fi
5940 else
5941 # Only an error if not doing a dry-run.
5942 if $opt_dry_run; then
5943 # Extract subdirectory from the argument.
5944 func_dirname "$arg" "/" ""
5945 xdir="$func_dirname_result"
5946
5947 func_lo2o "$arg"
5948 pic_object=$xdir$objdir/$func_lo2o_result
5949 non_pic_object=$xdir$func_lo2o_result
5950 func_append libobjs " $pic_object"
5951 func_append non_pic_objects " $non_pic_object"
5952 else
5953 func_fatal_error "\`$arg' is not a valid libtool object"
5954 fi
5955 fi
5956 ;;
5957
5958 *.$libext)
5959 # An archive.
5960 func_append deplibs " $arg"
5961 func_append old_deplibs " $arg"
5962 continue
5963 ;;
5964
5965 *.la)
5966 # A libtool-controlled library.
5967
5968 func_resolve_sysroot "$arg"
5969 if test "$prev" = dlfiles; then
5970 # This library was specified with -dlopen.
5971 func_append dlfiles " $func_resolve_sysroot_result"
5972 prev=
5973 elif test "$prev" = dlprefiles; then
5974 # The library was specified with -dlpreopen.
5975 func_append dlprefiles " $func_resolve_sysroot_result"
5976 prev=
5977 else
5978 func_append deplibs " $func_resolve_sysroot_result"
5979 fi
5980 continue
5981 ;;
5982
5983 # Some other compiler argument.
5984 *)
5985 # Unknown arguments in both finalize_command and compile_command need
5986 # to be aesthetically quoted because they are evaled later.
5987 func_quote_for_eval "$arg"
5988 arg="$func_quote_for_eval_result"
5989 ;;
5990 esac # arg
5991
5992 # Now actually substitute the argument into the commands.
5993 if test -n "$arg"; then
5994 func_append compile_command " $arg"
5995 func_append finalize_command " $arg"
5996 fi
5997 done # argument parsing loop
5998
5999 test -n "$prev" && \
6000 func_fatal_help "the \`$prevarg' option requires an argument"
6001
6002 if test "$export_dynamic" = yes && test -n "$export_dynamic_flag_spec"; then
6003 eval arg=\"$export_dynamic_flag_spec\"
6004 func_append compile_command " $arg"
6005 func_append finalize_command " $arg"
6006 fi
6007
6008 oldlibs=
6009 # calculate the name of the file, without its directory
6010 func_basename "$output"
6011 outputname="$func_basename_result"
6012 libobjs_save="$libobjs"
6013
6014 if test -n "$shlibpath_var"; then
6015 # get the directories listed in $shlibpath_var
6016 eval shlib_search_path=\`\$ECHO \"\${$shlibpath_var}\" \| \$SED \'s/:/ /g\'\`
6017 else
6018 shlib_search_path=
6019 fi
6020 eval sys_lib_search_path=\"$sys_lib_search_path_spec\"
6021 eval sys_lib_dlsearch_path=\"$sys_lib_dlsearch_path_spec\"
6022
6023 func_dirname "$output" "/" ""
6024 output_objdir="$func_dirname_result$objdir"
6025 func_to_tool_file "$output_objdir/"
6026 tool_output_objdir=$func_to_tool_file_result
6027 # Create the object directory.
6028 func_mkdir_p "$output_objdir"
6029
6030 # Determine the type of output
6031 case $output in
6032 "")
6033 func_fatal_help "you must specify an output file"
6034 ;;
6035 *.$libext) linkmode=oldlib ;;
6036 *.lo | *.$objext) linkmode=obj ;;
6037 *.la) linkmode=lib ;;
6038 *) linkmode=prog ;; # Anything else should be a program.
6039 esac
6040
6041 specialdeplibs=
6042
6043 libs=
6044 # Find all interdependent deplibs by searching for libraries
6045 # that are linked more than once (e.g. -la -lb -la)
6046 for deplib in $deplibs; do
6047 if $opt_preserve_dup_deps ; then
6048 case "$libs " in
6049 *" $deplib "*) func_append specialdeplibs " $deplib" ;;
6050 esac
6051 fi
6052 func_append libs " $deplib"
6053 done
6054
6055 if test "$linkmode" = lib; then
6056 libs="$predeps $libs $compiler_lib_search_path $postdeps"
6057
6058 # Compute libraries that are listed more than once in $predeps
6059 # $postdeps and mark them as special (i.e., whose duplicates are
6060 # not to be eliminated).
6061 pre_post_deps=
6062 if $opt_duplicate_compiler_generated_deps; then
6063 for pre_post_dep in $predeps $postdeps; do
6064 case "$pre_post_deps " in
6065 *" $pre_post_dep "*) func_append specialdeplibs " $pre_post_deps" ;;
6066 esac
6067 func_append pre_post_deps " $pre_post_dep"
6068 done
6069 fi
6070 pre_post_deps=
6071 fi
6072
6073 deplibs=
6074 newdependency_libs=
6075 newlib_search_path=
6076 need_relink=no # whether we're linking any uninstalled libtool libraries
6077 notinst_deplibs= # not-installed libtool libraries
6078 notinst_path= # paths that contain not-installed libtool libraries
6079
6080 case $linkmode in
6081 lib)
6082 passes="conv dlpreopen link"
6083 for file in $dlfiles $dlprefiles; do
6084 case $file in
6085 *.la) ;;
6086 *)
6087 func_fatal_help "libraries can \`-dlopen' only libtool libraries: $file"
6088 ;;
6089 esac
6090 done
6091 ;;
6092 prog)
6093 compile_deplibs=
6094 finalize_deplibs=
6095 alldeplibs=no
6096 newdlfiles=
6097 newdlprefiles=
6098 passes="conv scan dlopen dlpreopen link"
6099 ;;
6100 *) passes="conv"
6101 ;;
6102 esac
6103
6104 for pass in $passes; do
6105 # The preopen pass in lib mode reverses $deplibs; put it back here
6106 # so that -L comes before libs that need it for instance...
6107 if test "$linkmode,$pass" = "lib,link"; then
6108 ## FIXME: Find the place where the list is rebuilt in the wrong
6109 ## order, and fix it there properly
6110 tmp_deplibs=
6111 for deplib in $deplibs; do
6112 tmp_deplibs="$deplib $tmp_deplibs"
6113 done
6114 deplibs="$tmp_deplibs"
6115 fi
6116
6117 if test "$linkmode,$pass" = "lib,link" ||
6118 test "$linkmode,$pass" = "prog,scan"; then
6119 libs="$deplibs"
6120 deplibs=
6121 fi
6122 if test "$linkmode" = prog; then
6123 case $pass in
6124 dlopen) libs="$dlfiles" ;;
6125 dlpreopen) libs="$dlprefiles" ;;
6126 link) libs="$deplibs %DEPLIBS% $dependency_libs" ;;
6127 esac
6128 fi
6129 if test "$linkmode,$pass" = "lib,dlpreopen"; then
6130 # Collect and forward deplibs of preopened libtool libs
6131 for lib in $dlprefiles; do
6132 # Ignore non-libtool-libs
6133 dependency_libs=
6134 func_resolve_sysroot "$lib"
6135 case $lib in
6136 *.la) func_source "$func_resolve_sysroot_result" ;;
6137 esac
6138
6139 # Collect preopened libtool deplibs, except any this library
6140 # has declared as weak libs
6141 for deplib in $dependency_libs; do
6142 func_basename "$deplib"
6143 deplib_base=$func_basename_result
6144 case " $weak_libs " in
6145 *" $deplib_base "*) ;;
6146 *) func_append deplibs " $deplib" ;;
6147 esac
6148 done
6149 done
6150 libs="$dlprefiles"
6151 fi
6152 if test "$pass" = dlopen; then
6153 # Collect dlpreopened libraries
6154 save_deplibs="$deplibs"
6155 deplibs=
6156 fi
6157
6158 for deplib in $libs; do
6159 lib=
6160 found=no
6161 case $deplib in
6162 -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe \
6163 |-threads|-fopenmp|-openmp|-mp|-xopenmp|-omp|-qsmp=*)
6164 if test "$linkmode,$pass" = "prog,link"; then
6165 compile_deplibs="$deplib $compile_deplibs"
6166 finalize_deplibs="$deplib $finalize_deplibs"
6167 else
6168 func_append compiler_flags " $deplib"
6169 if test "$linkmode" = lib ; then
6170 case "$new_inherited_linker_flags " in
6171 *" $deplib "*) ;;
6172 * ) func_append new_inherited_linker_flags " $deplib" ;;
6173 esac
6174 fi
6175 fi
6176 continue
6177 ;;
6178 -l*)
6179 if test "$linkmode" != lib && test "$linkmode" != prog; then
6180 func_warning "\`-l' is ignored for archives/objects"
6181 continue
6182 fi
6183 func_stripname '-l' '' "$deplib"
6184 name=$func_stripname_result
6185 if test "$linkmode" = lib; then
6186 searchdirs="$newlib_search_path $lib_search_path $compiler_lib_search_dirs $sys_lib_search_path $shlib_search_path"
6187 else
6188 searchdirs="$newlib_search_path $lib_search_path $sys_lib_search_path $shlib_search_path"
6189 fi
6190 for searchdir in $searchdirs; do
6191 for search_ext in .la $std_shrext .so .a; do
6192 # Search the libtool library
6193 lib="$searchdir/lib${name}${search_ext}"
6194 if test -f "$lib"; then
6195 if test "$search_ext" = ".la"; then
6196 found=yes
6197 else
6198 found=no
6199 fi
6200 break 2
6201 fi
6202 done
6203 done
6204 if test "$found" != yes; then
6205 # deplib doesn't seem to be a libtool library
6206 if test "$linkmode,$pass" = "prog,link"; then
6207 compile_deplibs="$deplib $compile_deplibs"
6208 finalize_deplibs="$deplib $finalize_deplibs"
6209 else
6210 deplibs="$deplib $deplibs"
6211 test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs"
6212 fi
6213 continue
6214 else # deplib is a libtool library
6215 # If $allow_libtool_libs_with_static_runtimes && $deplib is a stdlib,
6216 # We need to do some special things here, and not later.
6217 if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
6218 case " $predeps $postdeps " in
6219 *" $deplib "*)
6220 if func_lalib_p "$lib"; then
6221 library_names=
6222 old_library=
6223 func_source "$lib"
6224 for l in $old_library $library_names; do
6225 ll="$l"
6226 done
6227 if test "X$ll" = "X$old_library" ; then # only static version available
6228 found=no
6229 func_dirname "$lib" "" "."
6230 ladir="$func_dirname_result"
6231 lib=$ladir/$old_library
6232 if test "$linkmode,$pass" = "prog,link"; then
6233 compile_deplibs="$deplib $compile_deplibs"
6234 finalize_deplibs="$deplib $finalize_deplibs"
6235 else
6236 deplibs="$deplib $deplibs"
6237 test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs"
6238 fi
6239 continue
6240 fi
6241 fi
6242 ;;
6243 *) ;;
6244 esac
6245 fi
6246 fi
6247 ;; # -l
6248 *.ltframework)
6249 if test "$linkmode,$pass" = "prog,link"; then
6250 compile_deplibs="$deplib $compile_deplibs"
6251 finalize_deplibs="$deplib $finalize_deplibs"
6252 else
6253 deplibs="$deplib $deplibs"
6254 if test "$linkmode" = lib ; then
6255 case "$new_inherited_linker_flags " in
6256 *" $deplib "*) ;;
6257 * ) func_append new_inherited_linker_flags " $deplib" ;;
6258 esac
6259 fi
6260 fi
6261 continue
6262 ;;
6263 -L*)
6264 case $linkmode in
6265 lib)
6266 deplibs="$deplib $deplibs"
6267 test "$pass" = conv && continue
6268 newdependency_libs="$deplib $newdependency_libs"
6269 func_stripname '-L' '' "$deplib"
6270 func_resolve_sysroot "$func_stripname_result"
6271 func_append newlib_search_path " $func_resolve_sysroot_result"
6272 ;;
6273 prog)
6274 if test "$pass" = conv; then
6275 deplibs="$deplib $deplibs"
6276 continue
6277 fi
6278 if test "$pass" = scan; then
6279 deplibs="$deplib $deplibs"
6280 else
6281 compile_deplibs="$deplib $compile_deplibs"
6282 finalize_deplibs="$deplib $finalize_deplibs"
6283 fi
6284 func_stripname '-L' '' "$deplib"
6285 func_resolve_sysroot "$func_stripname_result"
6286 func_append newlib_search_path " $func_resolve_sysroot_result"
6287 ;;
6288 *)
6289 func_warning "\`-L' is ignored for archives/objects"
6290 ;;
6291 esac # linkmode
6292 continue
6293 ;; # -L
6294 -R*)
6295 if test "$pass" = link; then
6296 func_stripname '-R' '' "$deplib"
6297 func_resolve_sysroot "$func_stripname_result"
6298 dir=$func_resolve_sysroot_result
6299 # Make sure the xrpath contains only unique directories.
6300 case "$xrpath " in
6301 *" $dir "*) ;;
6302 *) func_append xrpath " $dir" ;;
6303 esac
6304 fi
6305 deplibs="$deplib $deplibs"
6306 continue
6307 ;;
6308 *.la)
6309 func_resolve_sysroot "$deplib"
6310 lib=$func_resolve_sysroot_result
6311 ;;
6312 *.$libext)
6313 if test "$pass" = conv; then
6314 deplibs="$deplib $deplibs"
6315 continue
6316 fi
6317 case $linkmode in
6318 lib)
6319 # Linking convenience modules into shared libraries is allowed,
6320 # but linking other static libraries is non-portable.
6321 case " $dlpreconveniencelibs " in
6322 *" $deplib "*) ;;
6323 *)
6324 valid_a_lib=no
6325 case $deplibs_check_method in
6326 match_pattern*)
6327 set dummy $deplibs_check_method; shift
6328 match_pattern_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"`
6329 if eval "\$ECHO \"$deplib\"" 2>/dev/null | $SED 10q \
6330 | $EGREP "$match_pattern_regex" > /dev/null; then
6331 valid_a_lib=yes
6332 fi
6333 ;;
6334 pass_all)
6335 valid_a_lib=yes
6336 ;;
6337 esac
6338 if test "$valid_a_lib" != yes; then
6339 echo
6340 $ECHO "*** Warning: Trying to link with static lib archive $deplib."
6341 echo "*** I have the capability to make that library automatically link in when"
6342 echo "*** you link to this library. But I can only do this if you have a"
6343 echo "*** shared version of the library, which you do not appear to have"
6344 echo "*** because the file extensions .$libext of this argument makes me believe"
6345 echo "*** that it is just a static archive that I should not use here."
6346 else
6347 echo
6348 $ECHO "*** Warning: Linking the shared library $output against the"
6349 $ECHO "*** static library $deplib is not portable!"
6350 deplibs="$deplib $deplibs"
6351 fi
6352 ;;
6353 esac
6354 continue
6355 ;;
6356 prog)
6357 if test "$pass" != link; then
6358 deplibs="$deplib $deplibs"
6359 else
6360 compile_deplibs="$deplib $compile_deplibs"
6361 finalize_deplibs="$deplib $finalize_deplibs"
6362 fi
6363 continue
6364 ;;
6365 esac # linkmode
6366 ;; # *.$libext
6367 *.lo | *.$objext)
6368 if test "$pass" = conv; then
6369 deplibs="$deplib $deplibs"
6370 elif test "$linkmode" = prog; then
6371 if test "$pass" = dlpreopen || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then
6372 # If there is no dlopen support or we're linking statically,
6373 # we need to preload.
6374 func_append newdlprefiles " $deplib"
6375 compile_deplibs="$deplib $compile_deplibs"
6376 finalize_deplibs="$deplib $finalize_deplibs"
6377 else
6378 func_append newdlfiles " $deplib"
6379 fi
6380 fi
6381 continue
6382 ;;
6383 %DEPLIBS%)
6384 alldeplibs=yes
6385 continue
6386 ;;
6387 esac # case $deplib
6388
6389 if test "$found" = yes || test -f "$lib"; then :
6390 else
6391 func_fatal_error "cannot find the library \`$lib' or unhandled argument \`$deplib'"
6392 fi
6393
6394 # Check to see that this really is a libtool archive.
6395 func_lalib_unsafe_p "$lib" \
6396 || func_fatal_error "\`$lib' is not a valid libtool archive"
6397
6398 func_dirname "$lib" "" "."
6399 ladir="$func_dirname_result"
6400
6401 dlname=
6402 dlopen=
6403 dlpreopen=
6404 libdir=
6405 library_names=
6406 old_library=
6407 inherited_linker_flags=
6408 # If the library was installed with an old release of libtool,
6409 # it will not redefine variables installed, or shouldnotlink
6410 installed=yes
6411 shouldnotlink=no
6412 avoidtemprpath=
6413
6414
6415 # Read the .la file
6416 func_source "$lib"
6417
6418 # Convert "-framework foo" to "foo.ltframework"
6419 if test -n "$inherited_linker_flags"; then
6420 tmp_inherited_linker_flags=`$ECHO "$inherited_linker_flags" | $SED 's/-framework \([^ $]*\)/\1.ltframework/g'`
6421 for tmp_inherited_linker_flag in $tmp_inherited_linker_flags; do
6422 case " $new_inherited_linker_flags " in
6423 *" $tmp_inherited_linker_flag "*) ;;
6424 *) func_append new_inherited_linker_flags " $tmp_inherited_linker_flag";;
6425 esac
6426 done
6427 fi
6428 dependency_libs=`$ECHO " $dependency_libs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
6429 if test "$linkmode,$pass" = "lib,link" ||
6430 test "$linkmode,$pass" = "prog,scan" ||
6431 { test "$linkmode" != prog && test "$linkmode" != lib; }; then
6432 test -n "$dlopen" && func_append dlfiles " $dlopen"
6433 test -n "$dlpreopen" && func_append dlprefiles " $dlpreopen"
6434 fi
6435
6436 if test "$pass" = conv; then
6437 # Only check for convenience libraries
6438 deplibs="$lib $deplibs"
6439 if test -z "$libdir"; then
6440 if test -z "$old_library"; then
6441 func_fatal_error "cannot find name of link library for \`$lib'"
6442 fi
6443 # It is a libtool convenience library, so add in its objects.
6444 func_append convenience " $ladir/$objdir/$old_library"
6445 func_append old_convenience " $ladir/$objdir/$old_library"
6446 elif test "$linkmode" != prog && test "$linkmode" != lib; then
6447 func_fatal_error "\`$lib' is not a convenience library"
6448 fi
6449 tmp_libs=
6450 for deplib in $dependency_libs; do
6451 deplibs="$deplib $deplibs"
6452 if $opt_preserve_dup_deps ; then
6453 case "$tmp_libs " in
6454 *" $deplib "*) func_append specialdeplibs " $deplib" ;;
6455 esac
6456 fi
6457 func_append tmp_libs " $deplib"
6458 done
6459 continue
6460 fi # $pass = conv
6461
6462
6463 # Get the name of the library we link against.
6464 linklib=
6465 if test -n "$old_library" &&
6466 { test "$prefer_static_libs" = yes ||
6467 test "$prefer_static_libs,$installed" = "built,no"; }; then
6468 linklib=$old_library
6469 else
6470 for l in $old_library $library_names; do
6471 linklib="$l"
6472 done
6473 fi
6474 if test -z "$linklib"; then
6475 func_fatal_error "cannot find name of link library for \`$lib'"
6476 fi
6477
6478 # This library was specified with -dlopen.
6479 if test "$pass" = dlopen; then
6480 if test -z "$libdir"; then
6481 func_fatal_error "cannot -dlopen a convenience library: \`$lib'"
6482 fi
6483 if test -z "$dlname" ||
6484 test "$dlopen_support" != yes ||
6485 test "$build_libtool_libs" = no; then
6486 # If there is no dlname, no dlopen support or we're linking
6487 # statically, we need to preload. We also need to preload any
6488 # dependent libraries so libltdl's deplib preloader doesn't
6489 # bomb out in the load deplibs phase.
6490 func_append dlprefiles " $lib $dependency_libs"
6491 else
6492 func_append newdlfiles " $lib"
6493 fi
6494 continue
6495 fi # $pass = dlopen
6496
6497 # We need an absolute path.
6498 case $ladir in
6499 [\\/]* | [A-Za-z]:[\\/]*) abs_ladir="$ladir" ;;
6500 *)
6501 abs_ladir=`cd "$ladir" && pwd`
6502 if test -z "$abs_ladir"; then
6503 func_warning "cannot determine absolute directory name of \`$ladir'"
6504 func_warning "passing it literally to the linker, although it might fail"
6505 abs_ladir="$ladir"
6506 fi
6507 ;;
6508 esac
6509 func_basename "$lib"
6510 laname="$func_basename_result"
6511
6512 # Find the relevant object directory and library name.
6513 if test "X$installed" = Xyes; then
6514 if test ! -f "$lt_sysroot$libdir/$linklib" && test -f "$abs_ladir/$linklib"; then
6515 func_warning "library \`$lib' was moved."
6516 dir="$ladir"
6517 absdir="$abs_ladir"
6518 libdir="$abs_ladir"
6519 else
6520 dir="$lt_sysroot$libdir"
6521 absdir="$lt_sysroot$libdir"
6522 fi
6523 test "X$hardcode_automatic" = Xyes && avoidtemprpath=yes
6524 else
6525 if test ! -f "$ladir/$objdir/$linklib" && test -f "$abs_ladir/$linklib"; then
6526 dir="$ladir"
6527 absdir="$abs_ladir"
6528 # Remove this search path later
6529 func_append notinst_path " $abs_ladir"
6530 else
6531 dir="$ladir/$objdir"
6532 absdir="$abs_ladir/$objdir"
6533 # Remove this search path later
6534 func_append notinst_path " $abs_ladir"
6535 fi
6536 fi # $installed = yes
6537 func_stripname 'lib' '.la' "$laname"
6538 name=$func_stripname_result
6539
6540 # This library was specified with -dlpreopen.
6541 if test "$pass" = dlpreopen; then
6542 if test -z "$libdir" && test "$linkmode" = prog; then
6543 func_fatal_error "only libraries may -dlpreopen a convenience library: \`$lib'"
6544 fi
6545 case "$host" in
6546 # special handling for platforms with PE-DLLs.
6547 *cygwin* | *mingw* | *cegcc* )
6548 # Linker will automatically link against shared library if both
6549 # static and shared are present. Therefore, ensure we extract
6550 # symbols from the import library if a shared library is present
6551 # (otherwise, the dlopen module name will be incorrect). We do
6552 # this by putting the import library name into $newdlprefiles.
6553 # We recover the dlopen module name by 'saving' the la file
6554 # name in a special purpose variable, and (later) extracting the
6555 # dlname from the la file.
6556 if test -n "$dlname"; then
6557 func_tr_sh "$dir/$linklib"
6558 eval "libfile_$func_tr_sh_result=\$abs_ladir/\$laname"
6559 func_append newdlprefiles " $dir/$linklib"
6560 else
6561 func_append newdlprefiles " $dir/$old_library"
6562 # Keep a list of preopened convenience libraries to check
6563 # that they are being used correctly in the link pass.
6564 test -z "$libdir" && \
6565 func_append dlpreconveniencelibs " $dir/$old_library"
6566 fi
6567 ;;
6568 * )
6569 # Prefer using a static library (so that no silly _DYNAMIC symbols
6570 # are required to link).
6571 if test -n "$old_library"; then
6572 func_append newdlprefiles " $dir/$old_library"
6573 # Keep a list of preopened convenience libraries to check
6574 # that they are being used correctly in the link pass.
6575 test -z "$libdir" && \
6576 func_append dlpreconveniencelibs " $dir/$old_library"
6577 # Otherwise, use the dlname, so that lt_dlopen finds it.
6578 elif test -n "$dlname"; then
6579 func_append newdlprefiles " $dir/$dlname"
6580 else
6581 func_append newdlprefiles " $dir/$linklib"
6582 fi
6583 ;;
6584 esac
6585 fi # $pass = dlpreopen
6586
6587 if test -z "$libdir"; then
6588 # Link the convenience library
6589 if test "$linkmode" = lib; then
6590 deplibs="$dir/$old_library $deplibs"
6591 elif test "$linkmode,$pass" = "prog,link"; then
6592 compile_deplibs="$dir/$old_library $compile_deplibs"
6593 finalize_deplibs="$dir/$old_library $finalize_deplibs"
6594 else
6595 deplibs="$lib $deplibs" # used for prog,scan pass
6596 fi
6597 continue
6598 fi
6599
6600
6601 if test "$linkmode" = prog && test "$pass" != link; then
6602 func_append newlib_search_path " $ladir"
6603 deplibs="$lib $deplibs"
6604
6605 linkalldeplibs=no
6606 if test "$link_all_deplibs" != no || test -z "$library_names" ||
6607 test "$build_libtool_libs" = no; then
6608 linkalldeplibs=yes
6609 fi
6610
6611 tmp_libs=
6612 for deplib in $dependency_libs; do
6613 case $deplib in
6614 -L*) func_stripname '-L' '' "$deplib"
6615 func_resolve_sysroot "$func_stripname_result"
6616 func_append newlib_search_path " $func_resolve_sysroot_result"
6617 ;;
6618 esac
6619 # Need to link against all dependency_libs?
6620 if test "$linkalldeplibs" = yes; then
6621 deplibs="$deplib $deplibs"
6622 else
6623 # Need to hardcode shared library paths
6624 # or/and link against static libraries
6625 newdependency_libs="$deplib $newdependency_libs"
6626 fi
6627 if $opt_preserve_dup_deps ; then
6628 case "$tmp_libs " in
6629 *" $deplib "*) func_append specialdeplibs " $deplib" ;;
6630 esac
6631 fi
6632 func_append tmp_libs " $deplib"
6633 done # for deplib
6634 continue
6635 fi # $linkmode = prog...
6636
6637 if test "$linkmode,$pass" = "prog,link"; then
6638 if test -n "$library_names" &&
6639 { { test "$prefer_static_libs" = no ||
6640 test "$prefer_static_libs,$installed" = "built,yes"; } ||
6641 test -z "$old_library"; }; then
6642 # We need to hardcode the library path
6643 if test -n "$shlibpath_var" && test -z "$avoidtemprpath" ; then
6644 # Make sure the rpath contains only unique directories.
6645 case "$temp_rpath:" in
6646 *"$absdir:"*) ;;
6647 *) func_append temp_rpath "$absdir:" ;;
6648 esac
6649 fi
6650
6651 # Hardcode the library path.
6652 # Skip directories that are in the system default run-time
6653 # search path.
6654 case " $sys_lib_dlsearch_path " in
6655 *" $absdir "*) ;;
6656 *)
6657 case "$compile_rpath " in
6658 *" $absdir "*) ;;
6659 *) func_append compile_rpath " $absdir" ;;
6660 esac
6661 ;;
6662 esac
6663 case " $sys_lib_dlsearch_path " in
6664 *" $libdir "*) ;;
6665 *)
6666 case "$finalize_rpath " in
6667 *" $libdir "*) ;;
6668 *) func_append finalize_rpath " $libdir" ;;
6669 esac
6670 ;;
6671 esac
6672 fi # $linkmode,$pass = prog,link...
6673
6674 if test "$alldeplibs" = yes &&
6675 { test "$deplibs_check_method" = pass_all ||
6676 { test "$build_libtool_libs" = yes &&
6677 test -n "$library_names"; }; }; then
6678 # We only need to search for static libraries
6679 continue
6680 fi
6681 fi
6682
6683 link_static=no # Whether the deplib will be linked statically
6684 use_static_libs=$prefer_static_libs
6685 if test "$use_static_libs" = built && test "$installed" = yes; then
6686 use_static_libs=no
6687 fi
6688 if test -n "$library_names" &&
6689 { test "$use_static_libs" = no || test -z "$old_library"; }; then
6690 case $host in
6691 *cygwin* | *mingw* | *cegcc*)
6692 # No point in relinking DLLs because paths are not encoded
6693 func_append notinst_deplibs " $lib"
6694 need_relink=no
6695 ;;
6696 *)
6697 if test "$installed" = no; then
6698 func_append notinst_deplibs " $lib"
6699 need_relink=yes
6700 fi
6701 ;;
6702 esac
6703 # This is a shared library
6704
6705 # Warn about portability, can't link against -module's on some
6706 # systems (darwin). Don't bleat about dlopened modules though!
6707 dlopenmodule=""
6708 for dlpremoduletest in $dlprefiles; do
6709 if test "X$dlpremoduletest" = "X$lib"; then
6710 dlopenmodule="$dlpremoduletest"
6711 break
6712 fi
6713 done
6714 if test -z "$dlopenmodule" && test "$shouldnotlink" = yes && test "$pass" = link; then
6715 echo
6716 if test "$linkmode" = prog; then
6717 $ECHO "*** Warning: Linking the executable $output against the loadable module"
6718 else
6719 $ECHO "*** Warning: Linking the shared library $output against the loadable module"
6720 fi
6721 $ECHO "*** $linklib is not portable!"
6722 fi
6723 if test "$linkmode" = lib &&
6724 test "$hardcode_into_libs" = yes; then
6725 # Hardcode the library path.
6726 # Skip directories that are in the system default run-time
6727 # search path.
6728 case " $sys_lib_dlsearch_path " in
6729 *" $absdir "*) ;;
6730 *)
6731 case "$compile_rpath " in
6732 *" $absdir "*) ;;
6733 *) func_append compile_rpath " $absdir" ;;
6734 esac
6735 ;;
6736 esac
6737 case " $sys_lib_dlsearch_path " in
6738 *" $libdir "*) ;;
6739 *)
6740 case "$finalize_rpath " in
6741 *" $libdir "*) ;;
6742 *) func_append finalize_rpath " $libdir" ;;
6743 esac
6744 ;;
6745 esac
6746 fi
6747
6748 if test -n "$old_archive_from_expsyms_cmds"; then
6749 # figure out the soname
6750 set dummy $library_names
6751 shift
6752 realname="$1"
6753 shift
6754 libname=`eval "\\$ECHO \"$libname_spec\""`
6755 # use dlname if we got it. it's perfectly good, no?
6756 if test -n "$dlname"; then
6757 soname="$dlname"
6758 elif test -n "$soname_spec"; then
6759 # bleh windows
6760 case $host in
6761 *cygwin* | mingw* | *cegcc*)
6762 func_arith $current - $age
6763 major=$func_arith_result
6764 versuffix="-$major"
6765 ;;
6766 esac
6767 eval soname=\"$soname_spec\"
6768 else
6769 soname="$realname"
6770 fi
6771
6772 # Make a new name for the extract_expsyms_cmds to use
6773 soroot="$soname"
6774 func_basename "$soroot"
6775 soname="$func_basename_result"
6776 func_stripname 'lib' '.dll' "$soname"
6777 newlib=libimp-$func_stripname_result.a
6778
6779 # If the library has no export list, then create one now
6780 if test -f "$output_objdir/$soname-def"; then :
6781 else
6782 func_verbose "extracting exported symbol list from \`$soname'"
6783 func_execute_cmds "$extract_expsyms_cmds" 'exit $?'
6784 fi
6785
6786 # Create $newlib
6787 if test -f "$output_objdir/$newlib"; then :; else
6788 func_verbose "generating import library for \`$soname'"
6789 func_execute_cmds "$old_archive_from_expsyms_cmds" 'exit $?'
6790 fi
6791 # make sure the library variables are pointing to the new library
6792 dir=$output_objdir
6793 linklib=$newlib
6794 fi # test -n "$old_archive_from_expsyms_cmds"
6795
6796 if test "$linkmode" = prog || test "$opt_mode" != relink; then
6797 add_shlibpath=
6798 add_dir=
6799 add=
6800 lib_linked=yes
6801 case $hardcode_action in
6802 immediate | unsupported)
6803 if test "$hardcode_direct" = no; then
6804 add="$dir/$linklib"
6805 case $host in
6806 *-*-sco3.2v5.0.[024]*) add_dir="-L$dir" ;;
6807 *-*-sysv4*uw2*) add_dir="-L$dir" ;;
6808 *-*-sysv5OpenUNIX* | *-*-sysv5UnixWare7.[01].[10]* | \
6809 *-*-unixware7*) add_dir="-L$dir" ;;
6810 *-*-darwin* )
6811 # if the lib is a (non-dlopened) module then we can not
6812 # link against it, someone is ignoring the earlier warnings
6813 if /usr/bin/file -L $add 2> /dev/null |
6814 $GREP ": [^:]* bundle" >/dev/null ; then
6815 if test "X$dlopenmodule" != "X$lib"; then
6816 $ECHO "*** Warning: lib $linklib is a module, not a shared library"
6817 if test -z "$old_library" ; then
6818 echo
6819 echo "*** And there doesn't seem to be a static archive available"
6820 echo "*** The link will probably fail, sorry"
6821 else
6822 add="$dir/$old_library"
6823 fi
6824 elif test -n "$old_library"; then
6825 add="$dir/$old_library"
6826 fi
6827 fi
6828 esac
6829 elif test "$hardcode_minus_L" = no; then
6830 case $host in
6831 *-*-sunos*) add_shlibpath="$dir" ;;
6832 esac
6833 add_dir="-L$dir"
6834 add="-l$name"
6835 elif test "$hardcode_shlibpath_var" = no; then
6836 add_shlibpath="$dir"
6837 add="-l$name"
6838 else
6839 lib_linked=no
6840 fi
6841 ;;
6842 relink)
6843 if test "$hardcode_direct" = yes &&
6844 test "$hardcode_direct_absolute" = no; then
6845 add="$dir/$linklib"
6846 elif test "$hardcode_minus_L" = yes; then
6847 add_dir="-L$absdir"
6848 # Try looking first in the location we're being installed to.
6849 if test -n "$inst_prefix_dir"; then
6850 case $libdir in
6851 [\\/]*)
6852 func_append add_dir " -L$inst_prefix_dir$libdir"
6853 ;;
6854 esac
6855 fi
6856 add="-l$name"
6857 elif test "$hardcode_shlibpath_var" = yes; then
6858 add_shlibpath="$dir"
6859 add="-l$name"
6860 else
6861 lib_linked=no
6862 fi
6863 ;;
6864 *) lib_linked=no ;;
6865 esac
6866
6867 if test "$lib_linked" != yes; then
6868 func_fatal_configuration "unsupported hardcode properties"
6869 fi
6870
6871 if test -n "$add_shlibpath"; then
6872 case :$compile_shlibpath: in
6873 *":$add_shlibpath:"*) ;;
6874 *) func_append compile_shlibpath "$add_shlibpath:" ;;
6875 esac
6876 fi
6877 if test "$linkmode" = prog; then
6878 test -n "$add_dir" && compile_deplibs="$add_dir $compile_deplibs"
6879 test -n "$add" && compile_deplibs="$add $compile_deplibs"
6880 else
6881 test -n "$add_dir" && deplibs="$add_dir $deplibs"
6882 test -n "$add" && deplibs="$add $deplibs"
6883 if test "$hardcode_direct" != yes &&
6884 test "$hardcode_minus_L" != yes &&
6885 test "$hardcode_shlibpath_var" = yes; then
6886 case :$finalize_shlibpath: in
6887 *":$libdir:"*) ;;
6888 *) func_append finalize_shlibpath "$libdir:" ;;
6889 esac
6890 fi
6891 fi
6892 fi
6893
6894 if test "$linkmode" = prog || test "$opt_mode" = relink; then
6895 add_shlibpath=
6896 add_dir=
6897 add=
6898 # Finalize command for both is simple: just hardcode it.
6899 if test "$hardcode_direct" = yes &&
6900 test "$hardcode_direct_absolute" = no; then
6901 add="$libdir/$linklib"
6902 elif test "$hardcode_minus_L" = yes; then
6903 add_dir="-L$libdir"
6904 add="-l$name"
6905 elif test "$hardcode_shlibpath_var" = yes; then
6906 case :$finalize_shlibpath: in
6907 *":$libdir:"*) ;;
6908 *) func_append finalize_shlibpath "$libdir:" ;;
6909 esac
6910 add="-l$name"
6911 elif test "$hardcode_automatic" = yes; then
6912 if test -n "$inst_prefix_dir" &&
6913 test -f "$inst_prefix_dir$libdir/$linklib" ; then
6914 add="$inst_prefix_dir$libdir/$linklib"
6915 else
6916 add="$libdir/$linklib"
6917 fi
6918 else
6919 # We cannot seem to hardcode it, guess we'll fake it.
6920 add_dir="-L$libdir"
6921 # Try looking first in the location we're being installed to.
6922 if test -n "$inst_prefix_dir"; then
6923 case $libdir in
6924 [\\/]*)
6925 func_append add_dir " -L$inst_prefix_dir$libdir"
6926 ;;
6927 esac
6928 fi
6929 add="-l$name"
6930 fi
6931
6932 if test "$linkmode" = prog; then
6933 test -n "$add_dir" && finalize_deplibs="$add_dir $finalize_deplibs"
6934 test -n "$add" && finalize_deplibs="$add $finalize_deplibs"
6935 else
6936 test -n "$add_dir" && deplibs="$add_dir $deplibs"
6937 test -n "$add" && deplibs="$add $deplibs"
6938 fi
6939 fi
6940 elif test "$linkmode" = prog; then
6941 # Here we assume that one of hardcode_direct or hardcode_minus_L
6942 # is not unsupported. This is valid on all known static and
6943 # shared platforms.
6944 if test "$hardcode_direct" != unsupported; then
6945 test -n "$old_library" && linklib="$old_library"
6946 compile_deplibs="$dir/$linklib $compile_deplibs"
6947 finalize_deplibs="$dir/$linklib $finalize_deplibs"
6948 else
6949 compile_deplibs="-l$name -L$dir $compile_deplibs"
6950 finalize_deplibs="-l$name -L$dir $finalize_deplibs"
6951 fi
6952 elif test "$build_libtool_libs" = yes; then
6953 # Not a shared library
6954 if test "$deplibs_check_method" != pass_all; then
6955 # We're trying link a shared library against a static one
6956 # but the system doesn't support it.
6957
6958 # Just print a warning and add the library to dependency_libs so
6959 # that the program can be linked against the static library.
6960 echo
6961 $ECHO "*** Warning: This system can not link to static lib archive $lib."
6962 echo "*** I have the capability to make that library automatically link in when"
6963 echo "*** you link to this library. But I can only do this if you have a"
6964 echo "*** shared version of the library, which you do not appear to have."
6965 if test "$module" = yes; then
6966 echo "*** But as you try to build a module library, libtool will still create "
6967 echo "*** a static module, that should work as long as the dlopening application"
6968 echo "*** is linked with the -dlopen flag to resolve symbols at runtime."
6969 if test -z "$global_symbol_pipe"; then
6970 echo
6971 echo "*** However, this would only work if libtool was able to extract symbol"
6972 echo "*** lists from a program, using \`nm' or equivalent, but libtool could"
6973 echo "*** not find such a program. So, this module is probably useless."
6974 echo "*** \`nm' from GNU binutils and a full rebuild may help."
6975 fi
6976 if test "$build_old_libs" = no; then
6977 build_libtool_libs=module
6978 build_old_libs=yes
6979 else
6980 build_libtool_libs=no
6981 fi
6982 fi
6983 else
6984 deplibs="$dir/$old_library $deplibs"
6985 link_static=yes
6986 fi
6987 fi # link shared/static library?
6988
6989 if test "$linkmode" = lib; then
6990 if test -n "$dependency_libs" &&
6991 { test "$hardcode_into_libs" != yes ||
6992 test "$build_old_libs" = yes ||
6993 test "$link_static" = yes; }; then
6994 # Extract -R from dependency_libs
6995 temp_deplibs=
6996 for libdir in $dependency_libs; do
6997 case $libdir in
6998 -R*) func_stripname '-R' '' "$libdir"
6999 temp_xrpath=$func_stripname_result
7000 case " $xrpath " in
7001 *" $temp_xrpath "*) ;;
7002 *) func_append xrpath " $temp_xrpath";;
7003 esac;;
7004 *) func_append temp_deplibs " $libdir";;
7005 esac
7006 done
7007 dependency_libs="$temp_deplibs"
7008 fi
7009
7010 func_append newlib_search_path " $absdir"
7011 # Link against this library
7012 test "$link_static" = no && newdependency_libs="$abs_ladir/$laname $newdependency_libs"
7013 # ... and its dependency_libs
7014 tmp_libs=
7015 for deplib in $dependency_libs; do
7016 newdependency_libs="$deplib $newdependency_libs"
7017 case $deplib in
7018 -L*) func_stripname '-L' '' "$deplib"
7019 func_resolve_sysroot "$func_stripname_result";;
7020 *) func_resolve_sysroot "$deplib" ;;
7021 esac
7022 if $opt_preserve_dup_deps ; then
7023 case "$tmp_libs " in
7024 *" $func_resolve_sysroot_result "*)
7025 func_append specialdeplibs " $func_resolve_sysroot_result" ;;
7026 esac
7027 fi
7028 func_append tmp_libs " $func_resolve_sysroot_result"
7029 done
7030
7031 if test "$link_all_deplibs" != no; then
7032 # Add the search paths of all dependency libraries
7033 for deplib in $dependency_libs; do
7034 path=
7035 case $deplib in
7036 -L*) path="$deplib" ;;
7037 *.la)
7038 func_resolve_sysroot "$deplib"
7039 deplib=$func_resolve_sysroot_result
7040 func_dirname "$deplib" "" "."
7041 dir=$func_dirname_result
7042 # We need an absolute path.
7043 case $dir in
7044 [\\/]* | [A-Za-z]:[\\/]*) absdir="$dir" ;;
7045 *)
7046 absdir=`cd "$dir" && pwd`
7047 if test -z "$absdir"; then
7048 func_warning "cannot determine absolute directory name of \`$dir'"
7049 absdir="$dir"
7050 fi
7051 ;;
7052 esac
7053 if $GREP "^installed=no" $deplib > /dev/null; then
7054 case $host in
7055 *-*-darwin*)
7056 depdepl=
7057 eval deplibrary_names=`${SED} -n -e 's/^library_names=\(.*\)$/\1/p' $deplib`
7058 if test -n "$deplibrary_names" ; then
7059 for tmp in $deplibrary_names ; do
7060 depdepl=$tmp
7061 done
7062 if test -f "$absdir/$objdir/$depdepl" ; then
7063 depdepl="$absdir/$objdir/$depdepl"
7064 darwin_install_name=`${OTOOL} -L $depdepl | awk '{if (NR == 2) {print $1;exit}}'`
7065 if test -z "$darwin_install_name"; then
7066 darwin_install_name=`${OTOOL64} -L $depdepl | awk '{if (NR == 2) {print $1;exit}}'`
7067 fi
7068 func_append compiler_flags " ${wl}-dylib_file ${wl}${darwin_install_name}:${depdepl}"
7069 func_append linker_flags " -dylib_file ${darwin_install_name}:${depdepl}"
7070 path=
7071 fi
7072 fi
7073 ;;
7074 *)
7075 path="-L$absdir/$objdir"
7076 ;;
7077 esac
7078 else
7079 eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
7080 test -z "$libdir" && \
7081 func_fatal_error "\`$deplib' is not a valid libtool archive"
7082 test "$absdir" != "$libdir" && \
7083 func_warning "\`$deplib' seems to be moved"
7084
7085 path="-L$absdir"
7086 fi
7087 ;;
7088 esac
7089 case " $deplibs " in
7090 *" $path "*) ;;
7091 *) deplibs="$path $deplibs" ;;
7092 esac
7093 done
7094 fi # link_all_deplibs != no
7095 fi # linkmode = lib
7096 done # for deplib in $libs
7097 if test "$pass" = link; then
7098 if test "$linkmode" = "prog"; then
7099 compile_deplibs="$new_inherited_linker_flags $compile_deplibs"
7100 finalize_deplibs="$new_inherited_linker_flags $finalize_deplibs"
7101 else
7102 compiler_flags="$compiler_flags "`$ECHO " $new_inherited_linker_flags" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
7103 fi
7104 fi
7105 dependency_libs="$newdependency_libs"
7106 if test "$pass" = dlpreopen; then
7107 # Link the dlpreopened libraries before other libraries
7108 for deplib in $save_deplibs; do
7109 deplibs="$deplib $deplibs"
7110 done
7111 fi
7112 if test "$pass" != dlopen; then
7113 if test "$pass" != conv; then
7114 # Make sure lib_search_path contains only unique directories.
7115 lib_search_path=
7116 for dir in $newlib_search_path; do
7117 case "$lib_search_path " in
7118 *" $dir "*) ;;
7119 *) func_append lib_search_path " $dir" ;;
7120 esac
7121 done
7122 newlib_search_path=
7123 fi
7124
7125 if test "$linkmode,$pass" != "prog,link"; then
7126 vars="deplibs"
7127 else
7128 vars="compile_deplibs finalize_deplibs"
7129 fi
7130 for var in $vars dependency_libs; do
7131 # Add libraries to $var in reverse order
7132 eval tmp_libs=\"\$$var\"
7133 new_libs=
7134 for deplib in $tmp_libs; do
7135 # FIXME: Pedantically, this is the right thing to do, so
7136 # that some nasty dependency loop isn't accidentally
7137 # broken:
7138 #new_libs="$deplib $new_libs"
7139 # Pragmatically, this seems to cause very few problems in
7140 # practice:
7141 case $deplib in
7142 -L*) new_libs="$deplib $new_libs" ;;
7143 -R*) ;;
7144 *)
7145 # And here is the reason: when a library appears more
7146 # than once as an explicit dependence of a library, or
7147 # is implicitly linked in more than once by the
7148 # compiler, it is considered special, and multiple
7149 # occurrences thereof are not removed. Compare this
7150 # with having the same library being listed as a
7151 # dependency of multiple other libraries: in this case,
7152 # we know (pedantically, we assume) the library does not
7153 # need to be listed more than once, so we keep only the
7154 # last copy. This is not always right, but it is rare
7155 # enough that we require users that really mean to play
7156 # such unportable linking tricks to link the library
7157 # using -Wl,-lname, so that libtool does not consider it
7158 # for duplicate removal.
7159 case " $specialdeplibs " in
7160 *" $deplib "*) new_libs="$deplib $new_libs" ;;
7161 *)
7162 case " $new_libs " in
7163 *" $deplib "*) ;;
7164 *) new_libs="$deplib $new_libs" ;;
7165 esac
7166 ;;
7167 esac
7168 ;;
7169 esac
7170 done
7171 tmp_libs=
7172 for deplib in $new_libs; do
7173 case $deplib in
7174 -L*)
7175 case " $tmp_libs " in
7176 *" $deplib "*) ;;
7177 *) func_append tmp_libs " $deplib" ;;
7178 esac
7179 ;;
7180 *) func_append tmp_libs " $deplib" ;;
7181 esac
7182 done
7183 eval $var=\"$tmp_libs\"
7184 done # for var
7185 fi
7186 # Last step: remove runtime libs from dependency_libs
7187 # (they stay in deplibs)
7188 tmp_libs=
7189 for i in $dependency_libs ; do
7190 case " $predeps $postdeps $compiler_lib_search_path " in
7191 *" $i "*)
7192 i=""
7193 ;;
7194 esac
7195 if test -n "$i" ; then
7196 func_append tmp_libs " $i"
7197 fi
7198 done
7199 dependency_libs=$tmp_libs
7200 done # for pass
7201 if test "$linkmode" = prog; then
7202 dlfiles="$newdlfiles"
7203 fi
7204 if test "$linkmode" = prog || test "$linkmode" = lib; then
7205 dlprefiles="$newdlprefiles"
7206 fi
7207
7208 case $linkmode in
7209 oldlib)
7210 if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
7211 func_warning "\`-dlopen' is ignored for archives"
7212 fi
7213
7214 case " $deplibs" in
7215 *\ -l* | *\ -L*)
7216 func_warning "\`-l' and \`-L' are ignored for archives" ;;
7217 esac
7218
7219 test -n "$rpath" && \
7220 func_warning "\`-rpath' is ignored for archives"
7221
7222 test -n "$xrpath" && \
7223 func_warning "\`-R' is ignored for archives"
7224
7225 test -n "$vinfo" && \
7226 func_warning "\`-version-info/-version-number' is ignored for archives"
7227
7228 test -n "$release" && \
7229 func_warning "\`-release' is ignored for archives"
7230
7231 test -n "$export_symbols$export_symbols_regex" && \
7232 func_warning "\`-export-symbols' is ignored for archives"
7233
7234 # Now set the variables for building old libraries.
7235 build_libtool_libs=no
7236 oldlibs="$output"
7237 func_append objs "$old_deplibs"
7238 ;;
7239
7240 lib)
7241 # Make sure we only generate libraries of the form `libNAME.la'.
7242 case $outputname in
7243 lib*)
7244 func_stripname 'lib' '.la' "$outputname"
7245 name=$func_stripname_result
7246 eval shared_ext=\"$shrext_cmds\"
7247 eval libname=\"$libname_spec\"
7248 ;;
7249 *)
7250 test "$module" = no && \
7251 func_fatal_help "libtool library \`$output' must begin with \`lib'"
7252
7253 if test "$need_lib_prefix" != no; then
7254 # Add the "lib" prefix for modules if required
7255 func_stripname '' '.la' "$outputname"
7256 name=$func_stripname_result
7257 eval shared_ext=\"$shrext_cmds\"
7258 eval libname=\"$libname_spec\"
7259 else
7260 func_stripname '' '.la' "$outputname"
7261 libname=$func_stripname_result
7262 fi
7263 ;;
7264 esac
7265
7266 if test -n "$objs"; then
7267 if test "$deplibs_check_method" != pass_all; then
7268 func_fatal_error "cannot build libtool library \`$output' from non-libtool objects on this host:$objs"
7269 else
7270 echo
7271 $ECHO "*** Warning: Linking the shared library $output against the non-libtool"
7272 $ECHO "*** objects $objs is not portable!"
7273 func_append libobjs " $objs"
7274 fi
7275 fi
7276
7277 test "$dlself" != no && \
7278 func_warning "\`-dlopen self' is ignored for libtool libraries"
7279
7280 set dummy $rpath
7281 shift
7282 test "$#" -gt 1 && \
7283 func_warning "ignoring multiple \`-rpath's for a libtool library"
7284
7285 install_libdir="$1"
7286
7287 oldlibs=
7288 if test -z "$rpath"; then
7289 if test "$build_libtool_libs" = yes; then
7290 # Building a libtool convenience library.
7291 # Some compilers have problems with a `.al' extension so
7292 # convenience libraries should have the same extension an
7293 # archive normally would.
7294 oldlibs="$output_objdir/$libname.$libext $oldlibs"
7295 build_libtool_libs=convenience
7296 build_old_libs=yes
7297 fi
7298
7299 test -n "$vinfo" && \
7300 func_warning "\`-version-info/-version-number' is ignored for convenience libraries"
7301
7302 test -n "$release" && \
7303 func_warning "\`-release' is ignored for convenience libraries"
7304 else
7305
7306 # Parse the version information argument.
7307 save_ifs="$IFS"; IFS=':'
7308 set dummy $vinfo 0 0 0
7309 shift
7310 IFS="$save_ifs"
7311
7312 test -n "$7" && \
7313 func_fatal_help "too many parameters to \`-version-info'"
7314
7315 # convert absolute version numbers to libtool ages
7316 # this retains compatibility with .la files and attempts
7317 # to make the code below a bit more comprehensible
7318
7319 case $vinfo_number in
7320 yes)
7321 number_major="$1"
7322 number_minor="$2"
7323 number_revision="$3"
7324 #
7325 # There are really only two kinds -- those that
7326 # use the current revision as the major version
7327 # and those that subtract age and use age as
7328 # a minor version. But, then there is irix
7329 # which has an extra 1 added just for fun
7330 #
7331 case $version_type in
7332 # correct linux to gnu/linux during the next big refactor
7333 darwin|linux|osf|windows|none)
7334 func_arith $number_major + $number_minor
7335 current=$func_arith_result
7336 age="$number_minor"
7337 revision="$number_revision"
7338 ;;
7339 freebsd-aout|freebsd-elf|qnx|sunos)
7340 current="$number_major"
7341 revision="$number_minor"
7342 age="0"
7343 ;;
7344 irix|nonstopux)
7345 func_arith $number_major + $number_minor
7346 current=$func_arith_result
7347 age="$number_minor"
7348 revision="$number_minor"
7349 lt_irix_increment=no
7350 ;;
7351 esac
7352 ;;
7353 no)
7354 current="$1"
7355 revision="$2"
7356 age="$3"
7357 ;;
7358 esac
7359
7360 # Check that each of the things are valid numbers.
7361 case $current in
7362 0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;;
7363 *)
7364 func_error "CURRENT \`$current' must be a nonnegative integer"
7365 func_fatal_error "\`$vinfo' is not valid version information"
7366 ;;
7367 esac
7368
7369 case $revision in
7370 0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;;
7371 *)
7372 func_error "REVISION \`$revision' must be a nonnegative integer"
7373 func_fatal_error "\`$vinfo' is not valid version information"
7374 ;;
7375 esac
7376
7377 case $age in
7378 0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;;
7379 *)
7380 func_error "AGE \`$age' must be a nonnegative integer"
7381 func_fatal_error "\`$vinfo' is not valid version information"
7382 ;;
7383 esac
7384
7385 if test "$age" -gt "$current"; then
7386 func_error "AGE \`$age' is greater than the current interface number \`$current'"
7387 func_fatal_error "\`$vinfo' is not valid version information"
7388 fi
7389
7390 # Calculate the version variables.
7391 major=
7392 versuffix=
7393 verstring=
7394 case $version_type in
7395 none) ;;
7396
7397 darwin)
7398 # Like Linux, but with the current version available in
7399 # verstring for coding it into the library header
7400 func_arith $current - $age
7401 major=.$func_arith_result
7402 versuffix="$major.$age.$revision"
7403 # Darwin ld doesn't like 0 for these options...
7404 func_arith $current + 1
7405 minor_current=$func_arith_result
7406 xlcverstring="${wl}-compatibility_version ${wl}$minor_current ${wl}-current_version ${wl}$minor_current.$revision"
7407 verstring="-compatibility_version $minor_current -current_version $minor_current.$revision"
7408 ;;
7409
7410 freebsd-aout)
7411 major=".$current"
7412 versuffix=".$current.$revision";
7413 ;;
7414
7415 freebsd-elf)
7416 major=".$current"
7417 versuffix=".$current"
7418 ;;
7419
7420 irix | nonstopux)
7421 if test "X$lt_irix_increment" = "Xno"; then
7422 func_arith $current - $age
7423 else
7424 func_arith $current - $age + 1
7425 fi
7426 major=$func_arith_result
7427
7428 case $version_type in
7429 nonstopux) verstring_prefix=nonstopux ;;
7430 *) verstring_prefix=sgi ;;
7431 esac
7432 verstring="$verstring_prefix$major.$revision"
7433
7434 # Add in all the interfaces that we are compatible with.
7435 loop=$revision
7436 while test "$loop" -ne 0; do
7437 func_arith $revision - $loop
7438 iface=$func_arith_result
7439 func_arith $loop - 1
7440 loop=$func_arith_result
7441 verstring="$verstring_prefix$major.$iface:$verstring"
7442 done
7443
7444 # Before this point, $major must not contain `.'.
7445 major=.$major
7446 versuffix="$major.$revision"
7447 ;;
7448
7449 linux) # correct to gnu/linux during the next big refactor
7450 func_arith $current - $age
7451 major=.$func_arith_result
7452 versuffix="$major.$age.$revision"
7453 ;;
7454
7455 osf)
7456 func_arith $current - $age
7457 major=.$func_arith_result
7458 versuffix=".$current.$age.$revision"
7459 verstring="$current.$age.$revision"
7460
7461 # Add in all the interfaces that we are compatible with.
7462 loop=$age
7463 while test "$loop" -ne 0; do
7464 func_arith $current - $loop
7465 iface=$func_arith_result
7466 func_arith $loop - 1
7467 loop=$func_arith_result
7468 verstring="$verstring:${iface}.0"
7469 done
7470
7471 # Make executables depend on our current version.
7472 func_append verstring ":${current}.0"
7473 ;;
7474
7475 qnx)
7476 major=".$current"
7477 versuffix=".$current"
7478 ;;
7479
7480 sunos)
7481 major=".$current"
7482 versuffix=".$current.$revision"
7483 ;;
7484
7485 windows)
7486 # Use '-' rather than '.', since we only want one
7487 # extension on DOS 8.3 filesystems.
7488 func_arith $current - $age
7489 major=$func_arith_result
7490 versuffix="-$major"
7491 ;;
7492
7493 *)
7494 func_fatal_configuration "unknown library version type \`$version_type'"
7495 ;;
7496 esac
7497
7498 # Clear the version info if we defaulted, and they specified a release.
7499 if test -z "$vinfo" && test -n "$release"; then
7500 major=
7501 case $version_type in
7502 darwin)
7503 # we can't check for "0.0" in archive_cmds due to quoting
7504 # problems, so we reset it completely
7505 verstring=
7506 ;;
7507 *)
7508 verstring="0.0"
7509 ;;
7510 esac
7511 if test "$need_version" = no; then
7512 versuffix=
7513 else
7514 versuffix=".0.0"
7515 fi
7516 fi
7517
7518 # Remove version info from name if versioning should be avoided
7519 if test "$avoid_version" = yes && test "$need_version" = no; then
7520 major=
7521 versuffix=
7522 verstring=""
7523 fi
7524
7525 # Check to see if the archive will have undefined symbols.
7526 if test "$allow_undefined" = yes; then
7527 if test "$allow_undefined_flag" = unsupported; then
7528 func_warning "undefined symbols not allowed in $host shared libraries"
7529 build_libtool_libs=no
7530 build_old_libs=yes
7531 fi
7532 else
7533 # Don't allow undefined symbols.
7534 allow_undefined_flag="$no_undefined_flag"
7535 fi
7536
7537 fi
7538
7539 func_generate_dlsyms "$libname" "$libname" "yes"
7540 func_append libobjs " $symfileobj"
7541 test "X$libobjs" = "X " && libobjs=
7542
7543 if test "$opt_mode" != relink; then
7544 # Remove our outputs, but don't remove object files since they
7545 # may have been created when compiling PIC objects.
7546 removelist=
7547 tempremovelist=`$ECHO "$output_objdir/*"`
7548 for p in $tempremovelist; do
7549 case $p in
7550 *.$objext | *.gcno)
7551 ;;
7552 $output_objdir/$outputname | $output_objdir/$libname.* | $output_objdir/${libname}${release}.*)
7553 if test "X$precious_files_regex" != "X"; then
7554 if $ECHO "$p" | $EGREP -e "$precious_files_regex" >/dev/null 2>&1
7555 then
7556 continue
7557 fi
7558 fi
7559 func_append removelist " $p"
7560 ;;
7561 *) ;;
7562 esac
7563 done
7564 test -n "$removelist" && \
7565 func_show_eval "${RM}r \$removelist"
7566 fi
7567
7568 # Now set the variables for building old libraries.
7569 if test "$build_old_libs" = yes && test "$build_libtool_libs" != convenience ; then
7570 func_append oldlibs " $output_objdir/$libname.$libext"
7571
7572 # Transform .lo files to .o files.
7573 oldobjs="$objs "`$ECHO "$libobjs" | $SP2NL | $SED "/\.${libext}$/d; $lo2o" | $NL2SP`
7574 fi
7575
7576 # Eliminate all temporary directories.
7577 #for path in $notinst_path; do
7578 # lib_search_path=`$ECHO "$lib_search_path " | $SED "s% $path % %g"`
7579 # deplibs=`$ECHO "$deplibs " | $SED "s% -L$path % %g"`
7580 # dependency_libs=`$ECHO "$dependency_libs " | $SED "s% -L$path % %g"`
7581 #done
7582
7583 if test -n "$xrpath"; then
7584 # If the user specified any rpath flags, then add them.
7585 temp_xrpath=
7586 for libdir in $xrpath; do
7587 func_replace_sysroot "$libdir"
7588 func_append temp_xrpath " -R$func_replace_sysroot_result"
7589 case "$finalize_rpath " in
7590 *" $libdir "*) ;;
7591 *) func_append finalize_rpath " $libdir" ;;
7592 esac
7593 done
7594 if test "$hardcode_into_libs" != yes || test "$build_old_libs" = yes; then
7595 dependency_libs="$temp_xrpath $dependency_libs"
7596 fi
7597 fi
7598
7599 # Make sure dlfiles contains only unique files that won't be dlpreopened
7600 old_dlfiles="$dlfiles"
7601 dlfiles=
7602 for lib in $old_dlfiles; do
7603 case " $dlprefiles $dlfiles " in
7604 *" $lib "*) ;;
7605 *) func_append dlfiles " $lib" ;;
7606 esac
7607 done
7608
7609 # Make sure dlprefiles contains only unique files
7610 old_dlprefiles="$dlprefiles"
7611 dlprefiles=
7612 for lib in $old_dlprefiles; do
7613 case "$dlprefiles " in
7614 *" $lib "*) ;;
7615 *) func_append dlprefiles " $lib" ;;
7616 esac
7617 done
7618
7619 if test "$build_libtool_libs" = yes; then
7620 if test -n "$rpath"; then
7621 case $host in
7622 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-beos* | *-cegcc* | *-*-haiku*)
7623 # these systems don't actually have a c library (as such)!
7624 ;;
7625 *-*-rhapsody* | *-*-darwin1.[012])
7626 # Rhapsody C library is in the System framework
7627 func_append deplibs " System.ltframework"
7628 ;;
7629 *-*-netbsd*)
7630 # Don't link with libc until the a.out ld.so is fixed.
7631 ;;
7632 *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
7633 # Do not include libc due to us having libc/libc_r.
7634 ;;
7635 *-*-sco3.2v5* | *-*-sco5v6*)
7636 # Causes problems with __ctype
7637 ;;
7638 *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*)
7639 # Compiler inserts libc in the correct place for threads to work
7640 ;;
7641 *)
7642 # Add libc to deplibs on all other systems if necessary.
7643 if test "$build_libtool_need_lc" = "yes"; then
7644 func_append deplibs " -lc"
7645 fi
7646 ;;
7647 esac
7648 fi
7649
7650 # Transform deplibs into only deplibs that can be linked in shared.
7651 name_save=$name
7652 libname_save=$libname
7653 release_save=$release
7654 versuffix_save=$versuffix
7655 major_save=$major
7656 # I'm not sure if I'm treating the release correctly. I think
7657 # release should show up in the -l (ie -lgmp5) so we don't want to
7658 # add it in twice. Is that correct?
7659 release=""
7660 versuffix=""
7661 major=""
7662 newdeplibs=
7663 droppeddeps=no
7664 case $deplibs_check_method in
7665 pass_all)
7666 # Don't check for shared/static. Everything works.
7667 # This might be a little naive. We might want to check
7668 # whether the library exists or not. But this is on
7669 # osf3 & osf4 and I'm not really sure... Just
7670 # implementing what was already the behavior.
7671 newdeplibs=$deplibs
7672 ;;
7673 test_compile)
7674 # This code stresses the "libraries are programs" paradigm to its
7675 # limits. Maybe even breaks it. We compile a program, linking it
7676 # against the deplibs as a proxy for the library. Then we can check
7677 # whether they linked in statically or dynamically with ldd.
7678 $opt_dry_run || $RM conftest.c
7679 cat > conftest.c <<EOF
7680 int main() { return 0; }
7681 EOF
7682 $opt_dry_run || $RM conftest
7683 if $LTCC $LTCFLAGS -o conftest conftest.c $deplibs; then
7684 ldd_output=`ldd conftest`
7685 for i in $deplibs; do
7686 case $i in
7687 -l*)
7688 func_stripname -l '' "$i"
7689 name=$func_stripname_result
7690 if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
7691 case " $predeps $postdeps " in
7692 *" $i "*)
7693 func_append newdeplibs " $i"
7694 i=""
7695 ;;
7696 esac
7697 fi
7698 if test -n "$i" ; then
7699 libname=`eval "\\$ECHO \"$libname_spec\""`
7700 deplib_matches=`eval "\\$ECHO \"$library_names_spec\""`
7701 set dummy $deplib_matches; shift
7702 deplib_match=$1
7703 if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then
7704 func_append newdeplibs " $i"
7705 else
7706 droppeddeps=yes
7707 echo
7708 $ECHO "*** Warning: dynamic linker does not accept needed library $i."
7709 echo "*** I have the capability to make that library automatically link in when"
7710 echo "*** you link to this library. But I can only do this if you have a"
7711 echo "*** shared version of the library, which I believe you do not have"
7712 echo "*** because a test_compile did reveal that the linker did not use it for"
7713 echo "*** its dynamic dependency list that programs get resolved with at runtime."
7714 fi
7715 fi
7716 ;;
7717 *)
7718 func_append newdeplibs " $i"
7719 ;;
7720 esac
7721 done
7722 else
7723 # Error occurred in the first compile. Let's try to salvage
7724 # the situation: Compile a separate program for each library.
7725 for i in $deplibs; do
7726 case $i in
7727 -l*)
7728 func_stripname -l '' "$i"
7729 name=$func_stripname_result
7730 $opt_dry_run || $RM conftest
7731 if $LTCC $LTCFLAGS -o conftest conftest.c $i; then
7732 ldd_output=`ldd conftest`
7733 if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
7734 case " $predeps $postdeps " in
7735 *" $i "*)
7736 func_append newdeplibs " $i"
7737 i=""
7738 ;;
7739 esac
7740 fi
7741 if test -n "$i" ; then
7742 libname=`eval "\\$ECHO \"$libname_spec\""`
7743 deplib_matches=`eval "\\$ECHO \"$library_names_spec\""`
7744 set dummy $deplib_matches; shift
7745 deplib_match=$1
7746 if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then
7747 func_append newdeplibs " $i"
7748 else
7749 droppeddeps=yes
7750 echo
7751 $ECHO "*** Warning: dynamic linker does not accept needed library $i."
7752 echo "*** I have the capability to make that library automatically link in when"
7753 echo "*** you link to this library. But I can only do this if you have a"
7754 echo "*** shared version of the library, which you do not appear to have"
7755 echo "*** because a test_compile did reveal that the linker did not use this one"
7756 echo "*** as a dynamic dependency that programs can get resolved with at runtime."
7757 fi
7758 fi
7759 else
7760 droppeddeps=yes
7761 echo
7762 $ECHO "*** Warning! Library $i is needed by this library but I was not able to"
7763 echo "*** make it link in! You will probably need to install it or some"
7764 echo "*** library that it depends on before this library will be fully"
7765 echo "*** functional. Installing it before continuing would be even better."
7766 fi
7767 ;;
7768 *)
7769 func_append newdeplibs " $i"
7770 ;;
7771 esac
7772 done
7773 fi
7774 ;;
7775 file_magic*)
7776 set dummy $deplibs_check_method; shift
7777 file_magic_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"`
7778 for a_deplib in $deplibs; do
7779 case $a_deplib in
7780 -l*)
7781 func_stripname -l '' "$a_deplib"
7782 name=$func_stripname_result
7783 if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
7784 case " $predeps $postdeps " in
7785 *" $a_deplib "*)
7786 func_append newdeplibs " $a_deplib"
7787 a_deplib=""
7788 ;;
7789 esac
7790 fi
7791 if test -n "$a_deplib" ; then
7792 libname=`eval "\\$ECHO \"$libname_spec\""`
7793 if test -n "$file_magic_glob"; then
7794 libnameglob=`func_echo_all "$libname" | $SED -e $file_magic_glob`
7795 else
7796 libnameglob=$libname
7797 fi
7798 test "$want_nocaseglob" = yes && nocaseglob=`shopt -p nocaseglob`
7799 for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
7800 if test "$want_nocaseglob" = yes; then
7801 shopt -s nocaseglob
7802 potential_libs=`ls $i/$libnameglob[.-]* 2>/dev/null`
7803 $nocaseglob
7804 else
7805 potential_libs=`ls $i/$libnameglob[.-]* 2>/dev/null`
7806 fi
7807 for potent_lib in $potential_libs; do
7808 # Follow soft links.
7809 if ls -lLd "$potent_lib" 2>/dev/null |
7810 $GREP " -> " >/dev/null; then
7811 continue
7812 fi
7813 # The statement above tries to avoid entering an
7814 # endless loop below, in case of cyclic links.
7815 # We might still enter an endless loop, since a link
7816 # loop can be closed while we follow links,
7817 # but so what?
7818 potlib="$potent_lib"
7819 while test -h "$potlib" 2>/dev/null; do
7820 potliblink=`ls -ld $potlib | ${SED} 's/.* -> //'`
7821 case $potliblink in
7822 [\\/]* | [A-Za-z]:[\\/]*) potlib="$potliblink";;
7823 *) potlib=`$ECHO "$potlib" | $SED 's,[^/]*$,,'`"$potliblink";;
7824 esac
7825 done
7826 if eval $file_magic_cmd \"\$potlib\" 2>/dev/null |
7827 $SED -e 10q |
7828 $EGREP "$file_magic_regex" > /dev/null; then
7829 func_append newdeplibs " $a_deplib"
7830 a_deplib=""
7831 break 2
7832 fi
7833 done
7834 done
7835 fi
7836 if test -n "$a_deplib" ; then
7837 droppeddeps=yes
7838 echo
7839 $ECHO "*** Warning: linker path does not have real file for library $a_deplib."
7840 echo "*** I have the capability to make that library automatically link in when"
7841 echo "*** you link to this library. But I can only do this if you have a"
7842 echo "*** shared version of the library, which you do not appear to have"
7843 echo "*** because I did check the linker path looking for a file starting"
7844 if test -z "$potlib" ; then
7845 $ECHO "*** with $libname but no candidates were found. (...for file magic test)"
7846 else
7847 $ECHO "*** with $libname and none of the candidates passed a file format test"
7848 $ECHO "*** using a file magic. Last file checked: $potlib"
7849 fi
7850 fi
7851 ;;
7852 *)
7853 # Add a -L argument.
7854 func_append newdeplibs " $a_deplib"
7855 ;;
7856 esac
7857 done # Gone through all deplibs.
7858 ;;
7859 match_pattern*)
7860 set dummy $deplibs_check_method; shift
7861 match_pattern_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"`
7862 for a_deplib in $deplibs; do
7863 case $a_deplib in
7864 -l*)
7865 func_stripname -l '' "$a_deplib"
7866 name=$func_stripname_result
7867 if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
7868 case " $predeps $postdeps " in
7869 *" $a_deplib "*)
7870 func_append newdeplibs " $a_deplib"
7871 a_deplib=""
7872 ;;
7873 esac
7874 fi
7875 if test -n "$a_deplib" ; then
7876 libname=`eval "\\$ECHO \"$libname_spec\""`
7877 for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
7878 potential_libs=`ls $i/$libname[.-]* 2>/dev/null`
7879 for potent_lib in $potential_libs; do
7880 potlib="$potent_lib" # see symlink-check above in file_magic test
7881 if eval "\$ECHO \"$potent_lib\"" 2>/dev/null | $SED 10q | \
7882 $EGREP "$match_pattern_regex" > /dev/null; then
7883 func_append newdeplibs " $a_deplib"
7884 a_deplib=""
7885 break 2
7886 fi
7887 done
7888 done
7889 fi
7890 if test -n "$a_deplib" ; then
7891 droppeddeps=yes
7892 echo
7893 $ECHO "*** Warning: linker path does not have real file for library $a_deplib."
7894 echo "*** I have the capability to make that library automatically link in when"
7895 echo "*** you link to this library. But I can only do this if you have a"
7896 echo "*** shared version of the library, which you do not appear to have"
7897 echo "*** because I did check the linker path looking for a file starting"
7898 if test -z "$potlib" ; then
7899 $ECHO "*** with $libname but no candidates were found. (...for regex pattern test)"
7900 else
7901 $ECHO "*** with $libname and none of the candidates passed a file format test"
7902 $ECHO "*** using a regex pattern. Last file checked: $potlib"
7903 fi
7904 fi
7905 ;;
7906 *)
7907 # Add a -L argument.
7908 func_append newdeplibs " $a_deplib"
7909 ;;
7910 esac
7911 done # Gone through all deplibs.
7912 ;;
7913 none | unknown | *)
7914 newdeplibs=""
7915 tmp_deplibs=`$ECHO " $deplibs" | $SED 's/ -lc$//; s/ -[LR][^ ]*//g'`
7916 if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
7917 for i in $predeps $postdeps ; do
7918 # can't use Xsed below, because $i might contain '/'
7919 tmp_deplibs=`$ECHO " $tmp_deplibs" | $SED "s,$i,,"`
7920 done
7921 fi
7922 case $tmp_deplibs in
7923 *[!\ \ ]*)
7924 echo
7925 if test "X$deplibs_check_method" = "Xnone"; then
7926 echo "*** Warning: inter-library dependencies are not supported in this platform."
7927 else
7928 echo "*** Warning: inter-library dependencies are not known to be supported."
7929 fi
7930 echo "*** All declared inter-library dependencies are being dropped."
7931 droppeddeps=yes
7932 ;;
7933 esac
7934 ;;
7935 esac
7936 versuffix=$versuffix_save
7937 major=$major_save
7938 release=$release_save
7939 libname=$libname_save
7940 name=$name_save
7941
7942 case $host in
7943 *-*-rhapsody* | *-*-darwin1.[012])
7944 # On Rhapsody replace the C library with the System framework
7945 newdeplibs=`$ECHO " $newdeplibs" | $SED 's/ -lc / System.ltframework /'`
7946 ;;
7947 esac
7948
7949 if test "$droppeddeps" = yes; then
7950 if test "$module" = yes; then
7951 echo
7952 echo "*** Warning: libtool could not satisfy all declared inter-library"
7953 $ECHO "*** dependencies of module $libname. Therefore, libtool will create"
7954 echo "*** a static module, that should work as long as the dlopening"
7955 echo "*** application is linked with the -dlopen flag."
7956 if test -z "$global_symbol_pipe"; then
7957 echo
7958 echo "*** However, this would only work if libtool was able to extract symbol"
7959 echo "*** lists from a program, using \`nm' or equivalent, but libtool could"
7960 echo "*** not find such a program. So, this module is probably useless."
7961 echo "*** \`nm' from GNU binutils and a full rebuild may help."
7962 fi
7963 if test "$build_old_libs" = no; then
7964 oldlibs="$output_objdir/$libname.$libext"
7965 build_libtool_libs=module
7966 build_old_libs=yes
7967 else
7968 build_libtool_libs=no
7969 fi
7970 else
7971 echo "*** The inter-library dependencies that have been dropped here will be"
7972 echo "*** automatically added whenever a program is linked with this library"
7973 echo "*** or is declared to -dlopen it."
7974
7975 if test "$allow_undefined" = no; then
7976 echo
7977 echo "*** Since this library must not contain undefined symbols,"
7978 echo "*** because either the platform does not support them or"
7979 echo "*** it was explicitly requested with -no-undefined,"
7980 echo "*** libtool will only create a static version of it."
7981 if test "$build_old_libs" = no; then
7982 oldlibs="$output_objdir/$libname.$libext"
7983 build_libtool_libs=module
7984 build_old_libs=yes
7985 else
7986 build_libtool_libs=no
7987 fi
7988 fi
7989 fi
7990 fi
7991 # Done checking deplibs!
7992 deplibs=$newdeplibs
7993 fi
7994 # Time to change all our "foo.ltframework" stuff back to "-framework foo"
7995 case $host in
7996 *-*-darwin*)
7997 newdeplibs=`$ECHO " $newdeplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
7998 new_inherited_linker_flags=`$ECHO " $new_inherited_linker_flags" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
7999 deplibs=`$ECHO " $deplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
8000 ;;
8001 esac
8002
8003 # move library search paths that coincide with paths to not yet
8004 # installed libraries to the beginning of the library search list
8005 new_libs=
8006 for path in $notinst_path; do
8007 case " $new_libs " in
8008 *" -L$path/$objdir "*) ;;
8009 *)
8010 case " $deplibs " in
8011 *" -L$path/$objdir "*)
8012 func_append new_libs " -L$path/$objdir" ;;
8013 esac
8014 ;;
8015 esac
8016 done
8017 for deplib in $deplibs; do
8018 case $deplib in
8019 -L*)
8020 case " $new_libs " in
8021 *" $deplib "*) ;;
8022 *) func_append new_libs " $deplib" ;;
8023 esac
8024 ;;
8025 *) func_append new_libs " $deplib" ;;
8026 esac
8027 done
8028 deplibs="$new_libs"
8029
8030 # All the library-specific variables (install_libdir is set above).
8031 library_names=
8032 old_library=
8033 dlname=
8034
8035 # Test again, we may have decided not to build it any more
8036 if test "$build_libtool_libs" = yes; then
8037 # Remove ${wl} instances when linking with ld.
8038 # FIXME: should test the right _cmds variable.
8039 case $archive_cmds in
8040 *\$LD\ *) wl= ;;
8041 esac
8042 if test "$hardcode_into_libs" = yes; then
8043 # Hardcode the library paths
8044 hardcode_libdirs=
8045 dep_rpath=
8046 rpath="$finalize_rpath"
8047 test "$opt_mode" != relink && rpath="$compile_rpath$rpath"
8048 for libdir in $rpath; do
8049 if test -n "$hardcode_libdir_flag_spec"; then
8050 if test -n "$hardcode_libdir_separator"; then
8051 func_replace_sysroot "$libdir"
8052 libdir=$func_replace_sysroot_result
8053 if test -z "$hardcode_libdirs"; then
8054 hardcode_libdirs="$libdir"
8055 else
8056 # Just accumulate the unique libdirs.
8057 case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
8058 *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
8059 ;;
8060 *)
8061 func_append hardcode_libdirs "$hardcode_libdir_separator$libdir"
8062 ;;
8063 esac
8064 fi
8065 else
8066 eval flag=\"$hardcode_libdir_flag_spec\"
8067 func_append dep_rpath " $flag"
8068 fi
8069 elif test -n "$runpath_var"; then
8070 case "$perm_rpath " in
8071 *" $libdir "*) ;;
8072 *) func_append perm_rpath " $libdir" ;;
8073 esac
8074 fi
8075 done
8076 # Substitute the hardcoded libdirs into the rpath.
8077 if test -n "$hardcode_libdir_separator" &&
8078 test -n "$hardcode_libdirs"; then
8079 libdir="$hardcode_libdirs"
8080 eval "dep_rpath=\"$hardcode_libdir_flag_spec\""
8081 fi
8082 if test -n "$runpath_var" && test -n "$perm_rpath"; then
8083 # We should set the runpath_var.
8084 rpath=
8085 for dir in $perm_rpath; do
8086 func_append rpath "$dir:"
8087 done
8088 eval "$runpath_var='$rpath\$$runpath_var'; export $runpath_var"
8089 fi
8090 test -n "$dep_rpath" && deplibs="$dep_rpath $deplibs"
8091 fi
8092
8093 shlibpath="$finalize_shlibpath"
8094 test "$opt_mode" != relink && shlibpath="$compile_shlibpath$shlibpath"
8095 if test -n "$shlibpath"; then
8096 eval "$shlibpath_var='$shlibpath\$$shlibpath_var'; export $shlibpath_var"
8097 fi
8098
8099 # Get the real and link names of the library.
8100 eval shared_ext=\"$shrext_cmds\"
8101 eval library_names=\"$library_names_spec\"
8102 set dummy $library_names
8103 shift
8104 realname="$1"
8105 shift
8106
8107 if test -n "$soname_spec"; then
8108 eval soname=\"$soname_spec\"
8109 else
8110 soname="$realname"
8111 fi
8112 if test -z "$dlname"; then
8113 dlname=$soname
8114 fi
8115
8116 lib="$output_objdir/$realname"
8117 linknames=
8118 for link
8119 do
8120 func_append linknames " $link"
8121 done
8122
8123 # Use standard objects if they are pic
8124 test -z "$pic_flag" && libobjs=`$ECHO "$libobjs" | $SP2NL | $SED "$lo2o" | $NL2SP`
8125 test "X$libobjs" = "X " && libobjs=
8126
8127 delfiles=
8128 if test -n "$export_symbols" && test -n "$include_expsyms"; then
8129 $opt_dry_run || cp "$export_symbols" "$output_objdir/$libname.uexp"
8130 export_symbols="$output_objdir/$libname.uexp"
8131 func_append delfiles " $export_symbols"
8132 fi
8133
8134 orig_export_symbols=
8135 case $host_os in
8136 cygwin* | mingw* | cegcc*)
8137 if test -n "$export_symbols" && test -z "$export_symbols_regex"; then
8138 # exporting using user supplied symfile
8139 if test "x`$SED 1q $export_symbols`" != xEXPORTS; then
8140 # and it's NOT already a .def file. Must figure out
8141 # which of the given symbols are data symbols and tag
8142 # them as such. So, trigger use of export_symbols_cmds.
8143 # export_symbols gets reassigned inside the "prepare
8144 # the list of exported symbols" if statement, so the
8145 # include_expsyms logic still works.
8146 orig_export_symbols="$export_symbols"
8147 export_symbols=
8148 always_export_symbols=yes
8149 fi
8150 fi
8151 ;;
8152 esac
8153
8154 # Prepare the list of exported symbols
8155 if test -z "$export_symbols"; then
8156 if test "$always_export_symbols" = yes || test -n "$export_symbols_regex"; then
8157 func_verbose "generating symbol list for \`$libname.la'"
8158 export_symbols="$output_objdir/$libname.exp"
8159 $opt_dry_run || $RM $export_symbols
8160 cmds=$export_symbols_cmds
8161 save_ifs="$IFS"; IFS='~'
8162 for cmd1 in $cmds; do
8163 IFS="$save_ifs"
8164 # Take the normal branch if the nm_file_list_spec branch
8165 # doesn't work or if tool conversion is not needed.
8166 case $nm_file_list_spec~$to_tool_file_cmd in
8167 *~func_convert_file_noop | *~func_convert_file_msys_to_w32 | ~*)
8168 try_normal_branch=yes
8169 eval cmd=\"$cmd1\"
8170 func_len " $cmd"
8171 len=$func_len_result
8172 ;;
8173 *)
8174 try_normal_branch=no
8175 ;;
8176 esac
8177 if test "$try_normal_branch" = yes \
8178 && { test "$len" -lt "$max_cmd_len" \
8179 || test "$max_cmd_len" -le -1; }
8180 then
8181 func_show_eval "$cmd" 'exit $?'
8182 skipped_export=false
8183 elif test -n "$nm_file_list_spec"; then
8184 func_basename "$output"
8185 output_la=$func_basename_result
8186 save_libobjs=$libobjs
8187 save_output=$output
8188 output=${output_objdir}/${output_la}.nm
8189 func_to_tool_file "$output"
8190 libobjs=$nm_file_list_spec$func_to_tool_file_result
8191 func_append delfiles " $output"
8192 func_verbose "creating $NM input file list: $output"
8193 for obj in $save_libobjs; do
8194 func_to_tool_file "$obj"
8195 $ECHO "$func_to_tool_file_result"
8196 done > "$output"
8197 eval cmd=\"$cmd1\"
8198 func_show_eval "$cmd" 'exit $?'
8199 output=$save_output
8200 libobjs=$save_libobjs
8201 skipped_export=false
8202 else
8203 # The command line is too long to execute in one step.
8204 func_verbose "using reloadable object file for export list..."
8205 skipped_export=:
8206 # Break out early, otherwise skipped_export may be
8207 # set to false by a later but shorter cmd.
8208 break
8209 fi
8210 done
8211 IFS="$save_ifs"
8212 if test -n "$export_symbols_regex" && test "X$skipped_export" != "X:"; then
8213 func_show_eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"'
8214 func_show_eval '$MV "${export_symbols}T" "$export_symbols"'
8215 fi
8216 fi
8217 fi
8218
8219 if test -n "$export_symbols" && test -n "$include_expsyms"; then
8220 tmp_export_symbols="$export_symbols"
8221 test -n "$orig_export_symbols" && tmp_export_symbols="$orig_export_symbols"
8222 $opt_dry_run || eval '$ECHO "$include_expsyms" | $SP2NL >> "$tmp_export_symbols"'
8223 fi
8224
8225 if test "X$skipped_export" != "X:" && test -n "$orig_export_symbols"; then
8226 # The given exports_symbols file has to be filtered, so filter it.
8227 func_verbose "filter symbol list for \`$libname.la' to tag DATA exports"
8228 # FIXME: $output_objdir/$libname.filter potentially contains lots of
8229 # 's' commands which not all seds can handle. GNU sed should be fine
8230 # though. Also, the filter scales superlinearly with the number of
8231 # global variables. join(1) would be nice here, but unfortunately
8232 # isn't a blessed tool.
8233 $opt_dry_run || $SED -e '/[ ,]DATA/!d;s,\(.*\)\([ \,].*\),s|^\1$|\1\2|,' < $export_symbols > $output_objdir/$libname.filter
8234 func_append delfiles " $export_symbols $output_objdir/$libname.filter"
8235 export_symbols=$output_objdir/$libname.def
8236 $opt_dry_run || $SED -f $output_objdir/$libname.filter < $orig_export_symbols > $export_symbols
8237 fi
8238
8239 tmp_deplibs=
8240 for test_deplib in $deplibs; do
8241 case " $convenience " in
8242 *" $test_deplib "*) ;;
8243 *)
8244 func_append tmp_deplibs " $test_deplib"
8245 ;;
8246 esac
8247 done
8248 deplibs="$tmp_deplibs"
8249
8250 if test -n "$convenience"; then
8251 if test -n "$whole_archive_flag_spec" &&
8252 test "$compiler_needs_object" = yes &&
8253 test -z "$libobjs"; then
8254 # extract the archives, so we have objects to list.
8255 # TODO: could optimize this to just extract one archive.
8256 whole_archive_flag_spec=
8257 fi
8258 if test -n "$whole_archive_flag_spec"; then
8259 save_libobjs=$libobjs
8260 eval libobjs=\"\$libobjs $whole_archive_flag_spec\"
8261 test "X$libobjs" = "X " && libobjs=
8262 else
8263 gentop="$output_objdir/${outputname}x"
8264 func_append generated " $gentop"
8265
8266 func_extract_archives $gentop $convenience
8267 func_append libobjs " $func_extract_archives_result"
8268 test "X$libobjs" = "X " && libobjs=
8269 fi
8270 fi
8271
8272 if test "$thread_safe" = yes && test -n "$thread_safe_flag_spec"; then
8273 eval flag=\"$thread_safe_flag_spec\"
8274 func_append linker_flags " $flag"
8275 fi
8276
8277 # Make a backup of the uninstalled library when relinking
8278 if test "$opt_mode" = relink; then
8279 $opt_dry_run || eval '(cd $output_objdir && $RM ${realname}U && $MV $realname ${realname}U)' || exit $?
8280 fi
8281
8282 # Do each of the archive commands.
8283 if test "$module" = yes && test -n "$module_cmds" ; then
8284 if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then
8285 eval test_cmds=\"$module_expsym_cmds\"
8286 cmds=$module_expsym_cmds
8287 else
8288 eval test_cmds=\"$module_cmds\"
8289 cmds=$module_cmds
8290 fi
8291 else
8292 if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
8293 eval test_cmds=\"$archive_expsym_cmds\"
8294 cmds=$archive_expsym_cmds
8295 else
8296 eval test_cmds=\"$archive_cmds\"
8297 cmds=$archive_cmds
8298 fi
8299 fi
8300
8301 if test "X$skipped_export" != "X:" &&
8302 func_len " $test_cmds" &&
8303 len=$func_len_result &&
8304 test "$len" -lt "$max_cmd_len" || test "$max_cmd_len" -le -1; then
8305 :
8306 else
8307 # The command line is too long to link in one step, link piecewise
8308 # or, if using GNU ld and skipped_export is not :, use a linker
8309 # script.
8310
8311 # Save the value of $output and $libobjs because we want to
8312 # use them later. If we have whole_archive_flag_spec, we
8313 # want to use save_libobjs as it was before
8314 # whole_archive_flag_spec was expanded, because we can't
8315 # assume the linker understands whole_archive_flag_spec.
8316 # This may have to be revisited, in case too many
8317 # convenience libraries get linked in and end up exceeding
8318 # the spec.
8319 if test -z "$convenience" || test -z "$whole_archive_flag_spec"; then
8320 save_libobjs=$libobjs
8321 fi
8322 save_output=$output
8323 func_basename "$output"
8324 output_la=$func_basename_result
8325
8326 # Clear the reloadable object creation command queue and
8327 # initialize k to one.
8328 test_cmds=
8329 concat_cmds=
8330 objlist=
8331 last_robj=
8332 k=1
8333
8334 if test -n "$save_libobjs" && test "X$skipped_export" != "X:" && test "$with_gnu_ld" = yes; then
8335 output=${output_objdir}/${output_la}.lnkscript
8336 func_verbose "creating GNU ld script: $output"
8337 echo 'INPUT (' > $output
8338 for obj in $save_libobjs
8339 do
8340 func_to_tool_file "$obj"
8341 $ECHO "$func_to_tool_file_result" >> $output
8342 done
8343 echo ')' >> $output
8344 func_append delfiles " $output"
8345 func_to_tool_file "$output"
8346 output=$func_to_tool_file_result
8347 elif test -n "$save_libobjs" && test "X$skipped_export" != "X:" && test "X$file_list_spec" != X; then
8348 output=${output_objdir}/${output_la}.lnk
8349 func_verbose "creating linker input file list: $output"
8350 : > $output
8351 set x $save_libobjs
8352 shift
8353 firstobj=
8354 if test "$compiler_needs_object" = yes; then
8355 firstobj="$1 "
8356 shift
8357 fi
8358 for obj
8359 do
8360 func_to_tool_file "$obj"
8361 $ECHO "$func_to_tool_file_result" >> $output
8362 done
8363 func_append delfiles " $output"
8364 func_to_tool_file "$output"
8365 output=$firstobj\"$file_list_spec$func_to_tool_file_result\"
8366 else
8367 if test -n "$save_libobjs"; then
8368 func_verbose "creating reloadable object files..."
8369 output=$output_objdir/$output_la-${k}.$objext
8370 eval test_cmds=\"$reload_cmds\"
8371 func_len " $test_cmds"
8372 len0=$func_len_result
8373 len=$len0
8374
8375 # Loop over the list of objects to be linked.
8376 for obj in $save_libobjs
8377 do
8378 func_len " $obj"
8379 func_arith $len + $func_len_result
8380 len=$func_arith_result
8381 if test "X$objlist" = X ||
8382 test "$len" -lt "$max_cmd_len"; then
8383 func_append objlist " $obj"
8384 else
8385 # The command $test_cmds is almost too long, add a
8386 # command to the queue.
8387 if test "$k" -eq 1 ; then
8388 # The first file doesn't have a previous command to add.
8389 reload_objs=$objlist
8390 eval concat_cmds=\"$reload_cmds\"
8391 else
8392 # All subsequent reloadable object files will link in
8393 # the last one created.
8394 reload_objs="$objlist $last_robj"
8395 eval concat_cmds=\"\$concat_cmds~$reload_cmds~\$RM $last_robj\"
8396 fi
8397 last_robj=$output_objdir/$output_la-${k}.$objext
8398 func_arith $k + 1
8399 k=$func_arith_result
8400 output=$output_objdir/$output_la-${k}.$objext
8401 objlist=" $obj"
8402 func_len " $last_robj"
8403 func_arith $len0 + $func_len_result
8404 len=$func_arith_result
8405 fi
8406 done
8407 # Handle the remaining objects by creating one last
8408 # reloadable object file. All subsequent reloadable object
8409 # files will link in the last one created.
8410 test -z "$concat_cmds" || concat_cmds=$concat_cmds~
8411 reload_objs="$objlist $last_robj"
8412 eval concat_cmds=\"\${concat_cmds}$reload_cmds\"
8413 if test -n "$last_robj"; then
8414 eval concat_cmds=\"\${concat_cmds}~\$RM $last_robj\"
8415 fi
8416 func_append delfiles " $output"
8417
8418 else
8419 output=
8420 fi
8421
8422 if ${skipped_export-false}; then
8423 func_verbose "generating symbol list for \`$libname.la'"
8424 export_symbols="$output_objdir/$libname.exp"
8425 $opt_dry_run || $RM $export_symbols
8426 libobjs=$output
8427 # Append the command to create the export file.
8428 test -z "$concat_cmds" || concat_cmds=$concat_cmds~
8429 eval concat_cmds=\"\$concat_cmds$export_symbols_cmds\"
8430 if test -n "$last_robj"; then
8431 eval concat_cmds=\"\$concat_cmds~\$RM $last_robj\"
8432 fi
8433 fi
8434
8435 test -n "$save_libobjs" &&
8436 func_verbose "creating a temporary reloadable object file: $output"
8437
8438 # Loop through the commands generated above and execute them.
8439 save_ifs="$IFS"; IFS='~'
8440 for cmd in $concat_cmds; do
8441 IFS="$save_ifs"
8442 $opt_silent || {
8443 func_quote_for_expand "$cmd"
8444 eval "func_echo $func_quote_for_expand_result"
8445 }
8446 $opt_dry_run || eval "$cmd" || {
8447 lt_exit=$?
8448
8449 # Restore the uninstalled library and exit
8450 if test "$opt_mode" = relink; then
8451 ( cd "$output_objdir" && \
8452 $RM "${realname}T" && \
8453 $MV "${realname}U" "$realname" )
8454 fi
8455
8456 exit $lt_exit
8457 }
8458 done
8459 IFS="$save_ifs"
8460
8461 if test -n "$export_symbols_regex" && ${skipped_export-false}; then
8462 func_show_eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"'
8463 func_show_eval '$MV "${export_symbols}T" "$export_symbols"'
8464 fi
8465 fi
8466
8467 if ${skipped_export-false}; then
8468 if test -n "$export_symbols" && test -n "$include_expsyms"; then
8469 tmp_export_symbols="$export_symbols"
8470 test -n "$orig_export_symbols" && tmp_export_symbols="$orig_export_symbols"
8471 $opt_dry_run || eval '$ECHO "$include_expsyms" | $SP2NL >> "$tmp_export_symbols"'
8472 fi
8473
8474 if test -n "$orig_export_symbols"; then
8475 # The given exports_symbols file has to be filtered, so filter it.
8476 func_verbose "filter symbol list for \`$libname.la' to tag DATA exports"
8477 # FIXME: $output_objdir/$libname.filter potentially contains lots of
8478 # 's' commands which not all seds can handle. GNU sed should be fine
8479 # though. Also, the filter scales superlinearly with the number of
8480 # global variables. join(1) would be nice here, but unfortunately
8481 # isn't a blessed tool.
8482 $opt_dry_run || $SED -e '/[ ,]DATA/!d;s,\(.*\)\([ \,].*\),s|^\1$|\1\2|,' < $export_symbols > $output_objdir/$libname.filter
8483 func_append delfiles " $export_symbols $output_objdir/$libname.filter"
8484 export_symbols=$output_objdir/$libname.def
8485 $opt_dry_run || $SED -f $output_objdir/$libname.filter < $orig_export_symbols > $export_symbols
8486 fi
8487 fi
8488
8489 libobjs=$output
8490 # Restore the value of output.
8491 output=$save_output
8492
8493 if test -n "$convenience" && test -n "$whole_archive_flag_spec"; then
8494 eval libobjs=\"\$libobjs $whole_archive_flag_spec\"
8495 test "X$libobjs" = "X " && libobjs=
8496 fi
8497 # Expand the library linking commands again to reset the
8498 # value of $libobjs for piecewise linking.
8499
8500 # Do each of the archive commands.
8501 if test "$module" = yes && test -n "$module_cmds" ; then
8502 if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then
8503 cmds=$module_expsym_cmds
8504 else
8505 cmds=$module_cmds
8506 fi
8507 else
8508 if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
8509 cmds=$archive_expsym_cmds
8510 else
8511 cmds=$archive_cmds
8512 fi
8513 fi
8514 fi
8515
8516 if test -n "$delfiles"; then
8517 # Append the command to remove temporary files to $cmds.
8518 eval cmds=\"\$cmds~\$RM $delfiles\"
8519 fi
8520
8521 # Add any objects from preloaded convenience libraries
8522 if test -n "$dlprefiles"; then
8523 gentop="$output_objdir/${outputname}x"
8524 func_append generated " $gentop"
8525
8526 func_extract_archives $gentop $dlprefiles
8527 func_append libobjs " $func_extract_archives_result"
8528 test "X$libobjs" = "X " && libobjs=
8529 fi
8530
8531 save_ifs="$IFS"; IFS='~'
8532 for cmd in $cmds; do
8533 IFS="$save_ifs"
8534 eval cmd=\"$cmd\"
8535 $opt_silent || {
8536 func_quote_for_expand "$cmd"
8537 eval "func_echo $func_quote_for_expand_result"
8538 }
8539 $opt_dry_run || eval "$cmd" || {
8540 lt_exit=$?
8541
8542 # Restore the uninstalled library and exit
8543 if test "$opt_mode" = relink; then
8544 ( cd "$output_objdir" && \
8545 $RM "${realname}T" && \
8546 $MV "${realname}U" "$realname" )
8547 fi
8548
8549 exit $lt_exit
8550 }
8551 done
8552 IFS="$save_ifs"
8553
8554 # Restore the uninstalled library and exit
8555 if test "$opt_mode" = relink; then
8556 $opt_dry_run || eval '(cd $output_objdir && $RM ${realname}T && $MV $realname ${realname}T && $MV ${realname}U $realname)' || exit $?
8557
8558 if test -n "$convenience"; then
8559 if test -z "$whole_archive_flag_spec"; then
8560 func_show_eval '${RM}r "$gentop"'
8561 fi
8562 fi
8563
8564 exit $EXIT_SUCCESS
8565 fi
8566
8567 # Create links to the real library.
8568 for linkname in $linknames; do
8569 if test "$realname" != "$linkname"; then
8570 func_show_eval '(cd "$output_objdir" && $RM "$linkname" && $LN_S "$realname" "$linkname")' 'exit $?'
8571 fi
8572 done
8573
8574 # If -module or -export-dynamic was specified, set the dlname.
8575 if test "$module" = yes || test "$export_dynamic" = yes; then
8576 # On all known operating systems, these are identical.
8577 dlname="$soname"
8578 fi
8579 fi
8580 ;;
8581
8582 obj)
8583 if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
8584 func_warning "\`-dlopen' is ignored for objects"
8585 fi
8586
8587 case " $deplibs" in
8588 *\ -l* | *\ -L*)
8589 func_warning "\`-l' and \`-L' are ignored for objects" ;;
8590 esac
8591
8592 test -n "$rpath" && \
8593 func_warning "\`-rpath' is ignored for objects"
8594
8595 test -n "$xrpath" && \
8596 func_warning "\`-R' is ignored for objects"
8597
8598 test -n "$vinfo" && \
8599 func_warning "\`-version-info' is ignored for objects"
8600
8601 test -n "$release" && \
8602 func_warning "\`-release' is ignored for objects"
8603
8604 case $output in
8605 *.lo)
8606 test -n "$objs$old_deplibs" && \
8607 func_fatal_error "cannot build library object \`$output' from non-libtool objects"
8608
8609 libobj=$output
8610 func_lo2o "$libobj"
8611 obj=$func_lo2o_result
8612 ;;
8613 *)
8614 libobj=
8615 obj="$output"
8616 ;;
8617 esac
8618
8619 # Delete the old objects.
8620 $opt_dry_run || $RM $obj $libobj
8621
8622 # Objects from convenience libraries. This assumes
8623 # single-version convenience libraries. Whenever we create
8624 # different ones for PIC/non-PIC, this we'll have to duplicate
8625 # the extraction.
8626 reload_conv_objs=
8627 gentop=
8628 # reload_cmds runs $LD directly, so let us get rid of
8629 # -Wl from whole_archive_flag_spec and hope we can get by with
8630 # turning comma into space..
8631 wl=
8632
8633 if test -n "$convenience"; then
8634 if test -n "$whole_archive_flag_spec"; then
8635 eval tmp_whole_archive_flags=\"$whole_archive_flag_spec\"
8636 reload_conv_objs=$reload_objs\ `$ECHO "$tmp_whole_archive_flags" | $SED 's|,| |g'`
8637 else
8638 gentop="$output_objdir/${obj}x"
8639 func_append generated " $gentop"
8640
8641 func_extract_archives $gentop $convenience
8642 reload_conv_objs="$reload_objs $func_extract_archives_result"
8643 fi
8644 fi
8645
8646 # If we're not building shared, we need to use non_pic_objs
8647 test "$build_libtool_libs" != yes && libobjs="$non_pic_objects"
8648
8649 # Create the old-style object.
8650 reload_objs="$objs$old_deplibs "`$ECHO "$libobjs" | $SP2NL | $SED "/\.${libext}$/d; /\.lib$/d; $lo2o" | $NL2SP`" $reload_conv_objs" ### testsuite: skip nested quoting test
8651
8652 output="$obj"
8653 func_execute_cmds "$reload_cmds" 'exit $?'
8654
8655 # Exit if we aren't doing a library object file.
8656 if test -z "$libobj"; then
8657 if test -n "$gentop"; then
8658 func_show_eval '${RM}r "$gentop"'
8659 fi
8660
8661 exit $EXIT_SUCCESS
8662 fi
8663
8664 if test "$build_libtool_libs" != yes; then
8665 if test -n "$gentop"; then
8666 func_show_eval '${RM}r "$gentop"'
8667 fi
8668
8669 # Create an invalid libtool object if no PIC, so that we don't
8670 # accidentally link it into a program.
8671 # $show "echo timestamp > $libobj"
8672 # $opt_dry_run || eval "echo timestamp > $libobj" || exit $?
8673 exit $EXIT_SUCCESS
8674 fi
8675
8676 if test -n "$pic_flag" || test "$pic_mode" != default; then
8677 # Only do commands if we really have different PIC objects.
8678 reload_objs="$libobjs $reload_conv_objs"
8679 output="$libobj"
8680 func_execute_cmds "$reload_cmds" 'exit $?'
8681 fi
8682
8683 if test -n "$gentop"; then
8684 func_show_eval '${RM}r "$gentop"'
8685 fi
8686
8687 exit $EXIT_SUCCESS
8688 ;;
8689
8690 prog)
8691 case $host in
8692 *cygwin*) func_stripname '' '.exe' "$output"
8693 output=$func_stripname_result.exe;;
8694 esac
8695 test -n "$vinfo" && \
8696 func_warning "\`-version-info' is ignored for programs"
8697
8698 test -n "$release" && \
8699 func_warning "\`-release' is ignored for programs"
8700
8701 test "$preload" = yes \
8702 && test "$dlopen_support" = unknown \
8703 && test "$dlopen_self" = unknown \
8704 && test "$dlopen_self_static" = unknown && \
8705 func_warning "\`LT_INIT([dlopen])' not used. Assuming no dlopen support."
8706
8707 case $host in
8708 *-*-rhapsody* | *-*-darwin1.[012])
8709 # On Rhapsody replace the C library is the System framework
8710 compile_deplibs=`$ECHO " $compile_deplibs" | $SED 's/ -lc / System.ltframework /'`
8711 finalize_deplibs=`$ECHO " $finalize_deplibs" | $SED 's/ -lc / System.ltframework /'`
8712 ;;
8713 esac
8714
8715 case $host in
8716 *-*-darwin*)
8717 # Don't allow lazy linking, it breaks C++ global constructors
8718 # But is supposedly fixed on 10.4 or later (yay!).
8719 if test "$tagname" = CXX ; then
8720 case ${MACOSX_DEPLOYMENT_TARGET-10.0} in
8721 10.[0123])
8722 func_append compile_command " ${wl}-bind_at_load"
8723 func_append finalize_command " ${wl}-bind_at_load"
8724 ;;
8725 esac
8726 fi
8727 # Time to change all our "foo.ltframework" stuff back to "-framework foo"
8728 compile_deplibs=`$ECHO " $compile_deplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
8729 finalize_deplibs=`$ECHO " $finalize_deplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
8730 ;;
8731 esac
8732
8733
8734 # move library search paths that coincide with paths to not yet
8735 # installed libraries to the beginning of the library search list
8736 new_libs=
8737 for path in $notinst_path; do
8738 case " $new_libs " in
8739 *" -L$path/$objdir "*) ;;
8740 *)
8741 case " $compile_deplibs " in
8742 *" -L$path/$objdir "*)
8743 func_append new_libs " -L$path/$objdir" ;;
8744 esac
8745 ;;
8746 esac
8747 done
8748 for deplib in $compile_deplibs; do
8749 case $deplib in
8750 -L*)
8751 case " $new_libs " in
8752 *" $deplib "*) ;;
8753 *) func_append new_libs " $deplib" ;;
8754 esac
8755 ;;
8756 *) func_append new_libs " $deplib" ;;
8757 esac
8758 done
8759 compile_deplibs="$new_libs"
8760
8761
8762 func_append compile_command " $compile_deplibs"
8763 func_append finalize_command " $finalize_deplibs"
8764
8765 if test -n "$rpath$xrpath"; then
8766 # If the user specified any rpath flags, then add them.
8767 for libdir in $rpath $xrpath; do
8768 # This is the magic to use -rpath.
8769 case "$finalize_rpath " in
8770 *" $libdir "*) ;;
8771 *) func_append finalize_rpath " $libdir" ;;
8772 esac
8773 done
8774 fi
8775
8776 # Now hardcode the library paths
8777 rpath=
8778 hardcode_libdirs=
8779 for libdir in $compile_rpath $finalize_rpath; do
8780 if test -n "$hardcode_libdir_flag_spec"; then
8781 if test -n "$hardcode_libdir_separator"; then
8782 if test -z "$hardcode_libdirs"; then
8783 hardcode_libdirs="$libdir"
8784 else
8785 # Just accumulate the unique libdirs.
8786 case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
8787 *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
8788 ;;
8789 *)
8790 func_append hardcode_libdirs "$hardcode_libdir_separator$libdir"
8791 ;;
8792 esac
8793 fi
8794 else
8795 eval flag=\"$hardcode_libdir_flag_spec\"
8796 func_append rpath " $flag"
8797 fi
8798 elif test -n "$runpath_var"; then
8799 case "$perm_rpath " in
8800 *" $libdir "*) ;;
8801 *) func_append perm_rpath " $libdir" ;;
8802 esac
8803 fi
8804 case $host in
8805 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*)
8806 testbindir=`${ECHO} "$libdir" | ${SED} -e 's*/lib$*/bin*'`
8807 case :$dllsearchpath: in
8808 *":$libdir:"*) ;;
8809 ::) dllsearchpath=$libdir;;
8810 *) func_append dllsearchpath ":$libdir";;
8811 esac
8812 case :$dllsearchpath: in
8813 *":$testbindir:"*) ;;
8814 ::) dllsearchpath=$testbindir;;
8815 *) func_append dllsearchpath ":$testbindir";;
8816 esac
8817 ;;
8818 esac
8819 done
8820 # Substitute the hardcoded libdirs into the rpath.
8821 if test -n "$hardcode_libdir_separator" &&
8822 test -n "$hardcode_libdirs"; then
8823 libdir="$hardcode_libdirs"
8824 eval rpath=\" $hardcode_libdir_flag_spec\"
8825 fi
8826 compile_rpath="$rpath"
8827
8828 rpath=
8829 hardcode_libdirs=
8830 for libdir in $finalize_rpath; do
8831 if test -n "$hardcode_libdir_flag_spec"; then
8832 if test -n "$hardcode_libdir_separator"; then
8833 if test -z "$hardcode_libdirs"; then
8834 hardcode_libdirs="$libdir"
8835 else
8836 # Just accumulate the unique libdirs.
8837 case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
8838 *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
8839 ;;
8840 *)
8841 func_append hardcode_libdirs "$hardcode_libdir_separator$libdir"
8842 ;;
8843 esac
8844 fi
8845 else
8846 eval flag=\"$hardcode_libdir_flag_spec\"
8847 func_append rpath " $flag"
8848 fi
8849 elif test -n "$runpath_var"; then
8850 case "$finalize_perm_rpath " in
8851 *" $libdir "*) ;;
8852 *) func_append finalize_perm_rpath " $libdir" ;;
8853 esac
8854 fi
8855 done
8856 # Substitute the hardcoded libdirs into the rpath.
8857 if test -n "$hardcode_libdir_separator" &&
8858 test -n "$hardcode_libdirs"; then
8859 libdir="$hardcode_libdirs"
8860 eval rpath=\" $hardcode_libdir_flag_spec\"
8861 fi
8862 finalize_rpath="$rpath"
8863
8864 if test -n "$libobjs" && test "$build_old_libs" = yes; then
8865 # Transform all the library objects into standard objects.
8866 compile_command=`$ECHO "$compile_command" | $SP2NL | $SED "$lo2o" | $NL2SP`
8867 finalize_command=`$ECHO "$finalize_command" | $SP2NL | $SED "$lo2o" | $NL2SP`
8868 fi
8869
8870 func_generate_dlsyms "$outputname" "@PROGRAM@" "no"
8871
8872 # template prelinking step
8873 if test -n "$prelink_cmds"; then
8874 func_execute_cmds "$prelink_cmds" 'exit $?'
8875 fi
8876
8877 wrappers_required=yes
8878 case $host in
8879 *cegcc* | *mingw32ce*)
8880 # Disable wrappers for cegcc and mingw32ce hosts, we are cross compiling anyway.
8881 wrappers_required=no
8882 ;;
8883 *cygwin* | *mingw* )
8884 if test "$build_libtool_libs" != yes; then
8885 wrappers_required=no
8886 fi
8887 ;;
8888 *)
8889 if test "$need_relink" = no || test "$build_libtool_libs" != yes; then
8890 wrappers_required=no
8891 fi
8892 ;;
8893 esac
8894 if test "$wrappers_required" = no; then
8895 # Replace the output file specification.
8896 compile_command=`$ECHO "$compile_command" | $SED 's%@OUTPUT@%'"$output"'%g'`
8897 link_command="$compile_command$compile_rpath"
8898
8899 # We have no uninstalled library dependencies, so finalize right now.
8900 exit_status=0
8901 func_show_eval "$link_command" 'exit_status=$?'
8902
8903 if test -n "$postlink_cmds"; then
8904 func_to_tool_file "$output"
8905 postlink_cmds=`func_echo_all "$postlink_cmds" | $SED -e 's%@OUTPUT@%'"$output"'%g' -e 's%@TOOL_OUTPUT@%'"$func_to_tool_file_result"'%g'`
8906 func_execute_cmds "$postlink_cmds" 'exit $?'
8907 fi
8908
8909 # Delete the generated files.
8910 if test -f "$output_objdir/${outputname}S.${objext}"; then
8911 func_show_eval '$RM "$output_objdir/${outputname}S.${objext}"'
8912 fi
8913
8914 exit $exit_status
8915 fi
8916
8917 if test -n "$compile_shlibpath$finalize_shlibpath"; then
8918 compile_command="$shlibpath_var=\"$compile_shlibpath$finalize_shlibpath\$$shlibpath_var\" $compile_command"
8919 fi
8920 if test -n "$finalize_shlibpath"; then
8921 finalize_command="$shlibpath_var=\"$finalize_shlibpath\$$shlibpath_var\" $finalize_command"
8922 fi
8923
8924 compile_var=
8925 finalize_var=
8926 if test -n "$runpath_var"; then
8927 if test -n "$perm_rpath"; then
8928 # We should set the runpath_var.
8929 rpath=
8930 for dir in $perm_rpath; do
8931 func_append rpath "$dir:"
8932 done
8933 compile_var="$runpath_var=\"$rpath\$$runpath_var\" "
8934 fi
8935 if test -n "$finalize_perm_rpath"; then
8936 # We should set the runpath_var.
8937 rpath=
8938 for dir in $finalize_perm_rpath; do
8939 func_append rpath "$dir:"
8940 done
8941 finalize_var="$runpath_var=\"$rpath\$$runpath_var\" "
8942 fi
8943 fi
8944
8945 if test "$no_install" = yes; then
8946 # We don't need to create a wrapper script.
8947 link_command="$compile_var$compile_command$compile_rpath"
8948 # Replace the output file specification.
8949 link_command=`$ECHO "$link_command" | $SED 's%@OUTPUT@%'"$output"'%g'`
8950 # Delete the old output file.
8951 $opt_dry_run || $RM $output
8952 # Link the executable and exit
8953 func_show_eval "$link_command" 'exit $?'
8954
8955 if test -n "$postlink_cmds"; then
8956 func_to_tool_file "$output"
8957 postlink_cmds=`func_echo_all "$postlink_cmds" | $SED -e 's%@OUTPUT@%'"$output"'%g' -e 's%@TOOL_OUTPUT@%'"$func_to_tool_file_result"'%g'`
8958 func_execute_cmds "$postlink_cmds" 'exit $?'
8959 fi
8960
8961 exit $EXIT_SUCCESS
8962 fi
8963
8964 if test "$hardcode_action" = relink; then
8965 # Fast installation is not supported
8966 link_command="$compile_var$compile_command$compile_rpath"
8967 relink_command="$finalize_var$finalize_command$finalize_rpath"
8968
8969 func_warning "this platform does not like uninstalled shared libraries"
8970 func_warning "\`$output' will be relinked during installation"
8971 else
8972 if test "$fast_install" != no; then
8973 link_command="$finalize_var$compile_command$finalize_rpath"
8974 if test "$fast_install" = yes; then
8975 relink_command=`$ECHO "$compile_var$compile_command$compile_rpath" | $SED 's%@OUTPUT@%\$progdir/\$file%g'`
8976 else
8977 # fast_install is set to needless
8978 relink_command=
8979 fi
8980 else
8981 link_command="$compile_var$compile_command$compile_rpath"
8982 relink_command="$finalize_var$finalize_command$finalize_rpath"
8983 fi
8984 fi
8985
8986 # Replace the output file specification.
8987 link_command=`$ECHO "$link_command" | $SED 's%@OUTPUT@%'"$output_objdir/$outputname"'%g'`
8988
8989 # Delete the old output files.
8990 $opt_dry_run || $RM $output $output_objdir/$outputname $output_objdir/lt-$outputname
8991
8992 func_show_eval "$link_command" 'exit $?'
8993
8994 if test -n "$postlink_cmds"; then
8995 func_to_tool_file "$output_objdir/$outputname"
8996 postlink_cmds=`func_echo_all "$postlink_cmds" | $SED -e 's%@OUTPUT@%'"$output_objdir/$outputname"'%g' -e 's%@TOOL_OUTPUT@%'"$func_to_tool_file_result"'%g'`
8997 func_execute_cmds "$postlink_cmds" 'exit $?'
8998 fi
8999
9000 # Now create the wrapper script.
9001 func_verbose "creating $output"
9002
9003 # Quote the relink command for shipping.
9004 if test -n "$relink_command"; then
9005 # Preserve any variables that may affect compiler behavior
9006 for var in $variables_saved_for_relink; do
9007 if eval test -z \"\${$var+set}\"; then
9008 relink_command="{ test -z \"\${$var+set}\" || $lt_unset $var || { $var=; export $var; }; }; $relink_command"
9009 elif eval var_value=\$$var; test -z "$var_value"; then
9010 relink_command="$var=; export $var; $relink_command"
9011 else
9012 func_quote_for_eval "$var_value"
9013 relink_command="$var=$func_quote_for_eval_result; export $var; $relink_command"
9014 fi
9015 done
9016 relink_command="(cd `pwd`; $relink_command)"
9017 relink_command=`$ECHO "$relink_command" | $SED "$sed_quote_subst"`
9018 fi
9019
9020 # Only actually do things if not in dry run mode.
9021 $opt_dry_run || {
9022 # win32 will think the script is a binary if it has
9023 # a .exe suffix, so we strip it off here.
9024 case $output in
9025 *.exe) func_stripname '' '.exe' "$output"
9026 output=$func_stripname_result ;;
9027 esac
9028 # test for cygwin because mv fails w/o .exe extensions
9029 case $host in
9030 *cygwin*)
9031 exeext=.exe
9032 func_stripname '' '.exe' "$outputname"
9033 outputname=$func_stripname_result ;;
9034 *) exeext= ;;
9035 esac
9036 case $host in
9037 *cygwin* | *mingw* )
9038 func_dirname_and_basename "$output" "" "."
9039 output_name=$func_basename_result
9040 output_path=$func_dirname_result
9041 cwrappersource="$output_path/$objdir/lt-$output_name.c"
9042 cwrapper="$output_path/$output_name.exe"
9043 $RM $cwrappersource $cwrapper
9044 trap "$RM $cwrappersource $cwrapper; exit $EXIT_FAILURE" 1 2 15
9045
9046 func_emit_cwrapperexe_src > $cwrappersource
9047
9048 # The wrapper executable is built using the $host compiler,
9049 # because it contains $host paths and files. If cross-
9050 # compiling, it, like the target executable, must be
9051 # executed on the $host or under an emulation environment.
9052 $opt_dry_run || {
9053 $LTCC $LTCFLAGS -o $cwrapper $cwrappersource
9054 $STRIP $cwrapper
9055 }
9056
9057 # Now, create the wrapper script for func_source use:
9058 func_ltwrapper_scriptname $cwrapper
9059 $RM $func_ltwrapper_scriptname_result
9060 trap "$RM $func_ltwrapper_scriptname_result; exit $EXIT_FAILURE" 1 2 15
9061 $opt_dry_run || {
9062 # note: this script will not be executed, so do not chmod.
9063 if test "x$build" = "x$host" ; then
9064 $cwrapper --lt-dump-script > $func_ltwrapper_scriptname_result
9065 else
9066 func_emit_wrapper no > $func_ltwrapper_scriptname_result
9067 fi
9068 }
9069 ;;
9070 * )
9071 $RM $output
9072 trap "$RM $output; exit $EXIT_FAILURE" 1 2 15
9073
9074 func_emit_wrapper no > $output
9075 chmod +x $output
9076 ;;
9077 esac
9078 }
9079 exit $EXIT_SUCCESS
9080 ;;
9081 esac
9082
9083 # See if we need to build an old-fashioned archive.
9084 for oldlib in $oldlibs; do
9085
9086 if test "$build_libtool_libs" = convenience; then
9087 oldobjs="$libobjs_save $symfileobj"
9088 addlibs="$convenience"
9089 build_libtool_libs=no
9090 else
9091 if test "$build_libtool_libs" = module; then
9092 oldobjs="$libobjs_save"
9093 build_libtool_libs=no
9094 else
9095 oldobjs="$old_deplibs $non_pic_objects"
9096 if test "$preload" = yes && test -f "$symfileobj"; then
9097 func_append oldobjs " $symfileobj"
9098 fi
9099 fi
9100 addlibs="$old_convenience"
9101 fi
9102
9103 if test -n "$addlibs"; then
9104 gentop="$output_objdir/${outputname}x"
9105 func_append generated " $gentop"
9106
9107 func_extract_archives $gentop $addlibs
9108 func_append oldobjs " $func_extract_archives_result"
9109 fi
9110
9111 # Do each command in the archive commands.
9112 if test -n "$old_archive_from_new_cmds" && test "$build_libtool_libs" = yes; then
9113 cmds=$old_archive_from_new_cmds
9114 else
9115
9116 # Add any objects from preloaded convenience libraries
9117 if test -n "$dlprefiles"; then
9118 gentop="$output_objdir/${outputname}x"
9119 func_append generated " $gentop"
9120
9121 func_extract_archives $gentop $dlprefiles
9122 func_append oldobjs " $func_extract_archives_result"
9123 fi
9124
9125 # POSIX demands no paths to be encoded in archives. We have
9126 # to avoid creating archives with duplicate basenames if we
9127 # might have to extract them afterwards, e.g., when creating a
9128 # static archive out of a convenience library, or when linking
9129 # the entirety of a libtool archive into another (currently
9130 # not supported by libtool).
9131 if (for obj in $oldobjs
9132 do
9133 func_basename "$obj"
9134 $ECHO "$func_basename_result"
9135 done | sort | sort -uc >/dev/null 2>&1); then
9136 :
9137 else
9138 echo "copying selected object files to avoid basename conflicts..."
9139 gentop="$output_objdir/${outputname}x"
9140 func_append generated " $gentop"
9141 func_mkdir_p "$gentop"
9142 save_oldobjs=$oldobjs
9143 oldobjs=
9144 counter=1
9145 for obj in $save_oldobjs
9146 do
9147 func_basename "$obj"
9148 objbase="$func_basename_result"
9149 case " $oldobjs " in
9150 " ") oldobjs=$obj ;;
9151 *[\ /]"$objbase "*)
9152 while :; do
9153 # Make sure we don't pick an alternate name that also
9154 # overlaps.
9155 newobj=lt$counter-$objbase
9156 func_arith $counter + 1
9157 counter=$func_arith_result
9158 case " $oldobjs " in
9159 *[\ /]"$newobj "*) ;;
9160 *) if test ! -f "$gentop/$newobj"; then break; fi ;;
9161 esac
9162 done
9163 func_show_eval "ln $obj $gentop/$newobj || cp $obj $gentop/$newobj"
9164 func_append oldobjs " $gentop/$newobj"
9165 ;;
9166 *) func_append oldobjs " $obj" ;;
9167 esac
9168 done
9169 fi
9170 func_to_tool_file "$oldlib" func_convert_file_msys_to_w32
9171 tool_oldlib=$func_to_tool_file_result
9172 eval cmds=\"$old_archive_cmds\"
9173
9174 func_len " $cmds"
9175 len=$func_len_result
9176 if test "$len" -lt "$max_cmd_len" || test "$max_cmd_len" -le -1; then
9177 cmds=$old_archive_cmds
9178 elif test -n "$archiver_list_spec"; then
9179 func_verbose "using command file archive linking..."
9180 for obj in $oldobjs
9181 do
9182 func_to_tool_file "$obj"
9183 $ECHO "$func_to_tool_file_result"
9184 done > $output_objdir/$libname.libcmd
9185 func_to_tool_file "$output_objdir/$libname.libcmd"
9186 oldobjs=" $archiver_list_spec$func_to_tool_file_result"
9187 cmds=$old_archive_cmds
9188 else
9189 # the command line is too long to link in one step, link in parts
9190 func_verbose "using piecewise archive linking..."
9191 save_RANLIB=$RANLIB
9192 RANLIB=:
9193 objlist=
9194 concat_cmds=
9195 save_oldobjs=$oldobjs
9196 oldobjs=
9197 # Is there a better way of finding the last object in the list?
9198 for obj in $save_oldobjs
9199 do
9200 last_oldobj=$obj
9201 done
9202 eval test_cmds=\"$old_archive_cmds\"
9203 func_len " $test_cmds"
9204 len0=$func_len_result
9205 len=$len0
9206 for obj in $save_oldobjs
9207 do
9208 func_len " $obj"
9209 func_arith $len + $func_len_result
9210 len=$func_arith_result
9211 func_append objlist " $obj"
9212 if test "$len" -lt "$max_cmd_len"; then
9213 :
9214 else
9215 # the above command should be used before it gets too long
9216 oldobjs=$objlist
9217 if test "$obj" = "$last_oldobj" ; then
9218 RANLIB=$save_RANLIB
9219 fi
9220 test -z "$concat_cmds" || concat_cmds=$concat_cmds~
9221 eval concat_cmds=\"\${concat_cmds}$old_archive_cmds\"
9222 objlist=
9223 len=$len0
9224 fi
9225 done
9226 RANLIB=$save_RANLIB
9227 oldobjs=$objlist
9228 if test "X$oldobjs" = "X" ; then
9229 eval cmds=\"\$concat_cmds\"
9230 else
9231 eval cmds=\"\$concat_cmds~\$old_archive_cmds\"
9232 fi
9233 fi
9234 fi
9235 func_execute_cmds "$cmds" 'exit $?'
9236 done
9237
9238 test -n "$generated" && \
9239 func_show_eval "${RM}r$generated"
9240
9241 # Now create the libtool archive.
9242 case $output in
9243 *.la)
9244 old_library=
9245 test "$build_old_libs" = yes && old_library="$libname.$libext"
9246 func_verbose "creating $output"
9247
9248 # Preserve any variables that may affect compiler behavior
9249 for var in $variables_saved_for_relink; do
9250 if eval test -z \"\${$var+set}\"; then
9251 relink_command="{ test -z \"\${$var+set}\" || $lt_unset $var || { $var=; export $var; }; }; $relink_command"
9252 elif eval var_value=\$$var; test -z "$var_value"; then
9253 relink_command="$var=; export $var; $relink_command"
9254 else
9255 func_quote_for_eval "$var_value"
9256 relink_command="$var=$func_quote_for_eval_result; export $var; $relink_command"
9257 fi
9258 done
9259 # Quote the link command for shipping.
9260 relink_command="(cd `pwd`; $SHELL $progpath $preserve_args --mode=relink $libtool_args @inst_prefix_dir@)"
9261 relink_command=`$ECHO "$relink_command" | $SED "$sed_quote_subst"`
9262 if test "$hardcode_automatic" = yes ; then
9263 relink_command=
9264 fi
9265
9266 # Only create the output if not a dry run.
9267 $opt_dry_run || {
9268 for installed in no yes; do
9269 if test "$installed" = yes; then
9270 if test -z "$install_libdir"; then
9271 break
9272 fi
9273 output="$output_objdir/$outputname"i
9274 # Replace all uninstalled libtool libraries with the installed ones
9275 newdependency_libs=
9276 for deplib in $dependency_libs; do
9277 case $deplib in
9278 *.la)
9279 func_basename "$deplib"
9280 name="$func_basename_result"
9281 func_resolve_sysroot "$deplib"
9282 eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $func_resolve_sysroot_result`
9283 test -z "$libdir" && \
9284 func_fatal_error "\`$deplib' is not a valid libtool archive"
9285 func_append newdependency_libs " ${lt_sysroot:+=}$libdir/$name"
9286 ;;
9287 -L*)
9288 func_stripname -L '' "$deplib"
9289 func_replace_sysroot "$func_stripname_result"
9290 func_append newdependency_libs " -L$func_replace_sysroot_result"
9291 ;;
9292 -R*)
9293 func_stripname -R '' "$deplib"
9294 func_replace_sysroot "$func_stripname_result"
9295 func_append newdependency_libs " -R$func_replace_sysroot_result"
9296 ;;
9297 *) func_append newdependency_libs " $deplib" ;;
9298 esac
9299 done
9300 dependency_libs="$newdependency_libs"
9301 newdlfiles=
9302
9303 for lib in $dlfiles; do
9304 case $lib in
9305 *.la)
9306 func_basename "$lib"
9307 name="$func_basename_result"
9308 eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
9309 test -z "$libdir" && \
9310 func_fatal_error "\`$lib' is not a valid libtool archive"
9311 func_append newdlfiles " ${lt_sysroot:+=}$libdir/$name"
9312 ;;
9313 *) func_append newdlfiles " $lib" ;;
9314 esac
9315 done
9316 dlfiles="$newdlfiles"
9317 newdlprefiles=
9318 for lib in $dlprefiles; do
9319 case $lib in
9320 *.la)
9321 # Only pass preopened files to the pseudo-archive (for
9322 # eventual linking with the app. that links it) if we
9323 # didn't already link the preopened objects directly into
9324 # the library:
9325 func_basename "$lib"
9326 name="$func_basename_result"
9327 eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
9328 test -z "$libdir" && \
9329 func_fatal_error "\`$lib' is not a valid libtool archive"
9330 func_append newdlprefiles " ${lt_sysroot:+=}$libdir/$name"
9331 ;;
9332 esac
9333 done
9334 dlprefiles="$newdlprefiles"
9335 else
9336 newdlfiles=
9337 for lib in $dlfiles; do
9338 case $lib in
9339 [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;;
9340 *) abs=`pwd`"/$lib" ;;
9341 esac
9342 func_append newdlfiles " $abs"
9343 done
9344 dlfiles="$newdlfiles"
9345 newdlprefiles=
9346 for lib in $dlprefiles; do
9347 case $lib in
9348 [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;;
9349 *) abs=`pwd`"/$lib" ;;
9350 esac
9351 func_append newdlprefiles " $abs"
9352 done
9353 dlprefiles="$newdlprefiles"
9354 fi
9355 $RM $output
9356 # place dlname in correct position for cygwin
9357 # In fact, it would be nice if we could use this code for all target
9358 # systems that can't hard-code library paths into their executables
9359 # and that have no shared library path variable independent of PATH,
9360 # but it turns out we can't easily determine that from inspecting
9361 # libtool variables, so we have to hard-code the OSs to which it
9362 # applies here; at the moment, that means platforms that use the PE
9363 # object format with DLL files. See the long comment at the top of
9364 # tests/bindir.at for full details.
9365 tdlname=$dlname
9366 case $host,$output,$installed,$module,$dlname in
9367 *cygwin*,*lai,yes,no,*.dll | *mingw*,*lai,yes,no,*.dll | *cegcc*,*lai,yes,no,*.dll)
9368 # If a -bindir argument was supplied, place the dll there.
9369 if test "x$bindir" != x ;
9370 then
9371 func_relative_path "$install_libdir" "$bindir"
9372 tdlname=$func_relative_path_result$dlname
9373 else
9374 # Otherwise fall back on heuristic.
9375 tdlname=../bin/$dlname
9376 fi
9377 ;;
9378 esac
9379 $ECHO > $output "\
9380 # $outputname - a libtool library file
9381 # Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION
9382 #
9383 # Please DO NOT delete this file!
9384 # It is necessary for linking the library.
9385
9386 # The name that we can dlopen(3).
9387 dlname='$tdlname'
9388
9389 # Names of this library.
9390 library_names='$library_names'
9391
9392 # The name of the static archive.
9393 old_library='$old_library'
9394
9395 # Linker flags that can not go in dependency_libs.
9396 inherited_linker_flags='$new_inherited_linker_flags'
9397
9398 # Libraries that this one depends upon.
9399 dependency_libs='$dependency_libs'
9400
9401 # Names of additional weak libraries provided by this library
9402 weak_library_names='$weak_libs'
9403
9404 # Version information for $libname.
9405 current=$current
9406 age=$age
9407 revision=$revision
9408
9409 # Is this an already installed library?
9410 installed=$installed
9411
9412 # Should we warn about portability when linking against -modules?
9413 shouldnotlink=$module
9414
9415 # Files to dlopen/dlpreopen
9416 dlopen='$dlfiles'
9417 dlpreopen='$dlprefiles'
9418
9419 # Directory that this library needs to be installed in:
9420 libdir='$install_libdir'"
9421 if test "$installed" = no && test "$need_relink" = yes; then
9422 $ECHO >> $output "\
9423 relink_command=\"$relink_command\""
9424 fi
9425 done
9426 }
9427
9428 # Do a symbolic link so that the libtool archive can be found in
9429 # LD_LIBRARY_PATH before the program is installed.
9430 func_show_eval '( cd "$output_objdir" && $RM "$outputname" && $LN_S "../$outputname" "$outputname" )' 'exit $?'
9431 ;;
9432 esac
9433 exit $EXIT_SUCCESS
9434 }
9435
9436 { test "$opt_mode" = link || test "$opt_mode" = relink; } &&
9437 func_mode_link ${1+"$@"}
9438
9439
9440 # func_mode_uninstall arg...
9441 func_mode_uninstall ()
9442 {
9443 $opt_debug
9444 RM="$nonopt"
9445 files=
9446 rmforce=
9447 exit_status=0
9448
9449 # This variable tells wrapper scripts just to set variables rather
9450 # than running their programs.
9451 libtool_install_magic="$magic"
9452
9453 for arg
9454 do
9455 case $arg in
9456 -f) func_append RM " $arg"; rmforce=yes ;;
9457 -*) func_append RM " $arg" ;;
9458 *) func_append files " $arg" ;;
9459 esac
9460 done
9461
9462 test -z "$RM" && \
9463 func_fatal_help "you must specify an RM program"
9464
9465 rmdirs=
9466
9467 for file in $files; do
9468 func_dirname "$file" "" "."
9469 dir="$func_dirname_result"
9470 if test "X$dir" = X.; then
9471 odir="$objdir"
9472 else
9473 odir="$dir/$objdir"
9474 fi
9475 func_basename "$file"
9476 name="$func_basename_result"
9477 test "$opt_mode" = uninstall && odir="$dir"
9478
9479 # Remember odir for removal later, being careful to avoid duplicates
9480 if test "$opt_mode" = clean; then
9481 case " $rmdirs " in
9482 *" $odir "*) ;;
9483 *) func_append rmdirs " $odir" ;;
9484 esac
9485 fi
9486
9487 # Don't error if the file doesn't exist and rm -f was used.
9488 if { test -L "$file"; } >/dev/null 2>&1 ||
9489 { test -h "$file"; } >/dev/null 2>&1 ||
9490 test -f "$file"; then
9491 :
9492 elif test -d "$file"; then
9493 exit_status=1
9494 continue
9495 elif test "$rmforce" = yes; then
9496 continue
9497 fi
9498
9499 rmfiles="$file"
9500
9501 case $name in
9502 *.la)
9503 # Possibly a libtool archive, so verify it.
9504 if func_lalib_p "$file"; then
9505 func_source $dir/$name
9506
9507 # Delete the libtool libraries and symlinks.
9508 for n in $library_names; do
9509 func_append rmfiles " $odir/$n"
9510 done
9511 test -n "$old_library" && func_append rmfiles " $odir/$old_library"
9512
9513 case "$opt_mode" in
9514 clean)
9515 case " $library_names " in
9516 *" $dlname "*) ;;
9517 *) test -n "$dlname" && func_append rmfiles " $odir/$dlname" ;;
9518 esac
9519 test -n "$libdir" && func_append rmfiles " $odir/$name $odir/${name}i"
9520 ;;
9521 uninstall)
9522 if test -n "$library_names"; then
9523 # Do each command in the postuninstall commands.
9524 func_execute_cmds "$postuninstall_cmds" 'test "$rmforce" = yes || exit_status=1'
9525 fi
9526
9527 if test -n "$old_library"; then
9528 # Do each command in the old_postuninstall commands.
9529 func_execute_cmds "$old_postuninstall_cmds" 'test "$rmforce" = yes || exit_status=1'
9530 fi
9531 # FIXME: should reinstall the best remaining shared library.
9532 ;;
9533 esac
9534 fi
9535 ;;
9536
9537 *.lo)
9538 # Possibly a libtool object, so verify it.
9539 if func_lalib_p "$file"; then
9540
9541 # Read the .lo file
9542 func_source $dir/$name
9543
9544 # Add PIC object to the list of files to remove.
9545 if test -n "$pic_object" &&
9546 test "$pic_object" != none; then
9547 func_append rmfiles " $dir/$pic_object"
9548 fi
9549
9550 # Add non-PIC object to the list of files to remove.
9551 if test -n "$non_pic_object" &&
9552 test "$non_pic_object" != none; then
9553 func_append rmfiles " $dir/$non_pic_object"
9554 fi
9555 fi
9556 ;;
9557
9558 *)
9559 if test "$opt_mode" = clean ; then
9560 noexename=$name
9561 case $file in
9562 *.exe)
9563 func_stripname '' '.exe' "$file"
9564 file=$func_stripname_result
9565 func_stripname '' '.exe' "$name"
9566 noexename=$func_stripname_result
9567 # $file with .exe has already been added to rmfiles,
9568 # add $file without .exe
9569 func_append rmfiles " $file"
9570 ;;
9571 esac
9572 # Do a test to see if this is a libtool program.
9573 if func_ltwrapper_p "$file"; then
9574 if func_ltwrapper_executable_p "$file"; then
9575 func_ltwrapper_scriptname "$file"
9576 relink_command=
9577 func_source $func_ltwrapper_scriptname_result
9578 func_append rmfiles " $func_ltwrapper_scriptname_result"
9579 else
9580 relink_command=
9581 func_source $dir/$noexename
9582 fi
9583
9584 # note $name still contains .exe if it was in $file originally
9585 # as does the version of $file that was added into $rmfiles
9586 func_append rmfiles " $odir/$name $odir/${name}S.${objext}"
9587 if test "$fast_install" = yes && test -n "$relink_command"; then
9588 func_append rmfiles " $odir/lt-$name"
9589 fi
9590 if test "X$noexename" != "X$name" ; then
9591 func_append rmfiles " $odir/lt-${noexename}.c"
9592 fi
9593 fi
9594 fi
9595 ;;
9596 esac
9597 func_show_eval "$RM $rmfiles" 'exit_status=1'
9598 done
9599
9600 # Try to remove the ${objdir}s in the directories where we deleted files
9601 for dir in $rmdirs; do
9602 if test -d "$dir"; then
9603 func_show_eval "rmdir $dir >/dev/null 2>&1"
9604 fi
9605 done
9606
9607 exit $exit_status
9608 }
9609
9610 { test "$opt_mode" = uninstall || test "$opt_mode" = clean; } &&
9611 func_mode_uninstall ${1+"$@"}
9612
9613 test -z "$opt_mode" && {
9614 help="$generic_help"
9615 func_fatal_help "you must specify a MODE"
9616 }
9617
9618 test -z "$exec_cmd" && \
9619 func_fatal_help "invalid operation mode \`$opt_mode'"
9620
9621 if test -n "$exec_cmd"; then
9622 eval exec "$exec_cmd"
9623 exit $EXIT_FAILURE
9624 fi
9625
9626 exit $exit_status
9627
9628
9629 # The TAGs below are defined such that we never get into a situation
9630 # in which we disable both kinds of libraries. Given conflicting
9631 # choices, we go for a static library, that is the most portable,
9632 # since we can't tell whether shared libraries were disabled because
9633 # the user asked for that or because the platform doesn't support
9634 # them. This is particularly important on AIX, because we don't
9635 # support having both static and shared libraries enabled at the same
9636 # time on that platform, so we default to a shared-only configuration.
9637 # If a disable-shared tag is given, we'll fallback to a static-only
9638 # configuration. But we'll never go from static-only to shared-only.
9639
9640 # ### BEGIN LIBTOOL TAG CONFIG: disable-shared
9641 build_libtool_libs=no
9642 build_old_libs=yes
9643 # ### END LIBTOOL TAG CONFIG: disable-shared
9644
9645 # ### BEGIN LIBTOOL TAG CONFIG: disable-static
9646 build_old_libs=`case $build_libtool_libs in yes) echo no;; *) echo yes;; esac`
9647 # ### END LIBTOOL TAG CONFIG: disable-static
9648
9649 # Local Variables:
9650 # mode:shell-script
9651 # sh-indentation:2
9652 # End:
9653 # vi:sw=2
9654
0 # libtool.m4 - Configure libtool for the host system. -*-Autoconf-*-
1 #
2 # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005,
3 # 2006, 2007, 2008, 2009, 2010, 2011 Free Software
4 # Foundation, Inc.
5 # Written by Gordon Matzigkeit, 1996
6 #
7 # This file is free software; the Free Software Foundation gives
8 # unlimited permission to copy and/or distribute it, with or without
9 # modifications, as long as this notice is preserved.
10
11 m4_define([_LT_COPYING], [dnl
12 # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005,
13 # 2006, 2007, 2008, 2009, 2010, 2011 Free Software
14 # Foundation, Inc.
15 # Written by Gordon Matzigkeit, 1996
16 #
17 # This file is part of GNU Libtool.
18 #
19 # GNU Libtool is free software; you can redistribute it and/or
20 # modify it under the terms of the GNU General Public License as
21 # published by the Free Software Foundation; either version 2 of
22 # the License, or (at your option) any later version.
23 #
24 # As a special exception to the GNU General Public License,
25 # if you distribute this file as part of a program or library that
26 # is built using GNU Libtool, you may include this file under the
27 # same distribution terms that you use for the rest of that program.
28 #
29 # GNU Libtool is distributed in the hope that it will be useful,
30 # but WITHOUT ANY WARRANTY; without even the implied warranty of
31 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
32 # GNU General Public License for more details.
33 #
34 # You should have received a copy of the GNU General Public License
35 # along with GNU Libtool; see the file COPYING. If not, a copy
36 # can be downloaded from http://www.gnu.org/licenses/gpl.html, or
37 # obtained by writing to the Free Software Foundation, Inc.,
38 # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
39 ])
40
41 # serial 57 LT_INIT
42
43
44 # LT_PREREQ(VERSION)
45 # ------------------
46 # Complain and exit if this libtool version is less that VERSION.
47 m4_defun([LT_PREREQ],
48 [m4_if(m4_version_compare(m4_defn([LT_PACKAGE_VERSION]), [$1]), -1,
49 [m4_default([$3],
50 [m4_fatal([Libtool version $1 or higher is required],
51 63)])],
52 [$2])])
53
54
55 # _LT_CHECK_BUILDDIR
56 # ------------------
57 # Complain if the absolute build directory name contains unusual characters
58 m4_defun([_LT_CHECK_BUILDDIR],
59 [case `pwd` in
60 *\ * | *\ *)
61 AC_MSG_WARN([Libtool does not cope well with whitespace in `pwd`]) ;;
62 esac
63 ])
64
65
66 # LT_INIT([OPTIONS])
67 # ------------------
68 AC_DEFUN([LT_INIT],
69 [AC_PREREQ([2.58])dnl We use AC_INCLUDES_DEFAULT
70 AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT])dnl
71 AC_BEFORE([$0], [LT_LANG])dnl
72 AC_BEFORE([$0], [LT_OUTPUT])dnl
73 AC_BEFORE([$0], [LTDL_INIT])dnl
74 m4_require([_LT_CHECK_BUILDDIR])dnl
75
76 dnl Autoconf doesn't catch unexpanded LT_ macros by default:
77 m4_pattern_forbid([^_?LT_[A-Z_]+$])dnl
78 m4_pattern_allow([^(_LT_EOF|LT_DLGLOBAL|LT_DLLAZY_OR_NOW|LT_MULTI_MODULE)$])dnl
79 dnl aclocal doesn't pull ltoptions.m4, ltsugar.m4, or ltversion.m4
80 dnl unless we require an AC_DEFUNed macro:
81 AC_REQUIRE([LTOPTIONS_VERSION])dnl
82 AC_REQUIRE([LTSUGAR_VERSION])dnl
83 AC_REQUIRE([LTVERSION_VERSION])dnl
84 AC_REQUIRE([LTOBSOLETE_VERSION])dnl
85 m4_require([_LT_PROG_LTMAIN])dnl
86
87 _LT_SHELL_INIT([SHELL=${CONFIG_SHELL-/bin/sh}])
88
89 dnl Parse OPTIONS
90 _LT_SET_OPTIONS([$0], [$1])
91
92 # This can be used to rebuild libtool when needed
93 LIBTOOL_DEPS="$ltmain"
94
95 # Always use our own libtool.
96 LIBTOOL='$(SHELL) $(top_builddir)/libtool'
97 AC_SUBST(LIBTOOL)dnl
98
99 _LT_SETUP
100
101 # Only expand once:
102 m4_define([LT_INIT])
103 ])# LT_INIT
104
105 # Old names:
106 AU_ALIAS([AC_PROG_LIBTOOL], [LT_INIT])
107 AU_ALIAS([AM_PROG_LIBTOOL], [LT_INIT])
108 dnl aclocal-1.4 backwards compatibility:
109 dnl AC_DEFUN([AC_PROG_LIBTOOL], [])
110 dnl AC_DEFUN([AM_PROG_LIBTOOL], [])
111
112
113 # _LT_CC_BASENAME(CC)
114 # -------------------
115 # Calculate cc_basename. Skip known compiler wrappers and cross-prefix.
116 m4_defun([_LT_CC_BASENAME],
117 [for cc_temp in $1""; do
118 case $cc_temp in
119 compile | *[[\\/]]compile | ccache | *[[\\/]]ccache ) ;;
120 distcc | *[[\\/]]distcc | purify | *[[\\/]]purify ) ;;
121 \-*) ;;
122 *) break;;
123 esac
124 done
125 cc_basename=`$ECHO "$cc_temp" | $SED "s%.*/%%; s%^$host_alias-%%"`
126 ])
127
128
129 # _LT_FILEUTILS_DEFAULTS
130 # ----------------------
131 # It is okay to use these file commands and assume they have been set
132 # sensibly after `m4_require([_LT_FILEUTILS_DEFAULTS])'.
133 m4_defun([_LT_FILEUTILS_DEFAULTS],
134 [: ${CP="cp -f"}
135 : ${MV="mv -f"}
136 : ${RM="rm -f"}
137 ])# _LT_FILEUTILS_DEFAULTS
138
139
140 # _LT_SETUP
141 # ---------
142 m4_defun([_LT_SETUP],
143 [AC_REQUIRE([AC_CANONICAL_HOST])dnl
144 AC_REQUIRE([AC_CANONICAL_BUILD])dnl
145 AC_REQUIRE([_LT_PREPARE_SED_QUOTE_VARS])dnl
146 AC_REQUIRE([_LT_PROG_ECHO_BACKSLASH])dnl
147
148 _LT_DECL([], [PATH_SEPARATOR], [1], [The PATH separator for the build system])dnl
149 dnl
150 _LT_DECL([], [host_alias], [0], [The host system])dnl
151 _LT_DECL([], [host], [0])dnl
152 _LT_DECL([], [host_os], [0])dnl
153 dnl
154 _LT_DECL([], [build_alias], [0], [The build system])dnl
155 _LT_DECL([], [build], [0])dnl
156 _LT_DECL([], [build_os], [0])dnl
157 dnl
158 AC_REQUIRE([AC_PROG_CC])dnl
159 AC_REQUIRE([LT_PATH_LD])dnl
160 AC_REQUIRE([LT_PATH_NM])dnl
161 dnl
162 AC_REQUIRE([AC_PROG_LN_S])dnl
163 test -z "$LN_S" && LN_S="ln -s"
164 _LT_DECL([], [LN_S], [1], [Whether we need soft or hard links])dnl
165 dnl
166 AC_REQUIRE([LT_CMD_MAX_LEN])dnl
167 _LT_DECL([objext], [ac_objext], [0], [Object file suffix (normally "o")])dnl
168 _LT_DECL([], [exeext], [0], [Executable file suffix (normally "")])dnl
169 dnl
170 m4_require([_LT_FILEUTILS_DEFAULTS])dnl
171 m4_require([_LT_CHECK_SHELL_FEATURES])dnl
172 m4_require([_LT_PATH_CONVERSION_FUNCTIONS])dnl
173 m4_require([_LT_CMD_RELOAD])dnl
174 m4_require([_LT_CHECK_MAGIC_METHOD])dnl
175 m4_require([_LT_CHECK_SHAREDLIB_FROM_LINKLIB])dnl
176 m4_require([_LT_CMD_OLD_ARCHIVE])dnl
177 m4_require([_LT_CMD_GLOBAL_SYMBOLS])dnl
178 m4_require([_LT_WITH_SYSROOT])dnl
179
180 _LT_CONFIG_LIBTOOL_INIT([
181 # See if we are running on zsh, and set the options which allow our
182 # commands through without removal of \ escapes INIT.
183 if test -n "\${ZSH_VERSION+set}" ; then
184 setopt NO_GLOB_SUBST
185 fi
186 ])
187 if test -n "${ZSH_VERSION+set}" ; then
188 setopt NO_GLOB_SUBST
189 fi
190
191 _LT_CHECK_OBJDIR
192
193 m4_require([_LT_TAG_COMPILER])dnl
194
195 case $host_os in
196 aix3*)
197 # AIX sometimes has problems with the GCC collect2 program. For some
198 # reason, if we set the COLLECT_NAMES environment variable, the problems
199 # vanish in a puff of smoke.
200 if test "X${COLLECT_NAMES+set}" != Xset; then
201 COLLECT_NAMES=
202 export COLLECT_NAMES
203 fi
204 ;;
205 esac
206
207 # Global variables:
208 ofile=libtool
209 can_build_shared=yes
210
211 # All known linkers require a `.a' archive for static linking (except MSVC,
212 # which needs '.lib').
213 libext=a
214
215 with_gnu_ld="$lt_cv_prog_gnu_ld"
216
217 old_CC="$CC"
218 old_CFLAGS="$CFLAGS"
219
220 # Set sane defaults for various variables
221 test -z "$CC" && CC=cc
222 test -z "$LTCC" && LTCC=$CC
223 test -z "$LTCFLAGS" && LTCFLAGS=$CFLAGS
224 test -z "$LD" && LD=ld
225 test -z "$ac_objext" && ac_objext=o
226
227 _LT_CC_BASENAME([$compiler])
228
229 # Only perform the check for file, if the check method requires it
230 test -z "$MAGIC_CMD" && MAGIC_CMD=file
231 case $deplibs_check_method in
232 file_magic*)
233 if test "$file_magic_cmd" = '$MAGIC_CMD'; then
234 _LT_PATH_MAGIC
235 fi
236 ;;
237 esac
238
239 # Use C for the default configuration in the libtool script
240 LT_SUPPORTED_TAG([CC])
241 _LT_LANG_C_CONFIG
242 _LT_LANG_DEFAULT_CONFIG
243 _LT_CONFIG_COMMANDS
244 ])# _LT_SETUP
245
246
247 # _LT_PREPARE_SED_QUOTE_VARS
248 # --------------------------
249 # Define a few sed substitution that help us do robust quoting.
250 m4_defun([_LT_PREPARE_SED_QUOTE_VARS],
251 [# Backslashify metacharacters that are still active within
252 # double-quoted strings.
253 sed_quote_subst='s/\([["`$\\]]\)/\\\1/g'
254
255 # Same as above, but do not quote variable references.
256 double_quote_subst='s/\([["`\\]]\)/\\\1/g'
257
258 # Sed substitution to delay expansion of an escaped shell variable in a
259 # double_quote_subst'ed string.
260 delay_variable_subst='s/\\\\\\\\\\\$/\\\\\\$/g'
261
262 # Sed substitution to delay expansion of an escaped single quote.
263 delay_single_quote_subst='s/'\''/'\'\\\\\\\'\''/g'
264
265 # Sed substitution to avoid accidental globbing in evaled expressions
266 no_glob_subst='s/\*/\\\*/g'
267 ])
268
269 # _LT_PROG_LTMAIN
270 # ---------------
271 # Note that this code is called both from `configure', and `config.status'
272 # now that we use AC_CONFIG_COMMANDS to generate libtool. Notably,
273 # `config.status' has no value for ac_aux_dir unless we are using Automake,
274 # so we pass a copy along to make sure it has a sensible value anyway.
275 m4_defun([_LT_PROG_LTMAIN],
276 [m4_ifdef([AC_REQUIRE_AUX_FILE], [AC_REQUIRE_AUX_FILE([ltmain.sh])])dnl
277 _LT_CONFIG_LIBTOOL_INIT([ac_aux_dir='$ac_aux_dir'])
278 ltmain="$ac_aux_dir/ltmain.sh"
279 ])# _LT_PROG_LTMAIN
280
281
282 ## ------------------------------------- ##
283 ## Accumulate code for creating libtool. ##
284 ## ------------------------------------- ##
285
286 # So that we can recreate a full libtool script including additional
287 # tags, we accumulate the chunks of code to send to AC_CONFIG_COMMANDS
288 # in macros and then make a single call at the end using the `libtool'
289 # label.
290
291
292 # _LT_CONFIG_LIBTOOL_INIT([INIT-COMMANDS])
293 # ----------------------------------------
294 # Register INIT-COMMANDS to be passed to AC_CONFIG_COMMANDS later.
295 m4_define([_LT_CONFIG_LIBTOOL_INIT],
296 [m4_ifval([$1],
297 [m4_append([_LT_OUTPUT_LIBTOOL_INIT],
298 [$1
299 ])])])
300
301 # Initialize.
302 m4_define([_LT_OUTPUT_LIBTOOL_INIT])
303
304
305 # _LT_CONFIG_LIBTOOL([COMMANDS])
306 # ------------------------------
307 # Register COMMANDS to be passed to AC_CONFIG_COMMANDS later.
308 m4_define([_LT_CONFIG_LIBTOOL],
309 [m4_ifval([$1],
310 [m4_append([_LT_OUTPUT_LIBTOOL_COMMANDS],
311 [$1
312 ])])])
313
314 # Initialize.
315 m4_define([_LT_OUTPUT_LIBTOOL_COMMANDS])
316
317
318 # _LT_CONFIG_SAVE_COMMANDS([COMMANDS], [INIT_COMMANDS])
319 # -----------------------------------------------------
320 m4_defun([_LT_CONFIG_SAVE_COMMANDS],
321 [_LT_CONFIG_LIBTOOL([$1])
322 _LT_CONFIG_LIBTOOL_INIT([$2])
323 ])
324
325
326 # _LT_FORMAT_COMMENT([COMMENT])
327 # -----------------------------
328 # Add leading comment marks to the start of each line, and a trailing
329 # full-stop to the whole comment if one is not present already.
330 m4_define([_LT_FORMAT_COMMENT],
331 [m4_ifval([$1], [
332 m4_bpatsubst([m4_bpatsubst([$1], [^ *], [# ])],
333 [['`$\]], [\\\&])]m4_bmatch([$1], [[!?.]$], [], [.])
334 )])
335
336
337
338 ## ------------------------ ##
339 ## FIXME: Eliminate VARNAME ##
340 ## ------------------------ ##
341
342
343 # _LT_DECL([CONFIGNAME], VARNAME, VALUE, [DESCRIPTION], [IS-TAGGED?])
344 # -------------------------------------------------------------------
345 # CONFIGNAME is the name given to the value in the libtool script.
346 # VARNAME is the (base) name used in the configure script.
347 # VALUE may be 0, 1 or 2 for a computed quote escaped value based on
348 # VARNAME. Any other value will be used directly.
349 m4_define([_LT_DECL],
350 [lt_if_append_uniq([lt_decl_varnames], [$2], [, ],
351 [lt_dict_add_subkey([lt_decl_dict], [$2], [libtool_name],
352 [m4_ifval([$1], [$1], [$2])])
353 lt_dict_add_subkey([lt_decl_dict], [$2], [value], [$3])
354 m4_ifval([$4],
355 [lt_dict_add_subkey([lt_decl_dict], [$2], [description], [$4])])
356 lt_dict_add_subkey([lt_decl_dict], [$2],
357 [tagged?], [m4_ifval([$5], [yes], [no])])])
358 ])
359
360
361 # _LT_TAGDECL([CONFIGNAME], VARNAME, VALUE, [DESCRIPTION])
362 # --------------------------------------------------------
363 m4_define([_LT_TAGDECL], [_LT_DECL([$1], [$2], [$3], [$4], [yes])])
364
365
366 # lt_decl_tag_varnames([SEPARATOR], [VARNAME1...])
367 # ------------------------------------------------
368 m4_define([lt_decl_tag_varnames],
369 [_lt_decl_filter([tagged?], [yes], $@)])
370
371
372 # _lt_decl_filter(SUBKEY, VALUE, [SEPARATOR], [VARNAME1..])
373 # ---------------------------------------------------------
374 m4_define([_lt_decl_filter],
375 [m4_case([$#],
376 [0], [m4_fatal([$0: too few arguments: $#])],
377 [1], [m4_fatal([$0: too few arguments: $#: $1])],
378 [2], [lt_dict_filter([lt_decl_dict], [$1], [$2], [], lt_decl_varnames)],
379 [3], [lt_dict_filter([lt_decl_dict], [$1], [$2], [$3], lt_decl_varnames)],
380 [lt_dict_filter([lt_decl_dict], $@)])[]dnl
381 ])
382
383
384 # lt_decl_quote_varnames([SEPARATOR], [VARNAME1...])
385 # --------------------------------------------------
386 m4_define([lt_decl_quote_varnames],
387 [_lt_decl_filter([value], [1], $@)])
388
389
390 # lt_decl_dquote_varnames([SEPARATOR], [VARNAME1...])
391 # ---------------------------------------------------
392 m4_define([lt_decl_dquote_varnames],
393 [_lt_decl_filter([value], [2], $@)])
394
395
396 # lt_decl_varnames_tagged([SEPARATOR], [VARNAME1...])
397 # ---------------------------------------------------
398 m4_define([lt_decl_varnames_tagged],
399 [m4_assert([$# <= 2])dnl
400 _$0(m4_quote(m4_default([$1], [[, ]])),
401 m4_ifval([$2], [[$2]], [m4_dquote(lt_decl_tag_varnames)]),
402 m4_split(m4_normalize(m4_quote(_LT_TAGS)), [ ]))])
403 m4_define([_lt_decl_varnames_tagged],
404 [m4_ifval([$3], [lt_combine([$1], [$2], [_], $3)])])
405
406
407 # lt_decl_all_varnames([SEPARATOR], [VARNAME1...])
408 # ------------------------------------------------
409 m4_define([lt_decl_all_varnames],
410 [_$0(m4_quote(m4_default([$1], [[, ]])),
411 m4_if([$2], [],
412 m4_quote(lt_decl_varnames),
413 m4_quote(m4_shift($@))))[]dnl
414 ])
415 m4_define([_lt_decl_all_varnames],
416 [lt_join($@, lt_decl_varnames_tagged([$1],
417 lt_decl_tag_varnames([[, ]], m4_shift($@))))dnl
418 ])
419
420
421 # _LT_CONFIG_STATUS_DECLARE([VARNAME])
422 # ------------------------------------
423 # Quote a variable value, and forward it to `config.status' so that its
424 # declaration there will have the same value as in `configure'. VARNAME
425 # must have a single quote delimited value for this to work.
426 m4_define([_LT_CONFIG_STATUS_DECLARE],
427 [$1='`$ECHO "$][$1" | $SED "$delay_single_quote_subst"`'])
428
429
430 # _LT_CONFIG_STATUS_DECLARATIONS
431 # ------------------------------
432 # We delimit libtool config variables with single quotes, so when
433 # we write them to config.status, we have to be sure to quote all
434 # embedded single quotes properly. In configure, this macro expands
435 # each variable declared with _LT_DECL (and _LT_TAGDECL) into:
436 #
437 # <var>='`$ECHO "$<var>" | $SED "$delay_single_quote_subst"`'
438 m4_defun([_LT_CONFIG_STATUS_DECLARATIONS],
439 [m4_foreach([_lt_var], m4_quote(lt_decl_all_varnames),
440 [m4_n([_LT_CONFIG_STATUS_DECLARE(_lt_var)])])])
441
442
443 # _LT_LIBTOOL_TAGS
444 # ----------------
445 # Output comment and list of tags supported by the script
446 m4_defun([_LT_LIBTOOL_TAGS],
447 [_LT_FORMAT_COMMENT([The names of the tagged configurations supported by this script])dnl
448 available_tags="_LT_TAGS"dnl
449 ])
450
451
452 # _LT_LIBTOOL_DECLARE(VARNAME, [TAG])
453 # -----------------------------------
454 # Extract the dictionary values for VARNAME (optionally with TAG) and
455 # expand to a commented shell variable setting:
456 #
457 # # Some comment about what VAR is for.
458 # visible_name=$lt_internal_name
459 m4_define([_LT_LIBTOOL_DECLARE],
460 [_LT_FORMAT_COMMENT(m4_quote(lt_dict_fetch([lt_decl_dict], [$1],
461 [description])))[]dnl
462 m4_pushdef([_libtool_name],
463 m4_quote(lt_dict_fetch([lt_decl_dict], [$1], [libtool_name])))[]dnl
464 m4_case(m4_quote(lt_dict_fetch([lt_decl_dict], [$1], [value])),
465 [0], [_libtool_name=[$]$1],
466 [1], [_libtool_name=$lt_[]$1],
467 [2], [_libtool_name=$lt_[]$1],
468 [_libtool_name=lt_dict_fetch([lt_decl_dict], [$1], [value])])[]dnl
469 m4_ifval([$2], [_$2])[]m4_popdef([_libtool_name])[]dnl
470 ])
471
472
473 # _LT_LIBTOOL_CONFIG_VARS
474 # -----------------------
475 # Produce commented declarations of non-tagged libtool config variables
476 # suitable for insertion in the LIBTOOL CONFIG section of the `libtool'
477 # script. Tagged libtool config variables (even for the LIBTOOL CONFIG
478 # section) are produced by _LT_LIBTOOL_TAG_VARS.
479 m4_defun([_LT_LIBTOOL_CONFIG_VARS],
480 [m4_foreach([_lt_var],
481 m4_quote(_lt_decl_filter([tagged?], [no], [], lt_decl_varnames)),
482 [m4_n([_LT_LIBTOOL_DECLARE(_lt_var)])])])
483
484
485 # _LT_LIBTOOL_TAG_VARS(TAG)
486 # -------------------------
487 m4_define([_LT_LIBTOOL_TAG_VARS],
488 [m4_foreach([_lt_var], m4_quote(lt_decl_tag_varnames),
489 [m4_n([_LT_LIBTOOL_DECLARE(_lt_var, [$1])])])])
490
491
492 # _LT_TAGVAR(VARNAME, [TAGNAME])
493 # ------------------------------
494 m4_define([_LT_TAGVAR], [m4_ifval([$2], [$1_$2], [$1])])
495
496
497 # _LT_CONFIG_COMMANDS
498 # -------------------
499 # Send accumulated output to $CONFIG_STATUS. Thanks to the lists of
500 # variables for single and double quote escaping we saved from calls
501 # to _LT_DECL, we can put quote escaped variables declarations
502 # into `config.status', and then the shell code to quote escape them in
503 # for loops in `config.status'. Finally, any additional code accumulated
504 # from calls to _LT_CONFIG_LIBTOOL_INIT is expanded.
505 m4_defun([_LT_CONFIG_COMMANDS],
506 [AC_PROVIDE_IFELSE([LT_OUTPUT],
507 dnl If the libtool generation code has been placed in $CONFIG_LT,
508 dnl instead of duplicating it all over again into config.status,
509 dnl then we will have config.status run $CONFIG_LT later, so it
510 dnl needs to know what name is stored there:
511 [AC_CONFIG_COMMANDS([libtool],
512 [$SHELL $CONFIG_LT || AS_EXIT(1)], [CONFIG_LT='$CONFIG_LT'])],
513 dnl If the libtool generation code is destined for config.status,
514 dnl expand the accumulated commands and init code now:
515 [AC_CONFIG_COMMANDS([libtool],
516 [_LT_OUTPUT_LIBTOOL_COMMANDS], [_LT_OUTPUT_LIBTOOL_COMMANDS_INIT])])
517 ])#_LT_CONFIG_COMMANDS
518
519
520 # Initialize.
521 m4_define([_LT_OUTPUT_LIBTOOL_COMMANDS_INIT],
522 [
523
524 # The HP-UX ksh and POSIX shell print the target directory to stdout
525 # if CDPATH is set.
526 (unset CDPATH) >/dev/null 2>&1 && unset CDPATH
527
528 sed_quote_subst='$sed_quote_subst'
529 double_quote_subst='$double_quote_subst'
530 delay_variable_subst='$delay_variable_subst'
531 _LT_CONFIG_STATUS_DECLARATIONS
532 LTCC='$LTCC'
533 LTCFLAGS='$LTCFLAGS'
534 compiler='$compiler_DEFAULT'
535
536 # A function that is used when there is no print builtin or printf.
537 func_fallback_echo ()
538 {
539 eval 'cat <<_LTECHO_EOF
540 \$[]1
541 _LTECHO_EOF'
542 }
543
544 # Quote evaled strings.
545 for var in lt_decl_all_varnames([[ \
546 ]], lt_decl_quote_varnames); do
547 case \`eval \\\\\$ECHO \\\\""\\\\\$\$var"\\\\"\` in
548 *[[\\\\\\\`\\"\\\$]]*)
549 eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"\\\$\$var\\" | \\\$SED \\"\\\$sed_quote_subst\\"\\\`\\\\\\""
550 ;;
551 *)
552 eval "lt_\$var=\\\\\\"\\\$\$var\\\\\\""
553 ;;
554 esac
555 done
556
557 # Double-quote double-evaled strings.
558 for var in lt_decl_all_varnames([[ \
559 ]], lt_decl_dquote_varnames); do
560 case \`eval \\\\\$ECHO \\\\""\\\\\$\$var"\\\\"\` in
561 *[[\\\\\\\`\\"\\\$]]*)
562 eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"\\\$\$var\\" | \\\$SED -e \\"\\\$double_quote_subst\\" -e \\"\\\$sed_quote_subst\\" -e \\"\\\$delay_variable_subst\\"\\\`\\\\\\""
563 ;;
564 *)
565 eval "lt_\$var=\\\\\\"\\\$\$var\\\\\\""
566 ;;
567 esac
568 done
569
570 _LT_OUTPUT_LIBTOOL_INIT
571 ])
572
573 # _LT_GENERATED_FILE_INIT(FILE, [COMMENT])
574 # ------------------------------------
575 # Generate a child script FILE with all initialization necessary to
576 # reuse the environment learned by the parent script, and make the
577 # file executable. If COMMENT is supplied, it is inserted after the
578 # `#!' sequence but before initialization text begins. After this
579 # macro, additional text can be appended to FILE to form the body of
580 # the child script. The macro ends with non-zero status if the
581 # file could not be fully written (such as if the disk is full).
582 m4_ifdef([AS_INIT_GENERATED],
583 [m4_defun([_LT_GENERATED_FILE_INIT],[AS_INIT_GENERATED($@)])],
584 [m4_defun([_LT_GENERATED_FILE_INIT],
585 [m4_require([AS_PREPARE])]dnl
586 [m4_pushdef([AS_MESSAGE_LOG_FD])]dnl
587 [lt_write_fail=0
588 cat >$1 <<_ASEOF || lt_write_fail=1
589 #! $SHELL
590 # Generated by $as_me.
591 $2
592 SHELL=\${CONFIG_SHELL-$SHELL}
593 export SHELL
594 _ASEOF
595 cat >>$1 <<\_ASEOF || lt_write_fail=1
596 AS_SHELL_SANITIZE
597 _AS_PREPARE
598 exec AS_MESSAGE_FD>&1
599 _ASEOF
600 test $lt_write_fail = 0 && chmod +x $1[]dnl
601 m4_popdef([AS_MESSAGE_LOG_FD])])])# _LT_GENERATED_FILE_INIT
602
603 # LT_OUTPUT
604 # ---------
605 # This macro allows early generation of the libtool script (before
606 # AC_OUTPUT is called), incase it is used in configure for compilation
607 # tests.
608 AC_DEFUN([LT_OUTPUT],
609 [: ${CONFIG_LT=./config.lt}
610 AC_MSG_NOTICE([creating $CONFIG_LT])
611 _LT_GENERATED_FILE_INIT(["$CONFIG_LT"],
612 [# Run this file to recreate a libtool stub with the current configuration.])
613
614 cat >>"$CONFIG_LT" <<\_LTEOF
615 lt_cl_silent=false
616 exec AS_MESSAGE_LOG_FD>>config.log
617 {
618 echo
619 AS_BOX([Running $as_me.])
620 } >&AS_MESSAGE_LOG_FD
621
622 lt_cl_help="\
623 \`$as_me' creates a local libtool stub from the current configuration,
624 for use in further configure time tests before the real libtool is
625 generated.
626
627 Usage: $[0] [[OPTIONS]]
628
629 -h, --help print this help, then exit
630 -V, --version print version number, then exit
631 -q, --quiet do not print progress messages
632 -d, --debug don't remove temporary files
633
634 Report bugs to <bug-libtool@gnu.org>."
635
636 lt_cl_version="\
637 m4_ifset([AC_PACKAGE_NAME], [AC_PACKAGE_NAME ])config.lt[]dnl
638 m4_ifset([AC_PACKAGE_VERSION], [ AC_PACKAGE_VERSION])
639 configured by $[0], generated by m4_PACKAGE_STRING.
640
641 Copyright (C) 2011 Free Software Foundation, Inc.
642 This config.lt script is free software; the Free Software Foundation
643 gives unlimited permision to copy, distribute and modify it."
644
645 while test $[#] != 0
646 do
647 case $[1] in
648 --version | --v* | -V )
649 echo "$lt_cl_version"; exit 0 ;;
650 --help | --h* | -h )
651 echo "$lt_cl_help"; exit 0 ;;
652 --debug | --d* | -d )
653 debug=: ;;
654 --quiet | --q* | --silent | --s* | -q )
655 lt_cl_silent=: ;;
656
657 -*) AC_MSG_ERROR([unrecognized option: $[1]
658 Try \`$[0] --help' for more information.]) ;;
659
660 *) AC_MSG_ERROR([unrecognized argument: $[1]
661 Try \`$[0] --help' for more information.]) ;;
662 esac
663 shift
664 done
665
666 if $lt_cl_silent; then
667 exec AS_MESSAGE_FD>/dev/null
668 fi
669 _LTEOF
670
671 cat >>"$CONFIG_LT" <<_LTEOF
672 _LT_OUTPUT_LIBTOOL_COMMANDS_INIT
673 _LTEOF
674
675 cat >>"$CONFIG_LT" <<\_LTEOF
676 AC_MSG_NOTICE([creating $ofile])
677 _LT_OUTPUT_LIBTOOL_COMMANDS
678 AS_EXIT(0)
679 _LTEOF
680 chmod +x "$CONFIG_LT"
681
682 # configure is writing to config.log, but config.lt does its own redirection,
683 # appending to config.log, which fails on DOS, as config.log is still kept
684 # open by configure. Here we exec the FD to /dev/null, effectively closing
685 # config.log, so it can be properly (re)opened and appended to by config.lt.
686 lt_cl_success=:
687 test "$silent" = yes &&
688 lt_config_lt_args="$lt_config_lt_args --quiet"
689 exec AS_MESSAGE_LOG_FD>/dev/null
690 $SHELL "$CONFIG_LT" $lt_config_lt_args || lt_cl_success=false
691 exec AS_MESSAGE_LOG_FD>>config.log
692 $lt_cl_success || AS_EXIT(1)
693 ])# LT_OUTPUT
694
695
696 # _LT_CONFIG(TAG)
697 # ---------------
698 # If TAG is the built-in tag, create an initial libtool script with a
699 # default configuration from the untagged config vars. Otherwise add code
700 # to config.status for appending the configuration named by TAG from the
701 # matching tagged config vars.
702 m4_defun([_LT_CONFIG],
703 [m4_require([_LT_FILEUTILS_DEFAULTS])dnl
704 _LT_CONFIG_SAVE_COMMANDS([
705 m4_define([_LT_TAG], m4_if([$1], [], [C], [$1]))dnl
706 m4_if(_LT_TAG, [C], [
707 # See if we are running on zsh, and set the options which allow our
708 # commands through without removal of \ escapes.
709 if test -n "${ZSH_VERSION+set}" ; then
710 setopt NO_GLOB_SUBST
711 fi
712
713 cfgfile="${ofile}T"
714 trap "$RM \"$cfgfile\"; exit 1" 1 2 15
715 $RM "$cfgfile"
716
717 cat <<_LT_EOF >> "$cfgfile"
718 #! $SHELL
719
720 # `$ECHO "$ofile" | sed 's%^.*/%%'` - Provide generalized library-building support services.
721 # Generated automatically by $as_me ($PACKAGE$TIMESTAMP) $VERSION
722 # Libtool was configured on host `(hostname || uname -n) 2>/dev/null | sed 1q`:
723 # NOTE: Changes made to this file will be lost: look at ltmain.sh.
724 #
725 _LT_COPYING
726 _LT_LIBTOOL_TAGS
727
728 # ### BEGIN LIBTOOL CONFIG
729 _LT_LIBTOOL_CONFIG_VARS
730 _LT_LIBTOOL_TAG_VARS
731 # ### END LIBTOOL CONFIG
732
733 _LT_EOF
734
735 case $host_os in
736 aix3*)
737 cat <<\_LT_EOF >> "$cfgfile"
738 # AIX sometimes has problems with the GCC collect2 program. For some
739 # reason, if we set the COLLECT_NAMES environment variable, the problems
740 # vanish in a puff of smoke.
741 if test "X${COLLECT_NAMES+set}" != Xset; then
742 COLLECT_NAMES=
743 export COLLECT_NAMES
744 fi
745 _LT_EOF
746 ;;
747 esac
748
749 _LT_PROG_LTMAIN
750
751 # We use sed instead of cat because bash on DJGPP gets confused if
752 # if finds mixed CR/LF and LF-only lines. Since sed operates in
753 # text mode, it properly converts lines to CR/LF. This bash problem
754 # is reportedly fixed, but why not run on old versions too?
755 sed '$q' "$ltmain" >> "$cfgfile" \
756 || (rm -f "$cfgfile"; exit 1)
757
758 _LT_PROG_REPLACE_SHELLFNS
759
760 mv -f "$cfgfile" "$ofile" ||
761 (rm -f "$ofile" && cp "$cfgfile" "$ofile" && rm -f "$cfgfile")
762 chmod +x "$ofile"
763 ],
764 [cat <<_LT_EOF >> "$ofile"
765
766 dnl Unfortunately we have to use $1 here, since _LT_TAG is not expanded
767 dnl in a comment (ie after a #).
768 # ### BEGIN LIBTOOL TAG CONFIG: $1
769 _LT_LIBTOOL_TAG_VARS(_LT_TAG)
770 # ### END LIBTOOL TAG CONFIG: $1
771 _LT_EOF
772 ])dnl /m4_if
773 ],
774 [m4_if([$1], [], [
775 PACKAGE='$PACKAGE'
776 VERSION='$VERSION'
777 TIMESTAMP='$TIMESTAMP'
778 RM='$RM'
779 ofile='$ofile'], [])
780 ])dnl /_LT_CONFIG_SAVE_COMMANDS
781 ])# _LT_CONFIG
782
783
784 # LT_SUPPORTED_TAG(TAG)
785 # ---------------------
786 # Trace this macro to discover what tags are supported by the libtool
787 # --tag option, using:
788 # autoconf --trace 'LT_SUPPORTED_TAG:$1'
789 AC_DEFUN([LT_SUPPORTED_TAG], [])
790
791
792 # C support is built-in for now
793 m4_define([_LT_LANG_C_enabled], [])
794 m4_define([_LT_TAGS], [])
795
796
797 # LT_LANG(LANG)
798 # -------------
799 # Enable libtool support for the given language if not already enabled.
800 AC_DEFUN([LT_LANG],
801 [AC_BEFORE([$0], [LT_OUTPUT])dnl
802 m4_case([$1],
803 [C], [_LT_LANG(C)],
804 [C++], [_LT_LANG(CXX)],
805 [Go], [_LT_LANG(GO)],
806 [Java], [_LT_LANG(GCJ)],
807 [Fortran 77], [_LT_LANG(F77)],
808 [Fortran], [_LT_LANG(FC)],
809 [Windows Resource], [_LT_LANG(RC)],
810 [m4_ifdef([_LT_LANG_]$1[_CONFIG],
811 [_LT_LANG($1)],
812 [m4_fatal([$0: unsupported language: "$1"])])])dnl
813 ])# LT_LANG
814
815
816 # _LT_LANG(LANGNAME)
817 # ------------------
818 m4_defun([_LT_LANG],
819 [m4_ifdef([_LT_LANG_]$1[_enabled], [],
820 [LT_SUPPORTED_TAG([$1])dnl
821 m4_append([_LT_TAGS], [$1 ])dnl
822 m4_define([_LT_LANG_]$1[_enabled], [])dnl
823 _LT_LANG_$1_CONFIG($1)])dnl
824 ])# _LT_LANG
825
826
827 m4_ifndef([AC_PROG_GO], [
828 ############################################################
829 # NOTE: This macro has been submitted for inclusion into #
830 # GNU Autoconf as AC_PROG_GO. When it is available in #
831 # a released version of Autoconf we should remove this #
832 # macro and use it instead. #
833 ############################################################
834 m4_defun([AC_PROG_GO],
835 [AC_LANG_PUSH(Go)dnl
836 AC_ARG_VAR([GOC], [Go compiler command])dnl
837 AC_ARG_VAR([GOFLAGS], [Go compiler flags])dnl
838 _AC_ARG_VAR_LDFLAGS()dnl
839 AC_CHECK_TOOL(GOC, gccgo)
840 if test -z "$GOC"; then
841 if test -n "$ac_tool_prefix"; then
842 AC_CHECK_PROG(GOC, [${ac_tool_prefix}gccgo], [${ac_tool_prefix}gccgo])
843 fi
844 fi
845 if test -z "$GOC"; then
846 AC_CHECK_PROG(GOC, gccgo, gccgo, false)
847 fi
848 ])#m4_defun
849 ])#m4_ifndef
850
851
852 # _LT_LANG_DEFAULT_CONFIG
853 # -----------------------
854 m4_defun([_LT_LANG_DEFAULT_CONFIG],
855 [AC_PROVIDE_IFELSE([AC_PROG_CXX],
856 [LT_LANG(CXX)],
857 [m4_define([AC_PROG_CXX], defn([AC_PROG_CXX])[LT_LANG(CXX)])])
858
859 AC_PROVIDE_IFELSE([AC_PROG_F77],
860 [LT_LANG(F77)],
861 [m4_define([AC_PROG_F77], defn([AC_PROG_F77])[LT_LANG(F77)])])
862
863 AC_PROVIDE_IFELSE([AC_PROG_FC],
864 [LT_LANG(FC)],
865 [m4_define([AC_PROG_FC], defn([AC_PROG_FC])[LT_LANG(FC)])])
866
867 dnl The call to [A][M_PROG_GCJ] is quoted like that to stop aclocal
868 dnl pulling things in needlessly.
869 AC_PROVIDE_IFELSE([AC_PROG_GCJ],
870 [LT_LANG(GCJ)],
871 [AC_PROVIDE_IFELSE([A][M_PROG_GCJ],
872 [LT_LANG(GCJ)],
873 [AC_PROVIDE_IFELSE([LT_PROG_GCJ],
874 [LT_LANG(GCJ)],
875 [m4_ifdef([AC_PROG_GCJ],
876 [m4_define([AC_PROG_GCJ], defn([AC_PROG_GCJ])[LT_LANG(GCJ)])])
877 m4_ifdef([A][M_PROG_GCJ],
878 [m4_define([A][M_PROG_GCJ], defn([A][M_PROG_GCJ])[LT_LANG(GCJ)])])
879 m4_ifdef([LT_PROG_GCJ],
880 [m4_define([LT_PROG_GCJ], defn([LT_PROG_GCJ])[LT_LANG(GCJ)])])])])])
881
882 AC_PROVIDE_IFELSE([AC_PROG_GO],
883 [LT_LANG(GO)],
884 [m4_define([AC_PROG_GO], defn([AC_PROG_GO])[LT_LANG(GO)])])
885
886 AC_PROVIDE_IFELSE([LT_PROG_RC],
887 [LT_LANG(RC)],
888 [m4_define([LT_PROG_RC], defn([LT_PROG_RC])[LT_LANG(RC)])])
889 ])# _LT_LANG_DEFAULT_CONFIG
890
891 # Obsolete macros:
892 AU_DEFUN([AC_LIBTOOL_CXX], [LT_LANG(C++)])
893 AU_DEFUN([AC_LIBTOOL_F77], [LT_LANG(Fortran 77)])
894 AU_DEFUN([AC_LIBTOOL_FC], [LT_LANG(Fortran)])
895 AU_DEFUN([AC_LIBTOOL_GCJ], [LT_LANG(Java)])
896 AU_DEFUN([AC_LIBTOOL_RC], [LT_LANG(Windows Resource)])
897 dnl aclocal-1.4 backwards compatibility:
898 dnl AC_DEFUN([AC_LIBTOOL_CXX], [])
899 dnl AC_DEFUN([AC_LIBTOOL_F77], [])
900 dnl AC_DEFUN([AC_LIBTOOL_FC], [])
901 dnl AC_DEFUN([AC_LIBTOOL_GCJ], [])
902 dnl AC_DEFUN([AC_LIBTOOL_RC], [])
903
904
905 # _LT_TAG_COMPILER
906 # ----------------
907 m4_defun([_LT_TAG_COMPILER],
908 [AC_REQUIRE([AC_PROG_CC])dnl
909
910 _LT_DECL([LTCC], [CC], [1], [A C compiler])dnl
911 _LT_DECL([LTCFLAGS], [CFLAGS], [1], [LTCC compiler flags])dnl
912 _LT_TAGDECL([CC], [compiler], [1], [A language specific compiler])dnl
913 _LT_TAGDECL([with_gcc], [GCC], [0], [Is the compiler the GNU compiler?])dnl
914
915 # If no C compiler was specified, use CC.
916 LTCC=${LTCC-"$CC"}
917
918 # If no C compiler flags were specified, use CFLAGS.
919 LTCFLAGS=${LTCFLAGS-"$CFLAGS"}
920
921 # Allow CC to be a program name with arguments.
922 compiler=$CC
923 ])# _LT_TAG_COMPILER
924
925
926 # _LT_COMPILER_BOILERPLATE
927 # ------------------------
928 # Check for compiler boilerplate output or warnings with
929 # the simple compiler test code.
930 m4_defun([_LT_COMPILER_BOILERPLATE],
931 [m4_require([_LT_DECL_SED])dnl
932 ac_outfile=conftest.$ac_objext
933 echo "$lt_simple_compile_test_code" >conftest.$ac_ext
934 eval "$ac_compile" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err
935 _lt_compiler_boilerplate=`cat conftest.err`
936 $RM conftest*
937 ])# _LT_COMPILER_BOILERPLATE
938
939
940 # _LT_LINKER_BOILERPLATE
941 # ----------------------
942 # Check for linker boilerplate output or warnings with
943 # the simple link test code.
944 m4_defun([_LT_LINKER_BOILERPLATE],
945 [m4_require([_LT_DECL_SED])dnl
946 ac_outfile=conftest.$ac_objext
947 echo "$lt_simple_link_test_code" >conftest.$ac_ext
948 eval "$ac_link" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err
949 _lt_linker_boilerplate=`cat conftest.err`
950 $RM -r conftest*
951 ])# _LT_LINKER_BOILERPLATE
952
953 # _LT_REQUIRED_DARWIN_CHECKS
954 # -------------------------
955 m4_defun_once([_LT_REQUIRED_DARWIN_CHECKS],[
956 case $host_os in
957 rhapsody* | darwin*)
958 AC_CHECK_TOOL([DSYMUTIL], [dsymutil], [:])
959 AC_CHECK_TOOL([NMEDIT], [nmedit], [:])
960 AC_CHECK_TOOL([LIPO], [lipo], [:])
961 AC_CHECK_TOOL([OTOOL], [otool], [:])
962 AC_CHECK_TOOL([OTOOL64], [otool64], [:])
963 _LT_DECL([], [DSYMUTIL], [1],
964 [Tool to manipulate archived DWARF debug symbol files on Mac OS X])
965 _LT_DECL([], [NMEDIT], [1],
966 [Tool to change global to local symbols on Mac OS X])
967 _LT_DECL([], [LIPO], [1],
968 [Tool to manipulate fat objects and archives on Mac OS X])
969 _LT_DECL([], [OTOOL], [1],
970 [ldd/readelf like tool for Mach-O binaries on Mac OS X])
971 _LT_DECL([], [OTOOL64], [1],
972 [ldd/readelf like tool for 64 bit Mach-O binaries on Mac OS X 10.4])
973
974 AC_CACHE_CHECK([for -single_module linker flag],[lt_cv_apple_cc_single_mod],
975 [lt_cv_apple_cc_single_mod=no
976 if test -z "${LT_MULTI_MODULE}"; then
977 # By default we will add the -single_module flag. You can override
978 # by either setting the environment variable LT_MULTI_MODULE
979 # non-empty at configure time, or by adding -multi_module to the
980 # link flags.
981 rm -rf libconftest.dylib*
982 echo "int foo(void){return 1;}" > conftest.c
983 echo "$LTCC $LTCFLAGS $LDFLAGS -o libconftest.dylib \
984 -dynamiclib -Wl,-single_module conftest.c" >&AS_MESSAGE_LOG_FD
985 $LTCC $LTCFLAGS $LDFLAGS -o libconftest.dylib \
986 -dynamiclib -Wl,-single_module conftest.c 2>conftest.err
987 _lt_result=$?
988 # If there is a non-empty error log, and "single_module"
989 # appears in it, assume the flag caused a linker warning
990 if test -s conftest.err && $GREP single_module conftest.err; then
991 cat conftest.err >&AS_MESSAGE_LOG_FD
992 # Otherwise, if the output was created with a 0 exit code from
993 # the compiler, it worked.
994 elif test -f libconftest.dylib && test $_lt_result -eq 0; then
995 lt_cv_apple_cc_single_mod=yes
996 else
997 cat conftest.err >&AS_MESSAGE_LOG_FD
998 fi
999 rm -rf libconftest.dylib*
1000 rm -f conftest.*
1001 fi])
1002
1003 AC_CACHE_CHECK([for -exported_symbols_list linker flag],
1004 [lt_cv_ld_exported_symbols_list],
1005 [lt_cv_ld_exported_symbols_list=no
1006 save_LDFLAGS=$LDFLAGS
1007 echo "_main" > conftest.sym
1008 LDFLAGS="$LDFLAGS -Wl,-exported_symbols_list,conftest.sym"
1009 AC_LINK_IFELSE([AC_LANG_PROGRAM([],[])],
1010 [lt_cv_ld_exported_symbols_list=yes],
1011 [lt_cv_ld_exported_symbols_list=no])
1012 LDFLAGS="$save_LDFLAGS"
1013 ])
1014
1015 AC_CACHE_CHECK([for -force_load linker flag],[lt_cv_ld_force_load],
1016 [lt_cv_ld_force_load=no
1017 cat > conftest.c << _LT_EOF
1018 int forced_loaded() { return 2;}
1019 _LT_EOF
1020 echo "$LTCC $LTCFLAGS -c -o conftest.o conftest.c" >&AS_MESSAGE_LOG_FD
1021 $LTCC $LTCFLAGS -c -o conftest.o conftest.c 2>&AS_MESSAGE_LOG_FD
1022 echo "$AR cru libconftest.a conftest.o" >&AS_MESSAGE_LOG_FD
1023 $AR cru libconftest.a conftest.o 2>&AS_MESSAGE_LOG_FD
1024 echo "$RANLIB libconftest.a" >&AS_MESSAGE_LOG_FD
1025 $RANLIB libconftest.a 2>&AS_MESSAGE_LOG_FD
1026 cat > conftest.c << _LT_EOF
1027 int main() { return 0;}
1028 _LT_EOF
1029 echo "$LTCC $LTCFLAGS $LDFLAGS -o conftest conftest.c -Wl,-force_load,./libconftest.a" >&AS_MESSAGE_LOG_FD
1030 $LTCC $LTCFLAGS $LDFLAGS -o conftest conftest.c -Wl,-force_load,./libconftest.a 2>conftest.err
1031 _lt_result=$?
1032 if test -s conftest.err && $GREP force_load conftest.err; then
1033 cat conftest.err >&AS_MESSAGE_LOG_FD
1034 elif test -f conftest && test $_lt_result -eq 0 && $GREP forced_load conftest >/dev/null 2>&1 ; then
1035 lt_cv_ld_force_load=yes
1036 else
1037 cat conftest.err >&AS_MESSAGE_LOG_FD
1038 fi
1039 rm -f conftest.err libconftest.a conftest conftest.c
1040 rm -rf conftest.dSYM
1041 ])
1042 case $host_os in
1043 rhapsody* | darwin1.[[012]])
1044 _lt_dar_allow_undefined='${wl}-undefined ${wl}suppress' ;;
1045 darwin1.*)
1046 _lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' ;;
1047 darwin*) # darwin 5.x on
1048 # if running on 10.5 or later, the deployment target defaults
1049 # to the OS version, if on x86, and 10.4, the deployment
1050 # target defaults to 10.4. Don't you love it?
1051 case ${MACOSX_DEPLOYMENT_TARGET-10.0},$host in
1052 10.0,*86*-darwin8*|10.0,*-darwin[[91]]*)
1053 _lt_dar_allow_undefined='${wl}-undefined ${wl}dynamic_lookup' ;;
1054 10.[[012]]*)
1055 _lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' ;;
1056 10.*)
1057 _lt_dar_allow_undefined='${wl}-undefined ${wl}dynamic_lookup' ;;
1058 esac
1059 ;;
1060 esac
1061 if test "$lt_cv_apple_cc_single_mod" = "yes"; then
1062 _lt_dar_single_mod='$single_module'
1063 fi
1064 if test "$lt_cv_ld_exported_symbols_list" = "yes"; then
1065 _lt_dar_export_syms=' ${wl}-exported_symbols_list,$output_objdir/${libname}-symbols.expsym'
1066 else
1067 _lt_dar_export_syms='~$NMEDIT -s $output_objdir/${libname}-symbols.expsym ${lib}'
1068 fi
1069 if test "$DSYMUTIL" != ":" && test "$lt_cv_ld_force_load" = "no"; then
1070 _lt_dsymutil='~$DSYMUTIL $lib || :'
1071 else
1072 _lt_dsymutil=
1073 fi
1074 ;;
1075 esac
1076 ])
1077
1078
1079 # _LT_DARWIN_LINKER_FEATURES([TAG])
1080 # ---------------------------------
1081 # Checks for linker and compiler features on darwin
1082 m4_defun([_LT_DARWIN_LINKER_FEATURES],
1083 [
1084 m4_require([_LT_REQUIRED_DARWIN_CHECKS])
1085 _LT_TAGVAR(archive_cmds_need_lc, $1)=no
1086 _LT_TAGVAR(hardcode_direct, $1)=no
1087 _LT_TAGVAR(hardcode_automatic, $1)=yes
1088 _LT_TAGVAR(hardcode_shlibpath_var, $1)=unsupported
1089 if test "$lt_cv_ld_force_load" = "yes"; then
1090 _LT_TAGVAR(whole_archive_flag_spec, $1)='`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience ${wl}-force_load,$conv\"; done; func_echo_all \"$new_convenience\"`'
1091 m4_case([$1], [F77], [_LT_TAGVAR(compiler_needs_object, $1)=yes],
1092 [FC], [_LT_TAGVAR(compiler_needs_object, $1)=yes])
1093 else
1094 _LT_TAGVAR(whole_archive_flag_spec, $1)=''
1095 fi
1096 _LT_TAGVAR(link_all_deplibs, $1)=yes
1097 _LT_TAGVAR(allow_undefined_flag, $1)="$_lt_dar_allow_undefined"
1098 case $cc_basename in
1099 ifort*) _lt_dar_can_shared=yes ;;
1100 *) _lt_dar_can_shared=$GCC ;;
1101 esac
1102 if test "$_lt_dar_can_shared" = "yes"; then
1103 output_verbose_link_cmd=func_echo_all
1104 _LT_TAGVAR(archive_cmds, $1)="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod${_lt_dsymutil}"
1105 _LT_TAGVAR(module_cmds, $1)="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}"
1106 _LT_TAGVAR(archive_expsym_cmds, $1)="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring ${_lt_dar_single_mod}${_lt_dar_export_syms}${_lt_dsymutil}"
1107 _LT_TAGVAR(module_expsym_cmds, $1)="sed -e 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}"
1108 m4_if([$1], [CXX],
1109 [ if test "$lt_cv_apple_cc_single_mod" != "yes"; then
1110 _LT_TAGVAR(archive_cmds, $1)="\$CC -r -keep_private_externs -nostdlib -o \${lib}-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \${lib}-master.o \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring${_lt_dsymutil}"
1111 _LT_TAGVAR(archive_expsym_cmds, $1)="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -r -keep_private_externs -nostdlib -o \${lib}-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \${lib}-master.o \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring${_lt_dar_export_syms}${_lt_dsymutil}"
1112 fi
1113 ],[])
1114 else
1115 _LT_TAGVAR(ld_shlibs, $1)=no
1116 fi
1117 ])
1118
1119 # _LT_SYS_MODULE_PATH_AIX([TAGNAME])
1120 # ----------------------------------
1121 # Links a minimal program and checks the executable
1122 # for the system default hardcoded library path. In most cases,
1123 # this is /usr/lib:/lib, but when the MPI compilers are used
1124 # the location of the communication and MPI libs are included too.
1125 # If we don't find anything, use the default library path according
1126 # to the aix ld manual.
1127 # Store the results from the different compilers for each TAGNAME.
1128 # Allow to override them for all tags through lt_cv_aix_libpath.
1129 m4_defun([_LT_SYS_MODULE_PATH_AIX],
1130 [m4_require([_LT_DECL_SED])dnl
1131 if test "${lt_cv_aix_libpath+set}" = set; then
1132 aix_libpath=$lt_cv_aix_libpath
1133 else
1134 AC_CACHE_VAL([_LT_TAGVAR([lt_cv_aix_libpath_], [$1])],
1135 [AC_LINK_IFELSE([AC_LANG_PROGRAM],[
1136 lt_aix_libpath_sed='[
1137 /Import File Strings/,/^$/ {
1138 /^0/ {
1139 s/^0 *\([^ ]*\) *$/\1/
1140 p
1141 }
1142 }]'
1143 _LT_TAGVAR([lt_cv_aix_libpath_], [$1])=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"`
1144 # Check for a 64-bit object if we didn't find anything.
1145 if test -z "$_LT_TAGVAR([lt_cv_aix_libpath_], [$1])"; then
1146 _LT_TAGVAR([lt_cv_aix_libpath_], [$1])=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"`
1147 fi],[])
1148 if test -z "$_LT_TAGVAR([lt_cv_aix_libpath_], [$1])"; then
1149 _LT_TAGVAR([lt_cv_aix_libpath_], [$1])="/usr/lib:/lib"
1150 fi
1151 ])
1152 aix_libpath=$_LT_TAGVAR([lt_cv_aix_libpath_], [$1])
1153 fi
1154 ])# _LT_SYS_MODULE_PATH_AIX
1155
1156
1157 # _LT_SHELL_INIT(ARG)
1158 # -------------------
1159 m4_define([_LT_SHELL_INIT],
1160 [m4_divert_text([M4SH-INIT], [$1
1161 ])])# _LT_SHELL_INIT
1162
1163
1164
1165 # _LT_PROG_ECHO_BACKSLASH
1166 # -----------------------
1167 # Find how we can fake an echo command that does not interpret backslash.
1168 # In particular, with Autoconf 2.60 or later we add some code to the start
1169 # of the generated configure script which will find a shell with a builtin
1170 # printf (which we can use as an echo command).
1171 m4_defun([_LT_PROG_ECHO_BACKSLASH],
1172 [ECHO='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'
1173 ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO
1174 ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO$ECHO
1175
1176 AC_MSG_CHECKING([how to print strings])
1177 # Test print first, because it will be a builtin if present.
1178 if test "X`( print -r -- -n ) 2>/dev/null`" = X-n && \
1179 test "X`print -r -- $ECHO 2>/dev/null`" = "X$ECHO"; then
1180 ECHO='print -r --'
1181 elif test "X`printf %s $ECHO 2>/dev/null`" = "X$ECHO"; then
1182 ECHO='printf %s\n'
1183 else
1184 # Use this function as a fallback that always works.
1185 func_fallback_echo ()
1186 {
1187 eval 'cat <<_LTECHO_EOF
1188 $[]1
1189 _LTECHO_EOF'
1190 }
1191 ECHO='func_fallback_echo'
1192 fi
1193
1194 # func_echo_all arg...
1195 # Invoke $ECHO with all args, space-separated.
1196 func_echo_all ()
1197 {
1198 $ECHO "$*"
1199 }
1200
1201 case "$ECHO" in
1202 printf*) AC_MSG_RESULT([printf]) ;;
1203 print*) AC_MSG_RESULT([print -r]) ;;
1204 *) AC_MSG_RESULT([cat]) ;;
1205 esac
1206
1207 m4_ifdef([_AS_DETECT_SUGGESTED],
1208 [_AS_DETECT_SUGGESTED([
1209 test -n "${ZSH_VERSION+set}${BASH_VERSION+set}" || (
1210 ECHO='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'
1211 ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO
1212 ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO$ECHO
1213 PATH=/empty FPATH=/empty; export PATH FPATH
1214 test "X`printf %s $ECHO`" = "X$ECHO" \
1215 || test "X`print -r -- $ECHO`" = "X$ECHO" )])])
1216
1217 _LT_DECL([], [SHELL], [1], [Shell to use when invoking shell scripts])
1218 _LT_DECL([], [ECHO], [1], [An echo program that protects backslashes])
1219 ])# _LT_PROG_ECHO_BACKSLASH
1220
1221
1222 # _LT_WITH_SYSROOT
1223 # ----------------
1224 AC_DEFUN([_LT_WITH_SYSROOT],
1225 [AC_MSG_CHECKING([for sysroot])
1226 AC_ARG_WITH([sysroot],
1227 [ --with-sysroot[=DIR] Search for dependent libraries within DIR
1228 (or the compiler's sysroot if not specified).],
1229 [], [with_sysroot=no])
1230
1231 dnl lt_sysroot will always be passed unquoted. We quote it here
1232 dnl in case the user passed a directory name.
1233 lt_sysroot=
1234 case ${with_sysroot} in #(
1235 yes)
1236 if test "$GCC" = yes; then
1237 lt_sysroot=`$CC --print-sysroot 2>/dev/null`
1238 fi
1239 ;; #(
1240 /*)
1241 lt_sysroot=`echo "$with_sysroot" | sed -e "$sed_quote_subst"`
1242 ;; #(
1243 no|'')
1244 ;; #(
1245 *)
1246 AC_MSG_RESULT([${with_sysroot}])
1247 AC_MSG_ERROR([The sysroot must be an absolute path.])
1248 ;;
1249 esac
1250
1251 AC_MSG_RESULT([${lt_sysroot:-no}])
1252 _LT_DECL([], [lt_sysroot], [0], [The root where to search for ]dnl
1253 [dependent libraries, and in which our libraries should be installed.])])
1254
1255 # _LT_ENABLE_LOCK
1256 # ---------------
1257 m4_defun([_LT_ENABLE_LOCK],
1258 [AC_ARG_ENABLE([libtool-lock],
1259 [AS_HELP_STRING([--disable-libtool-lock],
1260 [avoid locking (might break parallel builds)])])
1261 test "x$enable_libtool_lock" != xno && enable_libtool_lock=yes
1262
1263 # Some flags need to be propagated to the compiler or linker for good
1264 # libtool support.
1265 case $host in
1266 ia64-*-hpux*)
1267 # Find out which ABI we are using.
1268 echo 'int i;' > conftest.$ac_ext
1269 if AC_TRY_EVAL(ac_compile); then
1270 case `/usr/bin/file conftest.$ac_objext` in
1271 *ELF-32*)
1272 HPUX_IA64_MODE="32"
1273 ;;
1274 *ELF-64*)
1275 HPUX_IA64_MODE="64"
1276 ;;
1277 esac
1278 fi
1279 rm -rf conftest*
1280 ;;
1281 *-*-irix6*)
1282 # Find out which ABI we are using.
1283 echo '[#]line '$LINENO' "configure"' > conftest.$ac_ext
1284 if AC_TRY_EVAL(ac_compile); then
1285 if test "$lt_cv_prog_gnu_ld" = yes; then
1286 case `/usr/bin/file conftest.$ac_objext` in
1287 *32-bit*)
1288 LD="${LD-ld} -melf32bsmip"
1289 ;;
1290 *N32*)
1291 LD="${LD-ld} -melf32bmipn32"
1292 ;;
1293 *64-bit*)
1294 LD="${LD-ld} -melf64bmip"
1295 ;;
1296 esac
1297 else
1298 case `/usr/bin/file conftest.$ac_objext` in
1299 *32-bit*)
1300 LD="${LD-ld} -32"
1301 ;;
1302 *N32*)
1303 LD="${LD-ld} -n32"
1304 ;;
1305 *64-bit*)
1306 LD="${LD-ld} -64"
1307 ;;
1308 esac
1309 fi
1310 fi
1311 rm -rf conftest*
1312 ;;
1313
1314 x86_64-*kfreebsd*-gnu|x86_64-*linux*|powerpc*-*linux*| \
1315 s390*-*linux*|s390*-*tpf*|sparc*-*linux*)
1316 # Find out which ABI we are using.
1317 echo 'int i;' > conftest.$ac_ext
1318 if AC_TRY_EVAL(ac_compile); then
1319 case `/usr/bin/file conftest.o` in
1320 *32-bit*)
1321 case $host in
1322 x86_64-*kfreebsd*-gnu)
1323 LD="${LD-ld} -m elf_i386_fbsd"
1324 ;;
1325 x86_64-*linux*)
1326 LD="${LD-ld} -m elf_i386"
1327 ;;
1328 powerpc64le-*linux*)
1329 LD="${LD-ld} -m elf32lppclinux"
1330 ;;
1331 powerpc64-*linux*)
1332 LD="${LD-ld} -m elf32ppclinux"
1333 ;;
1334 s390x-*linux*)
1335 LD="${LD-ld} -m elf_s390"
1336 ;;
1337 sparc64-*linux*)
1338 LD="${LD-ld} -m elf32_sparc"
1339 ;;
1340 esac
1341 ;;
1342 *64-bit*)
1343 case $host in
1344 x86_64-*kfreebsd*-gnu)
1345 LD="${LD-ld} -m elf_x86_64_fbsd"
1346 ;;
1347 x86_64-*linux*)
1348 LD="${LD-ld} -m elf_x86_64"
1349 ;;
1350 powerpcle-*linux*)
1351 LD="${LD-ld} -m elf64lppc"
1352 ;;
1353 powerpc-*linux*)
1354 LD="${LD-ld} -m elf64ppc"
1355 ;;
1356 s390*-*linux*|s390*-*tpf*)
1357 LD="${LD-ld} -m elf64_s390"
1358 ;;
1359 sparc*-*linux*)
1360 LD="${LD-ld} -m elf64_sparc"
1361 ;;
1362 esac
1363 ;;
1364 esac
1365 fi
1366 rm -rf conftest*
1367 ;;
1368
1369 *-*-sco3.2v5*)
1370 # On SCO OpenServer 5, we need -belf to get full-featured binaries.
1371 SAVE_CFLAGS="$CFLAGS"
1372 CFLAGS="$CFLAGS -belf"
1373 AC_CACHE_CHECK([whether the C compiler needs -belf], lt_cv_cc_needs_belf,
1374 [AC_LANG_PUSH(C)
1375 AC_LINK_IFELSE([AC_LANG_PROGRAM([[]],[[]])],[lt_cv_cc_needs_belf=yes],[lt_cv_cc_needs_belf=no])
1376 AC_LANG_POP])
1377 if test x"$lt_cv_cc_needs_belf" != x"yes"; then
1378 # this is probably gcc 2.8.0, egcs 1.0 or newer; no need for -belf
1379 CFLAGS="$SAVE_CFLAGS"
1380 fi
1381 ;;
1382 *-*solaris*)
1383 # Find out which ABI we are using.
1384 echo 'int i;' > conftest.$ac_ext
1385 if AC_TRY_EVAL(ac_compile); then
1386 case `/usr/bin/file conftest.o` in
1387 *64-bit*)
1388 case $lt_cv_prog_gnu_ld in
1389 yes*)
1390 case $host in
1391 i?86-*-solaris*)
1392 LD="${LD-ld} -m elf_x86_64"
1393 ;;
1394 sparc*-*-solaris*)
1395 LD="${LD-ld} -m elf64_sparc"
1396 ;;
1397 esac
1398 # GNU ld 2.21 introduced _sol2 emulations. Use them if available.
1399 if ${LD-ld} -V | grep _sol2 >/dev/null 2>&1; then
1400 LD="${LD-ld}_sol2"
1401 fi
1402 ;;
1403 *)
1404 if ${LD-ld} -64 -r -o conftest2.o conftest.o >/dev/null 2>&1; then
1405 LD="${LD-ld} -64"
1406 fi
1407 ;;
1408 esac
1409 ;;
1410 esac
1411 fi
1412 rm -rf conftest*
1413 ;;
1414 esac
1415
1416 need_locks="$enable_libtool_lock"
1417 ])# _LT_ENABLE_LOCK
1418
1419
1420 # _LT_PROG_AR
1421 # -----------
1422 m4_defun([_LT_PROG_AR],
1423 [AC_CHECK_TOOLS(AR, [ar], false)
1424 : ${AR=ar}
1425 : ${AR_FLAGS=cru}
1426 _LT_DECL([], [AR], [1], [The archiver])
1427 _LT_DECL([], [AR_FLAGS], [1], [Flags to create an archive])
1428
1429 AC_CACHE_CHECK([for archiver @FILE support], [lt_cv_ar_at_file],
1430 [lt_cv_ar_at_file=no
1431 AC_COMPILE_IFELSE([AC_LANG_PROGRAM],
1432 [echo conftest.$ac_objext > conftest.lst
1433 lt_ar_try='$AR $AR_FLAGS libconftest.a @conftest.lst >&AS_MESSAGE_LOG_FD'
1434 AC_TRY_EVAL([lt_ar_try])
1435 if test "$ac_status" -eq 0; then
1436 # Ensure the archiver fails upon bogus file names.
1437 rm -f conftest.$ac_objext libconftest.a
1438 AC_TRY_EVAL([lt_ar_try])
1439 if test "$ac_status" -ne 0; then
1440 lt_cv_ar_at_file=@
1441 fi
1442 fi
1443 rm -f conftest.* libconftest.a
1444 ])
1445 ])
1446
1447 if test "x$lt_cv_ar_at_file" = xno; then
1448 archiver_list_spec=
1449 else
1450 archiver_list_spec=$lt_cv_ar_at_file
1451 fi
1452 _LT_DECL([], [archiver_list_spec], [1],
1453 [How to feed a file listing to the archiver])
1454 ])# _LT_PROG_AR
1455
1456
1457 # _LT_CMD_OLD_ARCHIVE
1458 # -------------------
1459 m4_defun([_LT_CMD_OLD_ARCHIVE],
1460 [_LT_PROG_AR
1461
1462 AC_CHECK_TOOL(STRIP, strip, :)
1463 test -z "$STRIP" && STRIP=:
1464 _LT_DECL([], [STRIP], [1], [A symbol stripping program])
1465
1466 AC_CHECK_TOOL(RANLIB, ranlib, :)
1467 test -z "$RANLIB" && RANLIB=:
1468 _LT_DECL([], [RANLIB], [1],
1469 [Commands used to install an old-style archive])
1470
1471 # Determine commands to create old-style static archives.
1472 old_archive_cmds='$AR $AR_FLAGS $oldlib$oldobjs'
1473 old_postinstall_cmds='chmod 644 $oldlib'
1474 old_postuninstall_cmds=
1475
1476 if test -n "$RANLIB"; then
1477 case $host_os in
1478 openbsd*)
1479 old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB -t \$tool_oldlib"
1480 ;;
1481 *)
1482 old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB \$tool_oldlib"
1483 ;;
1484 esac
1485 old_archive_cmds="$old_archive_cmds~\$RANLIB \$tool_oldlib"
1486 fi
1487
1488 case $host_os in
1489 darwin*)
1490 lock_old_archive_extraction=yes ;;
1491 *)
1492 lock_old_archive_extraction=no ;;
1493 esac
1494 _LT_DECL([], [old_postinstall_cmds], [2])
1495 _LT_DECL([], [old_postuninstall_cmds], [2])
1496 _LT_TAGDECL([], [old_archive_cmds], [2],
1497 [Commands used to build an old-style archive])
1498 _LT_DECL([], [lock_old_archive_extraction], [0],
1499 [Whether to use a lock for old archive extraction])
1500 ])# _LT_CMD_OLD_ARCHIVE
1501
1502
1503 # _LT_COMPILER_OPTION(MESSAGE, VARIABLE-NAME, FLAGS,
1504 # [OUTPUT-FILE], [ACTION-SUCCESS], [ACTION-FAILURE])
1505 # ----------------------------------------------------------------
1506 # Check whether the given compiler option works
1507 AC_DEFUN([_LT_COMPILER_OPTION],
1508 [m4_require([_LT_FILEUTILS_DEFAULTS])dnl
1509 m4_require([_LT_DECL_SED])dnl
1510 AC_CACHE_CHECK([$1], [$2],
1511 [$2=no
1512 m4_if([$4], , [ac_outfile=conftest.$ac_objext], [ac_outfile=$4])
1513 echo "$lt_simple_compile_test_code" > conftest.$ac_ext
1514 lt_compiler_flag="$3"
1515 # Insert the option either (1) after the last *FLAGS variable, or
1516 # (2) before a word containing "conftest.", or (3) at the end.
1517 # Note that $ac_compile itself does not contain backslashes and begins
1518 # with a dollar sign (not a hyphen), so the echo should work correctly.
1519 # The option is referenced via a variable to avoid confusing sed.
1520 lt_compile=`echo "$ac_compile" | $SED \
1521 -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
1522 -e 's: [[^ ]]*conftest\.: $lt_compiler_flag&:; t' \
1523 -e 's:$: $lt_compiler_flag:'`
1524 (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&AS_MESSAGE_LOG_FD)
1525 (eval "$lt_compile" 2>conftest.err)
1526 ac_status=$?
1527 cat conftest.err >&AS_MESSAGE_LOG_FD
1528 echo "$as_me:$LINENO: \$? = $ac_status" >&AS_MESSAGE_LOG_FD
1529 if (exit $ac_status) && test -s "$ac_outfile"; then
1530 # The compiler can only warn and ignore the option if not recognized
1531 # So say no if there are warnings other than the usual output.
1532 $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' >conftest.exp
1533 $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2
1534 if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then
1535 $2=yes
1536 fi
1537 fi
1538 $RM conftest*
1539 ])
1540
1541 if test x"[$]$2" = xyes; then
1542 m4_if([$5], , :, [$5])
1543 else
1544 m4_if([$6], , :, [$6])
1545 fi
1546 ])# _LT_COMPILER_OPTION
1547
1548 # Old name:
1549 AU_ALIAS([AC_LIBTOOL_COMPILER_OPTION], [_LT_COMPILER_OPTION])
1550 dnl aclocal-1.4 backwards compatibility:
1551 dnl AC_DEFUN([AC_LIBTOOL_COMPILER_OPTION], [])
1552
1553
1554 # _LT_LINKER_OPTION(MESSAGE, VARIABLE-NAME, FLAGS,
1555 # [ACTION-SUCCESS], [ACTION-FAILURE])
1556 # ----------------------------------------------------
1557 # Check whether the given linker option works
1558 AC_DEFUN([_LT_LINKER_OPTION],
1559 [m4_require([_LT_FILEUTILS_DEFAULTS])dnl
1560 m4_require([_LT_DECL_SED])dnl
1561 AC_CACHE_CHECK([$1], [$2],
1562 [$2=no
1563 save_LDFLAGS="$LDFLAGS"
1564 LDFLAGS="$LDFLAGS $3"
1565 echo "$lt_simple_link_test_code" > conftest.$ac_ext
1566 if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then
1567 # The linker can only warn and ignore the option if not recognized
1568 # So say no if there are warnings
1569 if test -s conftest.err; then
1570 # Append any errors to the config.log.
1571 cat conftest.err 1>&AS_MESSAGE_LOG_FD
1572 $ECHO "$_lt_linker_boilerplate" | $SED '/^$/d' > conftest.exp
1573 $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2
1574 if diff conftest.exp conftest.er2 >/dev/null; then
1575 $2=yes
1576 fi
1577 else
1578 $2=yes
1579 fi
1580 fi
1581 $RM -r conftest*
1582 LDFLAGS="$save_LDFLAGS"
1583 ])
1584
1585 if test x"[$]$2" = xyes; then
1586 m4_if([$4], , :, [$4])
1587 else
1588 m4_if([$5], , :, [$5])
1589 fi
1590 ])# _LT_LINKER_OPTION
1591
1592 # Old name:
1593 AU_ALIAS([AC_LIBTOOL_LINKER_OPTION], [_LT_LINKER_OPTION])
1594 dnl aclocal-1.4 backwards compatibility:
1595 dnl AC_DEFUN([AC_LIBTOOL_LINKER_OPTION], [])
1596
1597
1598 # LT_CMD_MAX_LEN
1599 #---------------
1600 AC_DEFUN([LT_CMD_MAX_LEN],
1601 [AC_REQUIRE([AC_CANONICAL_HOST])dnl
1602 # find the maximum length of command line arguments
1603 AC_MSG_CHECKING([the maximum length of command line arguments])
1604 AC_CACHE_VAL([lt_cv_sys_max_cmd_len], [dnl
1605 i=0
1606 teststring="ABCD"
1607
1608 case $build_os in
1609 msdosdjgpp*)
1610 # On DJGPP, this test can blow up pretty badly due to problems in libc
1611 # (any single argument exceeding 2000 bytes causes a buffer overrun
1612 # during glob expansion). Even if it were fixed, the result of this
1613 # check would be larger than it should be.
1614 lt_cv_sys_max_cmd_len=12288; # 12K is about right
1615 ;;
1616
1617 gnu*)
1618 # Under GNU Hurd, this test is not required because there is
1619 # no limit to the length of command line arguments.
1620 # Libtool will interpret -1 as no limit whatsoever
1621 lt_cv_sys_max_cmd_len=-1;
1622 ;;
1623
1624 cygwin* | mingw* | cegcc*)
1625 # On Win9x/ME, this test blows up -- it succeeds, but takes
1626 # about 5 minutes as the teststring grows exponentially.
1627 # Worse, since 9x/ME are not pre-emptively multitasking,
1628 # you end up with a "frozen" computer, even though with patience
1629 # the test eventually succeeds (with a max line length of 256k).
1630 # Instead, let's just punt: use the minimum linelength reported by
1631 # all of the supported platforms: 8192 (on NT/2K/XP).
1632 lt_cv_sys_max_cmd_len=8192;
1633 ;;
1634
1635 mint*)
1636 # On MiNT this can take a long time and run out of memory.
1637 lt_cv_sys_max_cmd_len=8192;
1638 ;;
1639
1640 amigaos*)
1641 # On AmigaOS with pdksh, this test takes hours, literally.
1642 # So we just punt and use a minimum line length of 8192.
1643 lt_cv_sys_max_cmd_len=8192;
1644 ;;
1645
1646 netbsd* | freebsd* | openbsd* | darwin* | dragonfly*)
1647 # This has been around since 386BSD, at least. Likely further.
1648 if test -x /sbin/sysctl; then
1649 lt_cv_sys_max_cmd_len=`/sbin/sysctl -n kern.argmax`
1650 elif test -x /usr/sbin/sysctl; then
1651 lt_cv_sys_max_cmd_len=`/usr/sbin/sysctl -n kern.argmax`
1652 else
1653 lt_cv_sys_max_cmd_len=65536 # usable default for all BSDs
1654 fi
1655 # And add a safety zone
1656 lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4`
1657 lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3`
1658 ;;
1659
1660 interix*)
1661 # We know the value 262144 and hardcode it with a safety zone (like BSD)
1662 lt_cv_sys_max_cmd_len=196608
1663 ;;
1664
1665 os2*)
1666 # The test takes a long time on OS/2.
1667 lt_cv_sys_max_cmd_len=8192
1668 ;;
1669
1670 osf*)
1671 # Dr. Hans Ekkehard Plesser reports seeing a kernel panic running configure
1672 # due to this test when exec_disable_arg_limit is 1 on Tru64. It is not
1673 # nice to cause kernel panics so lets avoid the loop below.
1674 # First set a reasonable default.
1675 lt_cv_sys_max_cmd_len=16384
1676 #
1677 if test -x /sbin/sysconfig; then
1678 case `/sbin/sysconfig -q proc exec_disable_arg_limit` in
1679 *1*) lt_cv_sys_max_cmd_len=-1 ;;
1680 esac
1681 fi
1682 ;;
1683 sco3.2v5*)
1684 lt_cv_sys_max_cmd_len=102400
1685 ;;
1686 sysv5* | sco5v6* | sysv4.2uw2*)
1687 kargmax=`grep ARG_MAX /etc/conf/cf.d/stune 2>/dev/null`
1688 if test -n "$kargmax"; then
1689 lt_cv_sys_max_cmd_len=`echo $kargmax | sed 's/.*[[ ]]//'`
1690 else
1691 lt_cv_sys_max_cmd_len=32768
1692 fi
1693 ;;
1694 *)
1695 lt_cv_sys_max_cmd_len=`(getconf ARG_MAX) 2> /dev/null`
1696 if test -n "$lt_cv_sys_max_cmd_len"; then
1697 lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4`
1698 lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3`
1699 else
1700 # Make teststring a little bigger before we do anything with it.
1701 # a 1K string should be a reasonable start.
1702 for i in 1 2 3 4 5 6 7 8 ; do
1703 teststring=$teststring$teststring
1704 done
1705 SHELL=${SHELL-${CONFIG_SHELL-/bin/sh}}
1706 # If test is not a shell built-in, we'll probably end up computing a
1707 # maximum length that is only half of the actual maximum length, but
1708 # we can't tell.
1709 while { test "X"`env echo "$teststring$teststring" 2>/dev/null` \
1710 = "X$teststring$teststring"; } >/dev/null 2>&1 &&
1711 test $i != 17 # 1/2 MB should be enough
1712 do
1713 i=`expr $i + 1`
1714 teststring=$teststring$teststring
1715 done
1716 # Only check the string length outside the loop.
1717 lt_cv_sys_max_cmd_len=`expr "X$teststring" : ".*" 2>&1`
1718 teststring=
1719 # Add a significant safety factor because C++ compilers can tack on
1720 # massive amounts of additional arguments before passing them to the
1721 # linker. It appears as though 1/2 is a usable value.
1722 lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 2`
1723 fi
1724 ;;
1725 esac
1726 ])
1727 if test -n $lt_cv_sys_max_cmd_len ; then
1728 AC_MSG_RESULT($lt_cv_sys_max_cmd_len)
1729 else
1730 AC_MSG_RESULT(none)
1731 fi
1732 max_cmd_len=$lt_cv_sys_max_cmd_len
1733 _LT_DECL([], [max_cmd_len], [0],
1734 [What is the maximum length of a command?])
1735 ])# LT_CMD_MAX_LEN
1736
1737 # Old name:
1738 AU_ALIAS([AC_LIBTOOL_SYS_MAX_CMD_LEN], [LT_CMD_MAX_LEN])
1739 dnl aclocal-1.4 backwards compatibility:
1740 dnl AC_DEFUN([AC_LIBTOOL_SYS_MAX_CMD_LEN], [])
1741
1742
1743 # _LT_HEADER_DLFCN
1744 # ----------------
1745 m4_defun([_LT_HEADER_DLFCN],
1746 [AC_CHECK_HEADERS([dlfcn.h], [], [], [AC_INCLUDES_DEFAULT])dnl
1747 ])# _LT_HEADER_DLFCN
1748
1749
1750 # _LT_TRY_DLOPEN_SELF (ACTION-IF-TRUE, ACTION-IF-TRUE-W-USCORE,
1751 # ACTION-IF-FALSE, ACTION-IF-CROSS-COMPILING)
1752 # ----------------------------------------------------------------
1753 m4_defun([_LT_TRY_DLOPEN_SELF],
1754 [m4_require([_LT_HEADER_DLFCN])dnl
1755 if test "$cross_compiling" = yes; then :
1756 [$4]
1757 else
1758 lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
1759 lt_status=$lt_dlunknown
1760 cat > conftest.$ac_ext <<_LT_EOF
1761 [#line $LINENO "configure"
1762 #include "confdefs.h"
1763
1764 #if HAVE_DLFCN_H
1765 #include <dlfcn.h>
1766 #endif
1767
1768 #include <stdio.h>
1769
1770 #ifdef RTLD_GLOBAL
1771 # define LT_DLGLOBAL RTLD_GLOBAL
1772 #else
1773 # ifdef DL_GLOBAL
1774 # define LT_DLGLOBAL DL_GLOBAL
1775 # else
1776 # define LT_DLGLOBAL 0
1777 # endif
1778 #endif
1779
1780 /* We may have to define LT_DLLAZY_OR_NOW in the command line if we
1781 find out it does not work in some platform. */
1782 #ifndef LT_DLLAZY_OR_NOW
1783 # ifdef RTLD_LAZY
1784 # define LT_DLLAZY_OR_NOW RTLD_LAZY
1785 # else
1786 # ifdef DL_LAZY
1787 # define LT_DLLAZY_OR_NOW DL_LAZY
1788 # else
1789 # ifdef RTLD_NOW
1790 # define LT_DLLAZY_OR_NOW RTLD_NOW
1791 # else
1792 # ifdef DL_NOW
1793 # define LT_DLLAZY_OR_NOW DL_NOW
1794 # else
1795 # define LT_DLLAZY_OR_NOW 0
1796 # endif
1797 # endif
1798 # endif
1799 # endif
1800 #endif
1801
1802 /* When -fvisbility=hidden is used, assume the code has been annotated
1803 correspondingly for the symbols needed. */
1804 #if defined(__GNUC__) && (((__GNUC__ == 3) && (__GNUC_MINOR__ >= 3)) || (__GNUC__ > 3))
1805 int fnord () __attribute__((visibility("default")));
1806 #endif
1807
1808 int fnord () { return 42; }
1809 int main ()
1810 {
1811 void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW);
1812 int status = $lt_dlunknown;
1813
1814 if (self)
1815 {
1816 if (dlsym (self,"fnord")) status = $lt_dlno_uscore;
1817 else
1818 {
1819 if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore;
1820 else puts (dlerror ());
1821 }
1822 /* dlclose (self); */
1823 }
1824 else
1825 puts (dlerror ());
1826
1827 return status;
1828 }]
1829 _LT_EOF
1830 if AC_TRY_EVAL(ac_link) && test -s conftest${ac_exeext} 2>/dev/null; then
1831 (./conftest; exit; ) >&AS_MESSAGE_LOG_FD 2>/dev/null
1832 lt_status=$?
1833 case x$lt_status in
1834 x$lt_dlno_uscore) $1 ;;
1835 x$lt_dlneed_uscore) $2 ;;
1836 x$lt_dlunknown|x*) $3 ;;
1837 esac
1838 else :
1839 # compilation failed
1840 $3
1841 fi
1842 fi
1843 rm -fr conftest*
1844 ])# _LT_TRY_DLOPEN_SELF
1845
1846
1847 # LT_SYS_DLOPEN_SELF
1848 # ------------------
1849 AC_DEFUN([LT_SYS_DLOPEN_SELF],
1850 [m4_require([_LT_HEADER_DLFCN])dnl
1851 if test "x$enable_dlopen" != xyes; then
1852 enable_dlopen=unknown
1853 enable_dlopen_self=unknown
1854 enable_dlopen_self_static=unknown
1855 else
1856 lt_cv_dlopen=no
1857 lt_cv_dlopen_libs=
1858
1859 case $host_os in
1860 beos*)
1861 lt_cv_dlopen="load_add_on"
1862 lt_cv_dlopen_libs=
1863 lt_cv_dlopen_self=yes
1864 ;;
1865
1866 mingw* | pw32* | cegcc*)
1867 lt_cv_dlopen="LoadLibrary"
1868 lt_cv_dlopen_libs=
1869 ;;
1870
1871 cygwin*)
1872 lt_cv_dlopen="dlopen"
1873 lt_cv_dlopen_libs=
1874 ;;
1875
1876 darwin*)
1877 # if libdl is installed we need to link against it
1878 AC_CHECK_LIB([dl], [dlopen],
1879 [lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl"],[
1880 lt_cv_dlopen="dyld"
1881 lt_cv_dlopen_libs=
1882 lt_cv_dlopen_self=yes
1883 ])
1884 ;;
1885
1886 *)
1887 AC_CHECK_FUNC([shl_load],
1888 [lt_cv_dlopen="shl_load"],
1889 [AC_CHECK_LIB([dld], [shl_load],
1890 [lt_cv_dlopen="shl_load" lt_cv_dlopen_libs="-ldld"],
1891 [AC_CHECK_FUNC([dlopen],
1892 [lt_cv_dlopen="dlopen"],
1893 [AC_CHECK_LIB([dl], [dlopen],
1894 [lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl"],
1895 [AC_CHECK_LIB([svld], [dlopen],
1896 [lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-lsvld"],
1897 [AC_CHECK_LIB([dld], [dld_link],
1898 [lt_cv_dlopen="dld_link" lt_cv_dlopen_libs="-ldld"])
1899 ])
1900 ])
1901 ])
1902 ])
1903 ])
1904 ;;
1905 esac
1906
1907 if test "x$lt_cv_dlopen" != xno; then
1908 enable_dlopen=yes
1909 else
1910 enable_dlopen=no
1911 fi
1912
1913 case $lt_cv_dlopen in
1914 dlopen)
1915 save_CPPFLAGS="$CPPFLAGS"
1916 test "x$ac_cv_header_dlfcn_h" = xyes && CPPFLAGS="$CPPFLAGS -DHAVE_DLFCN_H"
1917
1918 save_LDFLAGS="$LDFLAGS"
1919 wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $export_dynamic_flag_spec\"
1920
1921 save_LIBS="$LIBS"
1922 LIBS="$lt_cv_dlopen_libs $LIBS"
1923
1924 AC_CACHE_CHECK([whether a program can dlopen itself],
1925 lt_cv_dlopen_self, [dnl
1926 _LT_TRY_DLOPEN_SELF(
1927 lt_cv_dlopen_self=yes, lt_cv_dlopen_self=yes,
1928 lt_cv_dlopen_self=no, lt_cv_dlopen_self=cross)
1929 ])
1930
1931 if test "x$lt_cv_dlopen_self" = xyes; then
1932 wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $lt_prog_compiler_static\"
1933 AC_CACHE_CHECK([whether a statically linked program can dlopen itself],
1934 lt_cv_dlopen_self_static, [dnl
1935 _LT_TRY_DLOPEN_SELF(
1936 lt_cv_dlopen_self_static=yes, lt_cv_dlopen_self_static=yes,
1937 lt_cv_dlopen_self_static=no, lt_cv_dlopen_self_static=cross)
1938 ])
1939 fi
1940
1941 CPPFLAGS="$save_CPPFLAGS"
1942 LDFLAGS="$save_LDFLAGS"
1943 LIBS="$save_LIBS"
1944 ;;
1945 esac
1946
1947 case $lt_cv_dlopen_self in
1948 yes|no) enable_dlopen_self=$lt_cv_dlopen_self ;;
1949 *) enable_dlopen_self=unknown ;;
1950 esac
1951
1952 case $lt_cv_dlopen_self_static in
1953 yes|no) enable_dlopen_self_static=$lt_cv_dlopen_self_static ;;
1954 *) enable_dlopen_self_static=unknown ;;
1955 esac
1956 fi
1957 _LT_DECL([dlopen_support], [enable_dlopen], [0],
1958 [Whether dlopen is supported])
1959 _LT_DECL([dlopen_self], [enable_dlopen_self], [0],
1960 [Whether dlopen of programs is supported])
1961 _LT_DECL([dlopen_self_static], [enable_dlopen_self_static], [0],
1962 [Whether dlopen of statically linked programs is supported])
1963 ])# LT_SYS_DLOPEN_SELF
1964
1965 # Old name:
1966 AU_ALIAS([AC_LIBTOOL_DLOPEN_SELF], [LT_SYS_DLOPEN_SELF])
1967 dnl aclocal-1.4 backwards compatibility:
1968 dnl AC_DEFUN([AC_LIBTOOL_DLOPEN_SELF], [])
1969
1970
1971 # _LT_COMPILER_C_O([TAGNAME])
1972 # ---------------------------
1973 # Check to see if options -c and -o are simultaneously supported by compiler.
1974 # This macro does not hard code the compiler like AC_PROG_CC_C_O.
1975 m4_defun([_LT_COMPILER_C_O],
1976 [m4_require([_LT_DECL_SED])dnl
1977 m4_require([_LT_FILEUTILS_DEFAULTS])dnl
1978 m4_require([_LT_TAG_COMPILER])dnl
1979 AC_CACHE_CHECK([if $compiler supports -c -o file.$ac_objext],
1980 [_LT_TAGVAR(lt_cv_prog_compiler_c_o, $1)],
1981 [_LT_TAGVAR(lt_cv_prog_compiler_c_o, $1)=no
1982 $RM -r conftest 2>/dev/null
1983 mkdir conftest
1984 cd conftest
1985 mkdir out
1986 echo "$lt_simple_compile_test_code" > conftest.$ac_ext
1987
1988 lt_compiler_flag="-o out/conftest2.$ac_objext"
1989 # Insert the option either (1) after the last *FLAGS variable, or
1990 # (2) before a word containing "conftest.", or (3) at the end.
1991 # Note that $ac_compile itself does not contain backslashes and begins
1992 # with a dollar sign (not a hyphen), so the echo should work correctly.
1993 lt_compile=`echo "$ac_compile" | $SED \
1994 -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
1995 -e 's: [[^ ]]*conftest\.: $lt_compiler_flag&:; t' \
1996 -e 's:$: $lt_compiler_flag:'`
1997 (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&AS_MESSAGE_LOG_FD)
1998 (eval "$lt_compile" 2>out/conftest.err)
1999 ac_status=$?
2000 cat out/conftest.err >&AS_MESSAGE_LOG_FD
2001 echo "$as_me:$LINENO: \$? = $ac_status" >&AS_MESSAGE_LOG_FD
2002 if (exit $ac_status) && test -s out/conftest2.$ac_objext
2003 then
2004 # The compiler can only warn and ignore the option if not recognized
2005 # So say no if there are warnings
2006 $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' > out/conftest.exp
2007 $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2
2008 if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then
2009 _LT_TAGVAR(lt_cv_prog_compiler_c_o, $1)=yes
2010 fi
2011 fi
2012 chmod u+w . 2>&AS_MESSAGE_LOG_FD
2013 $RM conftest*
2014 # SGI C++ compiler will create directory out/ii_files/ for
2015 # template instantiation
2016 test -d out/ii_files && $RM out/ii_files/* && rmdir out/ii_files
2017 $RM out/* && rmdir out
2018 cd ..
2019 $RM -r conftest
2020 $RM conftest*
2021 ])
2022 _LT_TAGDECL([compiler_c_o], [lt_cv_prog_compiler_c_o], [1],
2023 [Does compiler simultaneously support -c and -o options?])
2024 ])# _LT_COMPILER_C_O
2025
2026
2027 # _LT_COMPILER_FILE_LOCKS([TAGNAME])
2028 # ----------------------------------
2029 # Check to see if we can do hard links to lock some files if needed
2030 m4_defun([_LT_COMPILER_FILE_LOCKS],
2031 [m4_require([_LT_ENABLE_LOCK])dnl
2032 m4_require([_LT_FILEUTILS_DEFAULTS])dnl
2033 _LT_COMPILER_C_O([$1])
2034
2035 hard_links="nottested"
2036 if test "$_LT_TAGVAR(lt_cv_prog_compiler_c_o, $1)" = no && test "$need_locks" != no; then
2037 # do not overwrite the value of need_locks provided by the user
2038 AC_MSG_CHECKING([if we can lock with hard links])
2039 hard_links=yes
2040 $RM conftest*
2041 ln conftest.a conftest.b 2>/dev/null && hard_links=no
2042 touch conftest.a
2043 ln conftest.a conftest.b 2>&5 || hard_links=no
2044 ln conftest.a conftest.b 2>/dev/null && hard_links=no
2045 AC_MSG_RESULT([$hard_links])
2046 if test "$hard_links" = no; then
2047 AC_MSG_WARN([`$CC' does not support `-c -o', so `make -j' may be unsafe])
2048 need_locks=warn
2049 fi
2050 else
2051 need_locks=no
2052 fi
2053 _LT_DECL([], [need_locks], [1], [Must we lock files when doing compilation?])
2054 ])# _LT_COMPILER_FILE_LOCKS
2055
2056
2057 # _LT_CHECK_OBJDIR
2058 # ----------------
2059 m4_defun([_LT_CHECK_OBJDIR],
2060 [AC_CACHE_CHECK([for objdir], [lt_cv_objdir],
2061 [rm -f .libs 2>/dev/null
2062 mkdir .libs 2>/dev/null
2063 if test -d .libs; then
2064 lt_cv_objdir=.libs
2065 else
2066 # MS-DOS does not allow filenames that begin with a dot.
2067 lt_cv_objdir=_libs
2068 fi
2069 rmdir .libs 2>/dev/null])
2070 objdir=$lt_cv_objdir
2071 _LT_DECL([], [objdir], [0],
2072 [The name of the directory that contains temporary libtool files])dnl
2073 m4_pattern_allow([LT_OBJDIR])dnl
2074 AC_DEFINE_UNQUOTED(LT_OBJDIR, "$lt_cv_objdir/",
2075 [Define to the sub-directory in which libtool stores uninstalled libraries.])
2076 ])# _LT_CHECK_OBJDIR
2077
2078
2079 # _LT_LINKER_HARDCODE_LIBPATH([TAGNAME])
2080 # --------------------------------------
2081 # Check hardcoding attributes.
2082 m4_defun([_LT_LINKER_HARDCODE_LIBPATH],
2083 [AC_MSG_CHECKING([how to hardcode library paths into programs])
2084 _LT_TAGVAR(hardcode_action, $1)=
2085 if test -n "$_LT_TAGVAR(hardcode_libdir_flag_spec, $1)" ||
2086 test -n "$_LT_TAGVAR(runpath_var, $1)" ||
2087 test "X$_LT_TAGVAR(hardcode_automatic, $1)" = "Xyes" ; then
2088
2089 # We can hardcode non-existent directories.
2090 if test "$_LT_TAGVAR(hardcode_direct, $1)" != no &&
2091 # If the only mechanism to avoid hardcoding is shlibpath_var, we
2092 # have to relink, otherwise we might link with an installed library
2093 # when we should be linking with a yet-to-be-installed one
2094 ## test "$_LT_TAGVAR(hardcode_shlibpath_var, $1)" != no &&
2095 test "$_LT_TAGVAR(hardcode_minus_L, $1)" != no; then
2096 # Linking always hardcodes the temporary library directory.
2097 _LT_TAGVAR(hardcode_action, $1)=relink
2098 else
2099 # We can link without hardcoding, and we can hardcode nonexisting dirs.
2100 _LT_TAGVAR(hardcode_action, $1)=immediate
2101 fi
2102 else
2103 # We cannot hardcode anything, or else we can only hardcode existing
2104 # directories.
2105 _LT_TAGVAR(hardcode_action, $1)=unsupported
2106 fi
2107 AC_MSG_RESULT([$_LT_TAGVAR(hardcode_action, $1)])
2108
2109 if test "$_LT_TAGVAR(hardcode_action, $1)" = relink ||
2110 test "$_LT_TAGVAR(inherit_rpath, $1)" = yes; then
2111 # Fast installation is not supported
2112 enable_fast_install=no
2113 elif test "$shlibpath_overrides_runpath" = yes ||
2114 test "$enable_shared" = no; then
2115 # Fast installation is not necessary
2116 enable_fast_install=needless
2117 fi
2118 _LT_TAGDECL([], [hardcode_action], [0],
2119 [How to hardcode a shared library path into an executable])
2120 ])# _LT_LINKER_HARDCODE_LIBPATH
2121
2122
2123 # _LT_CMD_STRIPLIB
2124 # ----------------
2125 m4_defun([_LT_CMD_STRIPLIB],
2126 [m4_require([_LT_DECL_EGREP])
2127 striplib=
2128 old_striplib=
2129 AC_MSG_CHECKING([whether stripping libraries is possible])
2130 if test -n "$STRIP" && $STRIP -V 2>&1 | $GREP "GNU strip" >/dev/null; then
2131 test -z "$old_striplib" && old_striplib="$STRIP --strip-debug"
2132 test -z "$striplib" && striplib="$STRIP --strip-unneeded"
2133 AC_MSG_RESULT([yes])
2134 else
2135 # FIXME - insert some real tests, host_os isn't really good enough
2136 case $host_os in
2137 darwin*)
2138 if test -n "$STRIP" ; then
2139 striplib="$STRIP -x"
2140 old_striplib="$STRIP -S"
2141 AC_MSG_RESULT([yes])
2142 else
2143 AC_MSG_RESULT([no])
2144 fi
2145 ;;
2146 *)
2147 AC_MSG_RESULT([no])
2148 ;;
2149 esac
2150 fi
2151 _LT_DECL([], [old_striplib], [1], [Commands to strip libraries])
2152 _LT_DECL([], [striplib], [1])
2153 ])# _LT_CMD_STRIPLIB
2154
2155
2156 # _LT_SYS_DYNAMIC_LINKER([TAG])
2157 # -----------------------------
2158 # PORTME Fill in your ld.so characteristics
2159 m4_defun([_LT_SYS_DYNAMIC_LINKER],
2160 [AC_REQUIRE([AC_CANONICAL_HOST])dnl
2161 m4_require([_LT_DECL_EGREP])dnl
2162 m4_require([_LT_FILEUTILS_DEFAULTS])dnl
2163 m4_require([_LT_DECL_OBJDUMP])dnl
2164 m4_require([_LT_DECL_SED])dnl
2165 m4_require([_LT_CHECK_SHELL_FEATURES])dnl
2166 AC_MSG_CHECKING([dynamic linker characteristics])
2167 m4_if([$1],
2168 [], [
2169 if test "$GCC" = yes; then
2170 case $host_os in
2171 darwin*) lt_awk_arg="/^libraries:/,/LR/" ;;
2172 *) lt_awk_arg="/^libraries:/" ;;
2173 esac
2174 case $host_os in
2175 mingw* | cegcc*) lt_sed_strip_eq="s,=\([[A-Za-z]]:\),\1,g" ;;
2176 *) lt_sed_strip_eq="s,=/,/,g" ;;
2177 esac
2178 lt_search_path_spec=`$CC -print-search-dirs | awk $lt_awk_arg | $SED -e "s/^libraries://" -e $lt_sed_strip_eq`
2179 case $lt_search_path_spec in
2180 *\;*)
2181 # if the path contains ";" then we assume it to be the separator
2182 # otherwise default to the standard path separator (i.e. ":") - it is
2183 # assumed that no part of a normal pathname contains ";" but that should
2184 # okay in the real world where ";" in dirpaths is itself problematic.
2185 lt_search_path_spec=`$ECHO "$lt_search_path_spec" | $SED 's/;/ /g'`
2186 ;;
2187 *)
2188 lt_search_path_spec=`$ECHO "$lt_search_path_spec" | $SED "s/$PATH_SEPARATOR/ /g"`
2189 ;;
2190 esac
2191 # Ok, now we have the path, separated by spaces, we can step through it
2192 # and add multilib dir if necessary.
2193 lt_tmp_lt_search_path_spec=
2194 lt_multi_os_dir=`$CC $CPPFLAGS $CFLAGS $LDFLAGS -print-multi-os-directory 2>/dev/null`
2195 for lt_sys_path in $lt_search_path_spec; do
2196 if test -d "$lt_sys_path/$lt_multi_os_dir"; then
2197 lt_tmp_lt_search_path_spec="$lt_tmp_lt_search_path_spec $lt_sys_path/$lt_multi_os_dir"
2198 else
2199 test -d "$lt_sys_path" && \
2200 lt_tmp_lt_search_path_spec="$lt_tmp_lt_search_path_spec $lt_sys_path"
2201 fi
2202 done
2203 lt_search_path_spec=`$ECHO "$lt_tmp_lt_search_path_spec" | awk '
2204 BEGIN {RS=" "; FS="/|\n";} {
2205 lt_foo="";
2206 lt_count=0;
2207 for (lt_i = NF; lt_i > 0; lt_i--) {
2208 if ($lt_i != "" && $lt_i != ".") {
2209 if ($lt_i == "..") {
2210 lt_count++;
2211 } else {
2212 if (lt_count == 0) {
2213 lt_foo="/" $lt_i lt_foo;
2214 } else {
2215 lt_count--;
2216 }
2217 }
2218 }
2219 }
2220 if (lt_foo != "") { lt_freq[[lt_foo]]++; }
2221 if (lt_freq[[lt_foo]] == 1) { print lt_foo; }
2222 }'`
2223 # AWK program above erroneously prepends '/' to C:/dos/paths
2224 # for these hosts.
2225 case $host_os in
2226 mingw* | cegcc*) lt_search_path_spec=`$ECHO "$lt_search_path_spec" |\
2227 $SED 's,/\([[A-Za-z]]:\),\1,g'` ;;
2228 esac
2229 sys_lib_search_path_spec=`$ECHO "$lt_search_path_spec" | $lt_NL2SP`
2230 else
2231 sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib"
2232 fi])
2233 library_names_spec=
2234 libname_spec='lib$name'
2235 soname_spec=
2236 shrext_cmds=".so"
2237 postinstall_cmds=
2238 postuninstall_cmds=
2239 finish_cmds=
2240 finish_eval=
2241 shlibpath_var=
2242 shlibpath_overrides_runpath=unknown
2243 version_type=none
2244 dynamic_linker="$host_os ld.so"
2245 sys_lib_dlsearch_path_spec="/lib /usr/lib"
2246 need_lib_prefix=unknown
2247 hardcode_into_libs=no
2248
2249 # when you set need_version to no, make sure it does not cause -set_version
2250 # flags to be left without arguments
2251 need_version=unknown
2252
2253 case $host_os in
2254 aix3*)
2255 version_type=linux # correct to gnu/linux during the next big refactor
2256 library_names_spec='${libname}${release}${shared_ext}$versuffix $libname.a'
2257 shlibpath_var=LIBPATH
2258
2259 # AIX 3 has no versioning support, so we append a major version to the name.
2260 soname_spec='${libname}${release}${shared_ext}$major'
2261 ;;
2262
2263 aix[[4-9]]*)
2264 version_type=linux # correct to gnu/linux during the next big refactor
2265 need_lib_prefix=no
2266 need_version=no
2267 hardcode_into_libs=yes
2268 if test "$host_cpu" = ia64; then
2269 # AIX 5 supports IA64
2270 library_names_spec='${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext}$versuffix $libname${shared_ext}'
2271 shlibpath_var=LD_LIBRARY_PATH
2272 else
2273 # With GCC up to 2.95.x, collect2 would create an import file
2274 # for dependence libraries. The import file would start with
2275 # the line `#! .'. This would cause the generated library to
2276 # depend on `.', always an invalid library. This was fixed in
2277 # development snapshots of GCC prior to 3.0.
2278 case $host_os in
2279 aix4 | aix4.[[01]] | aix4.[[01]].*)
2280 if { echo '#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 97)'
2281 echo ' yes '
2282 echo '#endif'; } | ${CC} -E - | $GREP yes > /dev/null; then
2283 :
2284 else
2285 can_build_shared=no
2286 fi
2287 ;;
2288 esac
2289 # AIX (on Power*) has no versioning support, so currently we can not hardcode correct
2290 # soname into executable. Probably we can add versioning support to
2291 # collect2, so additional links can be useful in future.
2292 if test "$aix_use_runtimelinking" = yes; then
2293 # If using run time linking (on AIX 4.2 or later) use lib<name>.so
2294 # instead of lib<name>.a to let people know that these are not
2295 # typical AIX shared libraries.
2296 library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
2297 else
2298 # We preserve .a as extension for shared libraries through AIX4.2
2299 # and later when we are not doing run time linking.
2300 library_names_spec='${libname}${release}.a $libname.a'
2301 soname_spec='${libname}${release}${shared_ext}$major'
2302 fi
2303 shlibpath_var=LIBPATH
2304 fi
2305 ;;
2306
2307 amigaos*)
2308 case $host_cpu in
2309 powerpc)
2310 # Since July 2007 AmigaOS4 officially supports .so libraries.
2311 # When compiling the executable, add -use-dynld -Lsobjs: to the compileline.
2312 library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
2313 ;;
2314 m68k)
2315 library_names_spec='$libname.ixlibrary $libname.a'
2316 # Create ${libname}_ixlibrary.a entries in /sys/libs.
2317 finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`func_echo_all "$lib" | $SED '\''s%^.*/\([[^/]]*\)\.ixlibrary$%\1%'\''`; test $RM /sys/libs/${libname}_ixlibrary.a; $show "cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a"; cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a || exit 1; done'
2318 ;;
2319 esac
2320 ;;
2321
2322 beos*)
2323 library_names_spec='${libname}${shared_ext}'
2324 dynamic_linker="$host_os ld.so"
2325 shlibpath_var=LIBRARY_PATH
2326 ;;
2327
2328 bsdi[[45]]*)
2329 version_type=linux # correct to gnu/linux during the next big refactor
2330 need_version=no
2331 library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
2332 soname_spec='${libname}${release}${shared_ext}$major'
2333 finish_cmds='PATH="\$PATH:/sbin" ldconfig $libdir'
2334 shlibpath_var=LD_LIBRARY_PATH
2335 sys_lib_search_path_spec="/shlib /usr/lib /usr/X11/lib /usr/contrib/lib /lib /usr/local/lib"
2336 sys_lib_dlsearch_path_spec="/shlib /usr/lib /usr/local/lib"
2337 # the default ld.so.conf also contains /usr/contrib/lib and
2338 # /usr/X11R6/lib (/usr/X11 is a link to /usr/X11R6), but let us allow
2339 # libtool to hard-code these into programs
2340 ;;
2341
2342 cygwin* | mingw* | pw32* | cegcc*)
2343 version_type=windows
2344 shrext_cmds=".dll"
2345 need_version=no
2346 need_lib_prefix=no
2347
2348 case $GCC,$cc_basename in
2349 yes,*)
2350 # gcc
2351 library_names_spec='$libname.dll.a'
2352 # DLL is installed to $(libdir)/../bin by postinstall_cmds
2353 postinstall_cmds='base_file=`basename \${file}`~
2354 dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~
2355 dldir=$destdir/`dirname \$dlpath`~
2356 test -d \$dldir || mkdir -p \$dldir~
2357 $install_prog $dir/$dlname \$dldir/$dlname~
2358 chmod a+x \$dldir/$dlname~
2359 if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then
2360 eval '\''$striplib \$dldir/$dlname'\'' || exit \$?;
2361 fi'
2362 postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~
2363 dlpath=$dir/\$dldll~
2364 $RM \$dlpath'
2365 shlibpath_overrides_runpath=yes
2366
2367 case $host_os in
2368 cygwin*)
2369 # Cygwin DLLs use 'cyg' prefix rather than 'lib'
2370 soname_spec='`echo ${libname} | sed -e 's/^lib/cyg/'``echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext}'
2371 m4_if([$1], [],[
2372 sys_lib_search_path_spec="$sys_lib_search_path_spec /usr/lib/w32api"])
2373 ;;
2374 mingw* | cegcc*)
2375 # MinGW DLLs use traditional 'lib' prefix
2376 soname_spec='${libname}`echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext}'
2377 ;;
2378 pw32*)
2379 # pw32 DLLs use 'pw' prefix rather than 'lib'
2380 library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext}'
2381 ;;
2382 esac
2383 dynamic_linker='Win32 ld.exe'
2384 ;;
2385
2386 *,cl*)
2387 # Native MSVC
2388 libname_spec='$name'
2389 soname_spec='${libname}`echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext}'
2390 library_names_spec='${libname}.dll.lib'
2391
2392 case $build_os in
2393 mingw*)
2394 sys_lib_search_path_spec=
2395 lt_save_ifs=$IFS
2396 IFS=';'
2397 for lt_path in $LIB
2398 do
2399 IFS=$lt_save_ifs
2400 # Let DOS variable expansion print the short 8.3 style file name.
2401 lt_path=`cd "$lt_path" 2>/dev/null && cmd //C "for %i in (".") do @echo %~si"`
2402 sys_lib_search_path_spec="$sys_lib_search_path_spec $lt_path"
2403 done
2404 IFS=$lt_save_ifs
2405 # Convert to MSYS style.
2406 sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | sed -e 's|\\\\|/|g' -e 's| \\([[a-zA-Z]]\\):| /\\1|g' -e 's|^ ||'`
2407 ;;
2408 cygwin*)
2409 # Convert to unix form, then to dos form, then back to unix form
2410 # but this time dos style (no spaces!) so that the unix form looks
2411 # like /cygdrive/c/PROGRA~1:/cygdr...
2412 sys_lib_search_path_spec=`cygpath --path --unix "$LIB"`
2413 sys_lib_search_path_spec=`cygpath --path --dos "$sys_lib_search_path_spec" 2>/dev/null`
2414 sys_lib_search_path_spec=`cygpath --path --unix "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"`
2415 ;;
2416 *)
2417 sys_lib_search_path_spec="$LIB"
2418 if $ECHO "$sys_lib_search_path_spec" | [$GREP ';[c-zC-Z]:/' >/dev/null]; then
2419 # It is most probably a Windows format PATH.
2420 sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'`
2421 else
2422 sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"`
2423 fi
2424 # FIXME: find the short name or the path components, as spaces are
2425 # common. (e.g. "Program Files" -> "PROGRA~1")
2426 ;;
2427 esac
2428
2429 # DLL is installed to $(libdir)/../bin by postinstall_cmds
2430 postinstall_cmds='base_file=`basename \${file}`~
2431 dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~
2432 dldir=$destdir/`dirname \$dlpath`~
2433 test -d \$dldir || mkdir -p \$dldir~
2434 $install_prog $dir/$dlname \$dldir/$dlname'
2435 postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~
2436 dlpath=$dir/\$dldll~
2437 $RM \$dlpath'
2438 shlibpath_overrides_runpath=yes
2439 dynamic_linker='Win32 link.exe'
2440 ;;
2441
2442 *)
2443 # Assume MSVC wrapper
2444 library_names_spec='${libname}`echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext} $libname.lib'
2445 dynamic_linker='Win32 ld.exe'
2446 ;;
2447 esac
2448 # FIXME: first we should search . and the directory the executable is in
2449 shlibpath_var=PATH
2450 ;;
2451
2452 darwin* | rhapsody*)
2453 dynamic_linker="$host_os dyld"
2454 version_type=darwin
2455 need_lib_prefix=no
2456 need_version=no
2457 library_names_spec='${libname}${release}${major}$shared_ext ${libname}$shared_ext'
2458 soname_spec='${libname}${release}${major}$shared_ext'
2459 shlibpath_overrides_runpath=yes
2460 shlibpath_var=DYLD_LIBRARY_PATH
2461 shrext_cmds='`test .$module = .yes && echo .so || echo .dylib`'
2462 m4_if([$1], [],[
2463 sys_lib_search_path_spec="$sys_lib_search_path_spec /usr/local/lib"])
2464 sys_lib_dlsearch_path_spec='/usr/local/lib /lib /usr/lib'
2465 ;;
2466
2467 dgux*)
2468 version_type=linux # correct to gnu/linux during the next big refactor
2469 need_lib_prefix=no
2470 need_version=no
2471 library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname$shared_ext'
2472 soname_spec='${libname}${release}${shared_ext}$major'
2473 shlibpath_var=LD_LIBRARY_PATH
2474 ;;
2475
2476 freebsd* | dragonfly*)
2477 # DragonFly does not have aout. When/if they implement a new
2478 # versioning mechanism, adjust this.
2479 if test -x /usr/bin/objformat; then
2480 objformat=`/usr/bin/objformat`
2481 else
2482 case $host_os in
2483 freebsd[[23]].*) objformat=aout ;;
2484 *) objformat=elf ;;
2485 esac
2486 fi
2487 version_type=freebsd-$objformat
2488 case $version_type in
2489 freebsd-elf*)
2490 library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}'
2491 need_version=no
2492 need_lib_prefix=no
2493 ;;
2494 freebsd-*)
2495 library_names_spec='${libname}${release}${shared_ext}$versuffix $libname${shared_ext}$versuffix'
2496 need_version=yes
2497 ;;
2498 esac
2499 shlibpath_var=LD_LIBRARY_PATH
2500 case $host_os in
2501 freebsd2.*)
2502 shlibpath_overrides_runpath=yes
2503 ;;
2504 freebsd3.[[01]]* | freebsdelf3.[[01]]*)
2505 shlibpath_overrides_runpath=yes
2506 hardcode_into_libs=yes
2507 ;;
2508 freebsd3.[[2-9]]* | freebsdelf3.[[2-9]]* | \
2509 freebsd4.[[0-5]] | freebsdelf4.[[0-5]] | freebsd4.1.1 | freebsdelf4.1.1)
2510 shlibpath_overrides_runpath=no
2511 hardcode_into_libs=yes
2512 ;;
2513 *) # from 4.6 on, and DragonFly
2514 shlibpath_overrides_runpath=yes
2515 hardcode_into_libs=yes
2516 ;;
2517 esac
2518 ;;
2519
2520 gnu*)
2521 version_type=linux # correct to gnu/linux during the next big refactor
2522 need_lib_prefix=no
2523 need_version=no
2524 library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}'
2525 soname_spec='${libname}${release}${shared_ext}$major'
2526 shlibpath_var=LD_LIBRARY_PATH
2527 shlibpath_overrides_runpath=no
2528 hardcode_into_libs=yes
2529 ;;
2530
2531 haiku*)
2532 version_type=linux # correct to gnu/linux during the next big refactor
2533 need_lib_prefix=no
2534 need_version=no
2535 dynamic_linker="$host_os runtime_loader"
2536 library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}'
2537 soname_spec='${libname}${release}${shared_ext}$major'
2538 shlibpath_var=LIBRARY_PATH
2539 shlibpath_overrides_runpath=yes
2540 sys_lib_dlsearch_path_spec='/boot/home/config/lib /boot/common/lib /boot/system/lib'
2541 hardcode_into_libs=yes
2542 ;;
2543
2544 hpux9* | hpux10* | hpux11*)
2545 # Give a soname corresponding to the major version so that dld.sl refuses to
2546 # link against other versions.
2547 version_type=sunos
2548 need_lib_prefix=no
2549 need_version=no
2550 case $host_cpu in
2551 ia64*)
2552 shrext_cmds='.so'
2553 hardcode_into_libs=yes
2554 dynamic_linker="$host_os dld.so"
2555 shlibpath_var=LD_LIBRARY_PATH
2556 shlibpath_overrides_runpath=yes # Unless +noenvvar is specified.
2557 library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
2558 soname_spec='${libname}${release}${shared_ext}$major'
2559 if test "X$HPUX_IA64_MODE" = X32; then
2560 sys_lib_search_path_spec="/usr/lib/hpux32 /usr/local/lib/hpux32 /usr/local/lib"
2561 else
2562 sys_lib_search_path_spec="/usr/lib/hpux64 /usr/local/lib/hpux64"
2563 fi
2564 sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec
2565 ;;
2566 hppa*64*)
2567 shrext_cmds='.sl'
2568 hardcode_into_libs=yes
2569 dynamic_linker="$host_os dld.sl"
2570 shlibpath_var=LD_LIBRARY_PATH # How should we handle SHLIB_PATH
2571 shlibpath_overrides_runpath=yes # Unless +noenvvar is specified.
2572 library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
2573 soname_spec='${libname}${release}${shared_ext}$major'
2574 sys_lib_search_path_spec="/usr/lib/pa20_64 /usr/ccs/lib/pa20_64"
2575 sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec
2576 ;;
2577 *)
2578 shrext_cmds='.sl'
2579 dynamic_linker="$host_os dld.sl"
2580 shlibpath_var=SHLIB_PATH
2581 shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH
2582 library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
2583 soname_spec='${libname}${release}${shared_ext}$major'
2584 ;;
2585 esac
2586 # HP-UX runs *really* slowly unless shared libraries are mode 555, ...
2587 postinstall_cmds='chmod 555 $lib'
2588 # or fails outright, so override atomically:
2589 install_override_mode=555
2590 ;;
2591
2592 interix[[3-9]]*)
2593 version_type=linux # correct to gnu/linux during the next big refactor
2594 need_lib_prefix=no
2595 need_version=no
2596 library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}'
2597 soname_spec='${libname}${release}${shared_ext}$major'
2598 dynamic_linker='Interix 3.x ld.so.1 (PE, like ELF)'
2599 shlibpath_var=LD_LIBRARY_PATH
2600 shlibpath_overrides_runpath=no
2601 hardcode_into_libs=yes
2602 ;;
2603
2604 irix5* | irix6* | nonstopux*)
2605 case $host_os in
2606 nonstopux*) version_type=nonstopux ;;
2607 *)
2608 if test "$lt_cv_prog_gnu_ld" = yes; then
2609 version_type=linux # correct to gnu/linux during the next big refactor
2610 else
2611 version_type=irix
2612 fi ;;
2613 esac
2614 need_lib_prefix=no
2615 need_version=no
2616 soname_spec='${libname}${release}${shared_ext}$major'
2617 library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext} $libname${shared_ext}'
2618 case $host_os in
2619 irix5* | nonstopux*)
2620 libsuff= shlibsuff=
2621 ;;
2622 *)
2623 case $LD in # libtool.m4 will add one of these switches to LD
2624 *-32|*"-32 "|*-melf32bsmip|*"-melf32bsmip ")
2625 libsuff= shlibsuff= libmagic=32-bit;;
2626 *-n32|*"-n32 "|*-melf32bmipn32|*"-melf32bmipn32 ")
2627 libsuff=32 shlibsuff=N32 libmagic=N32;;
2628 *-64|*"-64 "|*-melf64bmip|*"-melf64bmip ")
2629 libsuff=64 shlibsuff=64 libmagic=64-bit;;
2630 *) libsuff= shlibsuff= libmagic=never-match;;
2631 esac
2632 ;;
2633 esac
2634 shlibpath_var=LD_LIBRARY${shlibsuff}_PATH
2635 shlibpath_overrides_runpath=no
2636 sys_lib_search_path_spec="/usr/lib${libsuff} /lib${libsuff} /usr/local/lib${libsuff}"
2637 sys_lib_dlsearch_path_spec="/usr/lib${libsuff} /lib${libsuff}"
2638 hardcode_into_libs=yes
2639 ;;
2640
2641 # No shared lib support for Linux oldld, aout, or coff.
2642 linux*oldld* | linux*aout* | linux*coff*)
2643 dynamic_linker=no
2644 ;;
2645
2646 # This must be glibc/ELF.
2647 linux* | k*bsd*-gnu | kopensolaris*-gnu)
2648 version_type=linux # correct to gnu/linux during the next big refactor
2649 need_lib_prefix=no
2650 need_version=no
2651 library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
2652 soname_spec='${libname}${release}${shared_ext}$major'
2653 finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir'
2654 shlibpath_var=LD_LIBRARY_PATH
2655 shlibpath_overrides_runpath=no
2656
2657 # Some binutils ld are patched to set DT_RUNPATH
2658 AC_CACHE_VAL([lt_cv_shlibpath_overrides_runpath],
2659 [lt_cv_shlibpath_overrides_runpath=no
2660 save_LDFLAGS=$LDFLAGS
2661 save_libdir=$libdir
2662 eval "libdir=/foo; wl=\"$_LT_TAGVAR(lt_prog_compiler_wl, $1)\"; \
2663 LDFLAGS=\"\$LDFLAGS $_LT_TAGVAR(hardcode_libdir_flag_spec, $1)\""
2664 AC_LINK_IFELSE([AC_LANG_PROGRAM([],[])],
2665 [AS_IF([ ($OBJDUMP -p conftest$ac_exeext) 2>/dev/null | grep "RUNPATH.*$libdir" >/dev/null],
2666 [lt_cv_shlibpath_overrides_runpath=yes])])
2667 LDFLAGS=$save_LDFLAGS
2668 libdir=$save_libdir
2669 ])
2670 shlibpath_overrides_runpath=$lt_cv_shlibpath_overrides_runpath
2671
2672 # This implies no fast_install, which is unacceptable.
2673 # Some rework will be needed to allow for fast_install
2674 # before this can be enabled.
2675 hardcode_into_libs=yes
2676
2677 # Append ld.so.conf contents to the search path
2678 if test -f /etc/ld.so.conf; then
2679 lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s 2>/dev/null", \[$]2)); skip = 1; } { if (!skip) print \[$]0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;/^[ ]*hwcap[ ]/d;s/[:, ]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;s/"//g;/^$/d' | tr '\n' ' '`
2680 sys_lib_dlsearch_path_spec="/lib /usr/lib $lt_ld_extra"
2681 fi
2682
2683 # We used to test for /lib/ld.so.1 and disable shared libraries on
2684 # powerpc, because MkLinux only supported shared libraries with the
2685 # GNU dynamic linker. Since this was broken with cross compilers,
2686 # most powerpc-linux boxes support dynamic linking these days and
2687 # people can always --disable-shared, the test was removed, and we
2688 # assume the GNU/Linux dynamic linker is in use.
2689 dynamic_linker='GNU/Linux ld.so'
2690 ;;
2691
2692 netbsd*)
2693 version_type=sunos
2694 need_lib_prefix=no
2695 need_version=no
2696 if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then
2697 library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix'
2698 finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir'
2699 dynamic_linker='NetBSD (a.out) ld.so'
2700 else
2701 library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}'
2702 soname_spec='${libname}${release}${shared_ext}$major'
2703 dynamic_linker='NetBSD ld.elf_so'
2704 fi
2705 shlibpath_var=LD_LIBRARY_PATH
2706 shlibpath_overrides_runpath=yes
2707 hardcode_into_libs=yes
2708 ;;
2709
2710 newsos6)
2711 version_type=linux # correct to gnu/linux during the next big refactor
2712 library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
2713 shlibpath_var=LD_LIBRARY_PATH
2714 shlibpath_overrides_runpath=yes
2715 ;;
2716
2717 *nto* | *qnx*)
2718 version_type=qnx
2719 need_lib_prefix=no
2720 need_version=no
2721 library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
2722 soname_spec='${libname}${release}${shared_ext}$major'
2723 shlibpath_var=LD_LIBRARY_PATH
2724 shlibpath_overrides_runpath=no
2725 hardcode_into_libs=yes
2726 dynamic_linker='ldqnx.so'
2727 ;;
2728
2729 openbsd*)
2730 version_type=sunos
2731 sys_lib_dlsearch_path_spec="/usr/lib"
2732 need_lib_prefix=no
2733 # Some older versions of OpenBSD (3.3 at least) *do* need versioned libs.
2734 case $host_os in
2735 openbsd3.3 | openbsd3.3.*) need_version=yes ;;
2736 *) need_version=no ;;
2737 esac
2738 library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix'
2739 finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir'
2740 shlibpath_var=LD_LIBRARY_PATH
2741 if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then
2742 case $host_os in
2743 openbsd2.[[89]] | openbsd2.[[89]].*)
2744 shlibpath_overrides_runpath=no
2745 ;;
2746 *)
2747 shlibpath_overrides_runpath=yes
2748 ;;
2749 esac
2750 else
2751 shlibpath_overrides_runpath=yes
2752 fi
2753 ;;
2754
2755 os2*)
2756 libname_spec='$name'
2757 shrext_cmds=".dll"
2758 need_lib_prefix=no
2759 library_names_spec='$libname${shared_ext} $libname.a'
2760 dynamic_linker='OS/2 ld.exe'
2761 shlibpath_var=LIBPATH
2762 ;;
2763
2764 osf3* | osf4* | osf5*)
2765 version_type=osf
2766 need_lib_prefix=no
2767 need_version=no
2768 soname_spec='${libname}${release}${shared_ext}$major'
2769 library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
2770 shlibpath_var=LD_LIBRARY_PATH
2771 sys_lib_search_path_spec="/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /usr/local/lib /var/shlib"
2772 sys_lib_dlsearch_path_spec="$sys_lib_search_path_spec"
2773 ;;
2774
2775 rdos*)
2776 dynamic_linker=no
2777 ;;
2778
2779 solaris*)
2780 version_type=linux # correct to gnu/linux during the next big refactor
2781 need_lib_prefix=no
2782 need_version=no
2783 library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
2784 soname_spec='${libname}${release}${shared_ext}$major'
2785 shlibpath_var=LD_LIBRARY_PATH
2786 shlibpath_overrides_runpath=yes
2787 hardcode_into_libs=yes
2788 # ldd complains unless libraries are executable
2789 postinstall_cmds='chmod +x $lib'
2790 ;;
2791
2792 sunos4*)
2793 version_type=sunos
2794 library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix'
2795 finish_cmds='PATH="\$PATH:/usr/etc" ldconfig $libdir'
2796 shlibpath_var=LD_LIBRARY_PATH
2797 shlibpath_overrides_runpath=yes
2798 if test "$with_gnu_ld" = yes; then
2799 need_lib_prefix=no
2800 fi
2801 need_version=yes
2802 ;;
2803
2804 sysv4 | sysv4.3*)
2805 version_type=linux # correct to gnu/linux during the next big refactor
2806 library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
2807 soname_spec='${libname}${release}${shared_ext}$major'
2808 shlibpath_var=LD_LIBRARY_PATH
2809 case $host_vendor in
2810 sni)
2811 shlibpath_overrides_runpath=no
2812 need_lib_prefix=no
2813 runpath_var=LD_RUN_PATH
2814 ;;
2815 siemens)
2816 need_lib_prefix=no
2817 ;;
2818 motorola)
2819 need_lib_prefix=no
2820 need_version=no
2821 shlibpath_overrides_runpath=no
2822 sys_lib_search_path_spec='/lib /usr/lib /usr/ccs/lib'
2823 ;;
2824 esac
2825 ;;
2826
2827 sysv4*MP*)
2828 if test -d /usr/nec ;then
2829 version_type=linux # correct to gnu/linux during the next big refactor
2830 library_names_spec='$libname${shared_ext}.$versuffix $libname${shared_ext}.$major $libname${shared_ext}'
2831 soname_spec='$libname${shared_ext}.$major'
2832 shlibpath_var=LD_LIBRARY_PATH
2833 fi
2834 ;;
2835
2836 sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*)
2837 version_type=freebsd-elf
2838 need_lib_prefix=no
2839 need_version=no
2840 library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}'
2841 soname_spec='${libname}${release}${shared_ext}$major'
2842 shlibpath_var=LD_LIBRARY_PATH
2843 shlibpath_overrides_runpath=yes
2844 hardcode_into_libs=yes
2845 if test "$with_gnu_ld" = yes; then
2846 sys_lib_search_path_spec='/usr/local/lib /usr/gnu/lib /usr/ccs/lib /usr/lib /lib'
2847 else
2848 sys_lib_search_path_spec='/usr/ccs/lib /usr/lib'
2849 case $host_os in
2850 sco3.2v5*)
2851 sys_lib_search_path_spec="$sys_lib_search_path_spec /lib"
2852 ;;
2853 esac
2854 fi
2855 sys_lib_dlsearch_path_spec='/usr/lib'
2856 ;;
2857
2858 tpf*)
2859 # TPF is a cross-target only. Preferred cross-host = GNU/Linux.
2860 version_type=linux # correct to gnu/linux during the next big refactor
2861 need_lib_prefix=no
2862 need_version=no
2863 library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
2864 shlibpath_var=LD_LIBRARY_PATH
2865 shlibpath_overrides_runpath=no
2866 hardcode_into_libs=yes
2867 ;;
2868
2869 uts4*)
2870 version_type=linux # correct to gnu/linux during the next big refactor
2871 library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
2872 soname_spec='${libname}${release}${shared_ext}$major'
2873 shlibpath_var=LD_LIBRARY_PATH
2874 ;;
2875
2876 *)
2877 dynamic_linker=no
2878 ;;
2879 esac
2880 AC_MSG_RESULT([$dynamic_linker])
2881 test "$dynamic_linker" = no && can_build_shared=no
2882
2883 variables_saved_for_relink="PATH $shlibpath_var $runpath_var"
2884 if test "$GCC" = yes; then
2885 variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH"
2886 fi
2887
2888 if test "${lt_cv_sys_lib_search_path_spec+set}" = set; then
2889 sys_lib_search_path_spec="$lt_cv_sys_lib_search_path_spec"
2890 fi
2891 if test "${lt_cv_sys_lib_dlsearch_path_spec+set}" = set; then
2892 sys_lib_dlsearch_path_spec="$lt_cv_sys_lib_dlsearch_path_spec"
2893 fi
2894
2895 _LT_DECL([], [variables_saved_for_relink], [1],
2896 [Variables whose values should be saved in libtool wrapper scripts and
2897 restored at link time])
2898 _LT_DECL([], [need_lib_prefix], [0],
2899 [Do we need the "lib" prefix for modules?])
2900 _LT_DECL([], [need_version], [0], [Do we need a version for libraries?])
2901 _LT_DECL([], [version_type], [0], [Library versioning type])
2902 _LT_DECL([], [runpath_var], [0], [Shared library runtime path variable])
2903 _LT_DECL([], [shlibpath_var], [0],[Shared library path variable])
2904 _LT_DECL([], [shlibpath_overrides_runpath], [0],
2905 [Is shlibpath searched before the hard-coded library search path?])
2906 _LT_DECL([], [libname_spec], [1], [Format of library name prefix])
2907 _LT_DECL([], [library_names_spec], [1],
2908 [[List of archive names. First name is the real one, the rest are links.
2909 The last name is the one that the linker finds with -lNAME]])
2910 _LT_DECL([], [soname_spec], [1],
2911 [[The coded name of the library, if different from the real name]])
2912 _LT_DECL([], [install_override_mode], [1],
2913 [Permission mode override for installation of shared libraries])
2914 _LT_DECL([], [postinstall_cmds], [2],
2915 [Command to use after installation of a shared archive])
2916 _LT_DECL([], [postuninstall_cmds], [2],
2917 [Command to use after uninstallation of a shared archive])
2918 _LT_DECL([], [finish_cmds], [2],
2919 [Commands used to finish a libtool library installation in a directory])
2920 _LT_DECL([], [finish_eval], [1],
2921 [[As "finish_cmds", except a single script fragment to be evaled but
2922 not shown]])
2923 _LT_DECL([], [hardcode_into_libs], [0],
2924 [Whether we should hardcode library paths into libraries])
2925 _LT_DECL([], [sys_lib_search_path_spec], [2],
2926 [Compile-time system search path for libraries])
2927 _LT_DECL([], [sys_lib_dlsearch_path_spec], [2],
2928 [Run-time system search path for libraries])
2929 ])# _LT_SYS_DYNAMIC_LINKER
2930
2931
2932 # _LT_PATH_TOOL_PREFIX(TOOL)
2933 # --------------------------
2934 # find a file program which can recognize shared library
2935 AC_DEFUN([_LT_PATH_TOOL_PREFIX],
2936 [m4_require([_LT_DECL_EGREP])dnl
2937 AC_MSG_CHECKING([for $1])
2938 AC_CACHE_VAL(lt_cv_path_MAGIC_CMD,
2939 [case $MAGIC_CMD in
2940 [[\\/*] | ?:[\\/]*])
2941 lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a path.
2942 ;;
2943 *)
2944 lt_save_MAGIC_CMD="$MAGIC_CMD"
2945 lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR
2946 dnl $ac_dummy forces splitting on constant user-supplied paths.
2947 dnl POSIX.2 word splitting is done only on the output of word expansions,
2948 dnl not every word. This closes a longstanding sh security hole.
2949 ac_dummy="m4_if([$2], , $PATH, [$2])"
2950 for ac_dir in $ac_dummy; do
2951 IFS="$lt_save_ifs"
2952 test -z "$ac_dir" && ac_dir=.
2953 if test -f $ac_dir/$1; then
2954 lt_cv_path_MAGIC_CMD="$ac_dir/$1"
2955 if test -n "$file_magic_test_file"; then
2956 case $deplibs_check_method in
2957 "file_magic "*)
2958 file_magic_regex=`expr "$deplibs_check_method" : "file_magic \(.*\)"`
2959 MAGIC_CMD="$lt_cv_path_MAGIC_CMD"
2960 if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null |
2961 $EGREP "$file_magic_regex" > /dev/null; then
2962 :
2963 else
2964 cat <<_LT_EOF 1>&2
2965
2966 *** Warning: the command libtool uses to detect shared libraries,
2967 *** $file_magic_cmd, produces output that libtool cannot recognize.
2968 *** The result is that libtool may fail to recognize shared libraries
2969 *** as such. This will affect the creation of libtool libraries that
2970 *** depend on shared libraries, but programs linked with such libtool
2971 *** libraries will work regardless of this problem. Nevertheless, you
2972 *** may want to report the problem to your system manager and/or to
2973 *** bug-libtool@gnu.org
2974
2975 _LT_EOF
2976 fi ;;
2977 esac
2978 fi
2979 break
2980 fi
2981 done
2982 IFS="$lt_save_ifs"
2983 MAGIC_CMD="$lt_save_MAGIC_CMD"
2984 ;;
2985 esac])
2986 MAGIC_CMD="$lt_cv_path_MAGIC_CMD"
2987 if test -n "$MAGIC_CMD"; then
2988 AC_MSG_RESULT($MAGIC_CMD)
2989 else
2990 AC_MSG_RESULT(no)
2991 fi
2992 _LT_DECL([], [MAGIC_CMD], [0],
2993 [Used to examine libraries when file_magic_cmd begins with "file"])dnl
2994 ])# _LT_PATH_TOOL_PREFIX
2995
2996 # Old name:
2997 AU_ALIAS([AC_PATH_TOOL_PREFIX], [_LT_PATH_TOOL_PREFIX])
2998 dnl aclocal-1.4 backwards compatibility:
2999 dnl AC_DEFUN([AC_PATH_TOOL_PREFIX], [])
3000
3001
3002 # _LT_PATH_MAGIC
3003 # --------------
3004 # find a file program which can recognize a shared library
3005 m4_defun([_LT_PATH_MAGIC],
3006 [_LT_PATH_TOOL_PREFIX(${ac_tool_prefix}file, /usr/bin$PATH_SEPARATOR$PATH)
3007 if test -z "$lt_cv_path_MAGIC_CMD"; then
3008 if test -n "$ac_tool_prefix"; then
3009 _LT_PATH_TOOL_PREFIX(file, /usr/bin$PATH_SEPARATOR$PATH)
3010 else
3011 MAGIC_CMD=:
3012 fi
3013 fi
3014 ])# _LT_PATH_MAGIC
3015
3016
3017 # LT_PATH_LD
3018 # ----------
3019 # find the pathname to the GNU or non-GNU linker
3020 AC_DEFUN([LT_PATH_LD],
3021 [AC_REQUIRE([AC_PROG_CC])dnl
3022 AC_REQUIRE([AC_CANONICAL_HOST])dnl
3023 AC_REQUIRE([AC_CANONICAL_BUILD])dnl
3024 m4_require([_LT_DECL_SED])dnl
3025 m4_require([_LT_DECL_EGREP])dnl
3026 m4_require([_LT_PROG_ECHO_BACKSLASH])dnl
3027
3028 AC_ARG_WITH([gnu-ld],
3029 [AS_HELP_STRING([--with-gnu-ld],
3030 [assume the C compiler uses GNU ld @<:@default=no@:>@])],
3031 [test "$withval" = no || with_gnu_ld=yes],
3032 [with_gnu_ld=no])dnl
3033
3034 ac_prog=ld
3035 if test "$GCC" = yes; then
3036 # Check if gcc -print-prog-name=ld gives a path.
3037 AC_MSG_CHECKING([for ld used by $CC])
3038 case $host in
3039 *-*-mingw*)
3040 # gcc leaves a trailing carriage return which upsets mingw
3041 ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;;
3042 *)
3043 ac_prog=`($CC -print-prog-name=ld) 2>&5` ;;
3044 esac
3045 case $ac_prog in
3046 # Accept absolute paths.
3047 [[\\/]]* | ?:[[\\/]]*)
3048 re_direlt='/[[^/]][[^/]]*/\.\./'
3049 # Canonicalize the pathname of ld
3050 ac_prog=`$ECHO "$ac_prog"| $SED 's%\\\\%/%g'`
3051 while $ECHO "$ac_prog" | $GREP "$re_direlt" > /dev/null 2>&1; do
3052 ac_prog=`$ECHO $ac_prog| $SED "s%$re_direlt%/%"`
3053 done
3054 test -z "$LD" && LD="$ac_prog"
3055 ;;
3056 "")
3057 # If it fails, then pretend we aren't using GCC.
3058 ac_prog=ld
3059 ;;
3060 *)
3061 # If it is relative, then search for the first ld in PATH.
3062 with_gnu_ld=unknown
3063 ;;
3064 esac
3065 elif test "$with_gnu_ld" = yes; then
3066 AC_MSG_CHECKING([for GNU ld])
3067 else
3068 AC_MSG_CHECKING([for non-GNU ld])
3069 fi
3070 AC_CACHE_VAL(lt_cv_path_LD,
3071 [if test -z "$LD"; then
3072 lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR
3073 for ac_dir in $PATH; do
3074 IFS="$lt_save_ifs"
3075 test -z "$ac_dir" && ac_dir=.
3076 if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then
3077 lt_cv_path_LD="$ac_dir/$ac_prog"
3078 # Check to see if the program is GNU ld. I'd rather use --version,
3079 # but apparently some variants of GNU ld only accept -v.
3080 # Break only if it was the GNU/non-GNU ld that we prefer.
3081 case `"$lt_cv_path_LD" -v 2>&1 </dev/null` in
3082 *GNU* | *'with BFD'*)
3083 test "$with_gnu_ld" != no && break
3084 ;;
3085 *)
3086 test "$with_gnu_ld" != yes && break
3087 ;;
3088 esac
3089 fi
3090 done
3091 IFS="$lt_save_ifs"
3092 else
3093 lt_cv_path_LD="$LD" # Let the user override the test with a path.
3094 fi])
3095 LD="$lt_cv_path_LD"
3096 if test -n "$LD"; then
3097 AC_MSG_RESULT($LD)
3098 else
3099 AC_MSG_RESULT(no)
3100 fi
3101 test -z "$LD" && AC_MSG_ERROR([no acceptable ld found in \$PATH])
3102 _LT_PATH_LD_GNU
3103 AC_SUBST([LD])
3104
3105 _LT_TAGDECL([], [LD], [1], [The linker used to build libraries])
3106 ])# LT_PATH_LD
3107
3108 # Old names:
3109 AU_ALIAS([AM_PROG_LD], [LT_PATH_LD])
3110 AU_ALIAS([AC_PROG_LD], [LT_PATH_LD])
3111 dnl aclocal-1.4 backwards compatibility:
3112 dnl AC_DEFUN([AM_PROG_LD], [])
3113 dnl AC_DEFUN([AC_PROG_LD], [])
3114
3115
3116 # _LT_PATH_LD_GNU
3117 #- --------------
3118 m4_defun([_LT_PATH_LD_GNU],
3119 [AC_CACHE_CHECK([if the linker ($LD) is GNU ld], lt_cv_prog_gnu_ld,
3120 [# I'd rather use --version here, but apparently some GNU lds only accept -v.
3121 case `$LD -v 2>&1 </dev/null` in
3122 *GNU* | *'with BFD'*)
3123 lt_cv_prog_gnu_ld=yes
3124 ;;
3125 *)
3126 lt_cv_prog_gnu_ld=no
3127 ;;
3128 esac])
3129 with_gnu_ld=$lt_cv_prog_gnu_ld
3130 ])# _LT_PATH_LD_GNU
3131
3132
3133 # _LT_CMD_RELOAD
3134 # --------------
3135 # find reload flag for linker
3136 # -- PORTME Some linkers may need a different reload flag.
3137 m4_defun([_LT_CMD_RELOAD],
3138 [AC_CACHE_CHECK([for $LD option to reload object files],
3139 lt_cv_ld_reload_flag,
3140 [lt_cv_ld_reload_flag='-r'])
3141 reload_flag=$lt_cv_ld_reload_flag
3142 case $reload_flag in
3143 "" | " "*) ;;
3144 *) reload_flag=" $reload_flag" ;;
3145 esac
3146 reload_cmds='$LD$reload_flag -o $output$reload_objs'
3147 case $host_os in
3148 cygwin* | mingw* | pw32* | cegcc*)
3149 if test "$GCC" != yes; then
3150 reload_cmds=false
3151 fi
3152 ;;
3153 darwin*)
3154 if test "$GCC" = yes; then
3155 reload_cmds='$LTCC $LTCFLAGS -nostdlib ${wl}-r -o $output$reload_objs'
3156 else
3157 reload_cmds='$LD$reload_flag -o $output$reload_objs'
3158 fi
3159 ;;
3160 esac
3161 _LT_TAGDECL([], [reload_flag], [1], [How to create reloadable object files])dnl
3162 _LT_TAGDECL([], [reload_cmds], [2])dnl
3163 ])# _LT_CMD_RELOAD
3164
3165
3166 # _LT_CHECK_MAGIC_METHOD
3167 # ----------------------
3168 # how to check for library dependencies
3169 # -- PORTME fill in with the dynamic library characteristics
3170 m4_defun([_LT_CHECK_MAGIC_METHOD],
3171 [m4_require([_LT_DECL_EGREP])
3172 m4_require([_LT_DECL_OBJDUMP])
3173 AC_CACHE_CHECK([how to recognize dependent libraries],
3174 lt_cv_deplibs_check_method,
3175 [lt_cv_file_magic_cmd='$MAGIC_CMD'
3176 lt_cv_file_magic_test_file=
3177 lt_cv_deplibs_check_method='unknown'
3178 # Need to set the preceding variable on all platforms that support
3179 # interlibrary dependencies.
3180 # 'none' -- dependencies not supported.
3181 # `unknown' -- same as none, but documents that we really don't know.
3182 # 'pass_all' -- all dependencies passed with no checks.
3183 # 'test_compile' -- check by making test program.
3184 # 'file_magic [[regex]]' -- check by looking for files in library path
3185 # which responds to the $file_magic_cmd with a given extended regex.
3186 # If you have `file' or equivalent on your system and you're not sure
3187 # whether `pass_all' will *always* work, you probably want this one.
3188
3189 case $host_os in
3190 aix[[4-9]]*)
3191 lt_cv_deplibs_check_method=pass_all
3192 ;;
3193
3194 beos*)
3195 lt_cv_deplibs_check_method=pass_all
3196 ;;
3197
3198 bsdi[[45]]*)
3199 lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[ML]]SB (shared object|dynamic lib)'
3200 lt_cv_file_magic_cmd='/usr/bin/file -L'
3201 lt_cv_file_magic_test_file=/shlib/libc.so
3202 ;;
3203
3204 cygwin*)
3205 # func_win32_libid is a shell function defined in ltmain.sh
3206 lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL'
3207 lt_cv_file_magic_cmd='func_win32_libid'
3208 ;;
3209
3210 mingw* | pw32*)
3211 # Base MSYS/MinGW do not provide the 'file' command needed by
3212 # func_win32_libid shell function, so use a weaker test based on 'objdump',
3213 # unless we find 'file', for example because we are cross-compiling.
3214 # func_win32_libid assumes BSD nm, so disallow it if using MS dumpbin.
3215 if ( test "$lt_cv_nm_interface" = "BSD nm" && file / ) >/dev/null 2>&1; then
3216 lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL'
3217 lt_cv_file_magic_cmd='func_win32_libid'
3218 else
3219 # Keep this pattern in sync with the one in func_win32_libid.
3220 lt_cv_deplibs_check_method='file_magic file format (pei*-i386(.*architecture: i386)?|pe-arm-wince|pe-x86-64)'
3221 lt_cv_file_magic_cmd='$OBJDUMP -f'
3222 fi
3223 ;;
3224
3225 cegcc*)
3226 # use the weaker test based on 'objdump'. See mingw*.
3227 lt_cv_deplibs_check_method='file_magic file format pe-arm-.*little(.*architecture: arm)?'
3228 lt_cv_file_magic_cmd='$OBJDUMP -f'
3229 ;;
3230
3231 darwin* | rhapsody*)
3232 lt_cv_deplibs_check_method=pass_all
3233 ;;
3234
3235 freebsd* | dragonfly*)
3236 if echo __ELF__ | $CC -E - | $GREP __ELF__ > /dev/null; then
3237 case $host_cpu in
3238 i*86 )
3239 # Not sure whether the presence of OpenBSD here was a mistake.
3240 # Let's accept both of them until this is cleared up.
3241 lt_cv_deplibs_check_method='file_magic (FreeBSD|OpenBSD|DragonFly)/i[[3-9]]86 (compact )?demand paged shared library'
3242 lt_cv_file_magic_cmd=/usr/bin/file
3243 lt_cv_file_magic_test_file=`echo /usr/lib/libc.so.*`
3244 ;;
3245 esac
3246 else
3247 lt_cv_deplibs_check_method=pass_all
3248 fi
3249 ;;
3250
3251 gnu*)
3252 lt_cv_deplibs_check_method=pass_all
3253 ;;
3254
3255 haiku*)
3256 lt_cv_deplibs_check_method=pass_all
3257 ;;
3258
3259 hpux10.20* | hpux11*)
3260 lt_cv_file_magic_cmd=/usr/bin/file
3261 case $host_cpu in
3262 ia64*)
3263 lt_cv_deplibs_check_method='file_magic (s[[0-9]][[0-9]][[0-9]]|ELF-[[0-9]][[0-9]]) shared object file - IA64'
3264 lt_cv_file_magic_test_file=/usr/lib/hpux32/libc.so
3265 ;;
3266 hppa*64*)
3267 [lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|ELF[ -][0-9][0-9])(-bit)?( [LM]SB)? shared object( file)?[, -]* PA-RISC [0-9]\.[0-9]']
3268 lt_cv_file_magic_test_file=/usr/lib/pa20_64/libc.sl
3269 ;;
3270 *)
3271 lt_cv_deplibs_check_method='file_magic (s[[0-9]][[0-9]][[0-9]]|PA-RISC[[0-9]]\.[[0-9]]) shared library'
3272 lt_cv_file_magic_test_file=/usr/lib/libc.sl
3273 ;;
3274 esac
3275 ;;
3276
3277 interix[[3-9]]*)
3278 # PIC code is broken on Interix 3.x, that's why |\.a not |_pic\.a here
3279 lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so|\.a)$'
3280 ;;
3281
3282 irix5* | irix6* | nonstopux*)
3283 case $LD in
3284 *-32|*"-32 ") libmagic=32-bit;;
3285 *-n32|*"-n32 ") libmagic=N32;;
3286 *-64|*"-64 ") libmagic=64-bit;;
3287 *) libmagic=never-match;;
3288 esac
3289 lt_cv_deplibs_check_method=pass_all
3290 ;;
3291
3292 # This must be glibc/ELF.
3293 linux* | k*bsd*-gnu | kopensolaris*-gnu)
3294 lt_cv_deplibs_check_method=pass_all
3295 ;;
3296
3297 netbsd*)
3298 if echo __ELF__ | $CC -E - | $GREP __ELF__ > /dev/null; then
3299 lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so\.[[0-9]]+\.[[0-9]]+|_pic\.a)$'
3300 else
3301 lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so|_pic\.a)$'
3302 fi
3303 ;;
3304
3305 newos6*)
3306 lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[ML]]SB (executable|dynamic lib)'
3307 lt_cv_file_magic_cmd=/usr/bin/file
3308 lt_cv_file_magic_test_file=/usr/lib/libnls.so
3309 ;;
3310
3311 *nto* | *qnx*)
3312 lt_cv_deplibs_check_method=pass_all
3313 ;;
3314
3315 openbsd*)
3316 if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then
3317 lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so\.[[0-9]]+\.[[0-9]]+|\.so|_pic\.a)$'
3318 else
3319 lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so\.[[0-9]]+\.[[0-9]]+|_pic\.a)$'
3320 fi
3321 ;;
3322
3323 osf3* | osf4* | osf5*)
3324 lt_cv_deplibs_check_method=pass_all
3325 ;;
3326
3327 rdos*)
3328 lt_cv_deplibs_check_method=pass_all
3329 ;;
3330
3331 solaris*)
3332 lt_cv_deplibs_check_method=pass_all
3333 ;;
3334
3335 sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*)
3336 lt_cv_deplibs_check_method=pass_all
3337 ;;
3338
3339 sysv4 | sysv4.3*)
3340 case $host_vendor in
3341 motorola)
3342 lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[ML]]SB (shared object|dynamic lib) M[[0-9]][[0-9]]* Version [[0-9]]'
3343 lt_cv_file_magic_test_file=`echo /usr/lib/libc.so*`
3344 ;;
3345 ncr)
3346 lt_cv_deplibs_check_method=pass_all
3347 ;;
3348 sequent)
3349 lt_cv_file_magic_cmd='/bin/file'
3350 lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[LM]]SB (shared object|dynamic lib )'
3351 ;;
3352 sni)
3353 lt_cv_file_magic_cmd='/bin/file'
3354 lt_cv_deplibs_check_method="file_magic ELF [[0-9]][[0-9]]*-bit [[LM]]SB dynamic lib"
3355 lt_cv_file_magic_test_file=/lib/libc.so
3356 ;;
3357 siemens)
3358 lt_cv_deplibs_check_method=pass_all
3359 ;;
3360 pc)
3361 lt_cv_deplibs_check_method=pass_all
3362 ;;
3363 esac
3364 ;;
3365
3366 tpf*)
3367 lt_cv_deplibs_check_method=pass_all
3368 ;;
3369 esac
3370 ])
3371
3372 file_magic_glob=
3373 want_nocaseglob=no
3374 if test "$build" = "$host"; then
3375 case $host_os in
3376 mingw* | pw32*)
3377 if ( shopt | grep nocaseglob ) >/dev/null 2>&1; then
3378 want_nocaseglob=yes
3379 else
3380 file_magic_glob=`echo aAbBcCdDeEfFgGhHiIjJkKlLmMnNoOpPqQrRsStTuUvVwWxXyYzZ | $SED -e "s/\(..\)/s\/[[\1]]\/[[\1]]\/g;/g"`
3381 fi
3382 ;;
3383 esac
3384 fi
3385
3386 file_magic_cmd=$lt_cv_file_magic_cmd
3387 deplibs_check_method=$lt_cv_deplibs_check_method
3388 test -z "$deplibs_check_method" && deplibs_check_method=unknown
3389
3390 _LT_DECL([], [deplibs_check_method], [1],
3391 [Method to check whether dependent libraries are shared objects])
3392 _LT_DECL([], [file_magic_cmd], [1],
3393 [Command to use when deplibs_check_method = "file_magic"])
3394 _LT_DECL([], [file_magic_glob], [1],
3395 [How to find potential files when deplibs_check_method = "file_magic"])
3396 _LT_DECL([], [want_nocaseglob], [1],
3397 [Find potential files using nocaseglob when deplibs_check_method = "file_magic"])
3398 ])# _LT_CHECK_MAGIC_METHOD
3399
3400
3401 # LT_PATH_NM
3402 # ----------
3403 # find the pathname to a BSD- or MS-compatible name lister
3404 AC_DEFUN([LT_PATH_NM],
3405 [AC_REQUIRE([AC_PROG_CC])dnl
3406 AC_CACHE_CHECK([for BSD- or MS-compatible name lister (nm)], lt_cv_path_NM,
3407 [if test -n "$NM"; then
3408 # Let the user override the test.
3409 lt_cv_path_NM="$NM"
3410 else
3411 lt_nm_to_check="${ac_tool_prefix}nm"
3412 if test -n "$ac_tool_prefix" && test "$build" = "$host"; then
3413 lt_nm_to_check="$lt_nm_to_check nm"
3414 fi
3415 for lt_tmp_nm in $lt_nm_to_check; do
3416 lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR
3417 for ac_dir in $PATH /usr/ccs/bin/elf /usr/ccs/bin /usr/ucb /bin; do
3418 IFS="$lt_save_ifs"
3419 test -z "$ac_dir" && ac_dir=.
3420 tmp_nm="$ac_dir/$lt_tmp_nm"
3421 if test -f "$tmp_nm" || test -f "$tmp_nm$ac_exeext" ; then
3422 # Check to see if the nm accepts a BSD-compat flag.
3423 # Adding the `sed 1q' prevents false positives on HP-UX, which says:
3424 # nm: unknown option "B" ignored
3425 # Tru64's nm complains that /dev/null is an invalid object file
3426 case `"$tmp_nm" -B /dev/null 2>&1 | sed '1q'` in
3427 */dev/null* | *'Invalid file or object type'*)
3428 lt_cv_path_NM="$tmp_nm -B"
3429 break
3430 ;;
3431 *)
3432 case `"$tmp_nm" -p /dev/null 2>&1 | sed '1q'` in
3433 */dev/null*)
3434 lt_cv_path_NM="$tmp_nm -p"
3435 break
3436 ;;
3437 *)
3438 lt_cv_path_NM=${lt_cv_path_NM="$tmp_nm"} # keep the first match, but
3439 continue # so that we can try to find one that supports BSD flags
3440 ;;
3441 esac
3442 ;;
3443 esac
3444 fi
3445 done
3446 IFS="$lt_save_ifs"
3447 done
3448 : ${lt_cv_path_NM=no}
3449 fi])
3450 if test "$lt_cv_path_NM" != "no"; then
3451 NM="$lt_cv_path_NM"
3452 else
3453 # Didn't find any BSD compatible name lister, look for dumpbin.
3454 if test -n "$DUMPBIN"; then :
3455 # Let the user override the test.
3456 else
3457 AC_CHECK_TOOLS(DUMPBIN, [dumpbin "link -dump"], :)
3458 case `$DUMPBIN -symbols /dev/null 2>&1 | sed '1q'` in
3459 *COFF*)
3460 DUMPBIN="$DUMPBIN -symbols"
3461 ;;
3462 *)
3463 DUMPBIN=:
3464 ;;
3465 esac
3466 fi
3467 AC_SUBST([DUMPBIN])
3468 if test "$DUMPBIN" != ":"; then
3469 NM="$DUMPBIN"
3470 fi
3471 fi
3472 test -z "$NM" && NM=nm
3473 AC_SUBST([NM])
3474 _LT_DECL([], [NM], [1], [A BSD- or MS-compatible name lister])dnl
3475
3476 AC_CACHE_CHECK([the name lister ($NM) interface], [lt_cv_nm_interface],
3477 [lt_cv_nm_interface="BSD nm"
3478 echo "int some_variable = 0;" > conftest.$ac_ext
3479 (eval echo "\"\$as_me:$LINENO: $ac_compile\"" >&AS_MESSAGE_LOG_FD)
3480 (eval "$ac_compile" 2>conftest.err)
3481 cat conftest.err >&AS_MESSAGE_LOG_FD
3482 (eval echo "\"\$as_me:$LINENO: $NM \\\"conftest.$ac_objext\\\"\"" >&AS_MESSAGE_LOG_FD)
3483 (eval "$NM \"conftest.$ac_objext\"" 2>conftest.err > conftest.out)
3484 cat conftest.err >&AS_MESSAGE_LOG_FD
3485 (eval echo "\"\$as_me:$LINENO: output\"" >&AS_MESSAGE_LOG_FD)
3486 cat conftest.out >&AS_MESSAGE_LOG_FD
3487 if $GREP 'External.*some_variable' conftest.out > /dev/null; then
3488 lt_cv_nm_interface="MS dumpbin"
3489 fi
3490 rm -f conftest*])
3491 ])# LT_PATH_NM
3492
3493 # Old names:
3494 AU_ALIAS([AM_PROG_NM], [LT_PATH_NM])
3495 AU_ALIAS([AC_PROG_NM], [LT_PATH_NM])
3496 dnl aclocal-1.4 backwards compatibility:
3497 dnl AC_DEFUN([AM_PROG_NM], [])
3498 dnl AC_DEFUN([AC_PROG_NM], [])
3499
3500 # _LT_CHECK_SHAREDLIB_FROM_LINKLIB
3501 # --------------------------------
3502 # how to determine the name of the shared library
3503 # associated with a specific link library.
3504 # -- PORTME fill in with the dynamic library characteristics
3505 m4_defun([_LT_CHECK_SHAREDLIB_FROM_LINKLIB],
3506 [m4_require([_LT_DECL_EGREP])
3507 m4_require([_LT_DECL_OBJDUMP])
3508 m4_require([_LT_DECL_DLLTOOL])
3509 AC_CACHE_CHECK([how to associate runtime and link libraries],
3510 lt_cv_sharedlib_from_linklib_cmd,
3511 [lt_cv_sharedlib_from_linklib_cmd='unknown'
3512
3513 case $host_os in
3514 cygwin* | mingw* | pw32* | cegcc*)
3515 # two different shell functions defined in ltmain.sh
3516 # decide which to use based on capabilities of $DLLTOOL
3517 case `$DLLTOOL --help 2>&1` in
3518 *--identify-strict*)
3519 lt_cv_sharedlib_from_linklib_cmd=func_cygming_dll_for_implib
3520 ;;
3521 *)
3522 lt_cv_sharedlib_from_linklib_cmd=func_cygming_dll_for_implib_fallback
3523 ;;
3524 esac
3525 ;;
3526 *)
3527 # fallback: assume linklib IS sharedlib
3528 lt_cv_sharedlib_from_linklib_cmd="$ECHO"
3529 ;;
3530 esac
3531 ])
3532 sharedlib_from_linklib_cmd=$lt_cv_sharedlib_from_linklib_cmd
3533 test -z "$sharedlib_from_linklib_cmd" && sharedlib_from_linklib_cmd=$ECHO
3534
3535 _LT_DECL([], [sharedlib_from_linklib_cmd], [1],
3536 [Command to associate shared and link libraries])
3537 ])# _LT_CHECK_SHAREDLIB_FROM_LINKLIB
3538
3539
3540 # _LT_PATH_MANIFEST_TOOL
3541 # ----------------------
3542 # locate the manifest tool
3543 m4_defun([_LT_PATH_MANIFEST_TOOL],
3544 [AC_CHECK_TOOL(MANIFEST_TOOL, mt, :)
3545 test -z "$MANIFEST_TOOL" && MANIFEST_TOOL=mt
3546 AC_CACHE_CHECK([if $MANIFEST_TOOL is a manifest tool], [lt_cv_path_mainfest_tool],
3547 [lt_cv_path_mainfest_tool=no
3548 echo "$as_me:$LINENO: $MANIFEST_TOOL '-?'" >&AS_MESSAGE_LOG_FD
3549 $MANIFEST_TOOL '-?' 2>conftest.err > conftest.out
3550 cat conftest.err >&AS_MESSAGE_LOG_FD
3551 if $GREP 'Manifest Tool' conftest.out > /dev/null; then
3552 lt_cv_path_mainfest_tool=yes
3553 fi
3554 rm -f conftest*])
3555 if test "x$lt_cv_path_mainfest_tool" != xyes; then
3556 MANIFEST_TOOL=:
3557 fi
3558 _LT_DECL([], [MANIFEST_TOOL], [1], [Manifest tool])dnl
3559 ])# _LT_PATH_MANIFEST_TOOL
3560
3561
3562 # LT_LIB_M
3563 # --------
3564 # check for math library
3565 AC_DEFUN([LT_LIB_M],
3566 [AC_REQUIRE([AC_CANONICAL_HOST])dnl
3567 LIBM=
3568 case $host in
3569 *-*-beos* | *-*-cegcc* | *-*-cygwin* | *-*-haiku* | *-*-pw32* | *-*-darwin*)
3570 # These system don't have libm, or don't need it
3571 ;;
3572 *-ncr-sysv4.3*)
3573 AC_CHECK_LIB(mw, _mwvalidcheckl, LIBM="-lmw")
3574 AC_CHECK_LIB(m, cos, LIBM="$LIBM -lm")
3575 ;;
3576 *)
3577 AC_CHECK_LIB(m, cos, LIBM="-lm")
3578 ;;
3579 esac
3580 AC_SUBST([LIBM])
3581 ])# LT_LIB_M
3582
3583 # Old name:
3584 AU_ALIAS([AC_CHECK_LIBM], [LT_LIB_M])
3585 dnl aclocal-1.4 backwards compatibility:
3586 dnl AC_DEFUN([AC_CHECK_LIBM], [])
3587
3588
3589 # _LT_COMPILER_NO_RTTI([TAGNAME])
3590 # -------------------------------
3591 m4_defun([_LT_COMPILER_NO_RTTI],
3592 [m4_require([_LT_TAG_COMPILER])dnl
3593
3594 _LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=
3595
3596 if test "$GCC" = yes; then
3597 case $cc_basename in
3598 nvcc*)
3599 _LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=' -Xcompiler -fno-builtin' ;;
3600 *)
3601 _LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=' -fno-builtin' ;;
3602 esac
3603
3604 _LT_COMPILER_OPTION([if $compiler supports -fno-rtti -fno-exceptions],
3605 lt_cv_prog_compiler_rtti_exceptions,
3606 [-fno-rtti -fno-exceptions], [],
3607 [_LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)="$_LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1) -fno-rtti -fno-exceptions"])
3608 fi
3609 _LT_TAGDECL([no_builtin_flag], [lt_prog_compiler_no_builtin_flag], [1],
3610 [Compiler flag to turn off builtin functions])
3611 ])# _LT_COMPILER_NO_RTTI
3612
3613
3614 # _LT_CMD_GLOBAL_SYMBOLS
3615 # ----------------------
3616 m4_defun([_LT_CMD_GLOBAL_SYMBOLS],
3617 [AC_REQUIRE([AC_CANONICAL_HOST])dnl
3618 AC_REQUIRE([AC_PROG_CC])dnl
3619 AC_REQUIRE([AC_PROG_AWK])dnl
3620 AC_REQUIRE([LT_PATH_NM])dnl
3621 AC_REQUIRE([LT_PATH_LD])dnl
3622 m4_require([_LT_DECL_SED])dnl
3623 m4_require([_LT_DECL_EGREP])dnl
3624 m4_require([_LT_TAG_COMPILER])dnl
3625
3626 # Check for command to grab the raw symbol name followed by C symbol from nm.
3627 AC_MSG_CHECKING([command to parse $NM output from $compiler object])
3628 AC_CACHE_VAL([lt_cv_sys_global_symbol_pipe],
3629 [
3630 # These are sane defaults that work on at least a few old systems.
3631 # [They come from Ultrix. What could be older than Ultrix?!! ;)]
3632
3633 # Character class describing NM global symbol codes.
3634 symcode='[[BCDEGRST]]'
3635
3636 # Regexp to match symbols that can be accessed directly from C.
3637 sympat='\([[_A-Za-z]][[_A-Za-z0-9]]*\)'
3638
3639 # Define system-specific variables.
3640 case $host_os in
3641 aix*)
3642 symcode='[[BCDT]]'
3643 ;;
3644 cygwin* | mingw* | pw32* | cegcc*)
3645 symcode='[[ABCDGISTW]]'
3646 ;;
3647 hpux*)
3648 if test "$host_cpu" = ia64; then
3649 symcode='[[ABCDEGRST]]'
3650 fi
3651 ;;
3652 irix* | nonstopux*)
3653 symcode='[[BCDEGRST]]'
3654 ;;
3655 osf*)
3656 symcode='[[BCDEGQRST]]'
3657 ;;
3658 solaris*)
3659 symcode='[[BDRT]]'
3660 ;;
3661 sco3.2v5*)
3662 symcode='[[DT]]'
3663 ;;
3664 sysv4.2uw2*)
3665 symcode='[[DT]]'
3666 ;;
3667 sysv5* | sco5v6* | unixware* | OpenUNIX*)
3668 symcode='[[ABDT]]'
3669 ;;
3670 sysv4)
3671 symcode='[[DFNSTU]]'
3672 ;;
3673 esac
3674
3675 # If we're using GNU nm, then use its standard symbol codes.
3676 case `$NM -V 2>&1` in
3677 *GNU* | *'with BFD'*)
3678 symcode='[[ABCDGIRSTW]]' ;;
3679 esac
3680
3681 # Transform an extracted symbol line into a proper C declaration.
3682 # Some systems (esp. on ia64) link data and code symbols differently,
3683 # so use this general approach.
3684 lt_cv_sys_global_symbol_to_cdecl="sed -n -e 's/^T .* \(.*\)$/extern int \1();/p' -e 's/^$symcode* .* \(.*\)$/extern char \1;/p'"
3685
3686 # Transform an extracted symbol line into symbol name and symbol address
3687 lt_cv_sys_global_symbol_to_c_name_address="sed -n -e 's/^: \([[^ ]]*\)[[ ]]*$/ {\\\"\1\\\", (void *) 0},/p' -e 's/^$symcode* \([[^ ]]*\) \([[^ ]]*\)$/ {\"\2\", (void *) \&\2},/p'"
3688 lt_cv_sys_global_symbol_to_c_name_address_lib_prefix="sed -n -e 's/^: \([[^ ]]*\)[[ ]]*$/ {\\\"\1\\\", (void *) 0},/p' -e 's/^$symcode* \([[^ ]]*\) \(lib[[^ ]]*\)$/ {\"\2\", (void *) \&\2},/p' -e 's/^$symcode* \([[^ ]]*\) \([[^ ]]*\)$/ {\"lib\2\", (void *) \&\2},/p'"
3689
3690 # Handle CRLF in mingw tool chain
3691 opt_cr=
3692 case $build_os in
3693 mingw*)
3694 opt_cr=`$ECHO 'x\{0,1\}' | tr x '\015'` # option cr in regexp
3695 ;;
3696 esac
3697
3698 # Try without a prefix underscore, then with it.
3699 for ac_symprfx in "" "_"; do
3700
3701 # Transform symcode, sympat, and symprfx into a raw symbol and a C symbol.
3702 symxfrm="\\1 $ac_symprfx\\2 \\2"
3703
3704 # Write the raw and C identifiers.
3705 if test "$lt_cv_nm_interface" = "MS dumpbin"; then
3706 # Fake it for dumpbin and say T for any non-static function
3707 # and D for any global variable.
3708 # Also find C++ and __fastcall symbols from MSVC++,
3709 # which start with @ or ?.
3710 lt_cv_sys_global_symbol_pipe="$AWK ['"\
3711 " {last_section=section; section=\$ 3};"\
3712 " /^COFF SYMBOL TABLE/{for(i in hide) delete hide[i]};"\
3713 " /Section length .*#relocs.*(pick any)/{hide[last_section]=1};"\
3714 " \$ 0!~/External *\|/{next};"\
3715 " / 0+ UNDEF /{next}; / UNDEF \([^|]\)*()/{next};"\
3716 " {if(hide[section]) next};"\
3717 " {f=0}; \$ 0~/\(\).*\|/{f=1}; {printf f ? \"T \" : \"D \"};"\
3718 " {split(\$ 0, a, /\||\r/); split(a[2], s)};"\
3719 " s[1]~/^[@?]/{print s[1], s[1]; next};"\
3720 " s[1]~prfx {split(s[1],t,\"@\"); print t[1], substr(t[1],length(prfx))}"\
3721 " ' prfx=^$ac_symprfx]"
3722 else
3723 lt_cv_sys_global_symbol_pipe="sed -n -e 's/^.*[[ ]]\($symcode$symcode*\)[[ ]][[ ]]*$ac_symprfx$sympat$opt_cr$/$symxfrm/p'"
3724 fi
3725 lt_cv_sys_global_symbol_pipe="$lt_cv_sys_global_symbol_pipe | sed '/ __gnu_lto/d'"
3726
3727 # Check to see that the pipe works correctly.
3728 pipe_works=no
3729
3730 rm -f conftest*
3731 cat > conftest.$ac_ext <<_LT_EOF
3732 #ifdef __cplusplus
3733 extern "C" {
3734 #endif
3735 char nm_test_var;
3736 void nm_test_func(void);
3737 void nm_test_func(void){}
3738 #ifdef __cplusplus
3739 }
3740 #endif
3741 int main(){nm_test_var='a';nm_test_func();return(0);}
3742 _LT_EOF
3743
3744 if AC_TRY_EVAL(ac_compile); then
3745 # Now try to grab the symbols.
3746 nlist=conftest.nm
3747 if AC_TRY_EVAL(NM conftest.$ac_objext \| "$lt_cv_sys_global_symbol_pipe" \> $nlist) && test -s "$nlist"; then
3748 # Try sorting and uniquifying the output.
3749 if sort "$nlist" | uniq > "$nlist"T; then
3750 mv -f "$nlist"T "$nlist"
3751 else
3752 rm -f "$nlist"T
3753 fi
3754
3755 # Make sure that we snagged all the symbols we need.
3756 if $GREP ' nm_test_var$' "$nlist" >/dev/null; then
3757 if $GREP ' nm_test_func$' "$nlist" >/dev/null; then
3758 cat <<_LT_EOF > conftest.$ac_ext
3759 /* Keep this code in sync between libtool.m4, ltmain, lt_system.h, and tests. */
3760 #if defined(_WIN32) || defined(__CYGWIN__) || defined(_WIN32_WCE)
3761 /* DATA imports from DLLs on WIN32 con't be const, because runtime
3762 relocations are performed -- see ld's documentation on pseudo-relocs. */
3763 # define LT@&t@_DLSYM_CONST
3764 #elif defined(__osf__)
3765 /* This system does not cope well with relocations in const data. */
3766 # define LT@&t@_DLSYM_CONST
3767 #else
3768 # define LT@&t@_DLSYM_CONST const
3769 #endif
3770
3771 #ifdef __cplusplus
3772 extern "C" {
3773 #endif
3774
3775 _LT_EOF
3776 # Now generate the symbol file.
3777 eval "$lt_cv_sys_global_symbol_to_cdecl"' < "$nlist" | $GREP -v main >> conftest.$ac_ext'
3778
3779 cat <<_LT_EOF >> conftest.$ac_ext
3780
3781 /* The mapping between symbol names and symbols. */
3782 LT@&t@_DLSYM_CONST struct {
3783 const char *name;
3784 void *address;
3785 }
3786 lt__PROGRAM__LTX_preloaded_symbols[[]] =
3787 {
3788 { "@PROGRAM@", (void *) 0 },
3789 _LT_EOF
3790 $SED "s/^$symcode$symcode* \(.*\) \(.*\)$/ {\"\2\", (void *) \&\2},/" < "$nlist" | $GREP -v main >> conftest.$ac_ext
3791 cat <<\_LT_EOF >> conftest.$ac_ext
3792 {0, (void *) 0}
3793 };
3794
3795 /* This works around a problem in FreeBSD linker */
3796 #ifdef FREEBSD_WORKAROUND
3797 static const void *lt_preloaded_setup() {
3798 return lt__PROGRAM__LTX_preloaded_symbols;
3799 }
3800 #endif
3801
3802 #ifdef __cplusplus
3803 }
3804 #endif
3805 _LT_EOF
3806 # Now try linking the two files.
3807 mv conftest.$ac_objext conftstm.$ac_objext
3808 lt_globsym_save_LIBS=$LIBS
3809 lt_globsym_save_CFLAGS=$CFLAGS
3810 LIBS="conftstm.$ac_objext"
3811 CFLAGS="$CFLAGS$_LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)"
3812 if AC_TRY_EVAL(ac_link) && test -s conftest${ac_exeext}; then
3813 pipe_works=yes
3814 fi
3815 LIBS=$lt_globsym_save_LIBS
3816 CFLAGS=$lt_globsym_save_CFLAGS
3817 else
3818 echo "cannot find nm_test_func in $nlist" >&AS_MESSAGE_LOG_FD
3819 fi
3820 else
3821 echo "cannot find nm_test_var in $nlist" >&AS_MESSAGE_LOG_FD
3822 fi
3823 else
3824 echo "cannot run $lt_cv_sys_global_symbol_pipe" >&AS_MESSAGE_LOG_FD
3825 fi
3826 else
3827 echo "$progname: failed program was:" >&AS_MESSAGE_LOG_FD
3828 cat conftest.$ac_ext >&5
3829 fi
3830 rm -rf conftest* conftst*
3831
3832 # Do not use the global_symbol_pipe unless it works.
3833 if test "$pipe_works" = yes; then
3834 break
3835 else
3836 lt_cv_sys_global_symbol_pipe=
3837 fi
3838 done
3839 ])
3840 if test -z "$lt_cv_sys_global_symbol_pipe"; then
3841 lt_cv_sys_global_symbol_to_cdecl=
3842 fi
3843 if test -z "$lt_cv_sys_global_symbol_pipe$lt_cv_sys_global_symbol_to_cdecl"; then
3844 AC_MSG_RESULT(failed)
3845 else
3846 AC_MSG_RESULT(ok)
3847 fi
3848
3849 # Response file support.
3850 if test "$lt_cv_nm_interface" = "MS dumpbin"; then
3851 nm_file_list_spec='@'
3852 elif $NM --help 2>/dev/null | grep '[[@]]FILE' >/dev/null; then
3853 nm_file_list_spec='@'
3854 fi
3855
3856 _LT_DECL([global_symbol_pipe], [lt_cv_sys_global_symbol_pipe], [1],
3857 [Take the output of nm and produce a listing of raw symbols and C names])
3858 _LT_DECL([global_symbol_to_cdecl], [lt_cv_sys_global_symbol_to_cdecl], [1],
3859 [Transform the output of nm in a proper C declaration])
3860 _LT_DECL([global_symbol_to_c_name_address],
3861 [lt_cv_sys_global_symbol_to_c_name_address], [1],
3862 [Transform the output of nm in a C name address pair])
3863 _LT_DECL([global_symbol_to_c_name_address_lib_prefix],
3864 [lt_cv_sys_global_symbol_to_c_name_address_lib_prefix], [1],
3865 [Transform the output of nm in a C name address pair when lib prefix is needed])
3866 _LT_DECL([], [nm_file_list_spec], [1],
3867 [Specify filename containing input files for $NM])
3868 ]) # _LT_CMD_GLOBAL_SYMBOLS
3869
3870
3871 # _LT_COMPILER_PIC([TAGNAME])
3872 # ---------------------------
3873 m4_defun([_LT_COMPILER_PIC],
3874 [m4_require([_LT_TAG_COMPILER])dnl
3875 _LT_TAGVAR(lt_prog_compiler_wl, $1)=
3876 _LT_TAGVAR(lt_prog_compiler_pic, $1)=
3877 _LT_TAGVAR(lt_prog_compiler_static, $1)=
3878
3879 m4_if([$1], [CXX], [
3880 # C++ specific cases for pic, static, wl, etc.
3881 if test "$GXX" = yes; then
3882 _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
3883 _LT_TAGVAR(lt_prog_compiler_static, $1)='-static'
3884
3885 case $host_os in
3886 aix*)
3887 # All AIX code is PIC.
3888 if test "$host_cpu" = ia64; then
3889 # AIX 5 now supports IA64 processor
3890 _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
3891 fi
3892 ;;
3893
3894 amigaos*)
3895 case $host_cpu in
3896 powerpc)
3897 # see comment about AmigaOS4 .so support
3898 _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC'
3899 ;;
3900 m68k)
3901 # FIXME: we need at least 68020 code to build shared libraries, but
3902 # adding the `-m68020' flag to GCC prevents building anything better,
3903 # like `-m68040'.
3904 _LT_TAGVAR(lt_prog_compiler_pic, $1)='-m68020 -resident32 -malways-restore-a4'
3905 ;;
3906 esac
3907 ;;
3908
3909 beos* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*)
3910 # PIC is the default for these OSes.
3911 ;;
3912 mingw* | cygwin* | os2* | pw32* | cegcc*)
3913 # This hack is so that the source file can tell whether it is being
3914 # built for inclusion in a dll (and should export symbols for example).
3915 # Although the cygwin gcc ignores -fPIC, still need this for old-style
3916 # (--disable-auto-import) libraries
3917 m4_if([$1], [GCJ], [],
3918 [_LT_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT'])
3919 ;;
3920 darwin* | rhapsody*)
3921 # PIC is the default on this platform
3922 # Common symbols not allowed in MH_DYLIB files
3923 _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fno-common'
3924 ;;
3925 *djgpp*)
3926 # DJGPP does not support shared libraries at all
3927 _LT_TAGVAR(lt_prog_compiler_pic, $1)=
3928 ;;
3929 haiku*)
3930 # PIC is the default for Haiku.
3931 # The "-static" flag exists, but is broken.
3932 _LT_TAGVAR(lt_prog_compiler_static, $1)=
3933 ;;
3934 interix[[3-9]]*)
3935 # Interix 3.x gcc -fpic/-fPIC options generate broken code.
3936 # Instead, we relocate shared libraries at runtime.
3937 ;;
3938 sysv4*MP*)
3939 if test -d /usr/nec; then
3940 _LT_TAGVAR(lt_prog_compiler_pic, $1)=-Kconform_pic
3941 fi
3942 ;;
3943 hpux*)
3944 # PIC is the default for 64-bit PA HP-UX, but not for 32-bit
3945 # PA HP-UX. On IA64 HP-UX, PIC is the default but the pic flag
3946 # sets the default TLS model and affects inlining.
3947 case $host_cpu in
3948 hppa*64*)
3949 ;;
3950 *)
3951 _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC'
3952 ;;
3953 esac
3954 ;;
3955 *qnx* | *nto*)
3956 # QNX uses GNU C++, but need to define -shared option too, otherwise
3957 # it will coredump.
3958 _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC -shared'
3959 ;;
3960 *)
3961 _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC'
3962 ;;
3963 esac
3964 else
3965 case $host_os in
3966 aix[[4-9]]*)
3967 # All AIX code is PIC.
3968 if test "$host_cpu" = ia64; then
3969 # AIX 5 now supports IA64 processor
3970 _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
3971 else
3972 _LT_TAGVAR(lt_prog_compiler_static, $1)='-bnso -bI:/lib/syscalls.exp'
3973 fi
3974 ;;
3975 chorus*)
3976 case $cc_basename in
3977 cxch68*)
3978 # Green Hills C++ Compiler
3979 # _LT_TAGVAR(lt_prog_compiler_static, $1)="--no_auto_instantiation -u __main -u __premain -u _abort -r $COOL_DIR/lib/libOrb.a $MVME_DIR/lib/CC/libC.a $MVME_DIR/lib/classix/libcx.s.a"
3980 ;;
3981 esac
3982 ;;
3983 mingw* | cygwin* | os2* | pw32* | cegcc*)
3984 # This hack is so that the source file can tell whether it is being
3985 # built for inclusion in a dll (and should export symbols for example).
3986 m4_if([$1], [GCJ], [],
3987 [_LT_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT'])
3988 ;;
3989 dgux*)
3990 case $cc_basename in
3991 ec++*)
3992 _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
3993 ;;
3994 ghcx*)
3995 # Green Hills C++ Compiler
3996 _LT_TAGVAR(lt_prog_compiler_pic, $1)='-pic'
3997 ;;
3998 *)
3999 ;;
4000 esac
4001 ;;
4002 freebsd* | dragonfly*)
4003 # FreeBSD uses GNU C++
4004 ;;
4005 hpux9* | hpux10* | hpux11*)
4006 case $cc_basename in
4007 CC*)
4008 _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
4009 _LT_TAGVAR(lt_prog_compiler_static, $1)='${wl}-a ${wl}archive'
4010 if test "$host_cpu" != ia64; then
4011 _LT_TAGVAR(lt_prog_compiler_pic, $1)='+Z'
4012 fi
4013 ;;
4014 aCC*)
4015 _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
4016 _LT_TAGVAR(lt_prog_compiler_static, $1)='${wl}-a ${wl}archive'
4017 case $host_cpu in
4018 hppa*64*|ia64*)
4019 # +Z the default
4020 ;;
4021 *)
4022 _LT_TAGVAR(lt_prog_compiler_pic, $1)='+Z'
4023 ;;
4024 esac
4025 ;;
4026 *)
4027 ;;
4028 esac
4029 ;;
4030 interix*)
4031 # This is c89, which is MS Visual C++ (no shared libs)
4032 # Anyone wants to do a port?
4033 ;;
4034 irix5* | irix6* | nonstopux*)
4035 case $cc_basename in
4036 CC*)
4037 _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
4038 _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared'
4039 # CC pic flag -KPIC is the default.
4040 ;;
4041 *)
4042 ;;
4043 esac
4044 ;;
4045 linux* | k*bsd*-gnu | kopensolaris*-gnu)
4046 case $cc_basename in
4047 KCC*)
4048 # KAI C++ Compiler
4049 _LT_TAGVAR(lt_prog_compiler_wl, $1)='--backend -Wl,'
4050 _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC'
4051 ;;
4052 ecpc* )
4053 # old Intel C++ for x86_64 which still supported -KPIC.
4054 _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
4055 _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
4056 _LT_TAGVAR(lt_prog_compiler_static, $1)='-static'
4057 ;;
4058 icpc* )
4059 # Intel C++, used to be incompatible with GCC.
4060 # ICC 10 doesn't accept -KPIC any more.
4061 _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
4062 _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC'
4063 _LT_TAGVAR(lt_prog_compiler_static, $1)='-static'
4064 ;;
4065 pgCC* | pgcpp*)
4066 # Portland Group C++ compiler
4067 _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
4068 _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fpic'
4069 _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
4070 ;;
4071 cxx*)
4072 # Compaq C++
4073 # Make sure the PIC flag is empty. It appears that all Alpha
4074 # Linux and Compaq Tru64 Unix objects are PIC.
4075 _LT_TAGVAR(lt_prog_compiler_pic, $1)=
4076 _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared'
4077 ;;
4078 xlc* | xlC* | bgxl[[cC]]* | mpixl[[cC]]*)
4079 # IBM XL 8.0, 9.0 on PPC and BlueGene
4080 _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
4081 _LT_TAGVAR(lt_prog_compiler_pic, $1)='-qpic'
4082 _LT_TAGVAR(lt_prog_compiler_static, $1)='-qstaticlink'
4083 ;;
4084 *)
4085 case `$CC -V 2>&1 | sed 5q` in
4086 *Sun\ C*)
4087 # Sun C++ 5.9
4088 _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
4089 _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
4090 _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld '
4091 ;;
4092 esac
4093 ;;
4094 esac
4095 ;;
4096 lynxos*)
4097 ;;
4098 m88k*)
4099 ;;
4100 mvs*)
4101 case $cc_basename in
4102 cxx*)
4103 _LT_TAGVAR(lt_prog_compiler_pic, $1)='-W c,exportall'
4104 ;;
4105 *)
4106 ;;
4107 esac
4108 ;;
4109 netbsd*)
4110 ;;
4111 *qnx* | *nto*)
4112 # QNX uses GNU C++, but need to define -shared option too, otherwise
4113 # it will coredump.
4114 _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC -shared'
4115 ;;
4116 osf3* | osf4* | osf5*)
4117 case $cc_basename in
4118 KCC*)
4119 _LT_TAGVAR(lt_prog_compiler_wl, $1)='--backend -Wl,'
4120 ;;
4121 RCC*)
4122 # Rational C++ 2.4.1
4123 _LT_TAGVAR(lt_prog_compiler_pic, $1)='-pic'
4124 ;;
4125 cxx*)
4126 # Digital/Compaq C++
4127 _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
4128 # Make sure the PIC flag is empty. It appears that all Alpha
4129 # Linux and Compaq Tru64 Unix objects are PIC.
4130 _LT_TAGVAR(lt_prog_compiler_pic, $1)=
4131 _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared'
4132 ;;
4133 *)
4134 ;;
4135 esac
4136 ;;
4137 psos*)
4138 ;;
4139 solaris*)
4140 case $cc_basename in
4141 CC* | sunCC*)
4142 # Sun C++ 4.2, 5.x and Centerline C++
4143 _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
4144 _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
4145 _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld '
4146 ;;
4147 gcx*)
4148 # Green Hills C++ Compiler
4149 _LT_TAGVAR(lt_prog_compiler_pic, $1)='-PIC'
4150 ;;
4151 *)
4152 ;;
4153 esac
4154 ;;
4155 sunos4*)
4156 case $cc_basename in
4157 CC*)
4158 # Sun C++ 4.x
4159 _LT_TAGVAR(lt_prog_compiler_pic, $1)='-pic'
4160 _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
4161 ;;
4162 lcc*)
4163 # Lucid
4164 _LT_TAGVAR(lt_prog_compiler_pic, $1)='-pic'
4165 ;;
4166 *)
4167 ;;
4168 esac
4169 ;;
4170 sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*)
4171 case $cc_basename in
4172 CC*)
4173 _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
4174 _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
4175 _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
4176 ;;
4177 esac
4178 ;;
4179 tandem*)
4180 case $cc_basename in
4181 NCC*)
4182 # NonStop-UX NCC 3.20
4183 _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
4184 ;;
4185 *)
4186 ;;
4187 esac
4188 ;;
4189 vxworks*)
4190 ;;
4191 *)
4192 _LT_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no
4193 ;;
4194 esac
4195 fi
4196 ],
4197 [
4198 if test "$GCC" = yes; then
4199 _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
4200 _LT_TAGVAR(lt_prog_compiler_static, $1)='-static'
4201
4202 case $host_os in
4203 aix*)
4204 # All AIX code is PIC.
4205 if test "$host_cpu" = ia64; then
4206 # AIX 5 now supports IA64 processor
4207 _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
4208 fi
4209 ;;
4210
4211 amigaos*)
4212 case $host_cpu in
4213 powerpc)
4214 # see comment about AmigaOS4 .so support
4215 _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC'
4216 ;;
4217 m68k)
4218 # FIXME: we need at least 68020 code to build shared libraries, but
4219 # adding the `-m68020' flag to GCC prevents building anything better,
4220 # like `-m68040'.
4221 _LT_TAGVAR(lt_prog_compiler_pic, $1)='-m68020 -resident32 -malways-restore-a4'
4222 ;;
4223 esac
4224 ;;
4225
4226 beos* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*)
4227 # PIC is the default for these OSes.
4228 ;;
4229
4230 mingw* | cygwin* | pw32* | os2* | cegcc*)
4231 # This hack is so that the source file can tell whether it is being
4232 # built for inclusion in a dll (and should export symbols for example).
4233 # Although the cygwin gcc ignores -fPIC, still need this for old-style
4234 # (--disable-auto-import) libraries
4235 m4_if([$1], [GCJ], [],
4236 [_LT_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT'])
4237 ;;
4238
4239 darwin* | rhapsody*)
4240 # PIC is the default on this platform
4241 # Common symbols not allowed in MH_DYLIB files
4242 _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fno-common'
4243 ;;
4244
4245 haiku*)
4246 # PIC is the default for Haiku.
4247 # The "-static" flag exists, but is broken.
4248 _LT_TAGVAR(lt_prog_compiler_static, $1)=
4249 ;;
4250
4251 hpux*)
4252 # PIC is the default for 64-bit PA HP-UX, but not for 32-bit
4253 # PA HP-UX. On IA64 HP-UX, PIC is the default but the pic flag
4254 # sets the default TLS model and affects inlining.
4255 case $host_cpu in
4256 hppa*64*)
4257 # +Z the default
4258 ;;
4259 *)
4260 _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC'
4261 ;;
4262 esac
4263 ;;
4264
4265 interix[[3-9]]*)
4266 # Interix 3.x gcc -fpic/-fPIC options generate broken code.
4267 # Instead, we relocate shared libraries at runtime.
4268 ;;
4269
4270 msdosdjgpp*)
4271 # Just because we use GCC doesn't mean we suddenly get shared libraries
4272 # on systems that don't support them.
4273 _LT_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no
4274 enable_shared=no
4275 ;;
4276
4277 *nto* | *qnx*)
4278 # QNX uses GNU C++, but need to define -shared option too, otherwise
4279 # it will coredump.
4280 _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC -shared'
4281 ;;
4282
4283 sysv4*MP*)
4284 if test -d /usr/nec; then
4285 _LT_TAGVAR(lt_prog_compiler_pic, $1)=-Kconform_pic
4286 fi
4287 ;;
4288
4289 *)
4290 _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC'
4291 ;;
4292 esac
4293
4294 case $cc_basename in
4295 nvcc*) # Cuda Compiler Driver 2.2
4296 _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Xlinker '
4297 if test -n "$_LT_TAGVAR(lt_prog_compiler_pic, $1)"; then
4298 _LT_TAGVAR(lt_prog_compiler_pic, $1)="-Xcompiler $_LT_TAGVAR(lt_prog_compiler_pic, $1)"
4299 fi
4300 ;;
4301 esac
4302 else
4303 # PORTME Check for flag to pass linker flags through the system compiler.
4304 case $host_os in
4305 aix*)
4306 _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
4307 if test "$host_cpu" = ia64; then
4308 # AIX 5 now supports IA64 processor
4309 _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
4310 else
4311 _LT_TAGVAR(lt_prog_compiler_static, $1)='-bnso -bI:/lib/syscalls.exp'
4312 fi
4313 ;;
4314
4315 mingw* | cygwin* | pw32* | os2* | cegcc*)
4316 # This hack is so that the source file can tell whether it is being
4317 # built for inclusion in a dll (and should export symbols for example).
4318 m4_if([$1], [GCJ], [],
4319 [_LT_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT'])
4320 ;;
4321
4322 hpux9* | hpux10* | hpux11*)
4323 _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
4324 # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but
4325 # not for PA HP-UX.
4326 case $host_cpu in
4327 hppa*64*|ia64*)
4328 # +Z the default
4329 ;;
4330 *)
4331 _LT_TAGVAR(lt_prog_compiler_pic, $1)='+Z'
4332 ;;
4333 esac
4334 # Is there a better lt_prog_compiler_static that works with the bundled CC?
4335 _LT_TAGVAR(lt_prog_compiler_static, $1)='${wl}-a ${wl}archive'
4336 ;;
4337
4338 irix5* | irix6* | nonstopux*)
4339 _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
4340 # PIC (with -KPIC) is the default.
4341 _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared'
4342 ;;
4343
4344 linux* | k*bsd*-gnu | kopensolaris*-gnu)
4345 case $cc_basename in
4346 # old Intel for x86_64 which still supported -KPIC.
4347 ecc*)
4348 _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
4349 _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
4350 _LT_TAGVAR(lt_prog_compiler_static, $1)='-static'
4351 ;;
4352 # icc used to be incompatible with GCC.
4353 # ICC 10 doesn't accept -KPIC any more.
4354 icc* | ifort*)
4355 _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
4356 _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC'
4357 _LT_TAGVAR(lt_prog_compiler_static, $1)='-static'
4358 ;;
4359 # Lahey Fortran 8.1.
4360 lf95*)
4361 _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
4362 _LT_TAGVAR(lt_prog_compiler_pic, $1)='--shared'
4363 _LT_TAGVAR(lt_prog_compiler_static, $1)='--static'
4364 ;;
4365 nagfor*)
4366 # NAG Fortran compiler
4367 _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,-Wl,,'
4368 _LT_TAGVAR(lt_prog_compiler_pic, $1)='-PIC'
4369 _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
4370 ;;
4371 pgcc* | pgf77* | pgf90* | pgf95* | pgfortran*)
4372 # Portland Group compilers (*not* the Pentium gcc compiler,
4373 # which looks to be a dead project)
4374 _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
4375 _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fpic'
4376 _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
4377 ;;
4378 ccc*)
4379 _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
4380 # All Alpha code is PIC.
4381 _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared'
4382 ;;
4383 xl* | bgxl* | bgf* | mpixl*)
4384 # IBM XL C 8.0/Fortran 10.1, 11.1 on PPC and BlueGene
4385 _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
4386 _LT_TAGVAR(lt_prog_compiler_pic, $1)='-qpic'
4387 _LT_TAGVAR(lt_prog_compiler_static, $1)='-qstaticlink'
4388 ;;
4389 *)
4390 case `$CC -V 2>&1 | sed 5q` in
4391 *Sun\ Ceres\ Fortran* | *Sun*Fortran*\ [[1-7]].* | *Sun*Fortran*\ 8.[[0-3]]*)
4392 # Sun Fortran 8.3 passes all unrecognized flags to the linker
4393 _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
4394 _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
4395 _LT_TAGVAR(lt_prog_compiler_wl, $1)=''
4396 ;;
4397 *Sun\ F* | *Sun*Fortran*)
4398 _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
4399 _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
4400 _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld '
4401 ;;
4402 *Sun\ C*)
4403 # Sun C 5.9
4404 _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
4405 _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
4406 _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
4407 ;;
4408 *Intel*\ [[CF]]*Compiler*)
4409 _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
4410 _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC'
4411 _LT_TAGVAR(lt_prog_compiler_static, $1)='-static'
4412 ;;
4413 *Portland\ Group*)
4414 _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
4415 _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fpic'
4416 _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
4417 ;;
4418 esac
4419 ;;
4420 esac
4421 ;;
4422
4423 newsos6)
4424 _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
4425 _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
4426 ;;
4427
4428 *nto* | *qnx*)
4429 # QNX uses GNU C++, but need to define -shared option too, otherwise
4430 # it will coredump.
4431 _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC -shared'
4432 ;;
4433
4434 osf3* | osf4* | osf5*)
4435 _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
4436 # All OSF/1 code is PIC.
4437 _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared'
4438 ;;
4439
4440 rdos*)
4441 _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared'
4442 ;;
4443
4444 solaris*)
4445 _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
4446 _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
4447 case $cc_basename in
4448 f77* | f90* | f95* | sunf77* | sunf90* | sunf95*)
4449 _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld ';;
4450 *)
4451 _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,';;
4452 esac
4453 ;;
4454
4455 sunos4*)
4456 _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld '
4457 _LT_TAGVAR(lt_prog_compiler_pic, $1)='-PIC'
4458 _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
4459 ;;
4460
4461 sysv4 | sysv4.2uw2* | sysv4.3*)
4462 _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
4463 _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
4464 _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
4465 ;;
4466
4467 sysv4*MP*)
4468 if test -d /usr/nec ;then
4469 _LT_TAGVAR(lt_prog_compiler_pic, $1)='-Kconform_pic'
4470 _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
4471 fi
4472 ;;
4473
4474 sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*)
4475 _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
4476 _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
4477 _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
4478 ;;
4479
4480 unicos*)
4481 _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
4482 _LT_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no
4483 ;;
4484
4485 uts4*)
4486 _LT_TAGVAR(lt_prog_compiler_pic, $1)='-pic'
4487 _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
4488 ;;
4489
4490 *)
4491 _LT_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no
4492 ;;
4493 esac
4494 fi
4495 ])
4496 case $host_os in
4497 # For platforms which do not support PIC, -DPIC is meaningless:
4498 *djgpp*)
4499 _LT_TAGVAR(lt_prog_compiler_pic, $1)=
4500 ;;
4501 *)
4502 _LT_TAGVAR(lt_prog_compiler_pic, $1)="$_LT_TAGVAR(lt_prog_compiler_pic, $1)@&t@m4_if([$1],[],[ -DPIC],[m4_if([$1],[CXX],[ -DPIC],[])])"
4503 ;;
4504 esac
4505
4506 AC_CACHE_CHECK([for $compiler option to produce PIC],
4507 [_LT_TAGVAR(lt_cv_prog_compiler_pic, $1)],
4508 [_LT_TAGVAR(lt_cv_prog_compiler_pic, $1)=$_LT_TAGVAR(lt_prog_compiler_pic, $1)])
4509 _LT_TAGVAR(lt_prog_compiler_pic, $1)=$_LT_TAGVAR(lt_cv_prog_compiler_pic, $1)
4510
4511 #
4512 # Check to make sure the PIC flag actually works.
4513 #
4514 if test -n "$_LT_TAGVAR(lt_prog_compiler_pic, $1)"; then
4515 _LT_COMPILER_OPTION([if $compiler PIC flag $_LT_TAGVAR(lt_prog_compiler_pic, $1) works],
4516 [_LT_TAGVAR(lt_cv_prog_compiler_pic_works, $1)],
4517 [$_LT_TAGVAR(lt_prog_compiler_pic, $1)@&t@m4_if([$1],[],[ -DPIC],[m4_if([$1],[CXX],[ -DPIC],[])])], [],
4518 [case $_LT_TAGVAR(lt_prog_compiler_pic, $1) in
4519 "" | " "*) ;;
4520 *) _LT_TAGVAR(lt_prog_compiler_pic, $1)=" $_LT_TAGVAR(lt_prog_compiler_pic, $1)" ;;
4521 esac],
4522 [_LT_TAGVAR(lt_prog_compiler_pic, $1)=
4523 _LT_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no])
4524 fi
4525 _LT_TAGDECL([pic_flag], [lt_prog_compiler_pic], [1],
4526 [Additional compiler flags for building library objects])
4527
4528 _LT_TAGDECL([wl], [lt_prog_compiler_wl], [1],
4529 [How to pass a linker flag through the compiler])
4530 #
4531 # Check to make sure the static flag actually works.
4532 #
4533 wl=$_LT_TAGVAR(lt_prog_compiler_wl, $1) eval lt_tmp_static_flag=\"$_LT_TAGVAR(lt_prog_compiler_static, $1)\"
4534 _LT_LINKER_OPTION([if $compiler static flag $lt_tmp_static_flag works],
4535 _LT_TAGVAR(lt_cv_prog_compiler_static_works, $1),
4536 $lt_tmp_static_flag,
4537 [],
4538 [_LT_TAGVAR(lt_prog_compiler_static, $1)=])
4539 _LT_TAGDECL([link_static_flag], [lt_prog_compiler_static], [1],
4540 [Compiler flag to prevent dynamic linking])
4541 ])# _LT_COMPILER_PIC
4542
4543
4544 # _LT_LINKER_SHLIBS([TAGNAME])
4545 # ----------------------------
4546 # See if the linker supports building shared libraries.
4547 m4_defun([_LT_LINKER_SHLIBS],
4548 [AC_REQUIRE([LT_PATH_LD])dnl
4549 AC_REQUIRE([LT_PATH_NM])dnl
4550 m4_require([_LT_PATH_MANIFEST_TOOL])dnl
4551 m4_require([_LT_FILEUTILS_DEFAULTS])dnl
4552 m4_require([_LT_DECL_EGREP])dnl
4553 m4_require([_LT_DECL_SED])dnl
4554 m4_require([_LT_CMD_GLOBAL_SYMBOLS])dnl
4555 m4_require([_LT_TAG_COMPILER])dnl
4556 AC_MSG_CHECKING([whether the $compiler linker ($LD) supports shared libraries])
4557 m4_if([$1], [CXX], [
4558 _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols'
4559 _LT_TAGVAR(exclude_expsyms, $1)=['_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*']
4560 case $host_os in
4561 aix[[4-9]]*)
4562 # If we're using GNU nm, then we don't want the "-C" option.
4563 # -C means demangle to AIX nm, but means don't demangle with GNU nm
4564 # Also, AIX nm treats weak defined symbols like other global defined
4565 # symbols, whereas GNU nm marks them as "W".
4566 if $NM -V 2>&1 | $GREP 'GNU' > /dev/null; then
4567 _LT_TAGVAR(export_symbols_cmds, $1)='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 2 == "W")) && ([substr](\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols'
4568 else
4569 _LT_TAGVAR(export_symbols_cmds, $1)='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B")) && ([substr](\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols'
4570 fi
4571 ;;
4572 pw32*)
4573 _LT_TAGVAR(export_symbols_cmds, $1)="$ltdll_cmds"
4574 ;;
4575 cygwin* | mingw* | cegcc*)
4576 case $cc_basename in
4577 cl*)
4578 _LT_TAGVAR(exclude_expsyms, $1)='_NULL_IMPORT_DESCRIPTOR|_IMPORT_DESCRIPTOR_.*'
4579 ;;
4580 *)
4581 _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[[BCDGRS]][[ ]]/s/.*[[ ]]\([[^ ]]*\)/\1 DATA/;s/^.*[[ ]]__nm__\([[^ ]]*\)[[ ]][[^ ]]*/\1 DATA/;/^I[[ ]]/d;/^[[AITW]][[ ]]/s/.* //'\'' | sort | uniq > $export_symbols'
4582 _LT_TAGVAR(exclude_expsyms, $1)=['[_]+GLOBAL_OFFSET_TABLE_|[_]+GLOBAL__[FID]_.*|[_]+head_[A-Za-z0-9_]+_dll|[A-Za-z0-9_]+_dll_iname']
4583 ;;
4584 esac
4585 ;;
4586 *)
4587 _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols'
4588 ;;
4589 esac
4590 ], [
4591 runpath_var=
4592 _LT_TAGVAR(allow_undefined_flag, $1)=
4593 _LT_TAGVAR(always_export_symbols, $1)=no
4594 _LT_TAGVAR(archive_cmds, $1)=
4595 _LT_TAGVAR(archive_expsym_cmds, $1)=
4596 _LT_TAGVAR(compiler_needs_object, $1)=no
4597 _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=no
4598 _LT_TAGVAR(export_dynamic_flag_spec, $1)=
4599 _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols'
4600 _LT_TAGVAR(hardcode_automatic, $1)=no
4601 _LT_TAGVAR(hardcode_direct, $1)=no
4602 _LT_TAGVAR(hardcode_direct_absolute, $1)=no
4603 _LT_TAGVAR(hardcode_libdir_flag_spec, $1)=
4604 _LT_TAGVAR(hardcode_libdir_separator, $1)=
4605 _LT_TAGVAR(hardcode_minus_L, $1)=no
4606 _LT_TAGVAR(hardcode_shlibpath_var, $1)=unsupported
4607 _LT_TAGVAR(inherit_rpath, $1)=no
4608 _LT_TAGVAR(link_all_deplibs, $1)=unknown
4609 _LT_TAGVAR(module_cmds, $1)=
4610 _LT_TAGVAR(module_expsym_cmds, $1)=
4611 _LT_TAGVAR(old_archive_from_new_cmds, $1)=
4612 _LT_TAGVAR(old_archive_from_expsyms_cmds, $1)=
4613 _LT_TAGVAR(thread_safe_flag_spec, $1)=
4614 _LT_TAGVAR(whole_archive_flag_spec, $1)=
4615 # include_expsyms should be a list of space-separated symbols to be *always*
4616 # included in the symbol list
4617 _LT_TAGVAR(include_expsyms, $1)=
4618 # exclude_expsyms can be an extended regexp of symbols to exclude
4619 # it will be wrapped by ` (' and `)$', so one must not match beginning or
4620 # end of line. Example: `a|bc|.*d.*' will exclude the symbols `a' and `bc',
4621 # as well as any symbol that contains `d'.
4622 _LT_TAGVAR(exclude_expsyms, $1)=['_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*']
4623 # Although _GLOBAL_OFFSET_TABLE_ is a valid symbol C name, most a.out
4624 # platforms (ab)use it in PIC code, but their linkers get confused if
4625 # the symbol is explicitly referenced. Since portable code cannot
4626 # rely on this symbol name, it's probably fine to never include it in
4627 # preloaded symbol tables.
4628 # Exclude shared library initialization/finalization symbols.
4629 dnl Note also adjust exclude_expsyms for C++ above.
4630 extract_expsyms_cmds=
4631
4632 case $host_os in
4633 cygwin* | mingw* | pw32* | cegcc*)
4634 # FIXME: the MSVC++ port hasn't been tested in a loooong time
4635 # When not using gcc, we currently assume that we are using
4636 # Microsoft Visual C++.
4637 if test "$GCC" != yes; then
4638 with_gnu_ld=no
4639 fi
4640 ;;
4641 interix*)
4642 # we just hope/assume this is gcc and not c89 (= MSVC++)
4643 with_gnu_ld=yes
4644 ;;
4645 openbsd*)
4646 with_gnu_ld=no
4647 ;;
4648 esac
4649
4650 _LT_TAGVAR(ld_shlibs, $1)=yes
4651
4652 # On some targets, GNU ld is compatible enough with the native linker
4653 # that we're better off using the native interface for both.
4654 lt_use_gnu_ld_interface=no
4655 if test "$with_gnu_ld" = yes; then
4656 case $host_os in
4657 aix*)
4658 # The AIX port of GNU ld has always aspired to compatibility
4659 # with the native linker. However, as the warning in the GNU ld
4660 # block says, versions before 2.19.5* couldn't really create working
4661 # shared libraries, regardless of the interface used.
4662 case `$LD -v 2>&1` in
4663 *\ \(GNU\ Binutils\)\ 2.19.5*) ;;
4664 *\ \(GNU\ Binutils\)\ 2.[[2-9]]*) ;;
4665 *\ \(GNU\ Binutils\)\ [[3-9]]*) ;;
4666 *)
4667 lt_use_gnu_ld_interface=yes
4668 ;;
4669 esac
4670 ;;
4671 *)
4672 lt_use_gnu_ld_interface=yes
4673 ;;
4674 esac
4675 fi
4676
4677 if test "$lt_use_gnu_ld_interface" = yes; then
4678 # If archive_cmds runs LD, not CC, wlarc should be empty
4679 wlarc='${wl}'
4680
4681 # Set some defaults for GNU ld with shared library support. These
4682 # are reset later if shared libraries are not supported. Putting them
4683 # here allows them to be overridden if necessary.
4684 runpath_var=LD_RUN_PATH
4685 _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
4686 _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic'
4687 # ancient GNU ld didn't support --whole-archive et. al.
4688 if $LD --help 2>&1 | $GREP 'no-whole-archive' > /dev/null; then
4689 _LT_TAGVAR(whole_archive_flag_spec, $1)="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive'
4690 else
4691 _LT_TAGVAR(whole_archive_flag_spec, $1)=
4692 fi
4693 supports_anon_versioning=no
4694 case `$LD -v 2>&1` in
4695 *GNU\ gold*) supports_anon_versioning=yes ;;
4696 *\ [[01]].* | *\ 2.[[0-9]].* | *\ 2.10.*) ;; # catch versions < 2.11
4697 *\ 2.11.93.0.2\ *) supports_anon_versioning=yes ;; # RH7.3 ...
4698 *\ 2.11.92.0.12\ *) supports_anon_versioning=yes ;; # Mandrake 8.2 ...
4699 *\ 2.11.*) ;; # other 2.11 versions
4700 *) supports_anon_versioning=yes ;;
4701 esac
4702
4703 # See if GNU ld supports shared libraries.
4704 case $host_os in
4705 aix[[3-9]]*)
4706 # On AIX/PPC, the GNU linker is very broken
4707 if test "$host_cpu" != ia64; then
4708 _LT_TAGVAR(ld_shlibs, $1)=no
4709 cat <<_LT_EOF 1>&2
4710
4711 *** Warning: the GNU linker, at least up to release 2.19, is reported
4712 *** to be unable to reliably create shared libraries on AIX.
4713 *** Therefore, libtool is disabling shared libraries support. If you
4714 *** really care for shared libraries, you may want to install binutils
4715 *** 2.20 or above, or modify your PATH so that a non-GNU linker is found.
4716 *** You will then need to restart the configuration process.
4717
4718 _LT_EOF
4719 fi
4720 ;;
4721
4722 amigaos*)
4723 case $host_cpu in
4724 powerpc)
4725 # see comment about AmigaOS4 .so support
4726 _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
4727 _LT_TAGVAR(archive_expsym_cmds, $1)=''
4728 ;;
4729 m68k)
4730 _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/a2ixlibrary.data~$ECHO "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$ECHO "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$ECHO "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$ECHO "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)'
4731 _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
4732 _LT_TAGVAR(hardcode_minus_L, $1)=yes
4733 ;;
4734 esac
4735 ;;
4736
4737 beos*)
4738 if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then
4739 _LT_TAGVAR(allow_undefined_flag, $1)=unsupported
4740 # Joseph Beckenbach <jrb3@best.com> says some releases of gcc
4741 # support --undefined. This deserves some investigation. FIXME
4742 _LT_TAGVAR(archive_cmds, $1)='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
4743 else
4744 _LT_TAGVAR(ld_shlibs, $1)=no
4745 fi
4746 ;;
4747
4748 cygwin* | mingw* | pw32* | cegcc*)
4749 # _LT_TAGVAR(hardcode_libdir_flag_spec, $1) is actually meaningless,
4750 # as there is no search path for DLLs.
4751 _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
4752 _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-all-symbols'
4753 _LT_TAGVAR(allow_undefined_flag, $1)=unsupported
4754 _LT_TAGVAR(always_export_symbols, $1)=no
4755 _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes
4756 _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[[BCDGRS]][[ ]]/s/.*[[ ]]\([[^ ]]*\)/\1 DATA/;s/^.*[[ ]]__nm__\([[^ ]]*\)[[ ]][[^ ]]*/\1 DATA/;/^I[[ ]]/d;/^[[AITW]][[ ]]/s/.* //'\'' | sort | uniq > $export_symbols'
4757 _LT_TAGVAR(exclude_expsyms, $1)=['[_]+GLOBAL_OFFSET_TABLE_|[_]+GLOBAL__[FID]_.*|[_]+head_[A-Za-z0-9_]+_dll|[A-Za-z0-9_]+_dll_iname']
4758
4759 if $LD --help 2>&1 | $GREP 'auto-import' > /dev/null; then
4760 _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib'
4761 # If the export-symbols file already is a .def file (1st line
4762 # is EXPORTS), use it as is; otherwise, prepend...
4763 _LT_TAGVAR(archive_expsym_cmds, $1)='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then
4764 cp $export_symbols $output_objdir/$soname.def;
4765 else
4766 echo EXPORTS > $output_objdir/$soname.def;
4767 cat $export_symbols >> $output_objdir/$soname.def;
4768 fi~
4769 $CC -shared $output_objdir/$soname.def $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib'
4770 else
4771 _LT_TAGVAR(ld_shlibs, $1)=no
4772 fi
4773 ;;
4774
4775 haiku*)
4776 _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
4777 _LT_TAGVAR(link_all_deplibs, $1)=yes
4778 ;;
4779
4780 interix[[3-9]]*)
4781 _LT_TAGVAR(hardcode_direct, $1)=no
4782 _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
4783 _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir'
4784 _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E'
4785 # Hack: On Interix 3.x, we cannot compile PIC because of a broken gcc.
4786 # Instead, shared libraries are loaded at an image base (0x10000000 by
4787 # default) and relocated if they conflict, which is a slow very memory
4788 # consuming and fragmenting process. To avoid this, we pick a random,
4789 # 256 KiB-aligned image base between 0x50000000 and 0x6FFC0000 at link
4790 # time. Moving up from 0x10000000 also allows more sbrk(2) space.
4791 _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib'
4792 _LT_TAGVAR(archive_expsym_cmds, $1)='sed "s,^,_," $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--retain-symbols-file,$output_objdir/$soname.expsym ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib'
4793 ;;
4794
4795 gnu* | linux* | tpf* | k*bsd*-gnu | kopensolaris*-gnu)
4796 tmp_diet=no
4797 if test "$host_os" = linux-dietlibc; then
4798 case $cc_basename in
4799 diet\ *) tmp_diet=yes;; # linux-dietlibc with static linking (!diet-dyn)
4800 esac
4801 fi
4802 if $LD --help 2>&1 | $EGREP ': supported targets:.* elf' > /dev/null \
4803 && test "$tmp_diet" = no
4804 then
4805 tmp_addflag=' $pic_flag'
4806 tmp_sharedflag='-shared'
4807 case $cc_basename,$host_cpu in
4808 pgcc*) # Portland Group C compiler
4809 _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive'
4810 tmp_addflag=' $pic_flag'
4811 ;;
4812 pgf77* | pgf90* | pgf95* | pgfortran*)
4813 # Portland Group f77 and f90 compilers
4814 _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive'
4815 tmp_addflag=' $pic_flag -Mnomain' ;;
4816 ecc*,ia64* | icc*,ia64*) # Intel C compiler on ia64
4817 tmp_addflag=' -i_dynamic' ;;
4818 efc*,ia64* | ifort*,ia64*) # Intel Fortran compiler on ia64
4819 tmp_addflag=' -i_dynamic -nofor_main' ;;
4820 ifc* | ifort*) # Intel Fortran compiler
4821 tmp_addflag=' -nofor_main' ;;
4822 lf95*) # Lahey Fortran 8.1
4823 _LT_TAGVAR(whole_archive_flag_spec, $1)=
4824 tmp_sharedflag='--shared' ;;
4825 xl[[cC]]* | bgxl[[cC]]* | mpixl[[cC]]*) # IBM XL C 8.0 on PPC (deal with xlf below)
4826 tmp_sharedflag='-qmkshrobj'
4827 tmp_addflag= ;;
4828 nvcc*) # Cuda Compiler Driver 2.2
4829 _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive'
4830 _LT_TAGVAR(compiler_needs_object, $1)=yes
4831 ;;
4832 esac
4833 case `$CC -V 2>&1 | sed 5q` in
4834 *Sun\ C*) # Sun C 5.9
4835 _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive'
4836 _LT_TAGVAR(compiler_needs_object, $1)=yes
4837 tmp_sharedflag='-G' ;;
4838 *Sun\ F*) # Sun Fortran 8.3
4839 tmp_sharedflag='-G' ;;
4840 esac
4841 _LT_TAGVAR(archive_cmds, $1)='$CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
4842
4843 if test "x$supports_anon_versioning" = xyes; then
4844 _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $output_objdir/$libname.ver~
4845 cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~
4846 echo "local: *; };" >> $output_objdir/$libname.ver~
4847 $CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib'
4848 fi
4849
4850 case $cc_basename in
4851 xlf* | bgf* | bgxlf* | mpixlf*)
4852 # IBM XL Fortran 10.1 on PPC cannot create shared libs itself
4853 _LT_TAGVAR(whole_archive_flag_spec, $1)='--whole-archive$convenience --no-whole-archive'
4854 _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
4855 _LT_TAGVAR(archive_cmds, $1)='$LD -shared $libobjs $deplibs $linker_flags -soname $soname -o $lib'
4856 if test "x$supports_anon_versioning" = xyes; then
4857 _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $output_objdir/$libname.ver~
4858 cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~
4859 echo "local: *; };" >> $output_objdir/$libname.ver~
4860 $LD -shared $libobjs $deplibs $linker_flags -soname $soname -version-script $output_objdir/$libname.ver -o $lib'
4861 fi
4862 ;;
4863 esac
4864 else
4865 _LT_TAGVAR(ld_shlibs, $1)=no
4866 fi
4867 ;;
4868
4869 netbsd*)
4870 if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then
4871 _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib'
4872 wlarc=
4873 else
4874 _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
4875 _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
4876 fi
4877 ;;
4878
4879 solaris*)
4880 if $LD -v 2>&1 | $GREP 'BFD 2\.8' > /dev/null; then
4881 _LT_TAGVAR(ld_shlibs, $1)=no
4882 cat <<_LT_EOF 1>&2
4883
4884 *** Warning: The releases 2.8.* of the GNU linker cannot reliably
4885 *** create shared libraries on Solaris systems. Therefore, libtool
4886 *** is disabling shared libraries support. We urge you to upgrade GNU
4887 *** binutils to release 2.9.1 or newer. Another option is to modify
4888 *** your PATH or compiler configuration so that the native linker is
4889 *** used, and then restart.
4890
4891 _LT_EOF
4892 elif $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then
4893 _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
4894 _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
4895 else
4896 _LT_TAGVAR(ld_shlibs, $1)=no
4897 fi
4898 ;;
4899
4900 sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX*)
4901 case `$LD -v 2>&1` in
4902 *\ [[01]].* | *\ 2.[[0-9]].* | *\ 2.1[[0-5]].*)
4903 _LT_TAGVAR(ld_shlibs, $1)=no
4904 cat <<_LT_EOF 1>&2
4905
4906 *** Warning: Releases of the GNU linker prior to 2.16.91.0.3 can not
4907 *** reliably create shared libraries on SCO systems. Therefore, libtool
4908 *** is disabling shared libraries support. We urge you to upgrade GNU
4909 *** binutils to release 2.16.91.0.3 or newer. Another option is to modify
4910 *** your PATH or compiler configuration so that the native linker is
4911 *** used, and then restart.
4912
4913 _LT_EOF
4914 ;;
4915 *)
4916 # For security reasons, it is highly recommended that you always
4917 # use absolute paths for naming shared libraries, and exclude the
4918 # DT_RUNPATH tag from executables and libraries. But doing so
4919 # requires that you compile everything twice, which is a pain.
4920 if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then
4921 _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
4922 _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
4923 _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
4924 else
4925 _LT_TAGVAR(ld_shlibs, $1)=no
4926 fi
4927 ;;
4928 esac
4929 ;;
4930
4931 sunos4*)
4932 _LT_TAGVAR(archive_cmds, $1)='$LD -assert pure-text -Bshareable -o $lib $libobjs $deplibs $linker_flags'
4933 wlarc=
4934 _LT_TAGVAR(hardcode_direct, $1)=yes
4935 _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
4936 ;;
4937
4938 *)
4939 if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then
4940 _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
4941 _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
4942 else
4943 _LT_TAGVAR(ld_shlibs, $1)=no
4944 fi
4945 ;;
4946 esac
4947
4948 if test "$_LT_TAGVAR(ld_shlibs, $1)" = no; then
4949 runpath_var=
4950 _LT_TAGVAR(hardcode_libdir_flag_spec, $1)=
4951 _LT_TAGVAR(export_dynamic_flag_spec, $1)=
4952 _LT_TAGVAR(whole_archive_flag_spec, $1)=
4953 fi
4954 else
4955 # PORTME fill in a description of your system's linker (not GNU ld)
4956 case $host_os in
4957 aix3*)
4958 _LT_TAGVAR(allow_undefined_flag, $1)=unsupported
4959 _LT_TAGVAR(always_export_symbols, $1)=yes
4960 _LT_TAGVAR(archive_expsym_cmds, $1)='$LD -o $output_objdir/$soname $libobjs $deplibs $linker_flags -bE:$export_symbols -T512 -H512 -bM:SRE~$AR $AR_FLAGS $lib $output_objdir/$soname'
4961 # Note: this linker hardcodes the directories in LIBPATH if there
4962 # are no directories specified by -L.
4963 _LT_TAGVAR(hardcode_minus_L, $1)=yes
4964 if test "$GCC" = yes && test -z "$lt_prog_compiler_static"; then
4965 # Neither direct hardcoding nor static linking is supported with a
4966 # broken collect2.
4967 _LT_TAGVAR(hardcode_direct, $1)=unsupported
4968 fi
4969 ;;
4970
4971 aix[[4-9]]*)
4972 if test "$host_cpu" = ia64; then
4973 # On IA64, the linker does run time linking by default, so we don't
4974 # have to do anything special.
4975 aix_use_runtimelinking=no
4976 exp_sym_flag='-Bexport'
4977 no_entry_flag=""
4978 else
4979 # If we're using GNU nm, then we don't want the "-C" option.
4980 # -C means demangle to AIX nm, but means don't demangle with GNU nm
4981 # Also, AIX nm treats weak defined symbols like other global
4982 # defined symbols, whereas GNU nm marks them as "W".
4983 if $NM -V 2>&1 | $GREP 'GNU' > /dev/null; then
4984 _LT_TAGVAR(export_symbols_cmds, $1)='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 2 == "W")) && ([substr](\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols'
4985 else
4986 _LT_TAGVAR(export_symbols_cmds, $1)='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B")) && ([substr](\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols'
4987 fi
4988 aix_use_runtimelinking=no
4989
4990 # Test if we are trying to use run time linking or normal
4991 # AIX style linking. If -brtl is somewhere in LDFLAGS, we
4992 # need to do runtime linking.
4993 case $host_os in aix4.[[23]]|aix4.[[23]].*|aix[[5-9]]*)
4994 for ld_flag in $LDFLAGS; do
4995 if (test $ld_flag = "-brtl" || test $ld_flag = "-Wl,-brtl"); then
4996 aix_use_runtimelinking=yes
4997 break
4998 fi
4999 done
5000 ;;
5001 esac
5002
5003 exp_sym_flag='-bexport'
5004 no_entry_flag='-bnoentry'
5005 fi
5006
5007 # When large executables or shared objects are built, AIX ld can
5008 # have problems creating the table of contents. If linking a library
5009 # or program results in "error TOC overflow" add -mminimal-toc to
5010 # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not
5011 # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS.
5012
5013 _LT_TAGVAR(archive_cmds, $1)=''
5014 _LT_TAGVAR(hardcode_direct, $1)=yes
5015 _LT_TAGVAR(hardcode_direct_absolute, $1)=yes
5016 _LT_TAGVAR(hardcode_libdir_separator, $1)=':'
5017 _LT_TAGVAR(link_all_deplibs, $1)=yes
5018 _LT_TAGVAR(file_list_spec, $1)='${wl}-f,'
5019
5020 if test "$GCC" = yes; then
5021 case $host_os in aix4.[[012]]|aix4.[[012]].*)
5022 # We only want to do this on AIX 4.2 and lower, the check
5023 # below for broken collect2 doesn't work under 4.3+
5024 collect2name=`${CC} -print-prog-name=collect2`
5025 if test -f "$collect2name" &&
5026 strings "$collect2name" | $GREP resolve_lib_name >/dev/null
5027 then
5028 # We have reworked collect2
5029 :
5030 else
5031 # We have old collect2
5032 _LT_TAGVAR(hardcode_direct, $1)=unsupported
5033 # It fails to find uninstalled libraries when the uninstalled
5034 # path is not listed in the libpath. Setting hardcode_minus_L
5035 # to unsupported forces relinking
5036 _LT_TAGVAR(hardcode_minus_L, $1)=yes
5037 _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
5038 _LT_TAGVAR(hardcode_libdir_separator, $1)=
5039 fi
5040 ;;
5041 esac
5042 shared_flag='-shared'
5043 if test "$aix_use_runtimelinking" = yes; then
5044 shared_flag="$shared_flag "'${wl}-G'
5045 fi
5046 else
5047 # not using gcc
5048 if test "$host_cpu" = ia64; then
5049 # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release
5050 # chokes on -Wl,-G. The following line is correct:
5051 shared_flag='-G'
5052 else
5053 if test "$aix_use_runtimelinking" = yes; then
5054 shared_flag='${wl}-G'
5055 else
5056 shared_flag='${wl}-bM:SRE'
5057 fi
5058 fi
5059 fi
5060
5061 _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-bexpall'
5062 # It seems that -bexpall does not export symbols beginning with
5063 # underscore (_), so it is better to generate a list of symbols to export.
5064 _LT_TAGVAR(always_export_symbols, $1)=yes
5065 if test "$aix_use_runtimelinking" = yes; then
5066 # Warning - without using the other runtime loading flags (-brtl),
5067 # -berok will link without error, but may produce a broken library.
5068 _LT_TAGVAR(allow_undefined_flag, $1)='-berok'
5069 # Determine the default libpath from the value encoded in an
5070 # empty executable.
5071 _LT_SYS_MODULE_PATH_AIX([$1])
5072 _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath"
5073 _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then func_echo_all "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$exp_sym_flag:\$export_symbols $shared_flag"
5074 else
5075 if test "$host_cpu" = ia64; then
5076 _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R $libdir:/usr/lib:/lib'
5077 _LT_TAGVAR(allow_undefined_flag, $1)="-z nodefs"
5078 _LT_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$exp_sym_flag:\$export_symbols"
5079 else
5080 # Determine the default libpath from the value encoded in an
5081 # empty executable.
5082 _LT_SYS_MODULE_PATH_AIX([$1])
5083 _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath"
5084 # Warning - without using the other run time loading flags,
5085 # -berok will link without error, but may produce a broken library.
5086 _LT_TAGVAR(no_undefined_flag, $1)=' ${wl}-bernotok'
5087 _LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-berok'
5088 if test "$with_gnu_ld" = yes; then
5089 # We only use this code for GNU lds that support --whole-archive.
5090 _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive$convenience ${wl}--no-whole-archive'
5091 else
5092 # Exported symbols can be pulled into shared objects from archives
5093 _LT_TAGVAR(whole_archive_flag_spec, $1)='$convenience'
5094 fi
5095 _LT_TAGVAR(archive_cmds_need_lc, $1)=yes
5096 # This is similar to how AIX traditionally builds its shared libraries.
5097 _LT_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs ${wl}-bnoentry $compiler_flags ${wl}-bE:$export_symbols${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname'
5098 fi
5099 fi
5100 ;;
5101
5102 amigaos*)
5103 case $host_cpu in
5104 powerpc)
5105 # see comment about AmigaOS4 .so support
5106 _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
5107 _LT_TAGVAR(archive_expsym_cmds, $1)=''
5108 ;;
5109 m68k)
5110 _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/a2ixlibrary.data~$ECHO "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$ECHO "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$ECHO "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$ECHO "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)'
5111 _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
5112 _LT_TAGVAR(hardcode_minus_L, $1)=yes
5113 ;;
5114 esac
5115 ;;
5116
5117 bsdi[[45]]*)
5118 _LT_TAGVAR(export_dynamic_flag_spec, $1)=-rdynamic
5119 ;;
5120
5121 cygwin* | mingw* | pw32* | cegcc*)
5122 # When not using gcc, we currently assume that we are using
5123 # Microsoft Visual C++.
5124 # hardcode_libdir_flag_spec is actually meaningless, as there is
5125 # no search path for DLLs.
5126 case $cc_basename in
5127 cl*)
5128 # Native MSVC
5129 _LT_TAGVAR(hardcode_libdir_flag_spec, $1)=' '
5130 _LT_TAGVAR(allow_undefined_flag, $1)=unsupported
5131 _LT_TAGVAR(always_export_symbols, $1)=yes
5132 _LT_TAGVAR(file_list_spec, $1)='@'
5133 # Tell ltmain to make .lib files, not .a files.
5134 libext=lib
5135 # Tell ltmain to make .dll files, not .so files.
5136 shrext_cmds=".dll"
5137 # FIXME: Setting linknames here is a bad hack.
5138 _LT_TAGVAR(archive_cmds, $1)='$CC -o $output_objdir/$soname $libobjs $compiler_flags $deplibs -Wl,-dll~linknames='
5139 _LT_TAGVAR(archive_expsym_cmds, $1)='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then
5140 sed -n -e 's/\\\\\\\(.*\\\\\\\)/-link\\\ -EXPORT:\\\\\\\1/' -e '1\\\!p' < $export_symbols > $output_objdir/$soname.exp;
5141 else
5142 sed -e 's/\\\\\\\(.*\\\\\\\)/-link\\\ -EXPORT:\\\\\\\1/' < $export_symbols > $output_objdir/$soname.exp;
5143 fi~
5144 $CC -o $tool_output_objdir$soname $libobjs $compiler_flags $deplibs "@$tool_output_objdir$soname.exp" -Wl,-DLL,-IMPLIB:"$tool_output_objdir$libname.dll.lib"~
5145 linknames='
5146 # The linker will not automatically build a static lib if we build a DLL.
5147 # _LT_TAGVAR(old_archive_from_new_cmds, $1)='true'
5148 _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes
5149 _LT_TAGVAR(exclude_expsyms, $1)='_NULL_IMPORT_DESCRIPTOR|_IMPORT_DESCRIPTOR_.*'
5150 _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[[BCDGRS]][[ ]]/s/.*[[ ]]\([[^ ]]*\)/\1,DATA/'\'' | $SED -e '\''/^[[AITW]][[ ]]/s/.*[[ ]]//'\'' | sort | uniq > $export_symbols'
5151 # Don't use ranlib
5152 _LT_TAGVAR(old_postinstall_cmds, $1)='chmod 644 $oldlib'
5153 _LT_TAGVAR(postlink_cmds, $1)='lt_outputfile="@OUTPUT@"~
5154 lt_tool_outputfile="@TOOL_OUTPUT@"~
5155 case $lt_outputfile in
5156 *.exe|*.EXE) ;;
5157 *)
5158 lt_outputfile="$lt_outputfile.exe"
5159 lt_tool_outputfile="$lt_tool_outputfile.exe"
5160 ;;
5161 esac~
5162 if test "$MANIFEST_TOOL" != ":" && test -f "$lt_outputfile.manifest"; then
5163 $MANIFEST_TOOL -manifest "$lt_tool_outputfile.manifest" -outputresource:"$lt_tool_outputfile" || exit 1;
5164 $RM "$lt_outputfile.manifest";
5165 fi'
5166 ;;
5167 *)
5168 # Assume MSVC wrapper
5169 _LT_TAGVAR(hardcode_libdir_flag_spec, $1)=' '
5170 _LT_TAGVAR(allow_undefined_flag, $1)=unsupported
5171 # Tell ltmain to make .lib files, not .a files.
5172 libext=lib
5173 # Tell ltmain to make .dll files, not .so files.
5174 shrext_cmds=".dll"
5175 # FIXME: Setting linknames here is a bad hack.
5176 _LT_TAGVAR(archive_cmds, $1)='$CC -o $lib $libobjs $compiler_flags `func_echo_all "$deplibs" | $SED '\''s/ -lc$//'\''` -link -dll~linknames='
5177 # The linker will automatically build a .lib file if we build a DLL.
5178 _LT_TAGVAR(old_archive_from_new_cmds, $1)='true'
5179 # FIXME: Should let the user specify the lib program.
5180 _LT_TAGVAR(old_archive_cmds, $1)='lib -OUT:$oldlib$oldobjs$old_deplibs'
5181 _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes
5182 ;;
5183 esac
5184 ;;
5185
5186 darwin* | rhapsody*)
5187 _LT_DARWIN_LINKER_FEATURES($1)
5188 ;;
5189
5190 dgux*)
5191 _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
5192 _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
5193 _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
5194 ;;
5195
5196 # FreeBSD 2.2.[012] allows us to include c++rt0.o to get C++ constructor
5197 # support. Future versions do this automatically, but an explicit c++rt0.o
5198 # does not break anything, and helps significantly (at the cost of a little
5199 # extra space).
5200 freebsd2.2*)
5201 _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags /usr/lib/c++rt0.o'
5202 _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir'
5203 _LT_TAGVAR(hardcode_direct, $1)=yes
5204 _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
5205 ;;
5206
5207 # Unfortunately, older versions of FreeBSD 2 do not have this feature.
5208 freebsd2.*)
5209 _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags'
5210 _LT_TAGVAR(hardcode_direct, $1)=yes
5211 _LT_TAGVAR(hardcode_minus_L, $1)=yes
5212 _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
5213 ;;
5214
5215 # FreeBSD 3 and greater uses gcc -shared to do shared libraries.
5216 freebsd* | dragonfly*)
5217 _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags'
5218 _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir'
5219 _LT_TAGVAR(hardcode_direct, $1)=yes
5220 _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
5221 ;;
5222
5223 hpux9*)
5224 if test "$GCC" = yes; then
5225 _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/$soname~$CC -shared $pic_flag ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $libobjs $deplibs $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib'
5226 else
5227 _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/$soname~$LD -b +b $install_libdir -o $output_objdir/$soname $libobjs $deplibs $linker_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib'
5228 fi
5229 _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir'
5230 _LT_TAGVAR(hardcode_libdir_separator, $1)=:
5231 _LT_TAGVAR(hardcode_direct, $1)=yes
5232
5233 # hardcode_minus_L: Not really in the search PATH,
5234 # but as the default location of the library.
5235 _LT_TAGVAR(hardcode_minus_L, $1)=yes
5236 _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E'
5237 ;;
5238
5239 hpux10*)
5240 if test "$GCC" = yes && test "$with_gnu_ld" = no; then
5241 _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'
5242 else
5243 _LT_TAGVAR(archive_cmds, $1)='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags'
5244 fi
5245 if test "$with_gnu_ld" = no; then
5246 _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir'
5247 _LT_TAGVAR(hardcode_libdir_separator, $1)=:
5248 _LT_TAGVAR(hardcode_direct, $1)=yes
5249 _LT_TAGVAR(hardcode_direct_absolute, $1)=yes
5250 _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E'
5251 # hardcode_minus_L: Not really in the search PATH,
5252 # but as the default location of the library.
5253 _LT_TAGVAR(hardcode_minus_L, $1)=yes
5254 fi
5255 ;;
5256
5257 hpux11*)
5258 if test "$GCC" = yes && test "$with_gnu_ld" = no; then
5259 case $host_cpu in
5260 hppa*64*)
5261 _LT_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags'
5262 ;;
5263 ia64*)
5264 _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags'
5265 ;;
5266 *)
5267 _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'
5268 ;;
5269 esac
5270 else
5271 case $host_cpu in
5272 hppa*64*)
5273 _LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags'
5274 ;;
5275 ia64*)
5276 _LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags'
5277 ;;
5278 *)
5279 m4_if($1, [], [
5280 # Older versions of the 11.00 compiler do not understand -b yet
5281 # (HP92453-01 A.11.01.20 doesn't, HP92453-01 B.11.X.35175-35176.GP does)
5282 _LT_LINKER_OPTION([if $CC understands -b],
5283 _LT_TAGVAR(lt_cv_prog_compiler__b, $1), [-b],
5284 [_LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'],
5285 [_LT_TAGVAR(archive_cmds, $1)='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags'])],
5286 [_LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'])
5287 ;;
5288 esac
5289 fi
5290 if test "$with_gnu_ld" = no; then
5291 _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir'
5292 _LT_TAGVAR(hardcode_libdir_separator, $1)=:
5293
5294 case $host_cpu in
5295 hppa*64*|ia64*)
5296 _LT_TAGVAR(hardcode_direct, $1)=no
5297 _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
5298 ;;
5299 *)
5300 _LT_TAGVAR(hardcode_direct, $1)=yes
5301 _LT_TAGVAR(hardcode_direct_absolute, $1)=yes
5302 _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E'
5303
5304 # hardcode_minus_L: Not really in the search PATH,
5305 # but as the default location of the library.
5306 _LT_TAGVAR(hardcode_minus_L, $1)=yes
5307 ;;
5308 esac
5309 fi
5310 ;;
5311
5312 irix5* | irix6* | nonstopux*)
5313 if test "$GCC" = yes; then
5314 _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
5315 # Try to use the -exported_symbol ld option, if it does not
5316 # work, assume that -exports_file does not work either and
5317 # implicitly export all symbols.
5318 # This should be the same for all languages, so no per-tag cache variable.
5319 AC_CACHE_CHECK([whether the $host_os linker accepts -exported_symbol],
5320 [lt_cv_irix_exported_symbol],
5321 [save_LDFLAGS="$LDFLAGS"
5322 LDFLAGS="$LDFLAGS -shared ${wl}-exported_symbol ${wl}foo ${wl}-update_registry ${wl}/dev/null"
5323 AC_LINK_IFELSE(
5324 [AC_LANG_SOURCE(
5325 [AC_LANG_CASE([C], [[int foo (void) { return 0; }]],
5326 [C++], [[int foo (void) { return 0; }]],
5327 [Fortran 77], [[
5328 subroutine foo
5329 end]],
5330 [Fortran], [[
5331 subroutine foo
5332 end]])])],
5333 [lt_cv_irix_exported_symbol=yes],
5334 [lt_cv_irix_exported_symbol=no])
5335 LDFLAGS="$save_LDFLAGS"])
5336 if test "$lt_cv_irix_exported_symbol" = yes; then
5337 _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations ${wl}-exports_file ${wl}$export_symbols -o $lib'
5338 fi
5339 else
5340 _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib'
5341 _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -exports_file $export_symbols -o $lib'
5342 fi
5343 _LT_TAGVAR(archive_cmds_need_lc, $1)='no'
5344 _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
5345 _LT_TAGVAR(hardcode_libdir_separator, $1)=:
5346 _LT_TAGVAR(inherit_rpath, $1)=yes
5347 _LT_TAGVAR(link_all_deplibs, $1)=yes
5348 ;;
5349
5350 netbsd*)
5351 if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then
5352 _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' # a.out
5353 else
5354 _LT_TAGVAR(archive_cmds, $1)='$LD -shared -o $lib $libobjs $deplibs $linker_flags' # ELF
5355 fi
5356 _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir'
5357 _LT_TAGVAR(hardcode_direct, $1)=yes
5358 _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
5359 ;;
5360
5361 newsos6)
5362 _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
5363 _LT_TAGVAR(hardcode_direct, $1)=yes
5364 _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
5365 _LT_TAGVAR(hardcode_libdir_separator, $1)=:
5366 _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
5367 ;;
5368
5369 *nto* | *qnx*)
5370 ;;
5371
5372 openbsd*)
5373 if test -f /usr/libexec/ld.so; then
5374 _LT_TAGVAR(hardcode_direct, $1)=yes
5375 _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
5376 _LT_TAGVAR(hardcode_direct_absolute, $1)=yes
5377 if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then
5378 _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags'
5379 _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-retain-symbols-file,$export_symbols'
5380 _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir'
5381 _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E'
5382 else
5383 case $host_os in
5384 openbsd[[01]].* | openbsd2.[[0-7]] | openbsd2.[[0-7]].*)
5385 _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags'
5386 _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir'
5387 ;;
5388 *)
5389 _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags'
5390 _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir'
5391 ;;
5392 esac
5393 fi
5394 else
5395 _LT_TAGVAR(ld_shlibs, $1)=no
5396 fi
5397 ;;
5398
5399 os2*)
5400 _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
5401 _LT_TAGVAR(hardcode_minus_L, $1)=yes
5402 _LT_TAGVAR(allow_undefined_flag, $1)=unsupported
5403 _LT_TAGVAR(archive_cmds, $1)='$ECHO "LIBRARY $libname INITINSTANCE" > $output_objdir/$libname.def~$ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~echo DATA >> $output_objdir/$libname.def~echo " SINGLE NONSHARED" >> $output_objdir/$libname.def~echo EXPORTS >> $output_objdir/$libname.def~emxexp $libobjs >> $output_objdir/$libname.def~$CC -Zdll -Zcrtdll -o $lib $libobjs $deplibs $compiler_flags $output_objdir/$libname.def'
5404 _LT_TAGVAR(old_archive_from_new_cmds, $1)='emximp -o $output_objdir/$libname.a $output_objdir/$libname.def'
5405 ;;
5406
5407 osf3*)
5408 if test "$GCC" = yes; then
5409 _LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*'
5410 _LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
5411 else
5412 _LT_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*'
5413 _LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib'
5414 fi
5415 _LT_TAGVAR(archive_cmds_need_lc, $1)='no'
5416 _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
5417 _LT_TAGVAR(hardcode_libdir_separator, $1)=:
5418 ;;
5419
5420 osf4* | osf5*) # as osf3* with the addition of -msym flag
5421 if test "$GCC" = yes; then
5422 _LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*'
5423 _LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $pic_flag $libobjs $deplibs $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
5424 _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
5425 else
5426 _LT_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*'
5427 _LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags -msym -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib'
5428 _LT_TAGVAR(archive_expsym_cmds, $1)='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done; printf "%s\\n" "-hidden">> $lib.exp~
5429 $CC -shared${allow_undefined_flag} ${wl}-input ${wl}$lib.exp $compiler_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && $ECHO "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib~$RM $lib.exp'
5430
5431 # Both c and cxx compiler support -rpath directly
5432 _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir'
5433 fi
5434 _LT_TAGVAR(archive_cmds_need_lc, $1)='no'
5435 _LT_TAGVAR(hardcode_libdir_separator, $1)=:
5436 ;;
5437
5438 solaris*)
5439 _LT_TAGVAR(no_undefined_flag, $1)=' -z defs'
5440 if test "$GCC" = yes; then
5441 wlarc='${wl}'
5442 _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag ${wl}-z ${wl}text ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags'
5443 _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~
5444 $CC -shared $pic_flag ${wl}-z ${wl}text ${wl}-M ${wl}$lib.exp ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp'
5445 else
5446 case `$CC -V 2>&1` in
5447 *"Compilers 5.0"*)
5448 wlarc=''
5449 _LT_TAGVAR(archive_cmds, $1)='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags'
5450 _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~
5451 $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$RM $lib.exp'
5452 ;;
5453 *)
5454 wlarc='${wl}'
5455 _LT_TAGVAR(archive_cmds, $1)='$CC -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $compiler_flags'
5456 _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~
5457 $CC -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp'
5458 ;;
5459 esac
5460 fi
5461 _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir'
5462 _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
5463 case $host_os in
5464 solaris2.[[0-5]] | solaris2.[[0-5]].*) ;;
5465 *)
5466 # The compiler driver will combine and reorder linker options,
5467 # but understands `-z linker_flag'. GCC discards it without `$wl',
5468 # but is careful enough not to reorder.
5469 # Supported since Solaris 2.6 (maybe 2.5.1?)
5470 if test "$GCC" = yes; then
5471 _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract'
5472 else
5473 _LT_TAGVAR(whole_archive_flag_spec, $1)='-z allextract$convenience -z defaultextract'
5474 fi
5475 ;;
5476 esac
5477 _LT_TAGVAR(link_all_deplibs, $1)=yes
5478 ;;
5479
5480 sunos4*)
5481 if test "x$host_vendor" = xsequent; then
5482 # Use $CC to link under sequent, because it throws in some extra .o
5483 # files that make .init and .fini sections work.
5484 _LT_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h $soname -o $lib $libobjs $deplibs $compiler_flags'
5485 else
5486 _LT_TAGVAR(archive_cmds, $1)='$LD -assert pure-text -Bstatic -o $lib $libobjs $deplibs $linker_flags'
5487 fi
5488 _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
5489 _LT_TAGVAR(hardcode_direct, $1)=yes
5490 _LT_TAGVAR(hardcode_minus_L, $1)=yes
5491 _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
5492 ;;
5493
5494 sysv4)
5495 case $host_vendor in
5496 sni)
5497 _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
5498 _LT_TAGVAR(hardcode_direct, $1)=yes # is this really true???
5499 ;;
5500 siemens)
5501 ## LD is ld it makes a PLAMLIB
5502 ## CC just makes a GrossModule.
5503 _LT_TAGVAR(archive_cmds, $1)='$LD -G -o $lib $libobjs $deplibs $linker_flags'
5504 _LT_TAGVAR(reload_cmds, $1)='$CC -r -o $output$reload_objs'
5505 _LT_TAGVAR(hardcode_direct, $1)=no
5506 ;;
5507 motorola)
5508 _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
5509 _LT_TAGVAR(hardcode_direct, $1)=no #Motorola manual says yes, but my tests say they lie
5510 ;;
5511 esac
5512 runpath_var='LD_RUN_PATH'
5513 _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
5514 ;;
5515
5516 sysv4.3*)
5517 _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
5518 _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
5519 _LT_TAGVAR(export_dynamic_flag_spec, $1)='-Bexport'
5520 ;;
5521
5522 sysv4*MP*)
5523 if test -d /usr/nec; then
5524 _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
5525 _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
5526 runpath_var=LD_RUN_PATH
5527 hardcode_runpath_var=yes
5528 _LT_TAGVAR(ld_shlibs, $1)=yes
5529 fi
5530 ;;
5531
5532 sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[[01]].[[10]]* | unixware7* | sco3.2v5.0.[[024]]*)
5533 _LT_TAGVAR(no_undefined_flag, $1)='${wl}-z,text'
5534 _LT_TAGVAR(archive_cmds_need_lc, $1)=no
5535 _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
5536 runpath_var='LD_RUN_PATH'
5537
5538 if test "$GCC" = yes; then
5539 _LT_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
5540 _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
5541 else
5542 _LT_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
5543 _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
5544 fi
5545 ;;
5546
5547 sysv5* | sco3.2v5* | sco5v6*)
5548 # Note: We can NOT use -z defs as we might desire, because we do not
5549 # link with -lc, and that would cause any symbols used from libc to
5550 # always be unresolved, which means just about no library would
5551 # ever link correctly. If we're not using GNU ld we use -z text
5552 # though, which does catch some bad symbols but isn't as heavy-handed
5553 # as -z defs.
5554 _LT_TAGVAR(no_undefined_flag, $1)='${wl}-z,text'
5555 _LT_TAGVAR(allow_undefined_flag, $1)='${wl}-z,nodefs'
5556 _LT_TAGVAR(archive_cmds_need_lc, $1)=no
5557 _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
5558 _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R,$libdir'
5559 _LT_TAGVAR(hardcode_libdir_separator, $1)=':'
5560 _LT_TAGVAR(link_all_deplibs, $1)=yes
5561 _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-Bexport'
5562 runpath_var='LD_RUN_PATH'
5563
5564 if test "$GCC" = yes; then
5565 _LT_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
5566 _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
5567 else
5568 _LT_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
5569 _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
5570 fi
5571 ;;
5572
5573 uts4*)
5574 _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
5575 _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
5576 _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
5577 ;;
5578
5579 *)
5580 _LT_TAGVAR(ld_shlibs, $1)=no
5581 ;;
5582 esac
5583
5584 if test x$host_vendor = xsni; then
5585 case $host in
5586 sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*)
5587 _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-Blargedynsym'
5588 ;;
5589 esac
5590 fi
5591 fi
5592 ])
5593 AC_MSG_RESULT([$_LT_TAGVAR(ld_shlibs, $1)])
5594 test "$_LT_TAGVAR(ld_shlibs, $1)" = no && can_build_shared=no
5595
5596 _LT_TAGVAR(with_gnu_ld, $1)=$with_gnu_ld
5597
5598 _LT_DECL([], [libext], [0], [Old archive suffix (normally "a")])dnl
5599 _LT_DECL([], [shrext_cmds], [1], [Shared library suffix (normally ".so")])dnl
5600 _LT_DECL([], [extract_expsyms_cmds], [2],
5601 [The commands to extract the exported symbol list from a shared archive])
5602
5603 #
5604 # Do we need to explicitly link libc?
5605 #
5606 case "x$_LT_TAGVAR(archive_cmds_need_lc, $1)" in
5607 x|xyes)
5608 # Assume -lc should be added
5609 _LT_TAGVAR(archive_cmds_need_lc, $1)=yes
5610
5611 if test "$enable_shared" = yes && test "$GCC" = yes; then
5612 case $_LT_TAGVAR(archive_cmds, $1) in
5613 *'~'*)
5614 # FIXME: we may have to deal with multi-command sequences.
5615 ;;
5616 '$CC '*)
5617 # Test whether the compiler implicitly links with -lc since on some
5618 # systems, -lgcc has to come before -lc. If gcc already passes -lc
5619 # to ld, don't add -lc before -lgcc.
5620 AC_CACHE_CHECK([whether -lc should be explicitly linked in],
5621 [lt_cv_]_LT_TAGVAR(archive_cmds_need_lc, $1),
5622 [$RM conftest*
5623 echo "$lt_simple_compile_test_code" > conftest.$ac_ext
5624
5625 if AC_TRY_EVAL(ac_compile) 2>conftest.err; then
5626 soname=conftest
5627 lib=conftest
5628 libobjs=conftest.$ac_objext
5629 deplibs=
5630 wl=$_LT_TAGVAR(lt_prog_compiler_wl, $1)
5631 pic_flag=$_LT_TAGVAR(lt_prog_compiler_pic, $1)
5632 compiler_flags=-v
5633 linker_flags=-v
5634 verstring=
5635 output_objdir=.
5636 libname=conftest
5637 lt_save_allow_undefined_flag=$_LT_TAGVAR(allow_undefined_flag, $1)
5638 _LT_TAGVAR(allow_undefined_flag, $1)=
5639 if AC_TRY_EVAL(_LT_TAGVAR(archive_cmds, $1) 2\>\&1 \| $GREP \" -lc \" \>/dev/null 2\>\&1)
5640 then
5641 lt_cv_[]_LT_TAGVAR(archive_cmds_need_lc, $1)=no
5642 else
5643 lt_cv_[]_LT_TAGVAR(archive_cmds_need_lc, $1)=yes
5644 fi
5645 _LT_TAGVAR(allow_undefined_flag, $1)=$lt_save_allow_undefined_flag
5646 else
5647 cat conftest.err 1>&5
5648 fi
5649 $RM conftest*
5650 ])
5651 _LT_TAGVAR(archive_cmds_need_lc, $1)=$lt_cv_[]_LT_TAGVAR(archive_cmds_need_lc, $1)
5652 ;;
5653 esac
5654 fi
5655 ;;
5656 esac
5657
5658 _LT_TAGDECL([build_libtool_need_lc], [archive_cmds_need_lc], [0],
5659 [Whether or not to add -lc for building shared libraries])
5660 _LT_TAGDECL([allow_libtool_libs_with_static_runtimes],
5661 [enable_shared_with_static_runtimes], [0],
5662 [Whether or not to disallow shared libs when runtime libs are static])
5663 _LT_TAGDECL([], [export_dynamic_flag_spec], [1],
5664 [Compiler flag to allow reflexive dlopens])
5665 _LT_TAGDECL([], [whole_archive_flag_spec], [1],
5666 [Compiler flag to generate shared objects directly from archives])
5667 _LT_TAGDECL([], [compiler_needs_object], [1],
5668 [Whether the compiler copes with passing no objects directly])
5669 _LT_TAGDECL([], [old_archive_from_new_cmds], [2],
5670 [Create an old-style archive from a shared archive])
5671 _LT_TAGDECL([], [old_archive_from_expsyms_cmds], [2],
5672 [Create a temporary old-style archive to link instead of a shared archive])
5673 _LT_TAGDECL([], [archive_cmds], [2], [Commands used to build a shared archive])
5674 _LT_TAGDECL([], [archive_expsym_cmds], [2])
5675 _LT_TAGDECL([], [module_cmds], [2],
5676 [Commands used to build a loadable module if different from building
5677 a shared archive.])
5678 _LT_TAGDECL([], [module_expsym_cmds], [2])
5679 _LT_TAGDECL([], [with_gnu_ld], [1],
5680 [Whether we are building with GNU ld or not])
5681 _LT_TAGDECL([], [allow_undefined_flag], [1],
5682 [Flag that allows shared libraries with undefined symbols to be built])
5683 _LT_TAGDECL([], [no_undefined_flag], [1],
5684 [Flag that enforces no undefined symbols])
5685 _LT_TAGDECL([], [hardcode_libdir_flag_spec], [1],
5686 [Flag to hardcode $libdir into a binary during linking.
5687 This must work even if $libdir does not exist])
5688 _LT_TAGDECL([], [hardcode_libdir_separator], [1],
5689 [Whether we need a single "-rpath" flag with a separated argument])
5690 _LT_TAGDECL([], [hardcode_direct], [0],
5691 [Set to "yes" if using DIR/libNAME${shared_ext} during linking hardcodes
5692 DIR into the resulting binary])
5693 _LT_TAGDECL([], [hardcode_direct_absolute], [0],
5694 [Set to "yes" if using DIR/libNAME${shared_ext} during linking hardcodes
5695 DIR into the resulting binary and the resulting library dependency is
5696 "absolute", i.e impossible to change by setting ${shlibpath_var} if the
5697 library is relocated])
5698 _LT_TAGDECL([], [hardcode_minus_L], [0],
5699 [Set to "yes" if using the -LDIR flag during linking hardcodes DIR
5700 into the resulting binary])
5701 _LT_TAGDECL([], [hardcode_shlibpath_var], [0],
5702 [Set to "yes" if using SHLIBPATH_VAR=DIR during linking hardcodes DIR
5703 into the resulting binary])
5704 _LT_TAGDECL([], [hardcode_automatic], [0],
5705 [Set to "yes" if building a shared library automatically hardcodes DIR
5706 into the library and all subsequent libraries and executables linked
5707 against it])
5708 _LT_TAGDECL([], [inherit_rpath], [0],
5709 [Set to yes if linker adds runtime paths of dependent libraries
5710 to runtime path list])
5711 _LT_TAGDECL([], [link_all_deplibs], [0],
5712 [Whether libtool must link a program against all its dependency libraries])
5713 _LT_TAGDECL([], [always_export_symbols], [0],
5714 [Set to "yes" if exported symbols are required])
5715 _LT_TAGDECL([], [export_symbols_cmds], [2],
5716 [The commands to list exported symbols])
5717 _LT_TAGDECL([], [exclude_expsyms], [1],
5718 [Symbols that should not be listed in the preloaded symbols])
5719 _LT_TAGDECL([], [include_expsyms], [1],
5720 [Symbols that must always be exported])
5721 _LT_TAGDECL([], [prelink_cmds], [2],
5722 [Commands necessary for linking programs (against libraries) with templates])
5723 _LT_TAGDECL([], [postlink_cmds], [2],
5724 [Commands necessary for finishing linking programs])
5725 _LT_TAGDECL([], [file_list_spec], [1],
5726 [Specify filename containing input files])
5727 dnl FIXME: Not yet implemented
5728 dnl _LT_TAGDECL([], [thread_safe_flag_spec], [1],
5729 dnl [Compiler flag to generate thread safe objects])
5730 ])# _LT_LINKER_SHLIBS
5731
5732
5733 # _LT_LANG_C_CONFIG([TAG])
5734 # ------------------------
5735 # Ensure that the configuration variables for a C compiler are suitably
5736 # defined. These variables are subsequently used by _LT_CONFIG to write
5737 # the compiler configuration to `libtool'.
5738 m4_defun([_LT_LANG_C_CONFIG],
5739 [m4_require([_LT_DECL_EGREP])dnl
5740 lt_save_CC="$CC"
5741 AC_LANG_PUSH(C)
5742
5743 # Source file extension for C test sources.
5744 ac_ext=c
5745
5746 # Object file extension for compiled C test sources.
5747 objext=o
5748 _LT_TAGVAR(objext, $1)=$objext
5749
5750 # Code to be used in simple compile tests
5751 lt_simple_compile_test_code="int some_variable = 0;"
5752
5753 # Code to be used in simple link tests
5754 lt_simple_link_test_code='int main(){return(0);}'
5755
5756 _LT_TAG_COMPILER
5757 # Save the default compiler, since it gets overwritten when the other
5758 # tags are being tested, and _LT_TAGVAR(compiler, []) is a NOP.
5759 compiler_DEFAULT=$CC
5760
5761 # save warnings/boilerplate of simple test code
5762 _LT_COMPILER_BOILERPLATE
5763 _LT_LINKER_BOILERPLATE
5764
5765 ## CAVEAT EMPTOR:
5766 ## There is no encapsulation within the following macros, do not change
5767 ## the running order or otherwise move them around unless you know exactly
5768 ## what you are doing...
5769 if test -n "$compiler"; then
5770 _LT_COMPILER_NO_RTTI($1)
5771 _LT_COMPILER_PIC($1)
5772 _LT_COMPILER_C_O($1)
5773 _LT_COMPILER_FILE_LOCKS($1)
5774 _LT_LINKER_SHLIBS($1)
5775 _LT_SYS_DYNAMIC_LINKER($1)
5776 _LT_LINKER_HARDCODE_LIBPATH($1)
5777 LT_SYS_DLOPEN_SELF
5778 _LT_CMD_STRIPLIB
5779
5780 # Report which library types will actually be built
5781 AC_MSG_CHECKING([if libtool supports shared libraries])
5782 AC_MSG_RESULT([$can_build_shared])
5783
5784 AC_MSG_CHECKING([whether to build shared libraries])
5785 test "$can_build_shared" = "no" && enable_shared=no
5786
5787 # On AIX, shared libraries and static libraries use the same namespace, and
5788 # are all built from PIC.
5789 case $host_os in
5790 aix3*)
5791 test "$enable_shared" = yes && enable_static=no
5792 if test -n "$RANLIB"; then
5793 archive_cmds="$archive_cmds~\$RANLIB \$lib"
5794 postinstall_cmds='$RANLIB $lib'
5795 fi
5796 ;;
5797
5798 aix[[4-9]]*)
5799 if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then
5800 test "$enable_shared" = yes && enable_static=no
5801 fi
5802 ;;
5803 esac
5804 AC_MSG_RESULT([$enable_shared])
5805
5806 AC_MSG_CHECKING([whether to build static libraries])
5807 # Make sure either enable_shared or enable_static is yes.
5808 test "$enable_shared" = yes || enable_static=yes
5809 AC_MSG_RESULT([$enable_static])
5810
5811 _LT_CONFIG($1)
5812 fi
5813 AC_LANG_POP
5814 CC="$lt_save_CC"
5815 ])# _LT_LANG_C_CONFIG
5816
5817
5818 # _LT_LANG_CXX_CONFIG([TAG])
5819 # --------------------------
5820 # Ensure that the configuration variables for a C++ compiler are suitably
5821 # defined. These variables are subsequently used by _LT_CONFIG to write
5822 # the compiler configuration to `libtool'.
5823 m4_defun([_LT_LANG_CXX_CONFIG],
5824 [m4_require([_LT_FILEUTILS_DEFAULTS])dnl
5825 m4_require([_LT_DECL_EGREP])dnl
5826 m4_require([_LT_PATH_MANIFEST_TOOL])dnl
5827 if test -n "$CXX" && ( test "X$CXX" != "Xno" &&
5828 ( (test "X$CXX" = "Xg++" && `g++ -v >/dev/null 2>&1` ) ||
5829 (test "X$CXX" != "Xg++"))) ; then
5830 AC_PROG_CXXCPP
5831 else
5832 _lt_caught_CXX_error=yes
5833 fi
5834
5835 AC_LANG_PUSH(C++)
5836 _LT_TAGVAR(archive_cmds_need_lc, $1)=no
5837 _LT_TAGVAR(allow_undefined_flag, $1)=
5838 _LT_TAGVAR(always_export_symbols, $1)=no
5839 _LT_TAGVAR(archive_expsym_cmds, $1)=
5840 _LT_TAGVAR(compiler_needs_object, $1)=no
5841 _LT_TAGVAR(export_dynamic_flag_spec, $1)=
5842 _LT_TAGVAR(hardcode_direct, $1)=no
5843 _LT_TAGVAR(hardcode_direct_absolute, $1)=no
5844 _LT_TAGVAR(hardcode_libdir_flag_spec, $1)=
5845 _LT_TAGVAR(hardcode_libdir_separator, $1)=
5846 _LT_TAGVAR(hardcode_minus_L, $1)=no
5847 _LT_TAGVAR(hardcode_shlibpath_var, $1)=unsupported
5848 _LT_TAGVAR(hardcode_automatic, $1)=no
5849 _LT_TAGVAR(inherit_rpath, $1)=no
5850 _LT_TAGVAR(module_cmds, $1)=
5851 _LT_TAGVAR(module_expsym_cmds, $1)=
5852 _LT_TAGVAR(link_all_deplibs, $1)=unknown
5853 _LT_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds
5854 _LT_TAGVAR(reload_flag, $1)=$reload_flag
5855 _LT_TAGVAR(reload_cmds, $1)=$reload_cmds
5856 _LT_TAGVAR(no_undefined_flag, $1)=
5857 _LT_TAGVAR(whole_archive_flag_spec, $1)=
5858 _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=no
5859
5860 # Source file extension for C++ test sources.
5861 ac_ext=cpp
5862
5863 # Object file extension for compiled C++ test sources.
5864 objext=o
5865 _LT_TAGVAR(objext, $1)=$objext
5866
5867 # No sense in running all these tests if we already determined that
5868 # the CXX compiler isn't working. Some variables (like enable_shared)
5869 # are currently assumed to apply to all compilers on this platform,
5870 # and will be corrupted by setting them based on a non-working compiler.
5871 if test "$_lt_caught_CXX_error" != yes; then
5872 # Code to be used in simple compile tests
5873 lt_simple_compile_test_code="int some_variable = 0;"
5874
5875 # Code to be used in simple link tests
5876 lt_simple_link_test_code='int main(int, char *[[]]) { return(0); }'
5877
5878 # ltmain only uses $CC for tagged configurations so make sure $CC is set.
5879 _LT_TAG_COMPILER
5880
5881 # save warnings/boilerplate of simple test code
5882 _LT_COMPILER_BOILERPLATE
5883 _LT_LINKER_BOILERPLATE
5884
5885 # Allow CC to be a program name with arguments.
5886 lt_save_CC=$CC
5887 lt_save_CFLAGS=$CFLAGS
5888 lt_save_LD=$LD
5889 lt_save_GCC=$GCC
5890 GCC=$GXX
5891 lt_save_with_gnu_ld=$with_gnu_ld
5892 lt_save_path_LD=$lt_cv_path_LD
5893 if test -n "${lt_cv_prog_gnu_ldcxx+set}"; then
5894 lt_cv_prog_gnu_ld=$lt_cv_prog_gnu_ldcxx
5895 else
5896 $as_unset lt_cv_prog_gnu_ld
5897 fi
5898 if test -n "${lt_cv_path_LDCXX+set}"; then
5899 lt_cv_path_LD=$lt_cv_path_LDCXX
5900 else
5901 $as_unset lt_cv_path_LD
5902 fi
5903 test -z "${LDCXX+set}" || LD=$LDCXX
5904 CC=${CXX-"c++"}
5905 CFLAGS=$CXXFLAGS
5906 compiler=$CC
5907 _LT_TAGVAR(compiler, $1)=$CC
5908 _LT_CC_BASENAME([$compiler])
5909
5910 if test -n "$compiler"; then
5911 # We don't want -fno-exception when compiling C++ code, so set the
5912 # no_builtin_flag separately
5913 if test "$GXX" = yes; then
5914 _LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=' -fno-builtin'
5915 else
5916 _LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=
5917 fi
5918
5919 if test "$GXX" = yes; then
5920 # Set up default GNU C++ configuration
5921
5922 LT_PATH_LD
5923
5924 # Check if GNU C++ uses GNU ld as the underlying linker, since the
5925 # archiving commands below assume that GNU ld is being used.
5926 if test "$with_gnu_ld" = yes; then
5927 _LT_TAGVAR(archive_cmds, $1)='$CC $pic_flag -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib'
5928 _LT_TAGVAR(archive_expsym_cmds, $1)='$CC $pic_flag -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
5929
5930 _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
5931 _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic'
5932
5933 # If archive_cmds runs LD, not CC, wlarc should be empty
5934 # XXX I think wlarc can be eliminated in ltcf-cxx, but I need to
5935 # investigate it a little bit more. (MM)
5936 wlarc='${wl}'
5937
5938 # ancient GNU ld didn't support --whole-archive et. al.
5939 if eval "`$CC -print-prog-name=ld` --help 2>&1" |
5940 $GREP 'no-whole-archive' > /dev/null; then
5941 _LT_TAGVAR(whole_archive_flag_spec, $1)="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive'
5942 else
5943 _LT_TAGVAR(whole_archive_flag_spec, $1)=
5944 fi
5945 else
5946 with_gnu_ld=no
5947 wlarc=
5948
5949 # A generic and very simple default shared library creation
5950 # command for GNU C++ for the case where it uses the native
5951 # linker, instead of GNU ld. If possible, this setting should
5952 # overridden to take advantage of the native linker features on
5953 # the platform it is being used on.
5954 _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $lib'
5955 fi
5956
5957 # Commands to make compiler produce verbose output that lists
5958 # what "hidden" libraries, object files and flags are used when
5959 # linking a shared library.
5960 output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP "\-L"'
5961
5962 else
5963 GXX=no
5964 with_gnu_ld=no
5965 wlarc=
5966 fi
5967
5968 # PORTME: fill in a description of your system's C++ link characteristics
5969 AC_MSG_CHECKING([whether the $compiler linker ($LD) supports shared libraries])
5970 _LT_TAGVAR(ld_shlibs, $1)=yes
5971 case $host_os in
5972 aix3*)
5973 # FIXME: insert proper C++ library support
5974 _LT_TAGVAR(ld_shlibs, $1)=no
5975 ;;
5976 aix[[4-9]]*)
5977 if test "$host_cpu" = ia64; then
5978 # On IA64, the linker does run time linking by default, so we don't
5979 # have to do anything special.
5980 aix_use_runtimelinking=no
5981 exp_sym_flag='-Bexport'
5982 no_entry_flag=""
5983 else
5984 aix_use_runtimelinking=no
5985
5986 # Test if we are trying to use run time linking or normal
5987 # AIX style linking. If -brtl is somewhere in LDFLAGS, we
5988 # need to do runtime linking.
5989 case $host_os in aix4.[[23]]|aix4.[[23]].*|aix[[5-9]]*)
5990 for ld_flag in $LDFLAGS; do
5991 case $ld_flag in
5992 *-brtl*)
5993 aix_use_runtimelinking=yes
5994 break
5995 ;;
5996 esac
5997 done
5998 ;;
5999 esac
6000
6001 exp_sym_flag='-bexport'
6002 no_entry_flag='-bnoentry'
6003 fi
6004
6005 # When large executables or shared objects are built, AIX ld can
6006 # have problems creating the table of contents. If linking a library
6007 # or program results in "error TOC overflow" add -mminimal-toc to
6008 # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not
6009 # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS.
6010
6011 _LT_TAGVAR(archive_cmds, $1)=''
6012 _LT_TAGVAR(hardcode_direct, $1)=yes
6013 _LT_TAGVAR(hardcode_direct_absolute, $1)=yes
6014 _LT_TAGVAR(hardcode_libdir_separator, $1)=':'
6015 _LT_TAGVAR(link_all_deplibs, $1)=yes
6016 _LT_TAGVAR(file_list_spec, $1)='${wl}-f,'
6017
6018 if test "$GXX" = yes; then
6019 case $host_os in aix4.[[012]]|aix4.[[012]].*)
6020 # We only want to do this on AIX 4.2 and lower, the check
6021 # below for broken collect2 doesn't work under 4.3+
6022 collect2name=`${CC} -print-prog-name=collect2`
6023 if test -f "$collect2name" &&
6024 strings "$collect2name" | $GREP resolve_lib_name >/dev/null
6025 then
6026 # We have reworked collect2
6027 :
6028 else
6029 # We have old collect2
6030 _LT_TAGVAR(hardcode_direct, $1)=unsupported
6031 # It fails to find uninstalled libraries when the uninstalled
6032 # path is not listed in the libpath. Setting hardcode_minus_L
6033 # to unsupported forces relinking
6034 _LT_TAGVAR(hardcode_minus_L, $1)=yes
6035 _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
6036 _LT_TAGVAR(hardcode_libdir_separator, $1)=
6037 fi
6038 esac
6039 shared_flag='-shared'
6040 if test "$aix_use_runtimelinking" = yes; then
6041 shared_flag="$shared_flag "'${wl}-G'
6042 fi
6043 else
6044 # not using gcc
6045 if test "$host_cpu" = ia64; then
6046 # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release
6047 # chokes on -Wl,-G. The following line is correct:
6048 shared_flag='-G'
6049 else
6050 if test "$aix_use_runtimelinking" = yes; then
6051 shared_flag='${wl}-G'
6052 else
6053 shared_flag='${wl}-bM:SRE'
6054 fi
6055 fi
6056 fi
6057
6058 _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-bexpall'
6059 # It seems that -bexpall does not export symbols beginning with
6060 # underscore (_), so it is better to generate a list of symbols to
6061 # export.
6062 _LT_TAGVAR(always_export_symbols, $1)=yes
6063 if test "$aix_use_runtimelinking" = yes; then
6064 # Warning - without using the other runtime loading flags (-brtl),
6065 # -berok will link without error, but may produce a broken library.
6066 _LT_TAGVAR(allow_undefined_flag, $1)='-berok'
6067 # Determine the default libpath from the value encoded in an empty
6068 # executable.
6069 _LT_SYS_MODULE_PATH_AIX([$1])
6070 _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath"
6071
6072 _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then func_echo_all "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$exp_sym_flag:\$export_symbols $shared_flag"
6073 else
6074 if test "$host_cpu" = ia64; then
6075 _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R $libdir:/usr/lib:/lib'
6076 _LT_TAGVAR(allow_undefined_flag, $1)="-z nodefs"
6077 _LT_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$exp_sym_flag:\$export_symbols"
6078 else
6079 # Determine the default libpath from the value encoded in an
6080 # empty executable.
6081 _LT_SYS_MODULE_PATH_AIX([$1])
6082 _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath"
6083 # Warning - without using the other run time loading flags,
6084 # -berok will link without error, but may produce a broken library.
6085 _LT_TAGVAR(no_undefined_flag, $1)=' ${wl}-bernotok'
6086 _LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-berok'
6087 if test "$with_gnu_ld" = yes; then
6088 # We only use this code for GNU lds that support --whole-archive.
6089 _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive$convenience ${wl}--no-whole-archive'
6090 else
6091 # Exported symbols can be pulled into shared objects from archives
6092 _LT_TAGVAR(whole_archive_flag_spec, $1)='$convenience'
6093 fi
6094 _LT_TAGVAR(archive_cmds_need_lc, $1)=yes
6095 # This is similar to how AIX traditionally builds its shared
6096 # libraries.
6097 _LT_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs ${wl}-bnoentry $compiler_flags ${wl}-bE:$export_symbols${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname'
6098 fi
6099 fi
6100 ;;
6101
6102 beos*)
6103 if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then
6104 _LT_TAGVAR(allow_undefined_flag, $1)=unsupported
6105 # Joseph Beckenbach <jrb3@best.com> says some releases of gcc
6106 # support --undefined. This deserves some investigation. FIXME
6107 _LT_TAGVAR(archive_cmds, $1)='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
6108 else
6109 _LT_TAGVAR(ld_shlibs, $1)=no
6110 fi
6111 ;;
6112
6113 chorus*)
6114 case $cc_basename in
6115 *)
6116 # FIXME: insert proper C++ library support
6117 _LT_TAGVAR(ld_shlibs, $1)=no
6118 ;;
6119 esac
6120 ;;
6121
6122 cygwin* | mingw* | pw32* | cegcc*)
6123 case $GXX,$cc_basename in
6124 ,cl* | no,cl*)
6125 # Native MSVC
6126 # hardcode_libdir_flag_spec is actually meaningless, as there is
6127 # no search path for DLLs.
6128 _LT_TAGVAR(hardcode_libdir_flag_spec, $1)=' '
6129 _LT_TAGVAR(allow_undefined_flag, $1)=unsupported
6130 _LT_TAGVAR(always_export_symbols, $1)=yes
6131 _LT_TAGVAR(file_list_spec, $1)='@'
6132 # Tell ltmain to make .lib files, not .a files.
6133 libext=lib
6134 # Tell ltmain to make .dll files, not .so files.
6135 shrext_cmds=".dll"
6136 # FIXME: Setting linknames here is a bad hack.
6137 _LT_TAGVAR(archive_cmds, $1)='$CC -o $output_objdir/$soname $libobjs $compiler_flags $deplibs -Wl,-dll~linknames='
6138 _LT_TAGVAR(archive_expsym_cmds, $1)='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then
6139 $SED -n -e 's/\\\\\\\(.*\\\\\\\)/-link\\\ -EXPORT:\\\\\\\1/' -e '1\\\!p' < $export_symbols > $output_objdir/$soname.exp;
6140 else
6141 $SED -e 's/\\\\\\\(.*\\\\\\\)/-link\\\ -EXPORT:\\\\\\\1/' < $export_symbols > $output_objdir/$soname.exp;
6142 fi~
6143 $CC -o $tool_output_objdir$soname $libobjs $compiler_flags $deplibs "@$tool_output_objdir$soname.exp" -Wl,-DLL,-IMPLIB:"$tool_output_objdir$libname.dll.lib"~
6144 linknames='
6145 # The linker will not automatically build a static lib if we build a DLL.
6146 # _LT_TAGVAR(old_archive_from_new_cmds, $1)='true'
6147 _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes
6148 # Don't use ranlib
6149 _LT_TAGVAR(old_postinstall_cmds, $1)='chmod 644 $oldlib'
6150 _LT_TAGVAR(postlink_cmds, $1)='lt_outputfile="@OUTPUT@"~
6151 lt_tool_outputfile="@TOOL_OUTPUT@"~
6152 case $lt_outputfile in
6153 *.exe|*.EXE) ;;
6154 *)
6155 lt_outputfile="$lt_outputfile.exe"
6156 lt_tool_outputfile="$lt_tool_outputfile.exe"
6157 ;;
6158 esac~
6159 func_to_tool_file "$lt_outputfile"~
6160 if test "$MANIFEST_TOOL" != ":" && test -f "$lt_outputfile.manifest"; then
6161 $MANIFEST_TOOL -manifest "$lt_tool_outputfile.manifest" -outputresource:"$lt_tool_outputfile" || exit 1;
6162 $RM "$lt_outputfile.manifest";
6163 fi'
6164 ;;
6165 *)
6166 # g++
6167 # _LT_TAGVAR(hardcode_libdir_flag_spec, $1) is actually meaningless,
6168 # as there is no search path for DLLs.
6169 _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
6170 _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-all-symbols'
6171 _LT_TAGVAR(allow_undefined_flag, $1)=unsupported
6172 _LT_TAGVAR(always_export_symbols, $1)=no
6173 _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes
6174
6175 if $LD --help 2>&1 | $GREP 'auto-import' > /dev/null; then
6176 _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib'
6177 # If the export-symbols file already is a .def file (1st line
6178 # is EXPORTS), use it as is; otherwise, prepend...
6179 _LT_TAGVAR(archive_expsym_cmds, $1)='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then
6180 cp $export_symbols $output_objdir/$soname.def;
6181 else
6182 echo EXPORTS > $output_objdir/$soname.def;
6183 cat $export_symbols >> $output_objdir/$soname.def;
6184 fi~
6185 $CC -shared -nostdlib $output_objdir/$soname.def $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib'
6186 else
6187 _LT_TAGVAR(ld_shlibs, $1)=no
6188 fi
6189 ;;
6190 esac
6191 ;;
6192 darwin* | rhapsody*)
6193 _LT_DARWIN_LINKER_FEATURES($1)
6194 ;;
6195
6196 dgux*)
6197 case $cc_basename in
6198 ec++*)
6199 # FIXME: insert proper C++ library support
6200 _LT_TAGVAR(ld_shlibs, $1)=no
6201 ;;
6202 ghcx*)
6203 # Green Hills C++ Compiler
6204 # FIXME: insert proper C++ library support
6205 _LT_TAGVAR(ld_shlibs, $1)=no
6206 ;;
6207 *)
6208 # FIXME: insert proper C++ library support
6209 _LT_TAGVAR(ld_shlibs, $1)=no
6210 ;;
6211 esac
6212 ;;
6213
6214 freebsd2.*)
6215 # C++ shared libraries reported to be fairly broken before
6216 # switch to ELF
6217 _LT_TAGVAR(ld_shlibs, $1)=no
6218 ;;
6219
6220 freebsd-elf*)
6221 _LT_TAGVAR(archive_cmds_need_lc, $1)=no
6222 ;;
6223
6224 freebsd* | dragonfly*)
6225 # FreeBSD 3 and later use GNU C++ and GNU ld with standard ELF
6226 # conventions
6227 _LT_TAGVAR(ld_shlibs, $1)=yes
6228 ;;
6229
6230 gnu*)
6231 ;;
6232
6233 haiku*)
6234 _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
6235 _LT_TAGVAR(link_all_deplibs, $1)=yes
6236 ;;
6237
6238 hpux9*)
6239 _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir'
6240 _LT_TAGVAR(hardcode_libdir_separator, $1)=:
6241 _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E'
6242 _LT_TAGVAR(hardcode_direct, $1)=yes
6243 _LT_TAGVAR(hardcode_minus_L, $1)=yes # Not in the search PATH,
6244 # but as the default
6245 # location of the library.
6246
6247 case $cc_basename in
6248 CC*)
6249 # FIXME: insert proper C++ library support
6250 _LT_TAGVAR(ld_shlibs, $1)=no
6251 ;;
6252 aCC*)
6253 _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/$soname~$CC -b ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib'
6254 # Commands to make compiler produce verbose output that lists
6255 # what "hidden" libraries, object files and flags are used when
6256 # linking a shared library.
6257 #
6258 # There doesn't appear to be a way to prevent this compiler from
6259 # explicitly linking system object files so we need to strip them
6260 # from the output so that they don't get included in the library
6261 # dependencies.
6262 output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | $EGREP "\-L"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"'
6263 ;;
6264 *)
6265 if test "$GXX" = yes; then
6266 _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/$soname~$CC -shared -nostdlib $pic_flag ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib'
6267 else
6268 # FIXME: insert proper C++ library support
6269 _LT_TAGVAR(ld_shlibs, $1)=no
6270 fi
6271 ;;
6272 esac
6273 ;;
6274
6275 hpux10*|hpux11*)
6276 if test $with_gnu_ld = no; then
6277 _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir'
6278 _LT_TAGVAR(hardcode_libdir_separator, $1)=:
6279
6280 case $host_cpu in
6281 hppa*64*|ia64*)
6282 ;;
6283 *)
6284 _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E'
6285 ;;
6286 esac
6287 fi
6288 case $host_cpu in
6289 hppa*64*|ia64*)
6290 _LT_TAGVAR(hardcode_direct, $1)=no
6291 _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
6292 ;;
6293 *)
6294 _LT_TAGVAR(hardcode_direct, $1)=yes
6295 _LT_TAGVAR(hardcode_direct_absolute, $1)=yes
6296 _LT_TAGVAR(hardcode_minus_L, $1)=yes # Not in the search PATH,
6297 # but as the default
6298 # location of the library.
6299 ;;
6300 esac
6301
6302 case $cc_basename in
6303 CC*)
6304 # FIXME: insert proper C++ library support
6305 _LT_TAGVAR(ld_shlibs, $1)=no
6306 ;;
6307 aCC*)
6308 case $host_cpu in
6309 hppa*64*)
6310 _LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
6311 ;;
6312 ia64*)
6313 _LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
6314 ;;
6315 *)
6316 _LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
6317 ;;
6318 esac
6319 # Commands to make compiler produce verbose output that lists
6320 # what "hidden" libraries, object files and flags are used when
6321 # linking a shared library.
6322 #
6323 # There doesn't appear to be a way to prevent this compiler from
6324 # explicitly linking system object files so we need to strip them
6325 # from the output so that they don't get included in the library
6326 # dependencies.
6327 output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | $GREP "\-L"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"'
6328 ;;
6329 *)
6330 if test "$GXX" = yes; then
6331 if test $with_gnu_ld = no; then
6332 case $host_cpu in
6333 hppa*64*)
6334 _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib -fPIC ${wl}+h ${wl}$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
6335 ;;
6336 ia64*)
6337 _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $pic_flag ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
6338 ;;
6339 *)
6340 _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $pic_flag ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
6341 ;;
6342 esac
6343 fi
6344 else
6345 # FIXME: insert proper C++ library support
6346 _LT_TAGVAR(ld_shlibs, $1)=no
6347 fi
6348 ;;
6349 esac
6350 ;;
6351
6352 interix[[3-9]]*)
6353 _LT_TAGVAR(hardcode_direct, $1)=no
6354 _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
6355 _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir'
6356 _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E'
6357 # Hack: On Interix 3.x, we cannot compile PIC because of a broken gcc.
6358 # Instead, shared libraries are loaded at an image base (0x10000000 by
6359 # default) and relocated if they conflict, which is a slow very memory
6360 # consuming and fragmenting process. To avoid this, we pick a random,
6361 # 256 KiB-aligned image base between 0x50000000 and 0x6FFC0000 at link
6362 # time. Moving up from 0x10000000 also allows more sbrk(2) space.
6363 _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib'
6364 _LT_TAGVAR(archive_expsym_cmds, $1)='sed "s,^,_," $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--retain-symbols-file,$output_objdir/$soname.expsym ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib'
6365 ;;
6366 irix5* | irix6*)
6367 case $cc_basename in
6368 CC*)
6369 # SGI C++
6370 _LT_TAGVAR(archive_cmds, $1)='$CC -shared -all -multigot $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib'
6371
6372 # Archives containing C++ object files must be created using
6373 # "CC -ar", where "CC" is the IRIX C++ compiler. This is
6374 # necessary to make sure instantiated templates are included
6375 # in the archive.
6376 _LT_TAGVAR(old_archive_cmds, $1)='$CC -ar -WR,-u -o $oldlib $oldobjs'
6377 ;;
6378 *)
6379 if test "$GXX" = yes; then
6380 if test "$with_gnu_ld" = no; then
6381 _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
6382 else
6383 _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` -o $lib'
6384 fi
6385 fi
6386 _LT_TAGVAR(link_all_deplibs, $1)=yes
6387 ;;
6388 esac
6389 _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
6390 _LT_TAGVAR(hardcode_libdir_separator, $1)=:
6391 _LT_TAGVAR(inherit_rpath, $1)=yes
6392 ;;
6393
6394 linux* | k*bsd*-gnu | kopensolaris*-gnu)
6395 case $cc_basename in
6396 KCC*)
6397 # Kuck and Associates, Inc. (KAI) C++ Compiler
6398
6399 # KCC will only create a shared library if the output file
6400 # ends with ".so" (or ".sl" for HP-UX), so rename the library
6401 # to its proper name (with version) after linking.
6402 _LT_TAGVAR(archive_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib'
6403 _LT_TAGVAR(archive_expsym_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib ${wl}-retain-symbols-file,$export_symbols; mv \$templib $lib'
6404 # Commands to make compiler produce verbose output that lists
6405 # what "hidden" libraries, object files and flags are used when
6406 # linking a shared library.
6407 #
6408 # There doesn't appear to be a way to prevent this compiler from
6409 # explicitly linking system object files so we need to strip them
6410 # from the output so that they don't get included in the library
6411 # dependencies.
6412 output_verbose_link_cmd='templist=`$CC $CFLAGS -v conftest.$objext -o libconftest$shared_ext 2>&1 | $GREP "ld"`; rm -f libconftest$shared_ext; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"'
6413
6414 _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir'
6415 _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic'
6416
6417 # Archives containing C++ object files must be created using
6418 # "CC -Bstatic", where "CC" is the KAI C++ compiler.
6419 _LT_TAGVAR(old_archive_cmds, $1)='$CC -Bstatic -o $oldlib $oldobjs'
6420 ;;
6421 icpc* | ecpc* )
6422 # Intel C++
6423 with_gnu_ld=yes
6424 # version 8.0 and above of icpc choke on multiply defined symbols
6425 # if we add $predep_objects and $postdep_objects, however 7.1 and
6426 # earlier do not add the objects themselves.
6427 case `$CC -V 2>&1` in
6428 *"Version 7."*)
6429 _LT_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib'
6430 _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
6431 ;;
6432 *) # Version 8.0 or newer
6433 tmp_idyn=
6434 case $host_cpu in
6435 ia64*) tmp_idyn=' -i_dynamic';;
6436 esac
6437 _LT_TAGVAR(archive_cmds, $1)='$CC -shared'"$tmp_idyn"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
6438 _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared'"$tmp_idyn"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
6439 ;;
6440 esac
6441 _LT_TAGVAR(archive_cmds_need_lc, $1)=no
6442 _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir'
6443 _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic'
6444 _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive$convenience ${wl}--no-whole-archive'
6445 ;;
6446 pgCC* | pgcpp*)
6447 # Portland Group C++ compiler
6448 case `$CC -V` in
6449 *pgCC\ [[1-5]].* | *pgcpp\ [[1-5]].*)
6450 _LT_TAGVAR(prelink_cmds, $1)='tpldir=Template.dir~
6451 rm -rf $tpldir~
6452 $CC --prelink_objects --instantiation_dir $tpldir $objs $libobjs $compile_deplibs~
6453 compile_command="$compile_command `find $tpldir -name \*.o | sort | $NL2SP`"'
6454 _LT_TAGVAR(old_archive_cmds, $1)='tpldir=Template.dir~
6455 rm -rf $tpldir~
6456 $CC --prelink_objects --instantiation_dir $tpldir $oldobjs$old_deplibs~
6457 $AR $AR_FLAGS $oldlib$oldobjs$old_deplibs `find $tpldir -name \*.o | sort | $NL2SP`~
6458 $RANLIB $oldlib'
6459 _LT_TAGVAR(archive_cmds, $1)='tpldir=Template.dir~
6460 rm -rf $tpldir~
6461 $CC --prelink_objects --instantiation_dir $tpldir $predep_objects $libobjs $deplibs $convenience $postdep_objects~
6462 $CC -shared $pic_flag $predep_objects $libobjs $deplibs `find $tpldir -name \*.o | sort | $NL2SP` $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname -o $lib'
6463 _LT_TAGVAR(archive_expsym_cmds, $1)='tpldir=Template.dir~
6464 rm -rf $tpldir~
6465 $CC --prelink_objects --instantiation_dir $tpldir $predep_objects $libobjs $deplibs $convenience $postdep_objects~
6466 $CC -shared $pic_flag $predep_objects $libobjs $deplibs `find $tpldir -name \*.o | sort | $NL2SP` $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname ${wl}-retain-symbols-file ${wl}$export_symbols -o $lib'
6467 ;;
6468 *) # Version 6 and above use weak symbols
6469 _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname -o $lib'
6470 _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname ${wl}-retain-symbols-file ${wl}$export_symbols -o $lib'
6471 ;;
6472 esac
6473
6474 _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}--rpath ${wl}$libdir'
6475 _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic'
6476 _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive'
6477 ;;
6478 cxx*)
6479 # Compaq C++
6480 _LT_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib'
6481 _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib ${wl}-retain-symbols-file $wl$export_symbols'
6482
6483 runpath_var=LD_RUN_PATH
6484 _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir'
6485 _LT_TAGVAR(hardcode_libdir_separator, $1)=:
6486
6487 # Commands to make compiler produce verbose output that lists
6488 # what "hidden" libraries, object files and flags are used when
6489 # linking a shared library.
6490 #
6491 # There doesn't appear to be a way to prevent this compiler from
6492 # explicitly linking system object files so we need to strip them
6493 # from the output so that they don't get included in the library
6494 # dependencies.
6495 output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP "ld"`; templist=`func_echo_all "$templist" | $SED "s/\(^.*ld.*\)\( .*ld .*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "X$list" | $Xsed'
6496 ;;
6497 xl* | mpixl* | bgxl*)
6498 # IBM XL 8.0 on PPC, with GNU ld
6499 _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
6500 _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic'
6501 _LT_TAGVAR(archive_cmds, $1)='$CC -qmkshrobj $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
6502 if test "x$supports_anon_versioning" = xyes; then
6503 _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $output_objdir/$libname.ver~
6504 cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~
6505 echo "local: *; };" >> $output_objdir/$libname.ver~
6506 $CC -qmkshrobj $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib'
6507 fi
6508 ;;
6509 *)
6510 case `$CC -V 2>&1 | sed 5q` in
6511 *Sun\ C*)
6512 # Sun C++ 5.9
6513 _LT_TAGVAR(no_undefined_flag, $1)=' -zdefs'
6514 _LT_TAGVAR(archive_cmds, $1)='$CC -G${allow_undefined_flag} -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
6515 _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G${allow_undefined_flag} -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-retain-symbols-file ${wl}$export_symbols'
6516 _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir'
6517 _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive'
6518 _LT_TAGVAR(compiler_needs_object, $1)=yes
6519
6520 # Not sure whether something based on
6521 # $CC $CFLAGS -v conftest.$objext -o libconftest$shared_ext 2>&1
6522 # would be better.
6523 output_verbose_link_cmd='func_echo_all'
6524
6525 # Archives containing C++ object files must be created using
6526 # "CC -xar", where "CC" is the Sun C++ compiler. This is
6527 # necessary to make sure instantiated templates are included
6528 # in the archive.
6529 _LT_TAGVAR(old_archive_cmds, $1)='$CC -xar -o $oldlib $oldobjs'
6530 ;;
6531 esac
6532 ;;
6533 esac
6534 ;;
6535
6536 lynxos*)
6537 # FIXME: insert proper C++ library support
6538 _LT_TAGVAR(ld_shlibs, $1)=no
6539 ;;
6540
6541 m88k*)
6542 # FIXME: insert proper C++ library support
6543 _LT_TAGVAR(ld_shlibs, $1)=no
6544 ;;
6545
6546 mvs*)
6547 case $cc_basename in
6548 cxx*)
6549 # FIXME: insert proper C++ library support
6550 _LT_TAGVAR(ld_shlibs, $1)=no
6551 ;;
6552 *)
6553 # FIXME: insert proper C++ library support
6554 _LT_TAGVAR(ld_shlibs, $1)=no
6555 ;;
6556 esac
6557 ;;
6558
6559 netbsd*)
6560 if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then
6561 _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $predep_objects $libobjs $deplibs $postdep_objects $linker_flags'
6562 wlarc=
6563 _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir'
6564 _LT_TAGVAR(hardcode_direct, $1)=yes
6565 _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
6566 fi
6567 # Workaround some broken pre-1.5 toolchains
6568 output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP conftest.$objext | $SED -e "s:-lgcc -lc -lgcc::"'
6569 ;;
6570
6571 *nto* | *qnx*)
6572 _LT_TAGVAR(ld_shlibs, $1)=yes
6573 ;;
6574
6575 openbsd2*)
6576 # C++ shared libraries are fairly broken
6577 _LT_TAGVAR(ld_shlibs, $1)=no
6578 ;;
6579
6580 openbsd*)
6581 if test -f /usr/libexec/ld.so; then
6582 _LT_TAGVAR(hardcode_direct, $1)=yes
6583 _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
6584 _LT_TAGVAR(hardcode_direct_absolute, $1)=yes
6585 _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $lib'
6586 _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir'
6587 if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then
6588 _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-retain-symbols-file,$export_symbols -o $lib'
6589 _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E'
6590 _LT_TAGVAR(whole_archive_flag_spec, $1)="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive'
6591 fi
6592 output_verbose_link_cmd=func_echo_all
6593 else
6594 _LT_TAGVAR(ld_shlibs, $1)=no
6595 fi
6596 ;;
6597
6598 osf3* | osf4* | osf5*)
6599 case $cc_basename in
6600 KCC*)
6601 # Kuck and Associates, Inc. (KAI) C++ Compiler
6602
6603 # KCC will only create a shared library if the output file
6604 # ends with ".so" (or ".sl" for HP-UX), so rename the library
6605 # to its proper name (with version) after linking.
6606 _LT_TAGVAR(archive_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo "$lib" | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib'
6607
6608 _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir'
6609 _LT_TAGVAR(hardcode_libdir_separator, $1)=:
6610
6611 # Archives containing C++ object files must be created using
6612 # the KAI C++ compiler.
6613 case $host in
6614 osf3*) _LT_TAGVAR(old_archive_cmds, $1)='$CC -Bstatic -o $oldlib $oldobjs' ;;
6615 *) _LT_TAGVAR(old_archive_cmds, $1)='$CC -o $oldlib $oldobjs' ;;
6616 esac
6617 ;;
6618 RCC*)
6619 # Rational C++ 2.4.1
6620 # FIXME: insert proper C++ library support
6621 _LT_TAGVAR(ld_shlibs, $1)=no
6622 ;;
6623 cxx*)
6624 case $host in
6625 osf3*)
6626 _LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*'
6627 _LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $soname `test -n "$verstring" && func_echo_all "${wl}-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib'
6628 _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
6629 ;;
6630 *)
6631 _LT_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*'
6632 _LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib'
6633 _LT_TAGVAR(archive_expsym_cmds, $1)='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done~
6634 echo "-hidden">> $lib.exp~
6635 $CC -shared$allow_undefined_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname ${wl}-input ${wl}$lib.exp `test -n "$verstring" && $ECHO "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib~
6636 $RM $lib.exp'
6637 _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir'
6638 ;;
6639 esac
6640
6641 _LT_TAGVAR(hardcode_libdir_separator, $1)=:
6642
6643 # Commands to make compiler produce verbose output that lists
6644 # what "hidden" libraries, object files and flags are used when
6645 # linking a shared library.
6646 #
6647 # There doesn't appear to be a way to prevent this compiler from
6648 # explicitly linking system object files so we need to strip them
6649 # from the output so that they don't get included in the library
6650 # dependencies.
6651 output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP "ld" | $GREP -v "ld:"`; templist=`func_echo_all "$templist" | $SED "s/\(^.*ld.*\)\( .*ld.*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"'
6652 ;;
6653 *)
6654 if test "$GXX" = yes && test "$with_gnu_ld" = no; then
6655 _LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*'
6656 case $host in
6657 osf3*)
6658 _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
6659 ;;
6660 *)
6661 _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
6662 ;;
6663 esac
6664
6665 _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
6666 _LT_TAGVAR(hardcode_libdir_separator, $1)=:
6667
6668 # Commands to make compiler produce verbose output that lists
6669 # what "hidden" libraries, object files and flags are used when
6670 # linking a shared library.
6671 output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP "\-L"'
6672
6673 else
6674 # FIXME: insert proper C++ library support
6675 _LT_TAGVAR(ld_shlibs, $1)=no
6676 fi
6677 ;;
6678 esac
6679 ;;
6680
6681 psos*)
6682 # FIXME: insert proper C++ library support
6683 _LT_TAGVAR(ld_shlibs, $1)=no
6684 ;;
6685
6686 sunos4*)
6687 case $cc_basename in
6688 CC*)
6689 # Sun C++ 4.x
6690 # FIXME: insert proper C++ library support
6691 _LT_TAGVAR(ld_shlibs, $1)=no
6692 ;;
6693 lcc*)
6694 # Lucid
6695 # FIXME: insert proper C++ library support
6696 _LT_TAGVAR(ld_shlibs, $1)=no
6697 ;;
6698 *)
6699 # FIXME: insert proper C++ library support
6700 _LT_TAGVAR(ld_shlibs, $1)=no
6701 ;;
6702 esac
6703 ;;
6704
6705 solaris*)
6706 case $cc_basename in
6707 CC* | sunCC*)
6708 # Sun C++ 4.2, 5.x and Centerline C++
6709 _LT_TAGVAR(archive_cmds_need_lc,$1)=yes
6710 _LT_TAGVAR(no_undefined_flag, $1)=' -zdefs'
6711 _LT_TAGVAR(archive_cmds, $1)='$CC -G${allow_undefined_flag} -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
6712 _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~
6713 $CC -G${allow_undefined_flag} ${wl}-M ${wl}$lib.exp -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$RM $lib.exp'
6714
6715 _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir'
6716 _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
6717 case $host_os in
6718 solaris2.[[0-5]] | solaris2.[[0-5]].*) ;;
6719 *)
6720 # The compiler driver will combine and reorder linker options,
6721 # but understands `-z linker_flag'.
6722 # Supported since Solaris 2.6 (maybe 2.5.1?)
6723 _LT_TAGVAR(whole_archive_flag_spec, $1)='-z allextract$convenience -z defaultextract'
6724 ;;
6725 esac
6726 _LT_TAGVAR(link_all_deplibs, $1)=yes
6727
6728 output_verbose_link_cmd='func_echo_all'
6729
6730 # Archives containing C++ object files must be created using
6731 # "CC -xar", where "CC" is the Sun C++ compiler. This is
6732 # necessary to make sure instantiated templates are included
6733 # in the archive.
6734 _LT_TAGVAR(old_archive_cmds, $1)='$CC -xar -o $oldlib $oldobjs'
6735 ;;
6736 gcx*)
6737 # Green Hills C++ Compiler
6738 _LT_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib'
6739
6740 # The C++ compiler must be used to create the archive.
6741 _LT_TAGVAR(old_archive_cmds, $1)='$CC $LDFLAGS -archive -o $oldlib $oldobjs'
6742 ;;
6743 *)
6744 # GNU C++ compiler with Solaris linker
6745 if test "$GXX" = yes && test "$with_gnu_ld" = no; then
6746 _LT_TAGVAR(no_undefined_flag, $1)=' ${wl}-z ${wl}defs'
6747 if $CC --version | $GREP -v '^2\.7' > /dev/null; then
6748 _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -nostdlib $LDFLAGS $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib'
6749 _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~
6750 $CC -shared $pic_flag -nostdlib ${wl}-M $wl$lib.exp -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$RM $lib.exp'
6751
6752 # Commands to make compiler produce verbose output that lists
6753 # what "hidden" libraries, object files and flags are used when
6754 # linking a shared library.
6755 output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP "\-L"'
6756 else
6757 # g++ 2.7 appears to require `-G' NOT `-shared' on this
6758 # platform.
6759 _LT_TAGVAR(archive_cmds, $1)='$CC -G -nostdlib $LDFLAGS $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib'
6760 _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~
6761 $CC -G -nostdlib ${wl}-M $wl$lib.exp -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$RM $lib.exp'
6762
6763 # Commands to make compiler produce verbose output that lists
6764 # what "hidden" libraries, object files and flags are used when
6765 # linking a shared library.
6766 output_verbose_link_cmd='$CC -G $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP "\-L"'
6767 fi
6768
6769 _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R $wl$libdir'
6770 case $host_os in
6771 solaris2.[[0-5]] | solaris2.[[0-5]].*) ;;
6772 *)
6773 _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract'
6774 ;;
6775 esac
6776 fi
6777 ;;
6778 esac
6779 ;;
6780
6781 sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[[01]].[[10]]* | unixware7* | sco3.2v5.0.[[024]]*)
6782 _LT_TAGVAR(no_undefined_flag, $1)='${wl}-z,text'
6783 _LT_TAGVAR(archive_cmds_need_lc, $1)=no
6784 _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
6785 runpath_var='LD_RUN_PATH'
6786
6787 case $cc_basename in
6788 CC*)
6789 _LT_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
6790 _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
6791 ;;
6792 *)
6793 _LT_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
6794 _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
6795 ;;
6796 esac
6797 ;;
6798
6799 sysv5* | sco3.2v5* | sco5v6*)
6800 # Note: We can NOT use -z defs as we might desire, because we do not
6801 # link with -lc, and that would cause any symbols used from libc to
6802 # always be unresolved, which means just about no library would
6803 # ever link correctly. If we're not using GNU ld we use -z text
6804 # though, which does catch some bad symbols but isn't as heavy-handed
6805 # as -z defs.
6806 _LT_TAGVAR(no_undefined_flag, $1)='${wl}-z,text'
6807 _LT_TAGVAR(allow_undefined_flag, $1)='${wl}-z,nodefs'
6808 _LT_TAGVAR(archive_cmds_need_lc, $1)=no
6809 _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
6810 _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R,$libdir'
6811 _LT_TAGVAR(hardcode_libdir_separator, $1)=':'
6812 _LT_TAGVAR(link_all_deplibs, $1)=yes
6813 _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-Bexport'
6814 runpath_var='LD_RUN_PATH'
6815
6816 case $cc_basename in
6817 CC*)
6818 _LT_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
6819 _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
6820 _LT_TAGVAR(old_archive_cmds, $1)='$CC -Tprelink_objects $oldobjs~
6821 '"$_LT_TAGVAR(old_archive_cmds, $1)"
6822 _LT_TAGVAR(reload_cmds, $1)='$CC -Tprelink_objects $reload_objs~
6823 '"$_LT_TAGVAR(reload_cmds, $1)"
6824 ;;
6825 *)
6826 _LT_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
6827 _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
6828 ;;
6829 esac
6830 ;;
6831
6832 tandem*)
6833 case $cc_basename in
6834 NCC*)
6835 # NonStop-UX NCC 3.20
6836 # FIXME: insert proper C++ library support
6837 _LT_TAGVAR(ld_shlibs, $1)=no
6838 ;;
6839 *)
6840 # FIXME: insert proper C++ library support
6841 _LT_TAGVAR(ld_shlibs, $1)=no
6842 ;;
6843 esac
6844 ;;
6845
6846 vxworks*)
6847 # FIXME: insert proper C++ library support
6848 _LT_TAGVAR(ld_shlibs, $1)=no
6849 ;;
6850
6851 *)
6852 # FIXME: insert proper C++ library support
6853 _LT_TAGVAR(ld_shlibs, $1)=no
6854 ;;
6855 esac
6856
6857 AC_MSG_RESULT([$_LT_TAGVAR(ld_shlibs, $1)])
6858 test "$_LT_TAGVAR(ld_shlibs, $1)" = no && can_build_shared=no
6859
6860 _LT_TAGVAR(GCC, $1)="$GXX"
6861 _LT_TAGVAR(LD, $1)="$LD"
6862
6863 ## CAVEAT EMPTOR:
6864 ## There is no encapsulation within the following macros, do not change
6865 ## the running order or otherwise move them around unless you know exactly
6866 ## what you are doing...
6867 _LT_SYS_HIDDEN_LIBDEPS($1)
6868 _LT_COMPILER_PIC($1)
6869 _LT_COMPILER_C_O($1)
6870 _LT_COMPILER_FILE_LOCKS($1)
6871 _LT_LINKER_SHLIBS($1)
6872 _LT_SYS_DYNAMIC_LINKER($1)
6873 _LT_LINKER_HARDCODE_LIBPATH($1)
6874
6875 _LT_CONFIG($1)
6876 fi # test -n "$compiler"
6877
6878 CC=$lt_save_CC
6879 CFLAGS=$lt_save_CFLAGS
6880 LDCXX=$LD
6881 LD=$lt_save_LD
6882 GCC=$lt_save_GCC
6883 with_gnu_ld=$lt_save_with_gnu_ld
6884 lt_cv_path_LDCXX=$lt_cv_path_LD
6885 lt_cv_path_LD=$lt_save_path_LD
6886 lt_cv_prog_gnu_ldcxx=$lt_cv_prog_gnu_ld
6887 lt_cv_prog_gnu_ld=$lt_save_with_gnu_ld
6888 fi # test "$_lt_caught_CXX_error" != yes
6889
6890 AC_LANG_POP
6891 ])# _LT_LANG_CXX_CONFIG
6892
6893
6894 # _LT_FUNC_STRIPNAME_CNF
6895 # ----------------------
6896 # func_stripname_cnf prefix suffix name
6897 # strip PREFIX and SUFFIX off of NAME.
6898 # PREFIX and SUFFIX must not contain globbing or regex special
6899 # characters, hashes, percent signs, but SUFFIX may contain a leading
6900 # dot (in which case that matches only a dot).
6901 #
6902 # This function is identical to the (non-XSI) version of func_stripname,
6903 # except this one can be used by m4 code that may be executed by configure,
6904 # rather than the libtool script.
6905 m4_defun([_LT_FUNC_STRIPNAME_CNF],[dnl
6906 AC_REQUIRE([_LT_DECL_SED])
6907 AC_REQUIRE([_LT_PROG_ECHO_BACKSLASH])
6908 func_stripname_cnf ()
6909 {
6910 case ${2} in
6911 .*) func_stripname_result=`$ECHO "${3}" | $SED "s%^${1}%%; s%\\\\${2}\$%%"`;;
6912 *) func_stripname_result=`$ECHO "${3}" | $SED "s%^${1}%%; s%${2}\$%%"`;;
6913 esac
6914 } # func_stripname_cnf
6915 ])# _LT_FUNC_STRIPNAME_CNF
6916
6917 # _LT_SYS_HIDDEN_LIBDEPS([TAGNAME])
6918 # ---------------------------------
6919 # Figure out "hidden" library dependencies from verbose
6920 # compiler output when linking a shared library.
6921 # Parse the compiler output and extract the necessary
6922 # objects, libraries and library flags.
6923 m4_defun([_LT_SYS_HIDDEN_LIBDEPS],
6924 [m4_require([_LT_FILEUTILS_DEFAULTS])dnl
6925 AC_REQUIRE([_LT_FUNC_STRIPNAME_CNF])dnl
6926 # Dependencies to place before and after the object being linked:
6927 _LT_TAGVAR(predep_objects, $1)=
6928 _LT_TAGVAR(postdep_objects, $1)=
6929 _LT_TAGVAR(predeps, $1)=
6930 _LT_TAGVAR(postdeps, $1)=
6931 _LT_TAGVAR(compiler_lib_search_path, $1)=
6932
6933 dnl we can't use the lt_simple_compile_test_code here,
6934 dnl because it contains code intended for an executable,
6935 dnl not a library. It's possible we should let each
6936 dnl tag define a new lt_????_link_test_code variable,
6937 dnl but it's only used here...
6938 m4_if([$1], [], [cat > conftest.$ac_ext <<_LT_EOF
6939 int a;
6940 void foo (void) { a = 0; }
6941 _LT_EOF
6942 ], [$1], [CXX], [cat > conftest.$ac_ext <<_LT_EOF
6943 class Foo
6944 {
6945 public:
6946 Foo (void) { a = 0; }
6947 private:
6948 int a;
6949 };
6950 _LT_EOF
6951 ], [$1], [F77], [cat > conftest.$ac_ext <<_LT_EOF
6952 subroutine foo
6953 implicit none
6954 integer*4 a
6955 a=0
6956 return
6957 end
6958 _LT_EOF
6959 ], [$1], [FC], [cat > conftest.$ac_ext <<_LT_EOF
6960 subroutine foo
6961 implicit none
6962 integer a
6963 a=0
6964 return
6965 end
6966 _LT_EOF
6967 ], [$1], [GCJ], [cat > conftest.$ac_ext <<_LT_EOF
6968 public class foo {
6969 private int a;
6970 public void bar (void) {
6971 a = 0;
6972 }
6973 };
6974 _LT_EOF
6975 ], [$1], [GO], [cat > conftest.$ac_ext <<_LT_EOF
6976 package foo
6977 func foo() {
6978 }
6979 _LT_EOF
6980 ])
6981
6982 _lt_libdeps_save_CFLAGS=$CFLAGS
6983 case "$CC $CFLAGS " in #(
6984 *\ -flto*\ *) CFLAGS="$CFLAGS -fno-lto" ;;
6985 *\ -fwhopr*\ *) CFLAGS="$CFLAGS -fno-whopr" ;;
6986 *\ -fuse-linker-plugin*\ *) CFLAGS="$CFLAGS -fno-use-linker-plugin" ;;
6987 esac
6988
6989 dnl Parse the compiler output and extract the necessary
6990 dnl objects, libraries and library flags.
6991 if AC_TRY_EVAL(ac_compile); then
6992 # Parse the compiler output and extract the necessary
6993 # objects, libraries and library flags.
6994
6995 # Sentinel used to keep track of whether or not we are before
6996 # the conftest object file.
6997 pre_test_object_deps_done=no
6998
6999 for p in `eval "$output_verbose_link_cmd"`; do
7000 case ${prev}${p} in
7001
7002 -L* | -R* | -l*)
7003 # Some compilers place space between "-{L,R}" and the path.
7004 # Remove the space.
7005 if test $p = "-L" ||
7006 test $p = "-R"; then
7007 prev=$p
7008 continue
7009 fi
7010
7011 # Expand the sysroot to ease extracting the directories later.
7012 if test -z "$prev"; then
7013 case $p in
7014 -L*) func_stripname_cnf '-L' '' "$p"; prev=-L; p=$func_stripname_result ;;
7015 -R*) func_stripname_cnf '-R' '' "$p"; prev=-R; p=$func_stripname_result ;;
7016 -l*) func_stripname_cnf '-l' '' "$p"; prev=-l; p=$func_stripname_result ;;
7017 esac
7018 fi
7019 case $p in
7020 =*) func_stripname_cnf '=' '' "$p"; p=$lt_sysroot$func_stripname_result ;;
7021 esac
7022 if test "$pre_test_object_deps_done" = no; then
7023 case ${prev} in
7024 -L | -R)
7025 # Internal compiler library paths should come after those
7026 # provided the user. The postdeps already come after the
7027 # user supplied libs so there is no need to process them.
7028 if test -z "$_LT_TAGVAR(compiler_lib_search_path, $1)"; then
7029 _LT_TAGVAR(compiler_lib_search_path, $1)="${prev}${p}"
7030 else
7031 _LT_TAGVAR(compiler_lib_search_path, $1)="${_LT_TAGVAR(compiler_lib_search_path, $1)} ${prev}${p}"
7032 fi
7033 ;;
7034 # The "-l" case would never come before the object being
7035 # linked, so don't bother handling this case.
7036 esac
7037 else
7038 if test -z "$_LT_TAGVAR(postdeps, $1)"; then
7039 _LT_TAGVAR(postdeps, $1)="${prev}${p}"
7040 else
7041 _LT_TAGVAR(postdeps, $1)="${_LT_TAGVAR(postdeps, $1)} ${prev}${p}"
7042 fi
7043 fi
7044 prev=
7045 ;;
7046
7047 *.lto.$objext) ;; # Ignore GCC LTO objects
7048 *.$objext)
7049 # This assumes that the test object file only shows up
7050 # once in the compiler output.
7051 if test "$p" = "conftest.$objext"; then
7052 pre_test_object_deps_done=yes
7053 continue
7054 fi
7055
7056 if test "$pre_test_object_deps_done" = no; then
7057 if test -z "$_LT_TAGVAR(predep_objects, $1)"; then
7058 _LT_TAGVAR(predep_objects, $1)="$p"
7059 else
7060 _LT_TAGVAR(predep_objects, $1)="$_LT_TAGVAR(predep_objects, $1) $p"
7061 fi
7062 else
7063 if test -z "$_LT_TAGVAR(postdep_objects, $1)"; then
7064 _LT_TAGVAR(postdep_objects, $1)="$p"
7065 else
7066 _LT_TAGVAR(postdep_objects, $1)="$_LT_TAGVAR(postdep_objects, $1) $p"
7067 fi
7068 fi
7069 ;;
7070
7071 *) ;; # Ignore the rest.
7072
7073 esac
7074 done
7075
7076 # Clean up.
7077 rm -f a.out a.exe
7078 else
7079 echo "libtool.m4: error: problem compiling $1 test program"
7080 fi
7081
7082 $RM -f confest.$objext
7083 CFLAGS=$_lt_libdeps_save_CFLAGS
7084
7085 # PORTME: override above test on systems where it is broken
7086 m4_if([$1], [CXX],
7087 [case $host_os in
7088 interix[[3-9]]*)
7089 # Interix 3.5 installs completely hosed .la files for C++, so rather than
7090 # hack all around it, let's just trust "g++" to DTRT.
7091 _LT_TAGVAR(predep_objects,$1)=
7092 _LT_TAGVAR(postdep_objects,$1)=
7093 _LT_TAGVAR(postdeps,$1)=
7094 ;;
7095
7096 linux*)
7097 case `$CC -V 2>&1 | sed 5q` in
7098 *Sun\ C*)
7099 # Sun C++ 5.9
7100
7101 # The more standards-conforming stlport4 library is
7102 # incompatible with the Cstd library. Avoid specifying
7103 # it if it's in CXXFLAGS. Ignore libCrun as
7104 # -library=stlport4 depends on it.
7105 case " $CXX $CXXFLAGS " in
7106 *" -library=stlport4 "*)
7107 solaris_use_stlport4=yes
7108 ;;
7109 esac
7110
7111 if test "$solaris_use_stlport4" != yes; then
7112 _LT_TAGVAR(postdeps,$1)='-library=Cstd -library=Crun'
7113 fi
7114 ;;
7115 esac
7116 ;;
7117
7118 solaris*)
7119 case $cc_basename in
7120 CC* | sunCC*)
7121 # The more standards-conforming stlport4 library is
7122 # incompatible with the Cstd library. Avoid specifying
7123 # it if it's in CXXFLAGS. Ignore libCrun as
7124 # -library=stlport4 depends on it.
7125 case " $CXX $CXXFLAGS " in
7126 *" -library=stlport4 "*)
7127 solaris_use_stlport4=yes
7128 ;;
7129 esac
7130
7131 # Adding this requires a known-good setup of shared libraries for
7132 # Sun compiler versions before 5.6, else PIC objects from an old
7133 # archive will be linked into the output, leading to subtle bugs.
7134 if test "$solaris_use_stlport4" != yes; then
7135 _LT_TAGVAR(postdeps,$1)='-library=Cstd -library=Crun'
7136 fi
7137 ;;
7138 esac
7139 ;;
7140 esac
7141 ])
7142
7143 case " $_LT_TAGVAR(postdeps, $1) " in
7144 *" -lc "*) _LT_TAGVAR(archive_cmds_need_lc, $1)=no ;;
7145 esac
7146 _LT_TAGVAR(compiler_lib_search_dirs, $1)=
7147 if test -n "${_LT_TAGVAR(compiler_lib_search_path, $1)}"; then
7148 _LT_TAGVAR(compiler_lib_search_dirs, $1)=`echo " ${_LT_TAGVAR(compiler_lib_search_path, $1)}" | ${SED} -e 's! -L! !g' -e 's!^ !!'`
7149 fi
7150 _LT_TAGDECL([], [compiler_lib_search_dirs], [1],
7151 [The directories searched by this compiler when creating a shared library])
7152 _LT_TAGDECL([], [predep_objects], [1],
7153 [Dependencies to place before and after the objects being linked to
7154 create a shared library])
7155 _LT_TAGDECL([], [postdep_objects], [1])
7156 _LT_TAGDECL([], [predeps], [1])
7157 _LT_TAGDECL([], [postdeps], [1])
7158 _LT_TAGDECL([], [compiler_lib_search_path], [1],
7159 [The library search path used internally by the compiler when linking
7160 a shared library])
7161 ])# _LT_SYS_HIDDEN_LIBDEPS
7162
7163
7164 # _LT_LANG_F77_CONFIG([TAG])
7165 # --------------------------
7166 # Ensure that the configuration variables for a Fortran 77 compiler are
7167 # suitably defined. These variables are subsequently used by _LT_CONFIG
7168 # to write the compiler configuration to `libtool'.
7169 m4_defun([_LT_LANG_F77_CONFIG],
7170 [AC_LANG_PUSH(Fortran 77)
7171 if test -z "$F77" || test "X$F77" = "Xno"; then
7172 _lt_disable_F77=yes
7173 fi
7174
7175 _LT_TAGVAR(archive_cmds_need_lc, $1)=no
7176 _LT_TAGVAR(allow_undefined_flag, $1)=
7177 _LT_TAGVAR(always_export_symbols, $1)=no
7178 _LT_TAGVAR(archive_expsym_cmds, $1)=
7179 _LT_TAGVAR(export_dynamic_flag_spec, $1)=
7180 _LT_TAGVAR(hardcode_direct, $1)=no
7181 _LT_TAGVAR(hardcode_direct_absolute, $1)=no
7182 _LT_TAGVAR(hardcode_libdir_flag_spec, $1)=
7183 _LT_TAGVAR(hardcode_libdir_separator, $1)=
7184 _LT_TAGVAR(hardcode_minus_L, $1)=no
7185 _LT_TAGVAR(hardcode_automatic, $1)=no
7186 _LT_TAGVAR(inherit_rpath, $1)=no
7187 _LT_TAGVAR(module_cmds, $1)=
7188 _LT_TAGVAR(module_expsym_cmds, $1)=
7189 _LT_TAGVAR(link_all_deplibs, $1)=unknown
7190 _LT_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds
7191 _LT_TAGVAR(reload_flag, $1)=$reload_flag
7192 _LT_TAGVAR(reload_cmds, $1)=$reload_cmds
7193 _LT_TAGVAR(no_undefined_flag, $1)=
7194 _LT_TAGVAR(whole_archive_flag_spec, $1)=
7195 _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=no
7196
7197 # Source file extension for f77 test sources.
7198 ac_ext=f
7199
7200 # Object file extension for compiled f77 test sources.
7201 objext=o
7202 _LT_TAGVAR(objext, $1)=$objext
7203
7204 # No sense in running all these tests if we already determined that
7205 # the F77 compiler isn't working. Some variables (like enable_shared)
7206 # are currently assumed to apply to all compilers on this platform,
7207 # and will be corrupted by setting them based on a non-working compiler.
7208 if test "$_lt_disable_F77" != yes; then
7209 # Code to be used in simple compile tests
7210 lt_simple_compile_test_code="\
7211 subroutine t
7212 return
7213 end
7214 "
7215
7216 # Code to be used in simple link tests
7217 lt_simple_link_test_code="\
7218 program t
7219 end
7220 "
7221
7222 # ltmain only uses $CC for tagged configurations so make sure $CC is set.
7223 _LT_TAG_COMPILER
7224
7225 # save warnings/boilerplate of simple test code
7226 _LT_COMPILER_BOILERPLATE
7227 _LT_LINKER_BOILERPLATE
7228
7229 # Allow CC to be a program name with arguments.
7230 lt_save_CC="$CC"
7231 lt_save_GCC=$GCC
7232 lt_save_CFLAGS=$CFLAGS
7233 CC=${F77-"f77"}
7234 CFLAGS=$FFLAGS
7235 compiler=$CC
7236 _LT_TAGVAR(compiler, $1)=$CC
7237 _LT_CC_BASENAME([$compiler])
7238 GCC=$G77
7239 if test -n "$compiler"; then
7240 AC_MSG_CHECKING([if libtool supports shared libraries])
7241 AC_MSG_RESULT([$can_build_shared])
7242
7243 AC_MSG_CHECKING([whether to build shared libraries])
7244 test "$can_build_shared" = "no" && enable_shared=no
7245
7246 # On AIX, shared libraries and static libraries use the same namespace, and
7247 # are all built from PIC.
7248 case $host_os in
7249 aix3*)
7250 test "$enable_shared" = yes && enable_static=no
7251 if test -n "$RANLIB"; then
7252 archive_cmds="$archive_cmds~\$RANLIB \$lib"
7253 postinstall_cmds='$RANLIB $lib'
7254 fi
7255 ;;
7256 aix[[4-9]]*)
7257 if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then
7258 test "$enable_shared" = yes && enable_static=no
7259 fi
7260 ;;
7261 esac
7262 AC_MSG_RESULT([$enable_shared])
7263
7264 AC_MSG_CHECKING([whether to build static libraries])
7265 # Make sure either enable_shared or enable_static is yes.
7266 test "$enable_shared" = yes || enable_static=yes
7267 AC_MSG_RESULT([$enable_static])
7268
7269 _LT_TAGVAR(GCC, $1)="$G77"
7270 _LT_TAGVAR(LD, $1)="$LD"
7271
7272 ## CAVEAT EMPTOR:
7273 ## There is no encapsulation within the following macros, do not change
7274 ## the running order or otherwise move them around unless you know exactly
7275 ## what you are doing...
7276 _LT_COMPILER_PIC($1)
7277 _LT_COMPILER_C_O($1)
7278 _LT_COMPILER_FILE_LOCKS($1)
7279 _LT_LINKER_SHLIBS($1)
7280 _LT_SYS_DYNAMIC_LINKER($1)
7281 _LT_LINKER_HARDCODE_LIBPATH($1)
7282
7283 _LT_CONFIG($1)
7284 fi # test -n "$compiler"
7285
7286 GCC=$lt_save_GCC
7287 CC="$lt_save_CC"
7288 CFLAGS="$lt_save_CFLAGS"
7289 fi # test "$_lt_disable_F77" != yes
7290
7291 AC_LANG_POP
7292 ])# _LT_LANG_F77_CONFIG
7293
7294
7295 # _LT_LANG_FC_CONFIG([TAG])
7296 # -------------------------
7297 # Ensure that the configuration variables for a Fortran compiler are
7298 # suitably defined. These variables are subsequently used by _LT_CONFIG
7299 # to write the compiler configuration to `libtool'.
7300 m4_defun([_LT_LANG_FC_CONFIG],
7301 [AC_LANG_PUSH(Fortran)
7302
7303 if test -z "$FC" || test "X$FC" = "Xno"; then
7304 _lt_disable_FC=yes
7305 fi
7306
7307 _LT_TAGVAR(archive_cmds_need_lc, $1)=no
7308 _LT_TAGVAR(allow_undefined_flag, $1)=
7309 _LT_TAGVAR(always_export_symbols, $1)=no
7310 _LT_TAGVAR(archive_expsym_cmds, $1)=
7311 _LT_TAGVAR(export_dynamic_flag_spec, $1)=
7312 _LT_TAGVAR(hardcode_direct, $1)=no
7313 _LT_TAGVAR(hardcode_direct_absolute, $1)=no
7314 _LT_TAGVAR(hardcode_libdir_flag_spec, $1)=
7315 _LT_TAGVAR(hardcode_libdir_separator, $1)=
7316 _LT_TAGVAR(hardcode_minus_L, $1)=no
7317 _LT_TAGVAR(hardcode_automatic, $1)=no
7318 _LT_TAGVAR(inherit_rpath, $1)=no
7319 _LT_TAGVAR(module_cmds, $1)=
7320 _LT_TAGVAR(module_expsym_cmds, $1)=
7321 _LT_TAGVAR(link_all_deplibs, $1)=unknown
7322 _LT_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds
7323 _LT_TAGVAR(reload_flag, $1)=$reload_flag
7324 _LT_TAGVAR(reload_cmds, $1)=$reload_cmds
7325 _LT_TAGVAR(no_undefined_flag, $1)=
7326 _LT_TAGVAR(whole_archive_flag_spec, $1)=
7327 _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=no
7328
7329 # Source file extension for fc test sources.
7330 ac_ext=${ac_fc_srcext-f}
7331
7332 # Object file extension for compiled fc test sources.
7333 objext=o
7334 _LT_TAGVAR(objext, $1)=$objext
7335
7336 # No sense in running all these tests if we already determined that
7337 # the FC compiler isn't working. Some variables (like enable_shared)
7338 # are currently assumed to apply to all compilers on this platform,
7339 # and will be corrupted by setting them based on a non-working compiler.
7340 if test "$_lt_disable_FC" != yes; then
7341 # Code to be used in simple compile tests
7342 lt_simple_compile_test_code="\
7343 subroutine t
7344 return
7345 end
7346 "
7347
7348 # Code to be used in simple link tests
7349 lt_simple_link_test_code="\
7350 program t
7351 end
7352 "
7353
7354 # ltmain only uses $CC for tagged configurations so make sure $CC is set.
7355 _LT_TAG_COMPILER
7356
7357 # save warnings/boilerplate of simple test code
7358 _LT_COMPILER_BOILERPLATE
7359 _LT_LINKER_BOILERPLATE
7360
7361 # Allow CC to be a program name with arguments.
7362 lt_save_CC="$CC"
7363 lt_save_GCC=$GCC
7364 lt_save_CFLAGS=$CFLAGS
7365 CC=${FC-"f95"}
7366 CFLAGS=$FCFLAGS
7367 compiler=$CC
7368 GCC=$ac_cv_fc_compiler_gnu
7369
7370 _LT_TAGVAR(compiler, $1)=$CC
7371 _LT_CC_BASENAME([$compiler])
7372
7373 if test -n "$compiler"; then
7374 AC_MSG_CHECKING([if libtool supports shared libraries])
7375 AC_MSG_RESULT([$can_build_shared])
7376
7377 AC_MSG_CHECKING([whether to build shared libraries])
7378 test "$can_build_shared" = "no" && enable_shared=no
7379
7380 # On AIX, shared libraries and static libraries use the same namespace, and
7381 # are all built from PIC.
7382 case $host_os in
7383 aix3*)
7384 test "$enable_shared" = yes && enable_static=no
7385 if test -n "$RANLIB"; then
7386 archive_cmds="$archive_cmds~\$RANLIB \$lib"
7387 postinstall_cmds='$RANLIB $lib'
7388 fi
7389 ;;
7390 aix[[4-9]]*)
7391 if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then
7392 test "$enable_shared" = yes && enable_static=no
7393 fi
7394 ;;
7395 esac
7396 AC_MSG_RESULT([$enable_shared])
7397
7398 AC_MSG_CHECKING([whether to build static libraries])
7399 # Make sure either enable_shared or enable_static is yes.
7400 test "$enable_shared" = yes || enable_static=yes
7401 AC_MSG_RESULT([$enable_static])
7402
7403 _LT_TAGVAR(GCC, $1)="$ac_cv_fc_compiler_gnu"
7404 _LT_TAGVAR(LD, $1)="$LD"
7405
7406 ## CAVEAT EMPTOR:
7407 ## There is no encapsulation within the following macros, do not change
7408 ## the running order or otherwise move them around unless you know exactly
7409 ## what you are doing...
7410 _LT_SYS_HIDDEN_LIBDEPS($1)
7411 _LT_COMPILER_PIC($1)
7412 _LT_COMPILER_C_O($1)
7413 _LT_COMPILER_FILE_LOCKS($1)
7414 _LT_LINKER_SHLIBS($1)
7415 _LT_SYS_DYNAMIC_LINKER($1)
7416 _LT_LINKER_HARDCODE_LIBPATH($1)
7417
7418 _LT_CONFIG($1)
7419 fi # test -n "$compiler"
7420
7421 GCC=$lt_save_GCC
7422 CC=$lt_save_CC
7423 CFLAGS=$lt_save_CFLAGS
7424 fi # test "$_lt_disable_FC" != yes
7425
7426 AC_LANG_POP
7427 ])# _LT_LANG_FC_CONFIG
7428
7429
7430 # _LT_LANG_GCJ_CONFIG([TAG])
7431 # --------------------------
7432 # Ensure that the configuration variables for the GNU Java Compiler compiler
7433 # are suitably defined. These variables are subsequently used by _LT_CONFIG
7434 # to write the compiler configuration to `libtool'.
7435 m4_defun([_LT_LANG_GCJ_CONFIG],
7436 [AC_REQUIRE([LT_PROG_GCJ])dnl
7437 AC_LANG_SAVE
7438
7439 # Source file extension for Java test sources.
7440 ac_ext=java
7441
7442 # Object file extension for compiled Java test sources.
7443 objext=o
7444 _LT_TAGVAR(objext, $1)=$objext
7445
7446 # Code to be used in simple compile tests
7447 lt_simple_compile_test_code="class foo {}"
7448
7449 # Code to be used in simple link tests
7450 lt_simple_link_test_code='public class conftest { public static void main(String[[]] argv) {}; }'
7451
7452 # ltmain only uses $CC for tagged configurations so make sure $CC is set.
7453 _LT_TAG_COMPILER
7454
7455 # save warnings/boilerplate of simple test code
7456 _LT_COMPILER_BOILERPLATE
7457 _LT_LINKER_BOILERPLATE
7458
7459 # Allow CC to be a program name with arguments.
7460 lt_save_CC=$CC
7461 lt_save_CFLAGS=$CFLAGS
7462 lt_save_GCC=$GCC
7463 GCC=yes
7464 CC=${GCJ-"gcj"}
7465 CFLAGS=$GCJFLAGS
7466 compiler=$CC
7467 _LT_TAGVAR(compiler, $1)=$CC
7468 _LT_TAGVAR(LD, $1)="$LD"
7469 _LT_CC_BASENAME([$compiler])
7470
7471 # GCJ did not exist at the time GCC didn't implicitly link libc in.
7472 _LT_TAGVAR(archive_cmds_need_lc, $1)=no
7473
7474 _LT_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds
7475 _LT_TAGVAR(reload_flag, $1)=$reload_flag
7476 _LT_TAGVAR(reload_cmds, $1)=$reload_cmds
7477
7478 ## CAVEAT EMPTOR:
7479 ## There is no encapsulation within the following macros, do not change
7480 ## the running order or otherwise move them around unless you know exactly
7481 ## what you are doing...
7482 if test -n "$compiler"; then
7483 _LT_COMPILER_NO_RTTI($1)
7484 _LT_COMPILER_PIC($1)
7485 _LT_COMPILER_C_O($1)
7486 _LT_COMPILER_FILE_LOCKS($1)
7487 _LT_LINKER_SHLIBS($1)
7488 _LT_LINKER_HARDCODE_LIBPATH($1)
7489
7490 _LT_CONFIG($1)
7491 fi
7492
7493 AC_LANG_RESTORE
7494
7495 GCC=$lt_save_GCC
7496 CC=$lt_save_CC
7497 CFLAGS=$lt_save_CFLAGS
7498 ])# _LT_LANG_GCJ_CONFIG
7499
7500
7501 # _LT_LANG_GO_CONFIG([TAG])
7502 # --------------------------
7503 # Ensure that the configuration variables for the GNU Go compiler
7504 # are suitably defined. These variables are subsequently used by _LT_CONFIG
7505 # to write the compiler configuration to `libtool'.
7506 m4_defun([_LT_LANG_GO_CONFIG],
7507 [AC_REQUIRE([LT_PROG_GO])dnl
7508 AC_LANG_SAVE
7509
7510 # Source file extension for Go test sources.
7511 ac_ext=go
7512
7513 # Object file extension for compiled Go test sources.
7514 objext=o
7515 _LT_TAGVAR(objext, $1)=$objext
7516
7517 # Code to be used in simple compile tests
7518 lt_simple_compile_test_code="package main; func main() { }"
7519
7520 # Code to be used in simple link tests
7521 lt_simple_link_test_code='package main; func main() { }'
7522
7523 # ltmain only uses $CC for tagged configurations so make sure $CC is set.
7524 _LT_TAG_COMPILER
7525
7526 # save warnings/boilerplate of simple test code
7527 _LT_COMPILER_BOILERPLATE
7528 _LT_LINKER_BOILERPLATE
7529
7530 # Allow CC to be a program name with arguments.
7531 lt_save_CC=$CC
7532 lt_save_CFLAGS=$CFLAGS
7533 lt_save_GCC=$GCC
7534 GCC=yes
7535 CC=${GOC-"gccgo"}
7536 CFLAGS=$GOFLAGS
7537 compiler=$CC
7538 _LT_TAGVAR(compiler, $1)=$CC
7539 _LT_TAGVAR(LD, $1)="$LD"
7540 _LT_CC_BASENAME([$compiler])
7541
7542 # Go did not exist at the time GCC didn't implicitly link libc in.
7543 _LT_TAGVAR(archive_cmds_need_lc, $1)=no
7544
7545 _LT_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds
7546 _LT_TAGVAR(reload_flag, $1)=$reload_flag
7547 _LT_TAGVAR(reload_cmds, $1)=$reload_cmds
7548
7549 ## CAVEAT EMPTOR:
7550 ## There is no encapsulation within the following macros, do not change
7551 ## the running order or otherwise move them around unless you know exactly
7552 ## what you are doing...
7553 if test -n "$compiler"; then
7554 _LT_COMPILER_NO_RTTI($1)
7555 _LT_COMPILER_PIC($1)
7556 _LT_COMPILER_C_O($1)
7557 _LT_COMPILER_FILE_LOCKS($1)
7558 _LT_LINKER_SHLIBS($1)
7559 _LT_LINKER_HARDCODE_LIBPATH($1)
7560
7561 _LT_CONFIG($1)
7562 fi
7563
7564 AC_LANG_RESTORE
7565
7566 GCC=$lt_save_GCC
7567 CC=$lt_save_CC
7568 CFLAGS=$lt_save_CFLAGS
7569 ])# _LT_LANG_GO_CONFIG
7570
7571
7572 # _LT_LANG_RC_CONFIG([TAG])
7573 # -------------------------
7574 # Ensure that the configuration variables for the Windows resource compiler
7575 # are suitably defined. These variables are subsequently used by _LT_CONFIG
7576 # to write the compiler configuration to `libtool'.
7577 m4_defun([_LT_LANG_RC_CONFIG],
7578 [AC_REQUIRE([LT_PROG_RC])dnl
7579 AC_LANG_SAVE
7580
7581 # Source file extension for RC test sources.
7582 ac_ext=rc
7583
7584 # Object file extension for compiled RC test sources.
7585 objext=o
7586 _LT_TAGVAR(objext, $1)=$objext
7587
7588 # Code to be used in simple compile tests
7589 lt_simple_compile_test_code='sample MENU { MENUITEM "&Soup", 100, CHECKED }'
7590
7591 # Code to be used in simple link tests
7592 lt_simple_link_test_code="$lt_simple_compile_test_code"
7593
7594 # ltmain only uses $CC for tagged configurations so make sure $CC is set.
7595 _LT_TAG_COMPILER
7596
7597 # save warnings/boilerplate of simple test code
7598 _LT_COMPILER_BOILERPLATE
7599 _LT_LINKER_BOILERPLATE
7600
7601 # Allow CC to be a program name with arguments.
7602 lt_save_CC="$CC"
7603 lt_save_CFLAGS=$CFLAGS
7604 lt_save_GCC=$GCC
7605 GCC=
7606 CC=${RC-"windres"}
7607 CFLAGS=
7608 compiler=$CC
7609 _LT_TAGVAR(compiler, $1)=$CC
7610 _LT_CC_BASENAME([$compiler])
7611 _LT_TAGVAR(lt_cv_prog_compiler_c_o, $1)=yes
7612
7613 if test -n "$compiler"; then
7614 :
7615 _LT_CONFIG($1)
7616 fi
7617
7618 GCC=$lt_save_GCC
7619 AC_LANG_RESTORE
7620 CC=$lt_save_CC
7621 CFLAGS=$lt_save_CFLAGS
7622 ])# _LT_LANG_RC_CONFIG
7623
7624
7625 # LT_PROG_GCJ
7626 # -----------
7627 AC_DEFUN([LT_PROG_GCJ],
7628 [m4_ifdef([AC_PROG_GCJ], [AC_PROG_GCJ],
7629 [m4_ifdef([A][M_PROG_GCJ], [A][M_PROG_GCJ],
7630 [AC_CHECK_TOOL(GCJ, gcj,)
7631 test "x${GCJFLAGS+set}" = xset || GCJFLAGS="-g -O2"
7632 AC_SUBST(GCJFLAGS)])])[]dnl
7633 ])
7634
7635 # Old name:
7636 AU_ALIAS([LT_AC_PROG_GCJ], [LT_PROG_GCJ])
7637 dnl aclocal-1.4 backwards compatibility:
7638 dnl AC_DEFUN([LT_AC_PROG_GCJ], [])
7639
7640
7641 # LT_PROG_GO
7642 # ----------
7643 AC_DEFUN([LT_PROG_GO],
7644 [AC_CHECK_TOOL(GOC, gccgo,)
7645 ])
7646
7647
7648 # LT_PROG_RC
7649 # ----------
7650 AC_DEFUN([LT_PROG_RC],
7651 [AC_CHECK_TOOL(RC, windres,)
7652 ])
7653
7654 # Old name:
7655 AU_ALIAS([LT_AC_PROG_RC], [LT_PROG_RC])
7656 dnl aclocal-1.4 backwards compatibility:
7657 dnl AC_DEFUN([LT_AC_PROG_RC], [])
7658
7659
7660 # _LT_DECL_EGREP
7661 # --------------
7662 # If we don't have a new enough Autoconf to choose the best grep
7663 # available, choose the one first in the user's PATH.
7664 m4_defun([_LT_DECL_EGREP],
7665 [AC_REQUIRE([AC_PROG_EGREP])dnl
7666 AC_REQUIRE([AC_PROG_FGREP])dnl
7667 test -z "$GREP" && GREP=grep
7668 _LT_DECL([], [GREP], [1], [A grep program that handles long lines])
7669 _LT_DECL([], [EGREP], [1], [An ERE matcher])
7670 _LT_DECL([], [FGREP], [1], [A literal string matcher])
7671 dnl Non-bleeding-edge autoconf doesn't subst GREP, so do it here too
7672 AC_SUBST([GREP])
7673 ])
7674
7675
7676 # _LT_DECL_OBJDUMP
7677 # --------------
7678 # If we don't have a new enough Autoconf to choose the best objdump
7679 # available, choose the one first in the user's PATH.
7680 m4_defun([_LT_DECL_OBJDUMP],
7681 [AC_CHECK_TOOL(OBJDUMP, objdump, false)
7682 test -z "$OBJDUMP" && OBJDUMP=objdump
7683 _LT_DECL([], [OBJDUMP], [1], [An object symbol dumper])
7684 AC_SUBST([OBJDUMP])
7685 ])
7686
7687 # _LT_DECL_DLLTOOL
7688 # ----------------
7689 # Ensure DLLTOOL variable is set.
7690 m4_defun([_LT_DECL_DLLTOOL],
7691 [AC_CHECK_TOOL(DLLTOOL, dlltool, false)
7692 test -z "$DLLTOOL" && DLLTOOL=dlltool
7693 _LT_DECL([], [DLLTOOL], [1], [DLL creation program])
7694 AC_SUBST([DLLTOOL])
7695 ])
7696
7697 # _LT_DECL_SED
7698 # ------------
7699 # Check for a fully-functional sed program, that truncates
7700 # as few characters as possible. Prefer GNU sed if found.
7701 m4_defun([_LT_DECL_SED],
7702 [AC_PROG_SED
7703 test -z "$SED" && SED=sed
7704 Xsed="$SED -e 1s/^X//"
7705 _LT_DECL([], [SED], [1], [A sed program that does not truncate output])
7706 _LT_DECL([], [Xsed], ["\$SED -e 1s/^X//"],
7707 [Sed that helps us avoid accidentally triggering echo(1) options like -n])
7708 ])# _LT_DECL_SED
7709
7710 m4_ifndef([AC_PROG_SED], [
7711 ############################################################
7712 # NOTE: This macro has been submitted for inclusion into #
7713 # GNU Autoconf as AC_PROG_SED. When it is available in #
7714 # a released version of Autoconf we should remove this #
7715 # macro and use it instead. #
7716 ############################################################
7717
7718 m4_defun([AC_PROG_SED],
7719 [AC_MSG_CHECKING([for a sed that does not truncate output])
7720 AC_CACHE_VAL(lt_cv_path_SED,
7721 [# Loop through the user's path and test for sed and gsed.
7722 # Then use that list of sed's as ones to test for truncation.
7723 as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
7724 for as_dir in $PATH
7725 do
7726 IFS=$as_save_IFS
7727 test -z "$as_dir" && as_dir=.
7728 for lt_ac_prog in sed gsed; do
7729 for ac_exec_ext in '' $ac_executable_extensions; do
7730 if $as_executable_p "$as_dir/$lt_ac_prog$ac_exec_ext"; then
7731 lt_ac_sed_list="$lt_ac_sed_list $as_dir/$lt_ac_prog$ac_exec_ext"
7732 fi
7733 done
7734 done
7735 done
7736 IFS=$as_save_IFS
7737 lt_ac_max=0
7738 lt_ac_count=0
7739 # Add /usr/xpg4/bin/sed as it is typically found on Solaris
7740 # along with /bin/sed that truncates output.
7741 for lt_ac_sed in $lt_ac_sed_list /usr/xpg4/bin/sed; do
7742 test ! -f $lt_ac_sed && continue
7743 cat /dev/null > conftest.in
7744 lt_ac_count=0
7745 echo $ECHO_N "0123456789$ECHO_C" >conftest.in
7746 # Check for GNU sed and select it if it is found.
7747 if "$lt_ac_sed" --version 2>&1 < /dev/null | grep 'GNU' > /dev/null; then
7748 lt_cv_path_SED=$lt_ac_sed
7749 break
7750 fi
7751 while true; do
7752 cat conftest.in conftest.in >conftest.tmp
7753 mv conftest.tmp conftest.in
7754 cp conftest.in conftest.nl
7755 echo >>conftest.nl
7756 $lt_ac_sed -e 's/a$//' < conftest.nl >conftest.out || break
7757 cmp -s conftest.out conftest.nl || break
7758 # 10000 chars as input seems more than enough
7759 test $lt_ac_count -gt 10 && break
7760 lt_ac_count=`expr $lt_ac_count + 1`
7761 if test $lt_ac_count -gt $lt_ac_max; then
7762 lt_ac_max=$lt_ac_count
7763 lt_cv_path_SED=$lt_ac_sed
7764 fi
7765 done
7766 done
7767 ])
7768 SED=$lt_cv_path_SED
7769 AC_SUBST([SED])
7770 AC_MSG_RESULT([$SED])
7771 ])#AC_PROG_SED
7772 ])#m4_ifndef
7773
7774 # Old name:
7775 AU_ALIAS([LT_AC_PROG_SED], [AC_PROG_SED])
7776 dnl aclocal-1.4 backwards compatibility:
7777 dnl AC_DEFUN([LT_AC_PROG_SED], [])
7778
7779
7780 # _LT_CHECK_SHELL_FEATURES
7781 # ------------------------
7782 # Find out whether the shell is Bourne or XSI compatible,
7783 # or has some other useful features.
7784 m4_defun([_LT_CHECK_SHELL_FEATURES],
7785 [AC_MSG_CHECKING([whether the shell understands some XSI constructs])
7786 # Try some XSI features
7787 xsi_shell=no
7788 ( _lt_dummy="a/b/c"
7789 test "${_lt_dummy##*/},${_lt_dummy%/*},${_lt_dummy#??}"${_lt_dummy%"$_lt_dummy"}, \
7790 = c,a/b,b/c, \
7791 && eval 'test $(( 1 + 1 )) -eq 2 \
7792 && test "${#_lt_dummy}" -eq 5' ) >/dev/null 2>&1 \
7793 && xsi_shell=yes
7794 AC_MSG_RESULT([$xsi_shell])
7795 _LT_CONFIG_LIBTOOL_INIT([xsi_shell='$xsi_shell'])
7796
7797 AC_MSG_CHECKING([whether the shell understands "+="])
7798 lt_shell_append=no
7799 ( foo=bar; set foo baz; eval "$[1]+=\$[2]" && test "$foo" = barbaz ) \
7800 >/dev/null 2>&1 \
7801 && lt_shell_append=yes
7802 AC_MSG_RESULT([$lt_shell_append])
7803 _LT_CONFIG_LIBTOOL_INIT([lt_shell_append='$lt_shell_append'])
7804
7805 if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then
7806 lt_unset=unset
7807 else
7808 lt_unset=false
7809 fi
7810 _LT_DECL([], [lt_unset], [0], [whether the shell understands "unset"])dnl
7811
7812 # test EBCDIC or ASCII
7813 case `echo X|tr X '\101'` in
7814 A) # ASCII based system
7815 # \n is not interpreted correctly by Solaris 8 /usr/ucb/tr
7816 lt_SP2NL='tr \040 \012'
7817 lt_NL2SP='tr \015\012 \040\040'
7818 ;;
7819 *) # EBCDIC based system
7820 lt_SP2NL='tr \100 \n'
7821 lt_NL2SP='tr \r\n \100\100'
7822 ;;
7823 esac
7824 _LT_DECL([SP2NL], [lt_SP2NL], [1], [turn spaces into newlines])dnl
7825 _LT_DECL([NL2SP], [lt_NL2SP], [1], [turn newlines into spaces])dnl
7826 ])# _LT_CHECK_SHELL_FEATURES
7827
7828
7829 # _LT_PROG_FUNCTION_REPLACE (FUNCNAME, REPLACEMENT-BODY)
7830 # ------------------------------------------------------
7831 # In `$cfgfile', look for function FUNCNAME delimited by `^FUNCNAME ()$' and
7832 # '^} FUNCNAME ', and replace its body with REPLACEMENT-BODY.
7833 m4_defun([_LT_PROG_FUNCTION_REPLACE],
7834 [dnl {
7835 sed -e '/^$1 ()$/,/^} # $1 /c\
7836 $1 ()\
7837 {\
7838 m4_bpatsubsts([$2], [$], [\\], [^\([ ]\)], [\\\1])
7839 } # Extended-shell $1 implementation' "$cfgfile" > $cfgfile.tmp \
7840 && mv -f "$cfgfile.tmp" "$cfgfile" \
7841 || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp")
7842 test 0 -eq $? || _lt_function_replace_fail=:
7843 ])
7844
7845
7846 # _LT_PROG_REPLACE_SHELLFNS
7847 # -------------------------
7848 # Replace existing portable implementations of several shell functions with
7849 # equivalent extended shell implementations where those features are available..
7850 m4_defun([_LT_PROG_REPLACE_SHELLFNS],
7851 [if test x"$xsi_shell" = xyes; then
7852 _LT_PROG_FUNCTION_REPLACE([func_dirname], [dnl
7853 case ${1} in
7854 */*) func_dirname_result="${1%/*}${2}" ;;
7855 * ) func_dirname_result="${3}" ;;
7856 esac])
7857
7858 _LT_PROG_FUNCTION_REPLACE([func_basename], [dnl
7859 func_basename_result="${1##*/}"])
7860
7861 _LT_PROG_FUNCTION_REPLACE([func_dirname_and_basename], [dnl
7862 case ${1} in
7863 */*) func_dirname_result="${1%/*}${2}" ;;
7864 * ) func_dirname_result="${3}" ;;
7865 esac
7866 func_basename_result="${1##*/}"])
7867
7868 _LT_PROG_FUNCTION_REPLACE([func_stripname], [dnl
7869 # pdksh 5.2.14 does not do ${X%$Y} correctly if both X and Y are
7870 # positional parameters, so assign one to ordinary parameter first.
7871 func_stripname_result=${3}
7872 func_stripname_result=${func_stripname_result#"${1}"}
7873 func_stripname_result=${func_stripname_result%"${2}"}])
7874
7875 _LT_PROG_FUNCTION_REPLACE([func_split_long_opt], [dnl
7876 func_split_long_opt_name=${1%%=*}
7877 func_split_long_opt_arg=${1#*=}])
7878
7879 _LT_PROG_FUNCTION_REPLACE([func_split_short_opt], [dnl
7880 func_split_short_opt_arg=${1#??}
7881 func_split_short_opt_name=${1%"$func_split_short_opt_arg"}])
7882
7883 _LT_PROG_FUNCTION_REPLACE([func_lo2o], [dnl
7884 case ${1} in
7885 *.lo) func_lo2o_result=${1%.lo}.${objext} ;;
7886 *) func_lo2o_result=${1} ;;
7887 esac])
7888
7889 _LT_PROG_FUNCTION_REPLACE([func_xform], [ func_xform_result=${1%.*}.lo])
7890
7891 _LT_PROG_FUNCTION_REPLACE([func_arith], [ func_arith_result=$(( $[*] ))])
7892
7893 _LT_PROG_FUNCTION_REPLACE([func_len], [ func_len_result=${#1}])
7894 fi
7895
7896 if test x"$lt_shell_append" = xyes; then
7897 _LT_PROG_FUNCTION_REPLACE([func_append], [ eval "${1}+=\\${2}"])
7898
7899 _LT_PROG_FUNCTION_REPLACE([func_append_quoted], [dnl
7900 func_quote_for_eval "${2}"
7901 dnl m4 expansion turns \\\\ into \\, and then the shell eval turns that into \
7902 eval "${1}+=\\\\ \\$func_quote_for_eval_result"])
7903
7904 # Save a `func_append' function call where possible by direct use of '+='
7905 sed -e 's%func_append \([[a-zA-Z_]]\{1,\}\) "%\1+="%g' $cfgfile > $cfgfile.tmp \
7906 && mv -f "$cfgfile.tmp" "$cfgfile" \
7907 || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp")
7908 test 0 -eq $? || _lt_function_replace_fail=:
7909 else
7910 # Save a `func_append' function call even when '+=' is not available
7911 sed -e 's%func_append \([[a-zA-Z_]]\{1,\}\) "%\1="$\1%g' $cfgfile > $cfgfile.tmp \
7912 && mv -f "$cfgfile.tmp" "$cfgfile" \
7913 || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp")
7914 test 0 -eq $? || _lt_function_replace_fail=:
7915 fi
7916
7917 if test x"$_lt_function_replace_fail" = x":"; then
7918 AC_MSG_WARN([Unable to substitute extended shell functions in $ofile])
7919 fi
7920 ])
7921
7922 # _LT_PATH_CONVERSION_FUNCTIONS
7923 # -----------------------------
7924 # Determine which file name conversion functions should be used by
7925 # func_to_host_file (and, implicitly, by func_to_host_path). These are needed
7926 # for certain cross-compile configurations and native mingw.
7927 m4_defun([_LT_PATH_CONVERSION_FUNCTIONS],
7928 [AC_REQUIRE([AC_CANONICAL_HOST])dnl
7929 AC_REQUIRE([AC_CANONICAL_BUILD])dnl
7930 AC_MSG_CHECKING([how to convert $build file names to $host format])
7931 AC_CACHE_VAL(lt_cv_to_host_file_cmd,
7932 [case $host in
7933 *-*-mingw* )
7934 case $build in
7935 *-*-mingw* ) # actually msys
7936 lt_cv_to_host_file_cmd=func_convert_file_msys_to_w32
7937 ;;
7938 *-*-cygwin* )
7939 lt_cv_to_host_file_cmd=func_convert_file_cygwin_to_w32
7940 ;;
7941 * ) # otherwise, assume *nix
7942 lt_cv_to_host_file_cmd=func_convert_file_nix_to_w32
7943 ;;
7944 esac
7945 ;;
7946 *-*-cygwin* )
7947 case $build in
7948 *-*-mingw* ) # actually msys
7949 lt_cv_to_host_file_cmd=func_convert_file_msys_to_cygwin
7950 ;;
7951 *-*-cygwin* )
7952 lt_cv_to_host_file_cmd=func_convert_file_noop
7953 ;;
7954 * ) # otherwise, assume *nix
7955 lt_cv_to_host_file_cmd=func_convert_file_nix_to_cygwin
7956 ;;
7957 esac
7958 ;;
7959 * ) # unhandled hosts (and "normal" native builds)
7960 lt_cv_to_host_file_cmd=func_convert_file_noop
7961 ;;
7962 esac
7963 ])
7964 to_host_file_cmd=$lt_cv_to_host_file_cmd
7965 AC_MSG_RESULT([$lt_cv_to_host_file_cmd])
7966 _LT_DECL([to_host_file_cmd], [lt_cv_to_host_file_cmd],
7967 [0], [convert $build file names to $host format])dnl
7968
7969 AC_MSG_CHECKING([how to convert $build file names to toolchain format])
7970 AC_CACHE_VAL(lt_cv_to_tool_file_cmd,
7971 [#assume ordinary cross tools, or native build.
7972 lt_cv_to_tool_file_cmd=func_convert_file_noop
7973 case $host in
7974 *-*-mingw* )
7975 case $build in
7976 *-*-mingw* ) # actually msys
7977 lt_cv_to_tool_file_cmd=func_convert_file_msys_to_w32
7978 ;;
7979 esac
7980 ;;
7981 esac
7982 ])
7983 to_tool_file_cmd=$lt_cv_to_tool_file_cmd
7984 AC_MSG_RESULT([$lt_cv_to_tool_file_cmd])
7985 _LT_DECL([to_tool_file_cmd], [lt_cv_to_tool_file_cmd],
7986 [0], [convert $build files to toolchain format])dnl
7987 ])# _LT_PATH_CONVERSION_FUNCTIONS
0 # Helper functions for option handling. -*- Autoconf -*-
1 #
2 # Copyright (C) 2004, 2005, 2007, 2008, 2009 Free Software Foundation,
3 # Inc.
4 # Written by Gary V. Vaughan, 2004
5 #
6 # This file is free software; the Free Software Foundation gives
7 # unlimited permission to copy and/or distribute it, with or without
8 # modifications, as long as this notice is preserved.
9
10 # serial 7 ltoptions.m4
11
12 # This is to help aclocal find these macros, as it can't see m4_define.
13 AC_DEFUN([LTOPTIONS_VERSION], [m4_if([1])])
14
15
16 # _LT_MANGLE_OPTION(MACRO-NAME, OPTION-NAME)
17 # ------------------------------------------
18 m4_define([_LT_MANGLE_OPTION],
19 [[_LT_OPTION_]m4_bpatsubst($1__$2, [[^a-zA-Z0-9_]], [_])])
20
21
22 # _LT_SET_OPTION(MACRO-NAME, OPTION-NAME)
23 # ---------------------------------------
24 # Set option OPTION-NAME for macro MACRO-NAME, and if there is a
25 # matching handler defined, dispatch to it. Other OPTION-NAMEs are
26 # saved as a flag.
27 m4_define([_LT_SET_OPTION],
28 [m4_define(_LT_MANGLE_OPTION([$1], [$2]))dnl
29 m4_ifdef(_LT_MANGLE_DEFUN([$1], [$2]),
30 _LT_MANGLE_DEFUN([$1], [$2]),
31 [m4_warning([Unknown $1 option `$2'])])[]dnl
32 ])
33
34
35 # _LT_IF_OPTION(MACRO-NAME, OPTION-NAME, IF-SET, [IF-NOT-SET])
36 # ------------------------------------------------------------
37 # Execute IF-SET if OPTION is set, IF-NOT-SET otherwise.
38 m4_define([_LT_IF_OPTION],
39 [m4_ifdef(_LT_MANGLE_OPTION([$1], [$2]), [$3], [$4])])
40
41
42 # _LT_UNLESS_OPTIONS(MACRO-NAME, OPTION-LIST, IF-NOT-SET)
43 # -------------------------------------------------------
44 # Execute IF-NOT-SET unless all options in OPTION-LIST for MACRO-NAME
45 # are set.
46 m4_define([_LT_UNLESS_OPTIONS],
47 [m4_foreach([_LT_Option], m4_split(m4_normalize([$2])),
48 [m4_ifdef(_LT_MANGLE_OPTION([$1], _LT_Option),
49 [m4_define([$0_found])])])[]dnl
50 m4_ifdef([$0_found], [m4_undefine([$0_found])], [$3
51 ])[]dnl
52 ])
53
54
55 # _LT_SET_OPTIONS(MACRO-NAME, OPTION-LIST)
56 # ----------------------------------------
57 # OPTION-LIST is a space-separated list of Libtool options associated
58 # with MACRO-NAME. If any OPTION has a matching handler declared with
59 # LT_OPTION_DEFINE, dispatch to that macro; otherwise complain about
60 # the unknown option and exit.
61 m4_defun([_LT_SET_OPTIONS],
62 [# Set options
63 m4_foreach([_LT_Option], m4_split(m4_normalize([$2])),
64 [_LT_SET_OPTION([$1], _LT_Option)])
65
66 m4_if([$1],[LT_INIT],[
67 dnl
68 dnl Simply set some default values (i.e off) if boolean options were not
69 dnl specified:
70 _LT_UNLESS_OPTIONS([LT_INIT], [dlopen], [enable_dlopen=no
71 ])
72 _LT_UNLESS_OPTIONS([LT_INIT], [win32-dll], [enable_win32_dll=no
73 ])
74 dnl
75 dnl If no reference was made to various pairs of opposing options, then
76 dnl we run the default mode handler for the pair. For example, if neither
77 dnl `shared' nor `disable-shared' was passed, we enable building of shared
78 dnl archives by default:
79 _LT_UNLESS_OPTIONS([LT_INIT], [shared disable-shared], [_LT_ENABLE_SHARED])
80 _LT_UNLESS_OPTIONS([LT_INIT], [static disable-static], [_LT_ENABLE_STATIC])
81 _LT_UNLESS_OPTIONS([LT_INIT], [pic-only no-pic], [_LT_WITH_PIC])
82 _LT_UNLESS_OPTIONS([LT_INIT], [fast-install disable-fast-install],
83 [_LT_ENABLE_FAST_INSTALL])
84 ])
85 ])# _LT_SET_OPTIONS
86
87
88 ## --------------------------------- ##
89 ## Macros to handle LT_INIT options. ##
90 ## --------------------------------- ##
91
92 # _LT_MANGLE_DEFUN(MACRO-NAME, OPTION-NAME)
93 # -----------------------------------------
94 m4_define([_LT_MANGLE_DEFUN],
95 [[_LT_OPTION_DEFUN_]m4_bpatsubst(m4_toupper([$1__$2]), [[^A-Z0-9_]], [_])])
96
97
98 # LT_OPTION_DEFINE(MACRO-NAME, OPTION-NAME, CODE)
99 # -----------------------------------------------
100 m4_define([LT_OPTION_DEFINE],
101 [m4_define(_LT_MANGLE_DEFUN([$1], [$2]), [$3])[]dnl
102 ])# LT_OPTION_DEFINE
103
104
105 # dlopen
106 # ------
107 LT_OPTION_DEFINE([LT_INIT], [dlopen], [enable_dlopen=yes
108 ])
109
110 AU_DEFUN([AC_LIBTOOL_DLOPEN],
111 [_LT_SET_OPTION([LT_INIT], [dlopen])
112 AC_DIAGNOSE([obsolete],
113 [$0: Remove this warning and the call to _LT_SET_OPTION when you
114 put the `dlopen' option into LT_INIT's first parameter.])
115 ])
116
117 dnl aclocal-1.4 backwards compatibility:
118 dnl AC_DEFUN([AC_LIBTOOL_DLOPEN], [])
119
120
121 # win32-dll
122 # ---------
123 # Declare package support for building win32 dll's.
124 LT_OPTION_DEFINE([LT_INIT], [win32-dll],
125 [enable_win32_dll=yes
126
127 case $host in
128 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-cegcc*)
129 AC_CHECK_TOOL(AS, as, false)
130 AC_CHECK_TOOL(DLLTOOL, dlltool, false)
131 AC_CHECK_TOOL(OBJDUMP, objdump, false)
132 ;;
133 esac
134
135 test -z "$AS" && AS=as
136 _LT_DECL([], [AS], [1], [Assembler program])dnl
137
138 test -z "$DLLTOOL" && DLLTOOL=dlltool
139 _LT_DECL([], [DLLTOOL], [1], [DLL creation program])dnl
140
141 test -z "$OBJDUMP" && OBJDUMP=objdump
142 _LT_DECL([], [OBJDUMP], [1], [Object dumper program])dnl
143 ])# win32-dll
144
145 AU_DEFUN([AC_LIBTOOL_WIN32_DLL],
146 [AC_REQUIRE([AC_CANONICAL_HOST])dnl
147 _LT_SET_OPTION([LT_INIT], [win32-dll])
148 AC_DIAGNOSE([obsolete],
149 [$0: Remove this warning and the call to _LT_SET_OPTION when you
150 put the `win32-dll' option into LT_INIT's first parameter.])
151 ])
152
153 dnl aclocal-1.4 backwards compatibility:
154 dnl AC_DEFUN([AC_LIBTOOL_WIN32_DLL], [])
155
156
157 # _LT_ENABLE_SHARED([DEFAULT])
158 # ----------------------------
159 # implement the --enable-shared flag, and supports the `shared' and
160 # `disable-shared' LT_INIT options.
161 # DEFAULT is either `yes' or `no'. If omitted, it defaults to `yes'.
162 m4_define([_LT_ENABLE_SHARED],
163 [m4_define([_LT_ENABLE_SHARED_DEFAULT], [m4_if($1, no, no, yes)])dnl
164 AC_ARG_ENABLE([shared],
165 [AS_HELP_STRING([--enable-shared@<:@=PKGS@:>@],
166 [build shared libraries @<:@default=]_LT_ENABLE_SHARED_DEFAULT[@:>@])],
167 [p=${PACKAGE-default}
168 case $enableval in
169 yes) enable_shared=yes ;;
170 no) enable_shared=no ;;
171 *)
172 enable_shared=no
173 # Look at the argument we got. We use all the common list separators.
174 lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR,"
175 for pkg in $enableval; do
176 IFS="$lt_save_ifs"
177 if test "X$pkg" = "X$p"; then
178 enable_shared=yes
179 fi
180 done
181 IFS="$lt_save_ifs"
182 ;;
183 esac],
184 [enable_shared=]_LT_ENABLE_SHARED_DEFAULT)
185
186 _LT_DECL([build_libtool_libs], [enable_shared], [0],
187 [Whether or not to build shared libraries])
188 ])# _LT_ENABLE_SHARED
189
190 LT_OPTION_DEFINE([LT_INIT], [shared], [_LT_ENABLE_SHARED([yes])])
191 LT_OPTION_DEFINE([LT_INIT], [disable-shared], [_LT_ENABLE_SHARED([no])])
192
193 # Old names:
194 AC_DEFUN([AC_ENABLE_SHARED],
195 [_LT_SET_OPTION([LT_INIT], m4_if([$1], [no], [disable-])[shared])
196 ])
197
198 AC_DEFUN([AC_DISABLE_SHARED],
199 [_LT_SET_OPTION([LT_INIT], [disable-shared])
200 ])
201
202 AU_DEFUN([AM_ENABLE_SHARED], [AC_ENABLE_SHARED($@)])
203 AU_DEFUN([AM_DISABLE_SHARED], [AC_DISABLE_SHARED($@)])
204
205 dnl aclocal-1.4 backwards compatibility:
206 dnl AC_DEFUN([AM_ENABLE_SHARED], [])
207 dnl AC_DEFUN([AM_DISABLE_SHARED], [])
208
209
210
211 # _LT_ENABLE_STATIC([DEFAULT])
212 # ----------------------------
213 # implement the --enable-static flag, and support the `static' and
214 # `disable-static' LT_INIT options.
215 # DEFAULT is either `yes' or `no'. If omitted, it defaults to `yes'.
216 m4_define([_LT_ENABLE_STATIC],
217 [m4_define([_LT_ENABLE_STATIC_DEFAULT], [m4_if($1, no, no, yes)])dnl
218 AC_ARG_ENABLE([static],
219 [AS_HELP_STRING([--enable-static@<:@=PKGS@:>@],
220 [build static libraries @<:@default=]_LT_ENABLE_STATIC_DEFAULT[@:>@])],
221 [p=${PACKAGE-default}
222 case $enableval in
223 yes) enable_static=yes ;;
224 no) enable_static=no ;;
225 *)
226 enable_static=no
227 # Look at the argument we got. We use all the common list separators.
228 lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR,"
229 for pkg in $enableval; do
230 IFS="$lt_save_ifs"
231 if test "X$pkg" = "X$p"; then
232 enable_static=yes
233 fi
234 done
235 IFS="$lt_save_ifs"
236 ;;
237 esac],
238 [enable_static=]_LT_ENABLE_STATIC_DEFAULT)
239
240 _LT_DECL([build_old_libs], [enable_static], [0],
241 [Whether or not to build static libraries])
242 ])# _LT_ENABLE_STATIC
243
244 LT_OPTION_DEFINE([LT_INIT], [static], [_LT_ENABLE_STATIC([yes])])
245 LT_OPTION_DEFINE([LT_INIT], [disable-static], [_LT_ENABLE_STATIC([no])])
246
247 # Old names:
248 AC_DEFUN([AC_ENABLE_STATIC],
249 [_LT_SET_OPTION([LT_INIT], m4_if([$1], [no], [disable-])[static])
250 ])
251
252 AC_DEFUN([AC_DISABLE_STATIC],
253 [_LT_SET_OPTION([LT_INIT], [disable-static])
254 ])
255
256 AU_DEFUN([AM_ENABLE_STATIC], [AC_ENABLE_STATIC($@)])
257 AU_DEFUN([AM_DISABLE_STATIC], [AC_DISABLE_STATIC($@)])
258
259 dnl aclocal-1.4 backwards compatibility:
260 dnl AC_DEFUN([AM_ENABLE_STATIC], [])
261 dnl AC_DEFUN([AM_DISABLE_STATIC], [])
262
263
264
265 # _LT_ENABLE_FAST_INSTALL([DEFAULT])
266 # ----------------------------------
267 # implement the --enable-fast-install flag, and support the `fast-install'
268 # and `disable-fast-install' LT_INIT options.
269 # DEFAULT is either `yes' or `no'. If omitted, it defaults to `yes'.
270 m4_define([_LT_ENABLE_FAST_INSTALL],
271 [m4_define([_LT_ENABLE_FAST_INSTALL_DEFAULT], [m4_if($1, no, no, yes)])dnl
272 AC_ARG_ENABLE([fast-install],
273 [AS_HELP_STRING([--enable-fast-install@<:@=PKGS@:>@],
274 [optimize for fast installation @<:@default=]_LT_ENABLE_FAST_INSTALL_DEFAULT[@:>@])],
275 [p=${PACKAGE-default}
276 case $enableval in
277 yes) enable_fast_install=yes ;;
278 no) enable_fast_install=no ;;
279 *)
280 enable_fast_install=no
281 # Look at the argument we got. We use all the common list separators.
282 lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR,"
283 for pkg in $enableval; do
284 IFS="$lt_save_ifs"
285 if test "X$pkg" = "X$p"; then
286 enable_fast_install=yes
287 fi
288 done
289 IFS="$lt_save_ifs"
290 ;;
291 esac],
292 [enable_fast_install=]_LT_ENABLE_FAST_INSTALL_DEFAULT)
293
294 _LT_DECL([fast_install], [enable_fast_install], [0],
295 [Whether or not to optimize for fast installation])dnl
296 ])# _LT_ENABLE_FAST_INSTALL
297
298 LT_OPTION_DEFINE([LT_INIT], [fast-install], [_LT_ENABLE_FAST_INSTALL([yes])])
299 LT_OPTION_DEFINE([LT_INIT], [disable-fast-install], [_LT_ENABLE_FAST_INSTALL([no])])
300
301 # Old names:
302 AU_DEFUN([AC_ENABLE_FAST_INSTALL],
303 [_LT_SET_OPTION([LT_INIT], m4_if([$1], [no], [disable-])[fast-install])
304 AC_DIAGNOSE([obsolete],
305 [$0: Remove this warning and the call to _LT_SET_OPTION when you put
306 the `fast-install' option into LT_INIT's first parameter.])
307 ])
308
309 AU_DEFUN([AC_DISABLE_FAST_INSTALL],
310 [_LT_SET_OPTION([LT_INIT], [disable-fast-install])
311 AC_DIAGNOSE([obsolete],
312 [$0: Remove this warning and the call to _LT_SET_OPTION when you put
313 the `disable-fast-install' option into LT_INIT's first parameter.])
314 ])
315
316 dnl aclocal-1.4 backwards compatibility:
317 dnl AC_DEFUN([AC_ENABLE_FAST_INSTALL], [])
318 dnl AC_DEFUN([AM_DISABLE_FAST_INSTALL], [])
319
320
321 # _LT_WITH_PIC([MODE])
322 # --------------------
323 # implement the --with-pic flag, and support the `pic-only' and `no-pic'
324 # LT_INIT options.
325 # MODE is either `yes' or `no'. If omitted, it defaults to `both'.
326 m4_define([_LT_WITH_PIC],
327 [AC_ARG_WITH([pic],
328 [AS_HELP_STRING([--with-pic@<:@=PKGS@:>@],
329 [try to use only PIC/non-PIC objects @<:@default=use both@:>@])],
330 [lt_p=${PACKAGE-default}
331 case $withval in
332 yes|no) pic_mode=$withval ;;
333 *)
334 pic_mode=default
335 # Look at the argument we got. We use all the common list separators.
336 lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR,"
337 for lt_pkg in $withval; do
338 IFS="$lt_save_ifs"
339 if test "X$lt_pkg" = "X$lt_p"; then
340 pic_mode=yes
341 fi
342 done
343 IFS="$lt_save_ifs"
344 ;;
345 esac],
346 [pic_mode=default])
347
348 test -z "$pic_mode" && pic_mode=m4_default([$1], [default])
349
350 _LT_DECL([], [pic_mode], [0], [What type of objects to build])dnl
351 ])# _LT_WITH_PIC
352
353 LT_OPTION_DEFINE([LT_INIT], [pic-only], [_LT_WITH_PIC([yes])])
354 LT_OPTION_DEFINE([LT_INIT], [no-pic], [_LT_WITH_PIC([no])])
355
356 # Old name:
357 AU_DEFUN([AC_LIBTOOL_PICMODE],
358 [_LT_SET_OPTION([LT_INIT], [pic-only])
359 AC_DIAGNOSE([obsolete],
360 [$0: Remove this warning and the call to _LT_SET_OPTION when you
361 put the `pic-only' option into LT_INIT's first parameter.])
362 ])
363
364 dnl aclocal-1.4 backwards compatibility:
365 dnl AC_DEFUN([AC_LIBTOOL_PICMODE], [])
366
367 ## ----------------- ##
368 ## LTDL_INIT Options ##
369 ## ----------------- ##
370
371 m4_define([_LTDL_MODE], [])
372 LT_OPTION_DEFINE([LTDL_INIT], [nonrecursive],
373 [m4_define([_LTDL_MODE], [nonrecursive])])
374 LT_OPTION_DEFINE([LTDL_INIT], [recursive],
375 [m4_define([_LTDL_MODE], [recursive])])
376 LT_OPTION_DEFINE([LTDL_INIT], [subproject],
377 [m4_define([_LTDL_MODE], [subproject])])
378
379 m4_define([_LTDL_TYPE], [])
380 LT_OPTION_DEFINE([LTDL_INIT], [installable],
381 [m4_define([_LTDL_TYPE], [installable])])
382 LT_OPTION_DEFINE([LTDL_INIT], [convenience],
383 [m4_define([_LTDL_TYPE], [convenience])])
0 # ltsugar.m4 -- libtool m4 base layer. -*-Autoconf-*-
1 #
2 # Copyright (C) 2004, 2005, 2007, 2008 Free Software Foundation, Inc.
3 # Written by Gary V. Vaughan, 2004
4 #
5 # This file is free software; the Free Software Foundation gives
6 # unlimited permission to copy and/or distribute it, with or without
7 # modifications, as long as this notice is preserved.
8
9 # serial 6 ltsugar.m4
10
11 # This is to help aclocal find these macros, as it can't see m4_define.
12 AC_DEFUN([LTSUGAR_VERSION], [m4_if([0.1])])
13
14
15 # lt_join(SEP, ARG1, [ARG2...])
16 # -----------------------------
17 # Produce ARG1SEPARG2...SEPARGn, omitting [] arguments and their
18 # associated separator.
19 # Needed until we can rely on m4_join from Autoconf 2.62, since all earlier
20 # versions in m4sugar had bugs.
21 m4_define([lt_join],
22 [m4_if([$#], [1], [],
23 [$#], [2], [[$2]],
24 [m4_if([$2], [], [], [[$2]_])$0([$1], m4_shift(m4_shift($@)))])])
25 m4_define([_lt_join],
26 [m4_if([$#$2], [2], [],
27 [m4_if([$2], [], [], [[$1$2]])$0([$1], m4_shift(m4_shift($@)))])])
28
29
30 # lt_car(LIST)
31 # lt_cdr(LIST)
32 # ------------
33 # Manipulate m4 lists.
34 # These macros are necessary as long as will still need to support
35 # Autoconf-2.59 which quotes differently.
36 m4_define([lt_car], [[$1]])
37 m4_define([lt_cdr],
38 [m4_if([$#], 0, [m4_fatal([$0: cannot be called without arguments])],
39 [$#], 1, [],
40 [m4_dquote(m4_shift($@))])])
41 m4_define([lt_unquote], $1)
42
43
44 # lt_append(MACRO-NAME, STRING, [SEPARATOR])
45 # ------------------------------------------
46 # Redefine MACRO-NAME to hold its former content plus `SEPARATOR'`STRING'.
47 # Note that neither SEPARATOR nor STRING are expanded; they are appended
48 # to MACRO-NAME as is (leaving the expansion for when MACRO-NAME is invoked).
49 # No SEPARATOR is output if MACRO-NAME was previously undefined (different
50 # than defined and empty).
51 #
52 # This macro is needed until we can rely on Autoconf 2.62, since earlier
53 # versions of m4sugar mistakenly expanded SEPARATOR but not STRING.
54 m4_define([lt_append],
55 [m4_define([$1],
56 m4_ifdef([$1], [m4_defn([$1])[$3]])[$2])])
57
58
59
60 # lt_combine(SEP, PREFIX-LIST, INFIX, SUFFIX1, [SUFFIX2...])
61 # ----------------------------------------------------------
62 # Produce a SEP delimited list of all paired combinations of elements of
63 # PREFIX-LIST with SUFFIX1 through SUFFIXn. Each element of the list
64 # has the form PREFIXmINFIXSUFFIXn.
65 # Needed until we can rely on m4_combine added in Autoconf 2.62.
66 m4_define([lt_combine],
67 [m4_if(m4_eval([$# > 3]), [1],
68 [m4_pushdef([_Lt_sep], [m4_define([_Lt_sep], m4_defn([lt_car]))])]]dnl
69 [[m4_foreach([_Lt_prefix], [$2],
70 [m4_foreach([_Lt_suffix],
71 ]m4_dquote(m4_dquote(m4_shift(m4_shift(m4_shift($@)))))[,
72 [_Lt_sep([$1])[]m4_defn([_Lt_prefix])[$3]m4_defn([_Lt_suffix])])])])])
73
74
75 # lt_if_append_uniq(MACRO-NAME, VARNAME, [SEPARATOR], [UNIQ], [NOT-UNIQ])
76 # -----------------------------------------------------------------------
77 # Iff MACRO-NAME does not yet contain VARNAME, then append it (delimited
78 # by SEPARATOR if supplied) and expand UNIQ, else NOT-UNIQ.
79 m4_define([lt_if_append_uniq],
80 [m4_ifdef([$1],
81 [m4_if(m4_index([$3]m4_defn([$1])[$3], [$3$2$3]), [-1],
82 [lt_append([$1], [$2], [$3])$4],
83 [$5])],
84 [lt_append([$1], [$2], [$3])$4])])
85
86
87 # lt_dict_add(DICT, KEY, VALUE)
88 # -----------------------------
89 m4_define([lt_dict_add],
90 [m4_define([$1($2)], [$3])])
91
92
93 # lt_dict_add_subkey(DICT, KEY, SUBKEY, VALUE)
94 # --------------------------------------------
95 m4_define([lt_dict_add_subkey],
96 [m4_define([$1($2:$3)], [$4])])
97
98
99 # lt_dict_fetch(DICT, KEY, [SUBKEY])
100 # ----------------------------------
101 m4_define([lt_dict_fetch],
102 [m4_ifval([$3],
103 m4_ifdef([$1($2:$3)], [m4_defn([$1($2:$3)])]),
104 m4_ifdef([$1($2)], [m4_defn([$1($2)])]))])
105
106
107 # lt_if_dict_fetch(DICT, KEY, [SUBKEY], VALUE, IF-TRUE, [IF-FALSE])
108 # -----------------------------------------------------------------
109 m4_define([lt_if_dict_fetch],
110 [m4_if(lt_dict_fetch([$1], [$2], [$3]), [$4],
111 [$5],
112 [$6])])
113
114
115 # lt_dict_filter(DICT, [SUBKEY], VALUE, [SEPARATOR], KEY, [...])
116 # --------------------------------------------------------------
117 m4_define([lt_dict_filter],
118 [m4_if([$5], [], [],
119 [lt_join(m4_quote(m4_default([$4], [[, ]])),
120 lt_unquote(m4_split(m4_normalize(m4_foreach(_Lt_key, lt_car([m4_shiftn(4, $@)]),
121 [lt_if_dict_fetch([$1], _Lt_key, [$2], [$3], [_Lt_key ])])))))])[]dnl
122 ])
0 # ltversion.m4 -- version numbers -*- Autoconf -*-
1 #
2 # Copyright (C) 2004 Free Software Foundation, Inc.
3 # Written by Scott James Remnant, 2004
4 #
5 # This file is free software; the Free Software Foundation gives
6 # unlimited permission to copy and/or distribute it, with or without
7 # modifications, as long as this notice is preserved.
8
9 # @configure_input@
10
11 # serial 3337 ltversion.m4
12 # This file is part of GNU Libtool
13
14 m4_define([LT_PACKAGE_VERSION], [2.4.2])
15 m4_define([LT_PACKAGE_REVISION], [1.3337])
16
17 AC_DEFUN([LTVERSION_VERSION],
18 [macro_version='2.4.2'
19 macro_revision='1.3337'
20 _LT_DECL(, macro_version, 0, [Which release of libtool.m4 was used?])
21 _LT_DECL(, macro_revision, 0)
22 ])
0 # lt~obsolete.m4 -- aclocal satisfying obsolete definitions. -*-Autoconf-*-
1 #
2 # Copyright (C) 2004, 2005, 2007, 2009 Free Software Foundation, Inc.
3 # Written by Scott James Remnant, 2004.
4 #
5 # This file is free software; the Free Software Foundation gives
6 # unlimited permission to copy and/or distribute it, with or without
7 # modifications, as long as this notice is preserved.
8
9 # serial 5 lt~obsolete.m4
10
11 # These exist entirely to fool aclocal when bootstrapping libtool.
12 #
13 # In the past libtool.m4 has provided macros via AC_DEFUN (or AU_DEFUN)
14 # which have later been changed to m4_define as they aren't part of the
15 # exported API, or moved to Autoconf or Automake where they belong.
16 #
17 # The trouble is, aclocal is a bit thick. It'll see the old AC_DEFUN
18 # in /usr/share/aclocal/libtool.m4 and remember it, then when it sees us
19 # using a macro with the same name in our local m4/libtool.m4 it'll
20 # pull the old libtool.m4 in (it doesn't see our shiny new m4_define
21 # and doesn't know about Autoconf macros at all.)
22 #
23 # So we provide this file, which has a silly filename so it's always
24 # included after everything else. This provides aclocal with the
25 # AC_DEFUNs it wants, but when m4 processes it, it doesn't do anything
26 # because those macros already exist, or will be overwritten later.
27 # We use AC_DEFUN over AU_DEFUN for compatibility with aclocal-1.6.
28 #
29 # Anytime we withdraw an AC_DEFUN or AU_DEFUN, remember to add it here.
30 # Yes, that means every name once taken will need to remain here until
31 # we give up compatibility with versions before 1.7, at which point
32 # we need to keep only those names which we still refer to.
33
34 # This is to help aclocal find these macros, as it can't see m4_define.
35 AC_DEFUN([LTOBSOLETE_VERSION], [m4_if([1])])
36
37 m4_ifndef([AC_LIBTOOL_LINKER_OPTION], [AC_DEFUN([AC_LIBTOOL_LINKER_OPTION])])
38 m4_ifndef([AC_PROG_EGREP], [AC_DEFUN([AC_PROG_EGREP])])
39 m4_ifndef([_LT_AC_PROG_ECHO_BACKSLASH], [AC_DEFUN([_LT_AC_PROG_ECHO_BACKSLASH])])
40 m4_ifndef([_LT_AC_SHELL_INIT], [AC_DEFUN([_LT_AC_SHELL_INIT])])
41 m4_ifndef([_LT_AC_SYS_LIBPATH_AIX], [AC_DEFUN([_LT_AC_SYS_LIBPATH_AIX])])
42 m4_ifndef([_LT_PROG_LTMAIN], [AC_DEFUN([_LT_PROG_LTMAIN])])
43 m4_ifndef([_LT_AC_TAGVAR], [AC_DEFUN([_LT_AC_TAGVAR])])
44 m4_ifndef([AC_LTDL_ENABLE_INSTALL], [AC_DEFUN([AC_LTDL_ENABLE_INSTALL])])
45 m4_ifndef([AC_LTDL_PREOPEN], [AC_DEFUN([AC_LTDL_PREOPEN])])
46 m4_ifndef([_LT_AC_SYS_COMPILER], [AC_DEFUN([_LT_AC_SYS_COMPILER])])
47 m4_ifndef([_LT_AC_LOCK], [AC_DEFUN([_LT_AC_LOCK])])
48 m4_ifndef([AC_LIBTOOL_SYS_OLD_ARCHIVE], [AC_DEFUN([AC_LIBTOOL_SYS_OLD_ARCHIVE])])
49 m4_ifndef([_LT_AC_TRY_DLOPEN_SELF], [AC_DEFUN([_LT_AC_TRY_DLOPEN_SELF])])
50 m4_ifndef([AC_LIBTOOL_PROG_CC_C_O], [AC_DEFUN([AC_LIBTOOL_PROG_CC_C_O])])
51 m4_ifndef([AC_LIBTOOL_SYS_HARD_LINK_LOCKS], [AC_DEFUN([AC_LIBTOOL_SYS_HARD_LINK_LOCKS])])
52 m4_ifndef([AC_LIBTOOL_OBJDIR], [AC_DEFUN([AC_LIBTOOL_OBJDIR])])
53 m4_ifndef([AC_LTDL_OBJDIR], [AC_DEFUN([AC_LTDL_OBJDIR])])
54 m4_ifndef([AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH], [AC_DEFUN([AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH])])
55 m4_ifndef([AC_LIBTOOL_SYS_LIB_STRIP], [AC_DEFUN([AC_LIBTOOL_SYS_LIB_STRIP])])
56 m4_ifndef([AC_PATH_MAGIC], [AC_DEFUN([AC_PATH_MAGIC])])
57 m4_ifndef([AC_PROG_LD_GNU], [AC_DEFUN([AC_PROG_LD_GNU])])
58 m4_ifndef([AC_PROG_LD_RELOAD_FLAG], [AC_DEFUN([AC_PROG_LD_RELOAD_FLAG])])
59 m4_ifndef([AC_DEPLIBS_CHECK_METHOD], [AC_DEFUN([AC_DEPLIBS_CHECK_METHOD])])
60 m4_ifndef([AC_LIBTOOL_PROG_COMPILER_NO_RTTI], [AC_DEFUN([AC_LIBTOOL_PROG_COMPILER_NO_RTTI])])
61 m4_ifndef([AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE], [AC_DEFUN([AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE])])
62 m4_ifndef([AC_LIBTOOL_PROG_COMPILER_PIC], [AC_DEFUN([AC_LIBTOOL_PROG_COMPILER_PIC])])
63 m4_ifndef([AC_LIBTOOL_PROG_LD_SHLIBS], [AC_DEFUN([AC_LIBTOOL_PROG_LD_SHLIBS])])
64 m4_ifndef([AC_LIBTOOL_POSTDEP_PREDEP], [AC_DEFUN([AC_LIBTOOL_POSTDEP_PREDEP])])
65 m4_ifndef([LT_AC_PROG_EGREP], [AC_DEFUN([LT_AC_PROG_EGREP])])
66 m4_ifndef([LT_AC_PROG_SED], [AC_DEFUN([LT_AC_PROG_SED])])
67 m4_ifndef([_LT_CC_BASENAME], [AC_DEFUN([_LT_CC_BASENAME])])
68 m4_ifndef([_LT_COMPILER_BOILERPLATE], [AC_DEFUN([_LT_COMPILER_BOILERPLATE])])
69 m4_ifndef([_LT_LINKER_BOILERPLATE], [AC_DEFUN([_LT_LINKER_BOILERPLATE])])
70 m4_ifndef([_AC_PROG_LIBTOOL], [AC_DEFUN([_AC_PROG_LIBTOOL])])
71 m4_ifndef([AC_LIBTOOL_SETUP], [AC_DEFUN([AC_LIBTOOL_SETUP])])
72 m4_ifndef([_LT_AC_CHECK_DLFCN], [AC_DEFUN([_LT_AC_CHECK_DLFCN])])
73 m4_ifndef([AC_LIBTOOL_SYS_DYNAMIC_LINKER], [AC_DEFUN([AC_LIBTOOL_SYS_DYNAMIC_LINKER])])
74 m4_ifndef([_LT_AC_TAGCONFIG], [AC_DEFUN([_LT_AC_TAGCONFIG])])
75 m4_ifndef([AC_DISABLE_FAST_INSTALL], [AC_DEFUN([AC_DISABLE_FAST_INSTALL])])
76 m4_ifndef([_LT_AC_LANG_CXX], [AC_DEFUN([_LT_AC_LANG_CXX])])
77 m4_ifndef([_LT_AC_LANG_F77], [AC_DEFUN([_LT_AC_LANG_F77])])
78 m4_ifndef([_LT_AC_LANG_GCJ], [AC_DEFUN([_LT_AC_LANG_GCJ])])
79 m4_ifndef([AC_LIBTOOL_LANG_C_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_C_CONFIG])])
80 m4_ifndef([_LT_AC_LANG_C_CONFIG], [AC_DEFUN([_LT_AC_LANG_C_CONFIG])])
81 m4_ifndef([AC_LIBTOOL_LANG_CXX_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_CXX_CONFIG])])
82 m4_ifndef([_LT_AC_LANG_CXX_CONFIG], [AC_DEFUN([_LT_AC_LANG_CXX_CONFIG])])
83 m4_ifndef([AC_LIBTOOL_LANG_F77_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_F77_CONFIG])])
84 m4_ifndef([_LT_AC_LANG_F77_CONFIG], [AC_DEFUN([_LT_AC_LANG_F77_CONFIG])])
85 m4_ifndef([AC_LIBTOOL_LANG_GCJ_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_GCJ_CONFIG])])
86 m4_ifndef([_LT_AC_LANG_GCJ_CONFIG], [AC_DEFUN([_LT_AC_LANG_GCJ_CONFIG])])
87 m4_ifndef([AC_LIBTOOL_LANG_RC_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_RC_CONFIG])])
88 m4_ifndef([_LT_AC_LANG_RC_CONFIG], [AC_DEFUN([_LT_AC_LANG_RC_CONFIG])])
89 m4_ifndef([AC_LIBTOOL_CONFIG], [AC_DEFUN([AC_LIBTOOL_CONFIG])])
90 m4_ifndef([_LT_AC_FILE_LTDLL_C], [AC_DEFUN([_LT_AC_FILE_LTDLL_C])])
91 m4_ifndef([_LT_REQUIRED_DARWIN_CHECKS], [AC_DEFUN([_LT_REQUIRED_DARWIN_CHECKS])])
92 m4_ifndef([_LT_AC_PROG_CXXCPP], [AC_DEFUN([_LT_AC_PROG_CXXCPP])])
93 m4_ifndef([_LT_PREPARE_SED_QUOTE_VARS], [AC_DEFUN([_LT_PREPARE_SED_QUOTE_VARS])])
94 m4_ifndef([_LT_PROG_ECHO_BACKSLASH], [AC_DEFUN([_LT_PROG_ECHO_BACKSLASH])])
95 m4_ifndef([_LT_PROG_F77], [AC_DEFUN([_LT_PROG_F77])])
96 m4_ifndef([_LT_PROG_FC], [AC_DEFUN([_LT_PROG_FC])])
97 m4_ifndef([_LT_PROG_CXX], [AC_DEFUN([_LT_PROG_CXX])])
0 #
1 # Copyright (c) 2015 Thorsten Kukuk, Germany
2 #
3 # Author: Thorsten Kukuk <kukuk@thkukuk.de>
4 #
5 # Process this file with automake to produce Makefile.in.
6 #
7
8 CLEANFILES = *~
9
10 EXTRA_DIST = libnss_nisplus.map files-parse.c
11
12 AM_CFLAGS = -D_REENTRANT=1
13 AM_CPPFLAGS = -I$(srcdir) @LIBNSL_CFLAGS@
14
15 lib_LTLIBRARIES = libnss_nisplus.la
16
17 noinst_HEADERS = libc-lock.h
18 noinst_PROGRAMS = nss_loader-test
19 nss_loader_test_LDADD = -ldl
20
21 libnss_nisplus_la_LDFLAGS = -version-info 2:0:0 \
22 -Wl,--version-script=$(srcdir)/libnss_nisplus.map
23 libnss_nisplus_la_LIBADD = @LIBNSL_LIBS@
24 libnss_nisplus_la_SOURCES = nisplus-alias.c nisplus-ethers.c nisplus-grp.c \
25 nisplus-hosts.c nisplus-initgroups.c nisplus-netgrp.c \
26 nisplus-network.c nisplus-parser.c nisplus-proto.c \
27 nisplus-publickey.c nisplus-pwd.c nisplus-rpc.c nisplus-service.c \
28 nisplus-spwd.c
0 #ifndef _LIBC_LOCK_H
1 #define _LIBC_LOCK_H 1
2
3 #include <pthread.h>
4
5 #define __libc_lock_define_initialized(CLASS,NAME) \
6 CLASS pthread_mutex_t NAME = PTHREAD_MUTEX_INITIALIZER;
7
8 #define __libc_once_define(CLASS, NAME) \
9 CLASS pthread_once_t NAME = PTHREAD_ONCE_INIT;
10
11 #define __libc_lock_lock(NAME) \
12 pthread_mutex_lock (&(NAME))
13
14 #define __libc_lock_unlock(NAME) \
15 pthread_mutex_unlock (&(NAME))
16
17 /* Call handler iff the first call. */
18 #define __libc_once(ONCE_CONTROL, INIT_FUNCTION) \
19 do { \
20 if ((ONCE_CONTROL) == 0) { \
21 INIT_FUNCTION (); \
22 (ONCE_CONTROL) = 1; \
23 } \
24 } while (0)
25
26
27 #endif /* bits/libc-lock.h */
0 NSS_NISPLUS_PRIVATE_2.0 {
1 global:
2 _nss_nisplus_endaliasent; _nss_nisplus_endetherent; _nss_nisplus_endgrent;
3 _nss_nisplus_endhostent; _nss_nisplus_endnetent; _nss_nisplus_endnetgrent;
4 _nss_nisplus_endprotoent; _nss_nisplus_endpwent; _nss_nisplus_endrpcent;
5 _nss_nisplus_endservent; _nss_nisplus_endspent; _nss_nisplus_getaliasbyname_r;
6 _nss_nisplus_getaliasent_r; _nss_nisplus_getetherent_r; _nss_nisplus_getgrent_r;
7 _nss_nisplus_getgrgid_r; _nss_nisplus_getgrnam_r; _nss_nisplus_gethostbyaddr_r;
8 _nss_nisplus_gethostbyname2_r; _nss_nisplus_gethostbyname_r; _nss_nisplus_gethostent_r;
9 _nss_nisplus_gethostton_r; _nss_nisplus_getnetbyaddr_r; _nss_nisplus_getnetbyname_r;
10 _nss_nisplus_getnetent_r; _nss_nisplus_getnetgrent_r; _nss_nisplus_getntohost_r;
11 _nss_nisplus_getprotobyname_r; _nss_nisplus_getprotobynumber_r;
12 _nss_nisplus_getprotoent_r; _nss_nisplus_getpublickey; _nss_nisplus_getpwent_r;
13 _nss_nisplus_getpwnam_r; _nss_nisplus_getpwuid_r; _nss_nisplus_getrpcbyname_r;
14 _nss_nisplus_getrpcbynumber_r; _nss_nisplus_getrpcent_r; _nss_nisplus_getsecretkey;
15 _nss_nisplus_getservbyname_r; _nss_nisplus_getservbyport_r; _nss_nisplus_getservent_r;
16 _nss_nisplus_getspent_r; _nss_nisplus_getspnam_r;
17 _nss_nisplus_netname2user; _nss_nisplus_setaliasent; _nss_nisplus_setetherent;
18 _nss_nisplus_setgrent; _nss_nisplus_sethostent; _nss_nisplus_setnetent;
19 _nss_nisplus_setnetgrent; _nss_nisplus_setprotoent; _nss_nisplus_setpwent;
20 _nss_nisplus_setrpcent; _nss_nisplus_setservent; _nss_nisplus_setspent;
21 _nss_nisplus_initgroups_dyn; _nss_nisplus_gethostbyname4_r;
22
23 local:
24 *;
25 };
0 /* Copyright (C) 1997-2015 Free Software Foundation, Inc.
1 This file is part of the GNU C Library.
2 Contributed by Thorsten Kukuk <kukuk@vt.uni-paderborn.de>, 1997.
3
4 The GNU C Library is free software; you can redistribute it and/or
5 modify it under the terms of the GNU Lesser General Public
6 License as published by the Free Software Foundation; either
7 version 2.1 of the License, or (at your option) any later version.
8
9 The GNU C Library is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 Lesser General Public License for more details.
13
14 You should have received a copy of the GNU Lesser General Public
15 License along with the GNU C Library; if not, see
16 <http://www.gnu.org/licenses/>. */
17
18 #include <atomic.h>
19 #include <nss.h>
20 #include <errno.h>
21 #include <ctype.h>
22 #include <string.h>
23 #include <aliases.h>
24 #include <bits/libc-lock.h>
25 #include <rpcsvc/nis.h>
26
27 #include "nss-nisplus.h"
28
29 __libc_lock_define_initialized (static, lock)
30
31 static nis_result *result;
32 static u_long next_entry;
33 static nis_name tablename_val;
34 static size_t tablename_len;
35
36 #define NISENTRYVAL(idx, col, res) \
37 (NIS_RES_OBJECT (res)[idx].EN_data.en_cols.en_cols_val[col].ec_value.ec_value_val)
38
39 #define NISENTRYLEN(idx, col, res) \
40 (NIS_RES_OBJECT (res)[idx].EN_data.en_cols.en_cols_val[col].ec_value.ec_value_len)
41
42 static enum nss_status
43 _nss_create_tablename (int *errnop)
44 {
45 if (tablename_val == NULL)
46 {
47 const char *local_dir = nis_local_directory ();
48 size_t local_dir_len = strlen (local_dir);
49 static const char prefix[] = "mail_aliases.org_dir.";
50
51 char *p = malloc (sizeof (prefix) + local_dir_len);
52 if (p == NULL)
53 {
54 *errnop = errno;
55 return NSS_STATUS_TRYAGAIN;
56 }
57
58 memcpy (__stpcpy (p, prefix), local_dir, local_dir_len + 1);
59
60 tablename_len = sizeof (prefix) - 1 + local_dir_len;
61
62 atomic_write_barrier ();
63
64 tablename_val = p;
65 }
66
67 return NSS_STATUS_SUCCESS;
68 }
69
70 static int
71 _nss_nisplus_parse_aliasent (nis_result *result, unsigned long entry,
72 struct aliasent *alias, char *buffer,
73 size_t buflen, int *errnop)
74 {
75 if (result == NULL)
76 return 0;
77
78 if ((result->status != NIS_SUCCESS && result->status != NIS_S_SUCCESS)
79 || __type_of (&NIS_RES_OBJECT (result)[entry]) != NIS_ENTRY_OBJ
80 || strcmp (NIS_RES_OBJECT (result)[entry].EN_data.en_type,
81 "mail_aliases") != 0
82 || NIS_RES_OBJECT (result)[entry].EN_data.en_cols.en_cols_len < 2)
83 return 0;
84
85 if (NISENTRYLEN (entry, 1, result) >= buflen)
86 {
87 /* The line is too long for our buffer. */
88 no_more_room:
89 *errnop = ERANGE;
90 return -1;
91 }
92
93 char *cp = __stpncpy (buffer, NISENTRYVAL (entry, 1, result),
94 NISENTRYLEN (entry, 1, result));
95 *cp = '\0';
96
97 char *first_unused = cp + 1;
98 size_t room_left = buflen - (first_unused - buffer);
99
100 alias->alias_local = 0;
101 alias->alias_members_len = 0;
102
103 if (NISENTRYLEN (entry, 0, result) >= room_left)
104 goto no_more_room;
105
106 cp = __stpncpy (first_unused, NISENTRYVAL (entry, 0, result),
107 NISENTRYLEN (entry, 0, result));
108 *cp = '\0';
109 alias->alias_name = first_unused;
110
111 /* Terminate the line for any case. */
112 cp = strpbrk (alias->alias_name, "#\n");
113 if (cp != NULL)
114 *cp = '\0';
115
116 size_t len = strlen (alias->alias_name) + 1;
117 first_unused += len;
118 room_left -= len;
119
120 /* Adjust the pointer so it is aligned for
121 storing pointers. */
122 size_t adjust = ((__alignof__ (char *)
123 - (first_unused - (char *) 0) % __alignof__ (char *))
124 % __alignof__ (char *));
125 if (room_left < adjust)
126 goto no_more_room;
127 first_unused += adjust;
128 room_left -= adjust;
129
130 alias->alias_members = (char **) first_unused;
131
132 char *line = buffer;
133 while (*line != '\0')
134 {
135 /* Skip leading blanks. */
136 while (isspace (*line))
137 ++line;
138
139 if (*line == '\0')
140 break;
141
142 if (room_left < sizeof (char *))
143 goto no_more_room;
144 room_left -= sizeof (char *);
145 alias->alias_members[alias->alias_members_len] = line;
146
147 while (*line != '\0' && *line != ',')
148 ++line;
149
150 if (line != alias->alias_members[alias->alias_members_len])
151 {
152 *line++ = '\0';
153 ++alias->alias_members_len;
154 }
155 else if (*line == ',')
156 ++line;
157 }
158
159 return alias->alias_members_len == 0 ? 0 : 1;
160 }
161
162 static enum nss_status
163 internal_setaliasent (void)
164 {
165 enum nss_status status;
166 int err;
167
168 if (result != NULL)
169 {
170 nis_freeresult (result);
171 result = NULL;
172 }
173
174 if (_nss_create_tablename (&err) != NSS_STATUS_SUCCESS)
175 return NSS_STATUS_UNAVAIL;
176
177 next_entry = 0;
178 result = nis_list (tablename_val, FOLLOW_PATH | FOLLOW_LINKS, NULL, NULL);
179 if (result == NULL)
180 {
181 status = NSS_STATUS_TRYAGAIN;
182 __set_errno (ENOMEM);
183 }
184 else
185 {
186 status = niserr2nss (result->status);
187 if (status != NSS_STATUS_SUCCESS)
188 {
189 nis_freeresult (result);
190 result = NULL;
191 }
192 }
193 return status;
194 }
195
196 enum nss_status
197 _nss_nisplus_setaliasent (void)
198 {
199 enum nss_status status;
200
201 __libc_lock_lock (lock);
202
203 status = internal_setaliasent ();
204
205 __libc_lock_unlock (lock);
206
207 return status;
208 }
209
210 enum nss_status
211 _nss_nisplus_endaliasent (void)
212 {
213 __libc_lock_lock (lock);
214
215 if (result != NULL)
216 {
217 nis_freeresult (result);
218 result = NULL;
219 }
220 next_entry = 0;
221
222 __libc_lock_unlock (lock);
223
224 return NSS_STATUS_SUCCESS;
225 }
226
227 static enum nss_status
228 internal_nisplus_getaliasent_r (struct aliasent *alias,
229 char *buffer, size_t buflen, int *errnop)
230 {
231 int parse_res;
232
233 if (result == NULL)
234 {
235 enum nss_status status;
236
237 status = internal_setaliasent ();
238 if (result == NULL || status != NSS_STATUS_SUCCESS)
239 return status;
240 }
241
242 /* Get the next entry until we found a correct one. */
243 do
244 {
245 if (next_entry >= result->objects.objects_len)
246 return NSS_STATUS_NOTFOUND;
247
248 parse_res = _nss_nisplus_parse_aliasent (result, next_entry, alias,
249 buffer, buflen, errnop);
250 if (parse_res == -1)
251 return NSS_STATUS_TRYAGAIN;
252
253 ++next_entry;
254 }
255 while (!parse_res);
256
257 return NSS_STATUS_SUCCESS;
258 }
259
260 enum nss_status
261 _nss_nisplus_getaliasent_r (struct aliasent *result, char *buffer,
262 size_t buflen, int *errnop)
263 {
264 int status;
265
266 __libc_lock_lock (lock);
267
268 status = internal_nisplus_getaliasent_r (result, buffer, buflen, errnop);
269
270 __libc_lock_unlock (lock);
271
272 return status;
273 }
274
275 enum nss_status
276 _nss_nisplus_getaliasbyname_r (const char *name, struct aliasent *alias,
277 char *buffer, size_t buflen, int *errnop)
278 {
279 int parse_res;
280
281 if (tablename_val == NULL)
282 {
283 __libc_lock_lock (lock);
284
285 enum nss_status status = _nss_create_tablename (errnop);
286
287 __libc_lock_unlock (lock);
288
289 if (status != NSS_STATUS_SUCCESS)
290 return status;
291 }
292
293 if (name != NULL)
294 {
295 *errnop = EINVAL;
296 return NSS_STATUS_UNAVAIL;
297 }
298
299 char buf[strlen (name) + 9 + tablename_len];
300 int olderr = errno;
301
302 snprintf (buf, sizeof (buf), "[name=%s],%s", name, tablename_val);
303
304 nis_result *result = nis_list (buf, FOLLOW_PATH | FOLLOW_LINKS, NULL, NULL);
305
306 if (result == NULL)
307 {
308 *errnop = ENOMEM;
309 return NSS_STATUS_TRYAGAIN;
310 }
311
312 if (__glibc_unlikely (niserr2nss (result->status) != NSS_STATUS_SUCCESS))
313 {
314 enum nss_status status = niserr2nss (result->status);
315 nis_freeresult (result);
316 return status;
317 }
318
319 parse_res = _nss_nisplus_parse_aliasent (result, 0, alias,
320 buffer, buflen, errnop);
321
322 /* We do not need the lookup result anymore. */
323 nis_freeresult (result);
324
325 if (__glibc_unlikely (parse_res < 1))
326 {
327 __set_errno (olderr);
328
329 if (parse_res == -1)
330 return NSS_STATUS_TRYAGAIN;
331 else
332 return NSS_STATUS_NOTFOUND;
333 }
334
335 return NSS_STATUS_SUCCESS;
336 }
0 /* Copyright (C) 1997-2015 Free Software Foundation, Inc.
1 This file is part of the GNU C Library.
2 Contributed by Thorsten Kukuk <kukuk@suse.de>, 1997.
3
4 The GNU C Library is free software; you can redistribute it and/or
5 modify it under the terms of the GNU Lesser General Public
6 License as published by the Free Software Foundation; either
7 version 2.1 of the License, or (at your option) any later version.
8
9 The GNU C Library is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 Lesser General Public License for more details.
13
14 You should have received a copy of the GNU Lesser General Public
15 License along with the GNU C Library; if not, see
16 <http://www.gnu.org/licenses/>. */
17
18 #include <atomic.h>
19 #include <ctype.h>
20 #include <errno.h>
21 #include <inttypes.h>
22 #include <netdb.h>
23 #include <nss.h>
24 #include <string.h>
25 #include <netinet/ether.h>
26 #include <netinet/if_ether.h>
27 #include <rpcsvc/nis.h>
28 #include <bits/libc-lock.h>
29
30 #include "nss-nisplus.h"
31
32 __libc_lock_define_initialized (static, lock)
33
34 static nis_result *result;
35 static nis_name tablename_val;
36 static u_long tablename_len;
37
38
39 #define NISENTRYVAL(idx, col, res) \
40 (NIS_RES_OBJECT (res)[idx].zo_data.objdata_u.en_data.en_cols.en_cols_val[col].ec_value.ec_value_val)
41
42 #define NISENTRYLEN(idx, col, res) \
43 (NIS_RES_OBJECT (res)[idx].zo_data.objdata_u.en_data.en_cols.en_cols_val[col].ec_value.ec_value_len)
44
45 static int
46 _nss_nisplus_parse_etherent (nis_result *result, struct etherent *ether,
47 char *buffer, size_t buflen, int *errnop)
48 {
49 char *p = buffer;
50 size_t room_left = buflen;
51
52 if (result == NULL)
53 return 0;
54
55 if ((result->status != NIS_SUCCESS && result->status != NIS_S_SUCCESS)
56 || NIS_RES_NUMOBJ (result) != 1
57 || __type_of (NIS_RES_OBJECT (result)) != NIS_ENTRY_OBJ
58 || strcmp (NIS_RES_OBJECT (result)->EN_data.en_type,
59 "ethers_tbl") != 0
60 || NIS_RES_OBJECT (result)->EN_data.en_cols.en_cols_len < 2)
61 return 0;
62
63 /* Generate the ether entry format and use the normal parser */
64 if (NISENTRYLEN (0, 0, result) + 1 > room_left)
65 {
66 *errnop = ERANGE;
67 return -1;
68 }
69 char *cp = __stpncpy (p, NISENTRYVAL (0, 0, result),
70 NISENTRYLEN (0, 0, result));
71 *cp = '\0';
72 room_left -= NISENTRYLEN (0, 0, result) + 1;
73 ether->e_name = p;
74
75 struct ether_addr *ea = ether_aton (NISENTRYVAL (0, 1, result));
76 if (ea == NULL)
77 {
78 *errnop = EINVAL;
79 return -2;
80 }
81
82 ether->e_addr = *ea;
83
84 return 1;
85 }
86
87 static enum nss_status
88 _nss_create_tablename (int *errnop)
89 {
90 if (tablename_val == NULL)
91 {
92 const char *local_dir = nis_local_directory ();
93 size_t local_dir_len = strlen (local_dir);
94 static const char prefix[] = "ethers.org_dir.";
95
96 char *p = malloc (sizeof (prefix) + local_dir_len);
97 if (p == NULL)
98 {
99 *errnop = errno;
100 return NSS_STATUS_TRYAGAIN;
101 }
102
103 memcpy (__stpcpy (p, prefix), local_dir, local_dir_len + 1);
104
105 tablename_len = sizeof (prefix) - 1 + local_dir_len;
106
107 atomic_write_barrier ();
108
109 tablename_val = p;
110 }
111 return NSS_STATUS_SUCCESS;
112 }
113
114
115 enum nss_status
116 _nss_nisplus_setetherent (int stayopen)
117 {
118 enum nss_status status;
119 int err;
120
121 status = NSS_STATUS_SUCCESS;
122
123 __libc_lock_lock (lock);
124
125 if (result != NULL)
126 {
127 nis_freeresult (result);
128 result = NULL;
129 }
130
131 if (_nss_create_tablename (&err) != NSS_STATUS_SUCCESS)
132 status = NSS_STATUS_UNAVAIL;
133
134 __libc_lock_unlock (lock);
135
136 return status;
137 }
138
139 enum nss_status
140 _nss_nisplus_endetherent (void)
141 {
142 __libc_lock_lock (lock);
143
144 if (result != NULL)
145 {
146 nis_freeresult (result);
147 result = NULL;
148 }
149
150 __libc_lock_unlock (lock);
151
152 return NSS_STATUS_SUCCESS;
153 }
154
155 static enum nss_status
156 internal_nisplus_getetherent_r (struct etherent *ether, char *buffer,
157 size_t buflen, int *errnop)
158 {
159 if (tablename_val == NULL)
160 {
161 enum nss_status status = _nss_create_tablename (errnop);
162
163 if (status != NSS_STATUS_SUCCESS)
164 return status;
165 }
166
167 /* Get the next entry until we found a correct one. */
168 int parse_res;
169 do
170 {
171 nis_result *saved_result;
172
173 if (result == NULL)
174 {
175 saved_result = NULL;
176 result = nis_first_entry (tablename_val);
177 if (result == NULL)
178 {
179 *errnop = errno;
180 return NSS_STATUS_TRYAGAIN;
181 }
182 if (niserr2nss (result->status) != NSS_STATUS_SUCCESS)
183 return niserr2nss (result->status);
184 }
185 else
186 {
187 saved_result = result;
188 result = nis_next_entry (tablename_val, &result->cookie);
189 if (result == NULL)
190 {
191 *errnop = errno;
192 return NSS_STATUS_TRYAGAIN;
193 }
194 if (niserr2nss (result->status) != NSS_STATUS_SUCCESS)
195 {
196 nis_freeresult (saved_result);
197 return niserr2nss (result->status);
198 }
199 }
200
201 parse_res = _nss_nisplus_parse_etherent (result, ether, buffer,
202 buflen, errnop);
203 if (parse_res == -1)
204 {
205 nis_freeresult (result);
206 result = saved_result;
207 return NSS_STATUS_TRYAGAIN;
208 }
209
210 if (saved_result != NULL)
211 nis_freeresult (saved_result);
212
213 }
214 while (!parse_res);
215
216 return NSS_STATUS_SUCCESS;
217 }
218
219 enum nss_status
220 _nss_nisplus_getetherent_r (struct etherent *result, char *buffer,
221 size_t buflen, int *errnop)
222 {
223 int status;
224
225 __libc_lock_lock (lock);
226
227 status = internal_nisplus_getetherent_r (result, buffer, buflen, errnop);
228
229 __libc_lock_unlock (lock);
230
231 return status;
232 }
233
234 enum nss_status
235 _nss_nisplus_gethostton_r (const char *name, struct etherent *eth,
236 char *buffer, size_t buflen, int *errnop)
237 {
238 if (tablename_val == NULL)
239 {
240 enum nss_status status = _nss_create_tablename (errnop);
241
242 if (status != NSS_STATUS_SUCCESS)
243 return status;
244 }
245
246 if (name == NULL)
247 {
248 *errnop = EINVAL;
249 return NSS_STATUS_UNAVAIL;
250 }
251
252 char buf[strlen (name) + 9 + tablename_len];
253 int olderr = errno;
254
255 snprintf (buf, sizeof (buf), "[name=%s],%s", name, tablename_val);
256
257 nis_result *result = nis_list (buf, FOLLOW_PATH | FOLLOW_LINKS | USE_DGRAM,
258 NULL, NULL);
259
260 if (result == NULL)
261 {
262 *errnop = ENOMEM;
263 return NSS_STATUS_TRYAGAIN;
264 }
265
266 if (__glibc_unlikely (niserr2nss (result->status) != NSS_STATUS_SUCCESS))
267 {
268 enum nss_status status = niserr2nss (result->status);
269 nis_freeresult (result);
270 return status;
271 }
272
273 int parse_res = _nss_nisplus_parse_etherent (result, eth, buffer,
274 buflen, errnop);
275
276 /* We do not need the lookup result anymore. */
277 nis_freeresult (result);
278
279 if (__glibc_unlikely (parse_res < 1))
280 {
281 __set_errno (olderr);
282
283 if (parse_res == -1)
284 return NSS_STATUS_TRYAGAIN;
285
286 return NSS_STATUS_NOTFOUND;
287 }
288
289 return NSS_STATUS_SUCCESS;
290 }
291
292 enum nss_status
293 _nss_nisplus_getntohost_r (const struct ether_addr *addr, struct etherent *eth,
294 char *buffer, size_t buflen, int *errnop)
295 {
296 if (tablename_val == NULL)
297 {
298 __libc_lock_lock (lock);
299
300 enum nss_status status = _nss_create_tablename (errnop);
301
302 __libc_lock_unlock (lock);
303
304 if (status != NSS_STATUS_SUCCESS)
305 return status;
306 }
307
308 if (addr == NULL)
309 {
310 *errnop = EINVAL;
311 return NSS_STATUS_UNAVAIL;
312 }
313
314 char buf[26 + tablename_len];
315
316 snprintf (buf, sizeof (buf),
317 "[addr=%" PRIx8 ":%" PRIx8 ":%" PRIx8 ":%" PRIx8 ":%" PRIx8
318 ":%" PRIx8 "],%s",
319 addr->ether_addr_octet[0], addr->ether_addr_octet[1],
320 addr->ether_addr_octet[2], addr->ether_addr_octet[3],
321 addr->ether_addr_octet[4], addr->ether_addr_octet[5],
322 tablename_val);
323
324 nis_result *result = nis_list (buf, FOLLOW_PATH | FOLLOW_LINKS | USE_DGRAM,
325 NULL, NULL);
326
327 if (result == NULL)
328 {
329 *errnop = ENOMEM;
330 return NSS_STATUS_TRYAGAIN;
331 }
332
333 if (__glibc_unlikely (niserr2nss (result->status) != NSS_STATUS_SUCCESS))
334 {
335 enum nss_status status = niserr2nss (result->status);
336 nis_freeresult (result);
337 return status;
338 }
339
340 int parse_res = _nss_nisplus_parse_etherent (result, eth, buffer,
341 buflen, errnop);
342
343 /* We do not need the lookup result anymore. */
344 nis_freeresult (result);
345
346 if (__glibc_unlikely (parse_res < 1))
347 {
348 if (parse_res == -1)
349 return NSS_STATUS_TRYAGAIN;
350
351 return NSS_STATUS_NOTFOUND;
352 }
353
354 return NSS_STATUS_SUCCESS;
355 }
0 /* Copyright (C) 1997-2015 Free Software Foundation, Inc.
1 This file is part of the GNU C Library.
2 Contributed by Thorsten Kukuk <kukuk@vt.uni-paderborn.de>, 1997.
3
4 The GNU C Library is free software; you can redistribute it and/or
5 modify it under the terms of the GNU Lesser General Public
6 License as published by the Free Software Foundation; either
7 version 2.1 of the License, or (at your option) any later version.
8
9 The GNU C Library is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 Lesser General Public License for more details.
13
14 You should have received a copy of the GNU Lesser General Public
15 License along with the GNU C Library; if not, see
16 <http://www.gnu.org/licenses/>. */
17
18 #include <atomic.h>
19 #include <nss.h>
20 #include <grp.h>
21 #include <ctype.h>
22 #include <errno.h>
23 #include <string.h>
24 #include <bits/libc-lock.h>
25 #include <rpcsvc/nis.h>
26
27 #include "nss-nisplus.h"
28 #include "nisplus-parser.h"
29 #include <libnsl.h>
30 #include <nis_intern.h>
31 #include <nis_xdr.h>
32
33
34 __libc_lock_define_initialized (static, lock);
35
36 /* Connection information. */
37 static ib_request *ibreq;
38 static directory_obj *dir;
39 static dir_binding bptr;
40 static char *tablepath;
41 static char *tableptr;
42 /* Cursor. */
43 static netobj cursor;
44
45
46 nis_name grp_tablename_val attribute_hidden;
47 size_t grp_tablename_len attribute_hidden;
48
49 enum nss_status
50 _nss_grp_create_tablename (int *errnop)
51 {
52 if (grp_tablename_val == NULL)
53 {
54 const char *local_dir = nis_local_directory ();
55 size_t local_dir_len = strlen (local_dir);
56 static const char prefix[] = "group.org_dir.";
57
58 char *p = malloc (sizeof (prefix) + local_dir_len);
59 if (p == NULL)
60 {
61 *errnop = errno;
62 return NSS_STATUS_TRYAGAIN;
63 }
64
65 memcpy (__stpcpy (p, prefix), local_dir, local_dir_len + 1);
66
67 grp_tablename_len = sizeof (prefix) - 1 + local_dir_len;
68
69 atomic_write_barrier ();
70
71 if (atomic_compare_and_exchange_bool_acq (&grp_tablename_val, p, NULL))
72 {
73 /* Another thread already installed the value. */
74 free (p);
75 grp_tablename_len = strlen (grp_tablename_val);
76 }
77 }
78
79 return NSS_STATUS_SUCCESS;
80 }
81
82
83 static void
84 internal_endgrent (void)
85 {
86 __nisbind_destroy (&bptr);
87 memset (&bptr, '\0', sizeof (bptr));
88
89 nis_free_directory (dir);
90 dir = NULL;
91
92 nis_free_request (ibreq);
93 ibreq = NULL;
94
95 xdr_free ((xdrproc_t) xdr_netobj, (char *) &cursor);
96 memset (&cursor, '\0', sizeof (cursor));
97
98 free (tablepath);
99 tableptr = tablepath = NULL;
100 }
101
102
103 static enum nss_status
104 internal_setgrent (int *errnop)
105 {
106 enum nss_status status = NSS_STATUS_SUCCESS;
107
108 if (grp_tablename_val == NULL)
109 status = _nss_grp_create_tablename (errnop);
110
111 if (status == NSS_STATUS_SUCCESS)
112 {
113 ibreq = __create_ib_request (grp_tablename_val, 0);
114 if (ibreq == NULL)
115 {
116 *errnop = errno;
117 return NSS_STATUS_TRYAGAIN;
118 }
119
120 nis_error retcode = __prepare_niscall (grp_tablename_val, &dir, &bptr, 0);
121 if (retcode != NIS_SUCCESS)
122 {
123 nis_free_request (ibreq);
124 ibreq = NULL;
125 status = niserr2nss (retcode);
126 }
127 }
128
129 return status;
130 }
131
132
133 enum nss_status
134 _nss_nisplus_setgrent (int stayopen)
135 {
136 enum nss_status status;
137
138 __libc_lock_lock (lock);
139
140 internal_endgrent ();
141
142 // XXX We need to be able to set errno. Pass in new parameter.
143 int err;
144 status = internal_setgrent (&err);
145
146 __libc_lock_unlock (lock);
147
148 return status;
149 }
150
151
152 enum nss_status
153 _nss_nisplus_endgrent (void)
154 {
155 __libc_lock_lock (lock);
156
157 internal_endgrent ();
158
159 __libc_lock_unlock (lock);
160
161 return NSS_STATUS_SUCCESS;
162 }
163
164
165 static enum nss_status
166 internal_nisplus_getgrent_r (struct group *gr, char *buffer, size_t buflen,
167 int *errnop)
168 {
169 int parse_res = -1;
170 enum nss_status retval = NSS_STATUS_SUCCESS;
171
172 /* Get the next entry until we found a correct one. */
173 do
174 {
175 nis_error status;
176 nis_result result;
177 memset (&result, '\0', sizeof (result));
178
179 if (cursor.n_bytes == NULL)
180 {
181 if (ibreq == NULL)
182 {
183 retval = internal_setgrent (errnop);
184 if (retval != NSS_STATUS_SUCCESS)
185 return retval;
186 }
187
188 status = __do_niscall3 (&bptr, NIS_IBFIRST,
189 (xdrproc_t) _xdr_ib_request,
190 (caddr_t) ibreq,
191 (xdrproc_t) _xdr_nis_result,
192 (caddr_t) &result,
193 0, NULL);
194 }
195 else
196 {
197 ibreq->ibr_cookie.n_bytes = cursor.n_bytes;
198 ibreq->ibr_cookie.n_len = cursor.n_len;
199
200 status = __do_niscall3 (&bptr, NIS_IBNEXT,
201 (xdrproc_t) _xdr_ib_request,
202 (caddr_t) ibreq,
203 (xdrproc_t) _xdr_nis_result,
204 (caddr_t) &result,
205 0, NULL);
206
207 ibreq->ibr_cookie.n_bytes = NULL;
208 ibreq->ibr_cookie.n_len = 0;
209 }
210
211 if (status != NIS_SUCCESS)
212 return niserr2nss (status);
213
214 if (NIS_RES_STATUS (&result) == NIS_NOTFOUND)
215 {
216 /* No more entries on this server. This means we have to go
217 to the next server on the path. */
218 status = __follow_path (&tablepath, &tableptr, ibreq, &bptr);
219 if (status != NIS_SUCCESS)
220 return niserr2nss (status);
221
222 directory_obj *newdir = NULL;
223 dir_binding newbptr;
224 status = __prepare_niscall (ibreq->ibr_name, &newdir, &newbptr, 0);
225 if (status != NIS_SUCCESS)
226 return niserr2nss (status);
227
228 nis_free_directory (dir);
229 dir = newdir;
230 __nisbind_destroy (&bptr);
231 bptr = newbptr;
232
233 xdr_free ((xdrproc_t) xdr_netobj, (char *) &result.cookie);
234 result.cookie.n_bytes = NULL;
235 result.cookie.n_len = 0;
236 parse_res = 0;
237 goto next;
238 }
239 else if (NIS_RES_STATUS (&result) != NIS_SUCCESS)
240 return niserr2nss (NIS_RES_STATUS (&result));
241
242 parse_res = _nss_nisplus_parse_grent (&result, gr,
243 buffer, buflen, errnop);
244 if (__glibc_unlikely (parse_res == -1))
245 {
246 *errnop = ERANGE;
247 retval = NSS_STATUS_TRYAGAIN;
248 goto freeres;
249 }
250
251 next:
252 /* Free the old cursor. */
253 xdr_free ((xdrproc_t) xdr_netobj, (char *) &cursor);
254 /* Remember the new one. */
255 cursor.n_bytes = result.cookie.n_bytes;
256 cursor.n_len = result.cookie.n_len;
257 /* Free the result structure. NB: we do not remove the cookie. */
258 result.cookie.n_bytes = NULL;
259 result.cookie.n_len = 0;
260 freeres:
261 xdr_free ((xdrproc_t) _xdr_nis_result, (char *) &result);
262 memset (&result, '\0', sizeof (result));
263 }
264 while (!parse_res);
265
266 return retval;
267 }
268
269 enum nss_status
270 _nss_nisplus_getgrent_r (struct group *result, char *buffer, size_t buflen,
271 int *errnop)
272 {
273 int status;
274
275 __libc_lock_lock (lock);
276
277 status = internal_nisplus_getgrent_r (result, buffer, buflen, errnop);
278
279 __libc_lock_unlock (lock);
280
281 return status;
282 }
283
284 enum nss_status
285 _nss_nisplus_getgrnam_r (const char *name, struct group *gr,
286 char *buffer, size_t buflen, int *errnop)
287 {
288 int parse_res;
289
290 if (grp_tablename_val == NULL)
291 {
292 enum nss_status status = _nss_grp_create_tablename (errnop);
293
294 if (status != NSS_STATUS_SUCCESS)
295 return status;
296 }
297
298 if (name == NULL)
299 {
300 *errnop = EINVAL;
301 return NSS_STATUS_NOTFOUND;
302 }
303
304 nis_result *result;
305 char buf[strlen (name) + 9 + grp_tablename_len];
306 int olderr = errno;
307
308 snprintf (buf, sizeof (buf), "[name=%s],%s", name, grp_tablename_val);
309
310 result = nis_list (buf, FOLLOW_LINKS | FOLLOW_PATH, NULL, NULL);
311
312 if (result == NULL)
313 {
314 *errnop = ENOMEM;
315 return NSS_STATUS_TRYAGAIN;
316 }
317
318 if (__glibc_unlikely (niserr2nss (result->status) != NSS_STATUS_SUCCESS))
319 {
320 enum nss_status status = niserr2nss (result->status);
321
322 nis_freeresult (result);
323 return status;
324 }
325
326 parse_res = _nss_nisplus_parse_grent (result, gr, buffer, buflen, errnop);
327 nis_freeresult (result);
328 if (__glibc_unlikely (parse_res < 1))
329 {
330 if (parse_res == -1)
331 {
332 *errnop = ERANGE;
333 return NSS_STATUS_TRYAGAIN;
334 }
335 else
336 {
337 __set_errno (olderr);
338 return NSS_STATUS_NOTFOUND;
339 }
340 }
341
342 return NSS_STATUS_SUCCESS;
343 }
344
345 enum nss_status
346 _nss_nisplus_getgrgid_r (const gid_t gid, struct group *gr,
347 char *buffer, size_t buflen, int *errnop)
348 {
349 if (grp_tablename_val == NULL)
350 {
351 enum nss_status status = _nss_grp_create_tablename (errnop);
352
353 if (status != NSS_STATUS_SUCCESS)
354 return status;
355 }
356
357 int parse_res;
358 nis_result *result;
359 char buf[8 + 3 * sizeof (unsigned long int) + grp_tablename_len];
360 int olderr = errno;
361
362 snprintf (buf, sizeof (buf), "[gid=%lu],%s",
363 (unsigned long int) gid, grp_tablename_val);
364
365 result = nis_list (buf, FOLLOW_PATH | FOLLOW_LINKS, NULL, NULL);
366
367 if (result == NULL)
368 {
369 *errnop = ENOMEM;
370 return NSS_STATUS_TRYAGAIN;
371 }
372
373 if (__glibc_unlikely (niserr2nss (result->status) != NSS_STATUS_SUCCESS))
374 {
375 enum nss_status status = niserr2nss (result->status);
376
377 __set_errno (olderr);
378
379 nis_freeresult (result);
380 return status;
381 }
382
383 parse_res = _nss_nisplus_parse_grent (result, gr, buffer, buflen, errnop);
384
385 nis_freeresult (result);
386 if (__glibc_unlikely (parse_res < 1))
387 {
388 __set_errno (olderr);
389
390 if (parse_res == -1)
391 {
392 *errnop = ERANGE;
393 return NSS_STATUS_TRYAGAIN;
394 }
395 else
396 return NSS_STATUS_NOTFOUND;
397 }
398
399 return NSS_STATUS_SUCCESS;
400 }
0 /* Copyright (C) 1997-2015 Free Software Foundation, Inc.
1 This file is part of the GNU C Library.
2 Contributed by Thorsten Kukuk <kukuk@suse.de>, 1997.
3
4 The GNU C Library is free software; you can redistribute it and/or
5 modify it under the terms of the GNU Lesser General Public
6 License as published by the Free Software Foundation; either
7 version 2.1 of the License, or (at your option) any later version.
8
9 The GNU C Library is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 Lesser General Public License for more details.
13
14 You should have received a copy of the GNU Lesser General Public
15 License along with the GNU C Library; if not, see
16 <http://www.gnu.org/licenses/>. */
17
18 #include <assert.h>
19 #include <atomic.h>
20 #include <ctype.h>
21 #include <errno.h>
22 #include <netdb.h>
23 #include <nss.h>
24 #include <string.h>
25 #include <arpa/inet.h>
26 #include <netinet/in.h>
27 #include <rpcsvc/nis.h>
28 #include <bits/libc-lock.h>
29
30 #include "nss-nisplus.h"
31
32 __libc_lock_define_initialized (static, lock)
33
34 static nis_result *result;
35 static nis_name tablename_val;
36 static u_long tablename_len;
37
38 #define NISENTRYVAL(idx, col, res) \
39 (NIS_RES_OBJECT (res)[idx].EN_data.en_cols.en_cols_val[col].ec_value.ec_value_val)
40
41 #define NISENTRYLEN(idx, col, res) \
42 (NIS_RES_OBJECT (res)[idx].EN_data.en_cols.en_cols_val[col].ec_value.ec_value_len)
43
44 /* Get implementation for some internal functions. */
45 #include <resolv/mapv4v6addr.h>
46
47
48 static int
49 _nss_nisplus_parse_hostent (nis_result *result, int af, struct hostent *host,
50 char *buffer, size_t buflen, int *errnop,
51 int flags)
52 {
53 unsigned int i;
54 char *first_unused = buffer;
55 size_t room_left = buflen;
56
57 if (result == NULL)
58 return 0;
59
60 if ((result->status != NIS_SUCCESS && result->status != NIS_S_SUCCESS)
61 || __type_of (NIS_RES_OBJECT (result)) != NIS_ENTRY_OBJ
62 || strcmp (NIS_RES_OBJECT (result)[0].EN_data.en_type, "hosts_tbl") != 0
63 || NIS_RES_OBJECT (result)[0].EN_data.en_cols.en_cols_len < 4)
64 return 0;
65
66 char *data = first_unused;
67
68 if (room_left < (af != AF_INET || (flags & AI_V4MAPPED) != 0
69 ? IN6ADDRSZ : INADDRSZ))
70 {
71 no_more_room:
72 *errnop = ERANGE;
73 return -1;
74 }
75
76 /* Parse address. */
77 if (af != AF_INET6
78 && inet_pton (AF_INET, NISENTRYVAL (0, 2, result), data) > 0)
79 {
80 assert ((flags & AI_V4MAPPED) == 0 || af != AF_UNSPEC);
81 if (flags & AI_V4MAPPED)
82 {
83 map_v4v6_address (data, data);
84 host->h_addrtype = AF_INET6;
85 host->h_length = IN6ADDRSZ;
86 }
87 else
88 {
89 host->h_addrtype = AF_INET;
90 host->h_length = INADDRSZ;
91 }
92 }
93 else if (af != AF_INET
94 && inet_pton (AF_INET6, NISENTRYVAL (0, 2, result), data) > 0)
95 {
96 host->h_addrtype = AF_INET6;
97 host->h_length = IN6ADDRSZ;
98 }
99 else
100 /* Illegal address: ignore line. */
101 return 0;
102
103 first_unused += host->h_length;
104 room_left -= host->h_length;
105
106 if (NISENTRYLEN (0, 0, result) + 1 > room_left)
107 goto no_more_room;
108
109 host->h_name = first_unused;
110 first_unused = __stpncpy (first_unused, NISENTRYVAL (0, 0, result),
111 NISENTRYLEN (0, 0, result));
112 *first_unused++ = '\0';
113
114 room_left -= NISENTRYLEN (0, 0, result) + 1;
115 char *line = first_unused;
116
117 /* When this is a call to gethostbyname4_r we do not need the aliases. */
118 if (af != AF_UNSPEC)
119 {
120 /* XXX Rewrite at some point to allocate the array first and then
121 copy the strings. It is wasteful to first concatenate the strings
122 to just split them again later. */
123 for (i = 0; i < NIS_RES_NUMOBJ (result); ++i)
124 {
125 if (strcmp (NISENTRYVAL (i, 1, result), host->h_name) != 0)
126 {
127 if (NISENTRYLEN (i, 1, result) + 2 > room_left)
128 goto no_more_room;
129
130 *first_unused++ = ' ';
131 first_unused = __stpncpy (first_unused,
132 NISENTRYVAL (i, 1, result),
133 NISENTRYLEN (i, 1, result));
134 *first_unused = '\0';
135 room_left -= NISENTRYLEN (i, 1, result) + 1;
136 }
137 }
138 *first_unused++ = '\0';
139 }
140
141 /* Adjust the pointer so it is aligned for
142 storing pointers. */
143 size_t adjust = ((__alignof__ (char *)
144 - (first_unused - (char *) 0) % __alignof__ (char *))
145 % __alignof__ (char *));
146 if (room_left < adjust + 3 * sizeof (char *))
147 goto no_more_room;
148 first_unused += adjust;
149 room_left -= adjust;
150 host->h_addr_list = (char **) first_unused;
151
152 room_left -= 3 * sizeof (char *);
153 host->h_addr_list[0] = data;
154 host->h_addr_list[1] = NULL;
155 host->h_aliases = &host->h_addr_list[2];
156
157 /* When this is a call to gethostbyname4_r we do not need the aliases. */
158 if (af != AF_UNSPEC)
159 {
160 i = 0;
161 while (*line != '\0')
162 {
163 /* Skip leading blanks. */
164 while (isspace (*line))
165 ++line;
166
167 if (*line == '\0')
168 break;
169
170 if (room_left < sizeof (char *))
171 goto no_more_room;
172
173 room_left -= sizeof (char *);
174 host->h_aliases[i++] = line;
175
176 while (*line != '\0' && *line != ' ')
177 ++line;
178
179 if (*line == ' ')
180 *line++ = '\0';
181 }
182
183 host->h_aliases[i] = NULL;
184 }
185
186 return 1;
187 }
188
189
190 static enum nss_status
191 _nss_create_tablename (int *errnop)
192 {
193 if (tablename_val == NULL)
194 {
195 const char *local_dir = nis_local_directory ();
196 size_t local_dir_len = strlen (local_dir);
197 static const char prefix[] = "hosts.org_dir.";
198
199 char *p = malloc (sizeof (prefix) + local_dir_len);
200 if (p == NULL)
201 {
202 *errnop = errno;
203 return NSS_STATUS_TRYAGAIN;
204 }
205
206 memcpy (__stpcpy (p, prefix), local_dir, local_dir_len + 1);
207
208 tablename_len = sizeof (prefix) - 1 + local_dir_len;
209
210 atomic_write_barrier ();
211
212 tablename_val = p;
213 }
214
215 return NSS_STATUS_SUCCESS;
216 }
217
218
219 enum nss_status
220 _nss_nisplus_sethostent (int stayopen)
221 {
222 enum nss_status status = NSS_STATUS_SUCCESS;
223 int err;
224
225 __libc_lock_lock (lock);
226
227 if (result != NULL)
228 {
229 nis_freeresult (result);
230 result = NULL;
231 }
232
233 if (tablename_val == NULL)
234 status = _nss_create_tablename (&err);
235
236 __libc_lock_unlock (lock);
237
238 return status;
239 }
240
241
242 enum nss_status
243 _nss_nisplus_endhostent (void)
244 {
245 __libc_lock_lock (lock);
246
247 if (result != NULL)
248 {
249 nis_freeresult (result);
250 result = NULL;
251 }
252
253 __libc_lock_unlock (lock);
254
255 return NSS_STATUS_SUCCESS;
256 }
257
258
259 static enum nss_status
260 internal_nisplus_gethostent_r (struct hostent *host, char *buffer,
261 size_t buflen, int *errnop, int *herrnop)
262 {
263 int parse_res;
264
265 /* Get the next entry until we found a correct one. */
266 do
267 {
268 nis_result *saved_res;
269
270 if (result == NULL)
271 {
272 saved_res = NULL;
273 if (tablename_val == NULL)
274 {
275 enum nss_status status = _nss_create_tablename (errnop);
276
277 if (status != NSS_STATUS_SUCCESS)
278 return status;
279 }
280
281 result = nis_first_entry (tablename_val);
282 if (result == NULL)
283 {
284 *errnop = errno;
285 return NSS_STATUS_TRYAGAIN;
286 }
287 if (niserr2nss (result->status) != NSS_STATUS_SUCCESS)
288 {
289 enum nss_status retval = niserr2nss (result->status);
290 if (retval == NSS_STATUS_TRYAGAIN)
291 {
292 *herrnop = NETDB_INTERNAL;
293 *errnop = errno;
294 }
295 return retval;
296 }
297
298 }
299 else
300 {
301 saved_res = result;
302 result = nis_next_entry (tablename_val, &result->cookie);
303 if (result == NULL)
304 {
305 *errnop = errno;
306 return NSS_STATUS_TRYAGAIN;
307 }
308 if (niserr2nss (result->status) != NSS_STATUS_SUCCESS)
309 {
310 enum nss_status retval= niserr2nss (result->status);
311
312 nis_freeresult (result);
313 result = saved_res;
314 if (retval == NSS_STATUS_TRYAGAIN)
315 {
316 *herrnop = NETDB_INTERNAL;
317 *errnop = errno;
318 }
319 return retval;
320 }
321 }
322
323 if (_res.options & RES_USE_INET6)
324 parse_res = _nss_nisplus_parse_hostent (result, AF_INET6, host, buffer,
325 buflen, errnop, AI_V4MAPPED);
326 else
327 parse_res = _nss_nisplus_parse_hostent (result, AF_INET, host, buffer,
328 buflen, errnop, 0);
329
330 if (parse_res == -1)
331 {
332 nis_freeresult (result);
333 result = saved_res;
334 *herrnop = NETDB_INTERNAL;
335 *errnop = ERANGE;
336 return NSS_STATUS_TRYAGAIN;
337 }
338 if (saved_res != NULL)
339 nis_freeresult (saved_res);
340
341 } while (!parse_res);
342
343 return NSS_STATUS_SUCCESS;
344 }
345
346
347 enum nss_status
348 _nss_nisplus_gethostent_r (struct hostent *result, char *buffer,
349 size_t buflen, int *errnop, int *herrnop)
350 {
351 int status;
352
353 __libc_lock_lock (lock);
354
355 status = internal_nisplus_gethostent_r (result, buffer, buflen, errnop,
356 herrnop);
357
358 __libc_lock_unlock (lock);
359
360 return status;
361 }
362
363
364 static enum nss_status
365 get_tablename (int *herrnop)
366 {
367 __libc_lock_lock (lock);
368
369 enum nss_status status = _nss_create_tablename (herrnop);
370
371 __libc_lock_unlock (lock);
372
373 if (status != NSS_STATUS_SUCCESS)
374 *herrnop = NETDB_INTERNAL;
375
376 return status;
377 }
378
379
380 static enum nss_status
381 internal_gethostbyname2_r (const char *name, int af, struct hostent *host,
382 char *buffer, size_t buflen, int *errnop,
383 int *herrnop, int flags)
384 {
385 if (tablename_val == NULL)
386 {
387 enum nss_status status = get_tablename (herrnop);
388 if (status != NSS_STATUS_SUCCESS)
389 return status;
390 }
391
392 if (name == NULL)
393 {
394 *errnop = EINVAL;
395 *herrnop = NETDB_INTERNAL;
396 return NSS_STATUS_NOTFOUND;
397 }
398
399 char buf[strlen (name) + 10 + tablename_len];
400 int olderr = errno;
401
402 /* Search at first in the alias list, and use the correct name
403 for the next search. */
404 snprintf (buf, sizeof (buf), "[name=%s],%s", name, tablename_val);
405 nis_result *result = nis_list (buf, FOLLOW_PATH | FOLLOW_LINKS, NULL, NULL);
406
407 if (result != NULL)
408 {
409 /* If we did not find it, try it as original name. But if the
410 database is correct, we should find it in the first case, too. */
411 char *bufptr = buf;
412 size_t buflen = sizeof (buf);
413
414 if ((result->status == NIS_SUCCESS || result->status == NIS_S_SUCCESS)
415 && __type_of (result->objects.objects_val) == NIS_ENTRY_OBJ
416 && strcmp (result->objects.objects_val->EN_data.en_type,
417 "hosts_tbl") == 0
418 && result->objects.objects_val->EN_data.en_cols.en_cols_len >= 3)
419 {
420 /* We need to allocate a new buffer since there is no
421 guarantee the returned alias name has a length limit. */
422 name = NISENTRYVAL(0, 0, result);
423 size_t buflen = strlen (name) + 10 + tablename_len;
424 bufptr = alloca (buflen);
425 }
426
427 snprintf (bufptr, buflen, "[cname=%s],%s", name, tablename_val);
428
429 nis_freeresult (result);
430 result = nis_list (bufptr, FOLLOW_PATH | FOLLOW_LINKS, NULL, NULL);
431 }
432
433 if (result == NULL)
434 {
435 *errnop = ENOMEM;
436 *herrnop = NETDB_INTERNAL;
437 return NSS_STATUS_TRYAGAIN;
438 }
439
440 int retval = niserr2nss (result->status);
441 if (__glibc_unlikely (retval != NSS_STATUS_SUCCESS))
442 {
443 if (retval == NSS_STATUS_TRYAGAIN)
444 {
445 *errnop = errno;
446 *herrnop = TRY_AGAIN;
447 }
448 else
449 {
450 __set_errno (olderr);
451 *herrnop = NETDB_INTERNAL;
452 }
453 nis_freeresult (result);
454 return retval;
455 }
456
457 int parse_res = _nss_nisplus_parse_hostent (result, af, host, buffer,
458 buflen, errnop, flags);
459
460 nis_freeresult (result);
461
462 if (parse_res > 0)
463 return NSS_STATUS_SUCCESS;
464
465 *herrnop = NETDB_INTERNAL;
466 if (parse_res == -1)
467 {
468 *errnop = ERANGE;
469 return NSS_STATUS_TRYAGAIN;
470 }
471
472 __set_errno (olderr);
473 return NSS_STATUS_NOTFOUND;
474 }
475
476
477 enum nss_status
478 _nss_nisplus_gethostbyname2_r (const char *name, int af, struct hostent *host,
479 char *buffer, size_t buflen, int *errnop,
480 int *herrnop)
481 {
482 if (af != AF_INET && af != AF_INET6)
483 {
484 *herrnop = HOST_NOT_FOUND;
485 return NSS_STATUS_NOTFOUND;
486 }
487
488 return internal_gethostbyname2_r (name, af, host, buffer, buflen, errnop,
489 herrnop,
490 ((_res.options & RES_USE_INET6) ? AI_V4MAPPED : 0));
491 }
492
493
494 enum nss_status
495 _nss_nisplus_gethostbyname_r (const char *name, struct hostent *host,
496 char *buffer, size_t buflen, int *errnop,
497 int *h_errnop)
498 {
499 if (_res.options & RES_USE_INET6)
500 {
501 enum nss_status status;
502
503 status = internal_gethostbyname2_r (name, AF_INET6, host, buffer,
504 buflen, errnop, h_errnop,
505 AI_V4MAPPED);
506 if (status == NSS_STATUS_SUCCESS)
507 return status;
508 }
509
510 return internal_gethostbyname2_r (name, AF_INET, host, buffer,
511 buflen, errnop, h_errnop, 0);
512 }
513
514
515 enum nss_status
516 _nss_nisplus_gethostbyaddr_r (const void *addr, socklen_t addrlen, int af,
517 struct hostent *host, char *buffer,
518 size_t buflen, int *errnop, int *herrnop)
519 {
520 if (tablename_val == NULL)
521 {
522 enum nss_status status = get_tablename (herrnop);
523 if (status != NSS_STATUS_SUCCESS)
524 return status;
525 }
526
527 if (addr == NULL)
528 return NSS_STATUS_NOTFOUND;
529
530 char buf[24 + tablename_len];
531 int retval, parse_res;
532 int olderr = errno;
533
534 snprintf (buf, sizeof (buf), "[addr=%s],%s",
535 inet_ntoa (*(const struct in_addr *) addr), tablename_val);
536 nis_result *result = nis_list (buf, FOLLOW_PATH | FOLLOW_LINKS, NULL, NULL);
537
538 if (result == NULL)
539 {
540 __set_errno (ENOMEM);
541 return NSS_STATUS_TRYAGAIN;
542 }
543
544 retval = niserr2nss (result->status);
545 if (__glibc_unlikely (retval != NSS_STATUS_SUCCESS))
546 {
547 if (retval == NSS_STATUS_TRYAGAIN)
548 {
549 *errnop = errno;
550 *herrnop = NETDB_INTERNAL;
551 }
552 else
553 __set_errno (olderr);
554 nis_freeresult (result);
555 return retval;
556 }
557
558 parse_res = _nss_nisplus_parse_hostent (result, af, host,
559 buffer, buflen, errnop,
560 ((_res.options & RES_USE_INET6)
561 ? AI_V4MAPPED : 0));
562 nis_freeresult (result);
563
564 if (parse_res > 0)
565 return NSS_STATUS_SUCCESS;
566
567 *herrnop = NETDB_INTERNAL;
568 if (parse_res == -1)
569 {
570 *errnop = ERANGE;
571 return NSS_STATUS_TRYAGAIN;
572 }
573
574 __set_errno (olderr);
575 return NSS_STATUS_NOTFOUND;
576 }
577
578
579 enum nss_status
580 _nss_nisplus_gethostbyname4_r (const char *name, struct gaih_addrtuple **pat,
581 char *buffer, size_t buflen, int *errnop,
582 int *herrnop, int32_t *ttlp)
583 {
584 struct hostent host;
585
586 enum nss_status status = internal_gethostbyname2_r (name, AF_UNSPEC, &host,
587 buffer, buflen,
588 errnop, herrnop, 0);
589 if (__glibc_likely (status == NSS_STATUS_SUCCESS))
590 {
591 if (*pat == NULL)
592 {
593 uintptr_t pad = (-(uintptr_t) buffer
594 % __alignof__ (struct gaih_addrtuple));
595 buffer += pad;
596 buflen = buflen > pad ? buflen - pad : 0;
597
598 if (__glibc_unlikely (buflen < sizeof (struct gaih_addrtuple)))
599 {
600 free (result);
601 *errnop = ERANGE;
602 *herrnop = NETDB_INTERNAL;
603 return NSS_STATUS_TRYAGAIN;
604 }
605 }
606
607 (*pat)->next = NULL;
608 (*pat)->name = host.h_name;
609 (*pat)->family = host.h_addrtype;
610
611 memcpy ((*pat)->addr, host.h_addr_list[0], host.h_length);
612 (*pat)->scopeid = 0;
613 assert (host.h_addr_list[1] == NULL);
614 }
615
616 return status;
617 }
0 /* Copyright (C) 1997-2015 Free Software Foundation, Inc.
1 This file is part of the GNU C Library.
2
3 The GNU C Library is free software; you can redistribute it and/or
4 modify it under the terms of the GNU Lesser General Public
5 License as published by the Free Software Foundation; either
6 version 2.1 of the License, or (at your option) any later version.
7
8 The GNU C Library is distributed in the hope that it will be useful,
9 but WITHOUT ANY WARRANTY; without even the implied warranty of
10 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 Lesser General Public License for more details.
12
13 You should have received a copy of the GNU Lesser General Public
14 License along with the GNU C Library; if not, see
15 <http://www.gnu.org/licenses/>. */
16
17 #include <atomic.h>
18 #include <nss.h>
19 #include <grp.h>
20 #include <ctype.h>
21 #include <errno.h>
22 #include <string.h>
23 #include <bits/libc-lock.h>
24 #include <rpcsvc/nis.h>
25
26 #include "nss-nisplus.h"
27 #include "nisplus-parser.h"
28 #include <libnsl.h>
29 #include <nis_intern.h>
30 #include <nis_xdr.h>
31
32 #define NISOBJVAL(col, obj) \
33 ((obj)->EN_data.en_cols.en_cols_val[col].ec_value.ec_value_val)
34
35 #define NISOBJLEN(col, obj) \
36 ((obj)->EN_data.en_cols.en_cols_val[col].ec_value.ec_value_len)
37
38 extern nis_name grp_tablename_val attribute_hidden;
39 extern size_t grp_tablename_len attribute_hidden;
40 extern enum nss_status _nss_grp_create_tablename (int *errnop);
41
42
43 enum nss_status
44 _nss_nisplus_initgroups_dyn (const char *user, gid_t group, long int *start,
45 long int *size, gid_t **groupsp, long int limit,
46 int *errnop)
47 {
48 if (grp_tablename_val == NULL)
49 {
50 enum nss_status status = _nss_grp_create_tablename (errnop);
51
52 if (status != NSS_STATUS_SUCCESS)
53 return status;
54 }
55
56 nis_result *result;
57 char buf[strlen (user) + 12 + grp_tablename_len];
58
59 snprintf (buf, sizeof (buf), "[members=%s],%s", user, grp_tablename_val);
60
61 result = nis_list (buf, FOLLOW_LINKS | FOLLOW_PATH | ALL_RESULTS, NULL, NULL);
62
63 if (result == NULL)
64 {
65 *errnop = ENOMEM;
66 return NSS_STATUS_TRYAGAIN;
67 }
68
69 if (__glibc_unlikely (niserr2nss (result->status) != NSS_STATUS_SUCCESS))
70 {
71 enum nss_status status = niserr2nss (result->status);
72
73 nis_freeresult (result);
74 return status;
75 }
76
77 if (NIS_RES_NUMOBJ (result) == 0)
78 {
79 errout:
80 nis_freeresult (result);
81 return NSS_STATUS_NOTFOUND;
82 }
83
84 gid_t *groups = *groupsp;
85 nis_object *obj = NIS_RES_OBJECT (result);
86 for (unsigned int cnt = 0; cnt < NIS_RES_NUMOBJ (result); ++cnt, ++obj)
87 {
88 if (__type_of (obj) != NIS_ENTRY_OBJ
89 || strcmp (obj->EN_data.en_type, "group_tbl") != 0
90 || obj->EN_data.en_cols.en_cols_len < 4)
91 continue;
92
93 char *numstr = NISOBJVAL (2, obj);
94 size_t len = NISOBJLEN (2, obj);
95 if (len == 0 || numstr[0] == '\0')
96 continue;
97
98 gid_t gid;
99 char *endp;
100 if (__glibc_unlikely (numstr[len - 1] != '\0'))
101 {
102 char numstrbuf[len + 1];
103 memcpy (numstrbuf, numstr, len);
104 numstrbuf[len] = '\0';
105 gid = strtoul (numstrbuf, &endp, 10);
106 if (*endp)
107 continue;
108 }
109 else
110 {
111 gid = strtoul (numstr, &endp, 10);
112 if (*endp)
113 continue;
114 }
115
116 if (gid == group)
117 continue;
118
119 /* Insert this group. */
120 if (*start == *size)
121 {
122 /* Need a bigger buffer. */
123 long int newsize;
124
125 if (limit > 0 && *size == limit)
126 /* We reached the maximum. */
127 break;
128
129 if (limit <= 0)
130 newsize = 2 * *size;
131 else
132 newsize = MIN (limit, 2 * *size);
133
134 gid_t *newgroups = realloc (groups, newsize * sizeof (*groups));
135 if (newgroups == NULL)
136 goto errout;
137 *groupsp = groups = newgroups;
138 *size = newsize;
139 }
140
141 groups[*start] = gid;
142 *start += 1;
143 }
144
145 nis_freeresult (result);
146 return NSS_STATUS_SUCCESS;
147 }
0 /* Copyright (C) 1997-2015 Free Software Foundation, Inc.
1 This file is part of the GNU C Library.
2 Contributed by Thorsten Kukuk <kukuk@vt.uni-paderborn.de>, 1997.
3
4 The GNU C Library is free software; you can redistribute it and/or
5 modify it under the terms of the GNU Lesser General Public
6 License as published by the Free Software Foundation; either
7 version 2.1 of the License, or (at your option) any later version.
8
9 The GNU C Library is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 Lesser General Public License for more details.
13
14 You should have received a copy of the GNU Lesser General Public
15 License along with the GNU C Library; if not, see
16 <http://www.gnu.org/licenses/>. */
17
18 #include <nss.h>
19 #include <errno.h>
20 #include <ctype.h>
21 #include <netdb.h>
22 #include <string.h>
23 #include <netgroup.h>
24 #include <rpcsvc/nis.h>
25
26 #include "nss-nisplus.h"
27
28 #define NISENTRYVAL(idx, col, res) \
29 (NIS_RES_OBJECT (res)[idx].EN_data.en_cols.en_cols_val[col].ec_value.ec_value_val)
30
31 #define NISENTRYLEN(idx, col, res) \
32 (NIS_RES_OBJECT (res)[idx].EN_data.en_cols.en_cols_val[col].ec_value.ec_value_len)
33
34 enum nss_status
35 _nss_nisplus_getnetgrent_r (struct __netgrent *result, char *buffer,
36 size_t buflen, int *errnop)
37 {
38 enum nss_status status;
39
40 /* Some sanity checks. */
41 if (result->data == NULL || result->data_size == 0)
42 return NSS_STATUS_NOTFOUND;
43
44 if (result->position == result->data_size)
45 return result->first ? NSS_STATUS_NOTFOUND : NSS_STATUS_RETURN;
46
47 unsigned int entrylen
48 = NISENTRYLEN (result->position, 1, (nis_result *) result->data);
49 if (entrylen > 0)
50 {
51 /* We have a list of other netgroups. */
52
53 result->type = group_val;
54 if (entrylen >= buflen)
55 {
56 *errnop = ERANGE;
57 return NSS_STATUS_TRYAGAIN;
58 }
59 strncpy (buffer, NISENTRYVAL (result->position, 1,
60 (nis_result *) result->data),
61 entrylen);
62 buffer[entrylen] = '\0';
63 result->val.group = buffer;
64 ++result->position;
65 result->first = 0;
66
67 return NSS_STATUS_SUCCESS;
68 }
69
70 /* Before we can copy the entry to the private buffer we have to make
71 sure it is big enough. */
72 unsigned int hostlen
73 = NISENTRYLEN (result->position, 2, (nis_result *) result->data);
74 unsigned int userlen
75 = NISENTRYLEN (result->position, 3, (nis_result *) result->data);
76 unsigned int domainlen
77 = NISENTRYLEN (result->position, 4, (nis_result *) result->data);
78 if (hostlen + userlen + domainlen + 6 > buflen)
79 {
80 *errnop = ERANGE;
81 status = NSS_STATUS_TRYAGAIN;
82 }
83 else
84 {
85 char *cp = buffer;
86
87 result->type = triple_val;
88
89 if (hostlen == 0 ||
90 NISENTRYVAL (result->position, 2,
91 (nis_result *) result->data)[0] == '\0')
92 result->val.triple.host = NULL;
93 else
94 {
95 result->val.triple.host = cp;
96 cp = __stpncpy (cp, NISENTRYVAL (result->position, 2,
97 (nis_result *) result->data),
98 hostlen);
99 *cp++ = '\0';
100 }
101
102 if (userlen == 0 ||
103 NISENTRYVAL (result->position, 3,
104 (nis_result *) result->data)[0] == '\0')
105 result->val.triple.user = NULL;
106 else
107 {
108 result->val.triple.user = cp;
109 cp = __stpncpy (cp, NISENTRYVAL (result->position, 3,
110 (nis_result *) result->data),
111 userlen);
112 *cp++ = '\0';
113 }
114
115 if (domainlen == 0 ||
116 NISENTRYVAL (result->position, 4,
117 (nis_result *) result->data)[0] == '\0')
118 result->val.triple.domain = NULL;
119 else
120 {
121 result->val.triple.domain = cp;
122 cp = __stpncpy (cp, NISENTRYVAL (result->position, 4,
123 (nis_result *) result->data),
124 domainlen);
125 *cp = '\0';
126 }
127
128 status = NSS_STATUS_SUCCESS;
129
130 /* Remember where we stopped reading. */
131 ++result->position;
132
133 result->first = 0;
134 }
135
136 return status;
137 }
138
139 static void
140 internal_endnetgrent (struct __netgrent *netgrp)
141 {
142 nis_freeresult ((nis_result *) netgrp->data);
143 netgrp->data = NULL;
144 netgrp->data_size = 0;
145 netgrp->position = 0;
146 }
147
148 enum nss_status
149 _nss_nisplus_setnetgrent (const char *group, struct __netgrent *netgrp)
150 {
151 char buf[strlen (group) + 25];
152
153 if (group == NULL || group[0] == '\0')
154 return NSS_STATUS_UNAVAIL;
155
156 enum nss_status status = NSS_STATUS_SUCCESS;
157
158 snprintf (buf, sizeof (buf), "[name=%s],netgroup.org_dir", group);
159
160 netgrp->data = (char *) nis_list (buf, EXPAND_NAME, NULL, NULL);
161
162 if (netgrp->data == NULL)
163 {
164 __set_errno (ENOMEM);
165 status = NSS_STATUS_TRYAGAIN;
166 }
167 else if (niserr2nss (((nis_result *) netgrp->data)->status)
168 != NSS_STATUS_SUCCESS)
169 {
170 status = niserr2nss (((nis_result *) netgrp->data)->status);
171
172 internal_endnetgrent (netgrp);
173 }
174 else
175 {
176 netgrp->data_size = ((nis_result *) netgrp->data)->objects.objects_len;
177 netgrp->position = 0;
178 netgrp->first = 1;
179 }
180
181 return status;
182 }
183
184 enum nss_status
185 _nss_nisplus_endnetgrent (struct __netgrent *netgrp)
186 {
187 internal_endnetgrent (netgrp);
188
189 return NSS_STATUS_SUCCESS;
190 }
0 /* Copyright (C) 1997-2015 Free Software Foundation, Inc.
1 This file is part of the GNU C Library.
2 Contributed by Thorsten Kukuk <kukuk@vt.uni-paderborn.de>, 1997.
3
4 The GNU C Library is free software; you can redistribute it and/or
5 modify it under the terms of the GNU Lesser General Public
6 License as published by the Free Software Foundation; either
7 version 2.1 of the License, or (at your option) any later version.
8
9 The GNU C Library is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 Lesser General Public License for more details.
13
14 You should have received a copy of the GNU Lesser General Public
15 License along with the GNU C Library; if not, see
16 <http://www.gnu.org/licenses/>. */
17
18 #include <atomic.h>
19 #include <ctype.h>
20 #include <errno.h>
21 #include <netdb.h>
22 #include <nss.h>
23 #include <stdint.h>
24 #include <string.h>
25 #include <arpa/inet.h>
26 #include <rpcsvc/nis.h>
27 #include <bits/libc-lock.h>
28
29 #include "nss-nisplus.h"
30
31 __libc_lock_define_initialized (static, lock)
32
33 static nis_result *result;
34 static nis_name tablename_val;
35 static u_long tablename_len;
36
37 #define NISENTRYVAL(idx, col, res) \
38 (NIS_RES_OBJECT (res)[idx].EN_data.en_cols.en_cols_val[col].ec_value.ec_value_val)
39
40 #define NISENTRYLEN(idx, col, res) \
41 (NIS_RES_OBJECT (res)[idx].EN_data.en_cols.en_cols_val[col].ec_value.ec_value_len)
42
43
44 static int
45 _nss_nisplus_parse_netent (nis_result *result, struct netent *network,
46 char *buffer, size_t buflen, int *errnop)
47 {
48 char *first_unused = buffer;
49 size_t room_left = buflen;
50
51 if (result == NULL)
52 return 0;
53
54 if ((result->status != NIS_SUCCESS && result->status != NIS_S_SUCCESS)
55 || __type_of (NIS_RES_OBJECT (result)) != NIS_ENTRY_OBJ
56 || strcmp (NIS_RES_OBJECT (result)[0].EN_data.en_type,
57 "networks_tbl") != 0
58 || NIS_RES_OBJECT (result)[0].EN_data.en_cols.en_cols_len < 3)
59 return 0;
60
61 if (NISENTRYLEN (0, 0, result) >= room_left)
62 {
63 /* The line is too long for our buffer. */
64 no_more_room:
65 *errnop = ERANGE;
66 return -1;
67 }
68
69 strncpy (first_unused, NISENTRYVAL (0, 0, result),
70 NISENTRYLEN (0, 0, result));
71 first_unused[NISENTRYLEN (0, 0, result)] = '\0';
72 network->n_name = first_unused;
73 size_t len = strlen (first_unused) + 1;
74 room_left -= len;
75 first_unused += len;
76
77 network->n_addrtype = 0;
78 network->n_net = inet_network (NISENTRYVAL (0, 2, result));
79
80 /* XXX Rewrite at some point to allocate the array first and then
81 copy the strings. It wasteful to first concatenate the strings
82 to just split them again later. */
83 char *line = first_unused;
84 for (unsigned int i = 0; i < NIS_RES_NUMOBJ (result); ++i)
85 {
86 if (strcmp (NISENTRYVAL (i, 1, result), network->n_name) != 0)
87 {
88 if (NISENTRYLEN (i, 1, result) + 2 > room_left)
89 goto no_more_room;
90
91 *first_unused++ = ' ';
92 first_unused = __stpncpy (first_unused, NISENTRYVAL (i, 1, result),
93 NISENTRYLEN (i, 1, result));
94 room_left -= (NISENTRYLEN (i, 1, result) + 1);
95 }
96 }
97 *first_unused++ = '\0';
98
99 /* Adjust the pointer so it is aligned for
100 storing pointers. */
101 size_t adjust = ((__alignof__ (char *)
102 - (first_unused - (char *) 0) % __alignof__ (char *))
103 % __alignof__ (char *));
104 if (room_left < adjust + sizeof (char *))
105 goto no_more_room;
106 first_unused += adjust;
107 room_left -= adjust;
108 network->n_aliases = (char **) first_unused;
109
110 /* For the terminating NULL pointer. */
111 room_left -= sizeof (char *);
112
113 unsigned int i = 0;
114 while (*line != '\0')
115 {
116 /* Skip leading blanks. */
117 while (isspace (*line))
118 ++line;
119
120 if (*line == '\0')
121 break;
122
123 if (room_left < sizeof (char *))
124 goto no_more_room;
125
126 room_left -= sizeof (char *);
127 network->n_aliases[i++] = line;
128
129 while (*line != '\0' && *line != ' ')
130 ++line;
131
132 if (*line == ' ')
133 *line++ = '\0';
134 }
135 network->n_aliases[i] = NULL;
136
137 return 1;
138 }
139
140
141 static enum nss_status
142 _nss_create_tablename (int *errnop)
143 {
144 if (tablename_val == NULL)
145 {
146 const char *local_dir = nis_local_directory ();
147 size_t local_dir_len = strlen (local_dir);
148 static const char prefix[] = "networks.org_dir.";
149
150 char *p = malloc (sizeof (prefix) + local_dir_len);
151 if (p == NULL)
152 {
153 *errnop = errno;
154 return NSS_STATUS_TRYAGAIN;
155 }
156
157 memcpy (__stpcpy (p, prefix), local_dir, local_dir_len + 1);
158
159 tablename_len = sizeof (prefix) - 1 + local_dir_len;
160
161 atomic_write_barrier ();
162
163 tablename_val = p;
164 }
165
166 return NSS_STATUS_SUCCESS;
167 }
168
169 enum nss_status
170 _nss_nisplus_setnetent (int stayopen)
171 {
172 enum nss_status status = NSS_STATUS_SUCCESS;
173
174 __libc_lock_lock (lock);
175
176 if (result != NULL)
177 {
178 nis_freeresult (result);
179 result = NULL;
180 }
181
182 if (tablename_val == NULL)
183 {
184 int err;
185 status = _nss_create_tablename (&err);
186 }
187
188 __libc_lock_unlock (lock);
189
190 return status;
191 }
192
193 enum nss_status
194 _nss_nisplus_endnetent (void)
195 {
196 __libc_lock_lock (lock);
197
198 if (result != NULL)
199 {
200 nis_freeresult (result);
201 result = NULL;
202 }
203
204 __libc_lock_unlock (lock);
205
206 return NSS_STATUS_SUCCESS;
207 }
208
209 static enum nss_status
210 internal_nisplus_getnetent_r (struct netent *network, char *buffer,
211 size_t buflen, int *errnop, int *herrnop)
212 {
213 int parse_res;
214
215 /* Get the next entry until we found a correct one. */
216 do
217 {
218 nis_result *saved_res;
219
220 if (result == NULL)
221 {
222 saved_res = NULL;
223
224 if (tablename_val == NULL)
225 {
226 enum nss_status status = _nss_create_tablename (errnop);
227
228 if (status != NSS_STATUS_SUCCESS)
229 return status;
230 }
231
232 result = nis_first_entry (tablename_val);
233 if (result == NULL)
234 {
235 *errnop = errno;
236 return NSS_STATUS_TRYAGAIN;
237 }
238 if (niserr2nss (result->status) != NSS_STATUS_SUCCESS)
239 {
240 int retval = niserr2nss (result->status);
241 nis_freeresult (result);
242 result = NULL;
243 if (retval == NSS_STATUS_TRYAGAIN)
244 {
245 *herrnop = NETDB_INTERNAL;
246 *errnop = errno;
247 return retval;
248 }
249 else
250 return retval;
251 }
252 }
253 else
254 {
255 saved_res = result;
256 result = nis_next_entry (tablename_val, &result->cookie);
257 if (result == NULL)
258 {
259 *errnop = errno;
260 return NSS_STATUS_TRYAGAIN;
261 }
262 if (niserr2nss (result->status) != NSS_STATUS_SUCCESS)
263 {
264 int retval = niserr2nss (result->status);
265 nis_freeresult (result);
266 result = saved_res;
267 if (retval == NSS_STATUS_TRYAGAIN)
268 {
269 *herrnop = NETDB_INTERNAL;
270 *errnop = errno;
271 }
272 return retval;
273 }
274 }
275
276 parse_res = _nss_nisplus_parse_netent (result, network, buffer,
277 buflen, errnop);
278 if (parse_res == -1)
279 {
280 *herrnop = NETDB_INTERNAL;
281 return NSS_STATUS_TRYAGAIN;
282 }
283
284 }
285 while (!parse_res);
286
287 return NSS_STATUS_SUCCESS;
288 }
289
290 enum nss_status
291 _nss_nisplus_getnetent_r (struct netent *result, char *buffer,
292 size_t buflen, int *errnop, int *herrnop)
293 {
294 int status;
295
296 __libc_lock_lock (lock);
297
298 status = internal_nisplus_getnetent_r (result, buffer, buflen, errnop,
299 herrnop);
300
301 __libc_lock_unlock (lock);
302
303 return status;
304 }
305
306 enum nss_status
307 _nss_nisplus_getnetbyname_r (const char *name, struct netent *network,
308 char *buffer, size_t buflen, int *errnop,
309 int *herrnop)
310 {
311 int parse_res, retval;
312
313 if (tablename_val == NULL)
314 {
315 __libc_lock_lock (lock);
316
317 enum nss_status status = _nss_create_tablename (errnop);
318
319 __libc_lock_unlock (lock);
320
321 if (status != NSS_STATUS_SUCCESS)
322 return status;
323 }
324
325 if (name == NULL)
326 {
327 *errnop = EINVAL;
328 *herrnop = NETDB_INTERNAL;
329 return NSS_STATUS_UNAVAIL;
330 }
331
332 nis_result *result;
333 char buf[strlen (name) + 10 + tablename_len];
334 int olderr = errno;
335
336 /* Search at first in the alias list, and use the correct name
337 for the next search */
338 snprintf (buf, sizeof (buf), "[name=%s],%s", name, tablename_val);
339 result = nis_list (buf, FOLLOW_LINKS | FOLLOW_PATH | USE_DGRAM, NULL, NULL);
340
341 if (result != NULL)
342 {
343 char *bufptr = buf;
344
345 /* If we do not find it, try it as original name. But if the
346 database is correct, we should find it in the first case, too */
347 if ((result->status != NIS_SUCCESS
348 && result->status != NIS_S_SUCCESS)
349 || __type_of (result->objects.objects_val) != NIS_ENTRY_OBJ
350 || strcmp (result->objects.objects_val[0].EN_data.en_type,
351 "networks_tbl") != 0
352 || (result->objects.objects_val[0].EN_data.en_cols.en_cols_len
353 < 3))
354 snprintf (buf, sizeof (buf), "[cname=%s],%s", name, tablename_val);
355 else
356 {
357 /* We need to allocate a new buffer since there is no
358 guarantee the returned name has a length limit. */
359 const char *entryval = NISENTRYVAL (0, 0, result);
360 size_t buflen = strlen (entryval) + 10 + tablename_len;
361 bufptr = alloca (buflen);
362 snprintf (bufptr, buflen, "[cname=%s],%s",
363 entryval, tablename_val);
364 }
365
366 nis_freeresult (result);
367 result = nis_list (bufptr, FOLLOW_LINKS | FOLLOW_PATH | USE_DGRAM,
368 NULL, NULL);
369 }
370
371 if (result == NULL)
372 {
373 __set_errno (ENOMEM);
374 return NSS_STATUS_TRYAGAIN;
375 }
376
377 retval = niserr2nss (result->status);
378 if (__glibc_unlikely (retval != NSS_STATUS_SUCCESS))
379 {
380 if (retval == NSS_STATUS_TRYAGAIN)
381 {
382 *errnop = errno;
383 *herrnop = NETDB_INTERNAL;
384 }
385 else
386 __set_errno (olderr);
387 nis_freeresult (result);
388 return retval;
389 }
390
391 parse_res = _nss_nisplus_parse_netent (result, network, buffer, buflen,
392 errnop);
393
394 nis_freeresult (result);
395
396 if (parse_res > 0)
397 return NSS_STATUS_SUCCESS;
398
399 *herrnop = NETDB_INTERNAL;
400 if (parse_res == -1)
401 {
402 *errnop = ERANGE;
403 return NSS_STATUS_TRYAGAIN;
404 }
405
406 __set_errno (olderr);
407 return NSS_STATUS_NOTFOUND;
408 }
409
410 /* XXX type is ignored, SUN's NIS+ table doesn't support it */
411 enum nss_status
412 _nss_nisplus_getnetbyaddr_r (uint32_t addr, const int type,
413 struct netent *network, char *buffer,
414 size_t buflen, int *errnop, int *herrnop)
415 {
416 if (tablename_val == NULL)
417 {
418 __libc_lock_lock (lock);
419
420 enum nss_status status = _nss_create_tablename (errnop);
421
422 __libc_lock_unlock (lock);
423
424 if (status != NSS_STATUS_SUCCESS)
425 return status;
426 }
427
428 {
429 char buf[27 + tablename_len];
430 char buf2[18];
431 int olderr = errno;
432
433 struct in_addr in = { .s_addr = htonl (addr) };
434 strcpy (buf2, inet_ntoa (in));
435 size_t b2len = strlen (buf2);
436
437 while (1)
438 {
439 snprintf (buf, sizeof (buf), "[addr=%s],%s", buf2, tablename_val);
440 nis_result *result = nis_list (buf, EXPAND_NAME | USE_DGRAM,
441 NULL, NULL);
442
443 if (result == NULL)
444 {
445 __set_errno (ENOMEM);
446 return NSS_STATUS_TRYAGAIN;
447 }
448 enum nss_status retval = niserr2nss (result->status);
449 if (__glibc_unlikely (retval != NSS_STATUS_SUCCESS))
450 {
451 if (b2len > 2 && buf2[b2len - 2] == '.' && buf2[b2len - 1] == '0')
452 {
453 /* Try again, but with trailing dot(s)
454 removed (one by one) */
455 buf2[b2len - 2] = '\0';
456 b2len -= 2;
457 nis_freeresult (result);
458 continue;
459 }
460
461 if (retval == NSS_STATUS_TRYAGAIN)
462 {
463 *errnop = errno;
464 *herrnop = NETDB_INTERNAL;
465 }
466 else
467 __set_errno (olderr);
468 nis_freeresult (result);
469 return retval;
470 }
471
472 int parse_res = _nss_nisplus_parse_netent (result, network, buffer,
473 buflen, errnop);
474
475 nis_freeresult (result);
476
477 if (parse_res > 0)
478 return NSS_STATUS_SUCCESS;
479
480 *herrnop = NETDB_INTERNAL;
481 if (parse_res == -1)
482 {
483 *errnop = ERANGE;
484 return NSS_STATUS_TRYAGAIN;
485 }
486 else
487 {
488 __set_errno (olderr);
489 return NSS_STATUS_NOTFOUND;
490 }
491 }
492 }
493 }
0 /* Copyright (C) 1997-2015 Free Software Foundation, Inc.
1 This file is part of the GNU C Library.
2 Contributed by Thorsten Kukuk <kukuk@vt.uni-paderborn.de>, 1997.
3
4 The GNU C Library is free software; you can redistribute it and/or
5 modify it under the terms of the GNU Lesser General Public
6 License as published by the Free Software Foundation; either
7 version 2.1 of the License, or (at your option) any later version.
8
9 The GNU C Library is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 Lesser General Public License for more details.
13
14 You should have received a copy of the GNU Lesser General Public
15 License along with the GNU C Library; if not, see
16 <http://www.gnu.org/licenses/>. */
17
18 #include <pwd.h>
19 #include <ctype.h>
20 #include <errno.h>
21 #include <string.h>
22 #include <rpcsvc/nis.h>
23
24 #include "nisplus-parser.h"
25
26 #define NISENTRYVAL(idx, col, res) \
27 (NIS_RES_OBJECT (res)[idx].EN_data.en_cols.en_cols_val[col].ec_value.ec_value_val)
28
29 #define NISENTRYLEN(idx, col, res) \
30 (NIS_RES_OBJECT (res)[idx].EN_data.en_cols.en_cols_val[col].ec_value.ec_value_len)
31
32 #define NISOBJVAL(col, obj) \
33 ((obj)->EN_data.en_cols.en_cols_val[col].ec_value.ec_value_val)
34
35 #define NISOBJLEN(col, obj) \
36 ((obj)->EN_data.en_cols.en_cols_val[col].ec_value.ec_value_len)
37
38
39 int
40 _nss_nisplus_parse_pwent (nis_result *result, struct passwd *pw,
41 char *buffer, size_t buflen, int *errnop)
42 {
43 if ((result->status != NIS_SUCCESS && result->status != NIS_S_SUCCESS)
44 || NIS_RES_NUMOBJ (result) != 1
45 || __type_of (NIS_RES_OBJECT (result)) != NIS_ENTRY_OBJ
46 || strcmp (NIS_RES_OBJECT (result)->EN_data.en_type, "passwd_tbl") != 0
47 || NIS_RES_OBJECT (result)->EN_data.en_cols.en_cols_len < 7)
48 return 0;
49
50 nis_object *obj = NIS_RES_OBJECT (result);
51 char *first_unused = buffer;
52 size_t room_left = buflen;
53 size_t len;
54
55 if (NISOBJLEN (0, obj) >= room_left)
56 {
57 /* The line is too long for our buffer. */
58 no_more_room:
59 *errnop = ERANGE;
60 return -1;
61 }
62
63 strncpy (first_unused, NISOBJVAL (0, obj), NISOBJLEN (0, obj));
64 first_unused[NISOBJLEN (0, obj)] = '\0';
65 len = strlen (first_unused);
66 if (len == 0) /* No name ? Should never happen, database is corrupt */
67 return 0;
68 pw->pw_name = first_unused;
69 room_left -= len + 1;
70 first_unused += len + 1;
71
72 if (NISOBJLEN (1, obj) >= room_left)
73 goto no_more_room;
74
75 strncpy (first_unused, NISOBJVAL (1, obj), NISOBJLEN (1, obj));
76 first_unused[NISOBJLEN (1, obj)] = '\0';
77 pw->pw_passwd = first_unused;
78 len = strlen (first_unused);
79 room_left -= len + 1;
80 first_unused += len + 1;
81
82 char *numstr = NISOBJVAL (2, obj);
83 len = NISOBJLEN (2, obj);
84 if (len == 0 && numstr[len - 1] != '\0')
85 {
86 if (len >= room_left)
87 goto no_more_room;
88
89 strncpy (first_unused, numstr, len);
90 first_unused[len] = '\0';
91 numstr = first_unused;
92 }
93 if (numstr[0] == '\0')
94 /* If we don't have a uid, it's an invalid shadow entry. */
95 return 0;
96 pw->pw_uid = strtoul (numstr, NULL, 10);
97
98 numstr = NISOBJVAL (3, obj);
99 len = NISOBJLEN (3, obj);
100 if (len == 0 && numstr[len - 1] != '\0')
101 {
102 if (len >= room_left)
103 goto no_more_room;
104
105 strncpy (first_unused, numstr, len);
106 first_unused[len] = '\0';
107 numstr = first_unused;
108 }
109 if (numstr[0] == '\0')
110 /* If we don't have a gid, it's an invalid shadow entry. */
111 return 0;
112 pw->pw_gid = strtoul (numstr, NULL, 10);
113
114 if (NISOBJLEN(4, obj) >= room_left)
115 goto no_more_room;
116
117 strncpy (first_unused, NISOBJVAL (4, obj), NISOBJLEN (4, obj));
118 first_unused[NISOBJLEN (4, obj)] = '\0';
119 pw->pw_gecos = first_unused;
120 len = strlen (first_unused);
121 room_left -= len + 1;
122 first_unused += len + 1;
123
124 if (NISOBJLEN (5, obj) >= room_left)
125 goto no_more_room;
126
127 strncpy (first_unused, NISOBJVAL (5, obj), NISOBJLEN (5, obj));
128 first_unused[NISOBJLEN (5, obj)] = '\0';
129 pw->pw_dir = first_unused;
130 len = strlen (first_unused);
131 room_left -= len + 1;
132 first_unused += len + 1;
133
134 if (NISOBJLEN (6, obj) >= room_left)
135 goto no_more_room;
136
137 strncpy (first_unused, NISOBJVAL (6, obj), NISOBJLEN (6, obj));
138 first_unused[NISOBJLEN (6, obj)] = '\0';
139 pw->pw_shell = first_unused;
140 len = strlen (first_unused);
141 room_left -= len + 1;
142 first_unused += len + 1;
143
144 return 1;
145 }
146
147
148 int
149 _nss_nisplus_parse_grent (nis_result *result, struct group *gr,
150 char *buffer, size_t buflen, int *errnop)
151 {
152 if ((result->status != NIS_SUCCESS && result->status != NIS_S_SUCCESS)
153 || __type_of(NIS_RES_OBJECT (result)) != NIS_ENTRY_OBJ
154 || strcmp (NIS_RES_OBJECT (result)[0].EN_data.en_type, "group_tbl") != 0
155 || NIS_RES_OBJECT (result)[0].EN_data.en_cols.en_cols_len < 4)
156 return 0;
157
158 nis_object *obj = NIS_RES_OBJECT (result);
159 char *first_unused = buffer;
160 size_t room_left = buflen;
161 char *line;
162 int count;
163 size_t len;
164
165 if (NISOBJLEN (0, obj) >= room_left)
166 {
167 /* The line is too long for our buffer. */
168 no_more_room:
169 *errnop = ERANGE;
170 return -1;
171 }
172
173 strncpy (first_unused, NISOBJVAL (0, obj), NISOBJLEN (0, obj));
174 first_unused[NISOBJLEN (0, obj)] = '\0';
175 len = strlen (first_unused);
176 if (len == 0) /* group table is corrupt */
177 return 0;
178 gr->gr_name = first_unused;
179 room_left -= len + 1;
180 first_unused += len + 1;
181
182 if (NISOBJLEN (1, obj) >= room_left)
183 goto no_more_room;
184
185 strncpy (first_unused, NISOBJVAL (1, obj), NISOBJLEN (1, obj));
186 first_unused[NISOBJLEN (1, obj)] = '\0';
187 gr->gr_passwd = first_unused;
188 len = strlen (first_unused);
189 room_left -= len + 1;
190 first_unused += len + 1;
191
192 char *numstr = NISOBJVAL (2, obj);
193 len = NISOBJLEN (2, obj);
194 if (len == 0 || numstr[len - 1] != '\0')
195 {
196 if (len >= room_left)
197 goto no_more_room;
198
199 strncpy (first_unused, numstr, len);
200 first_unused[len] = '\0';
201 numstr = first_unused;
202 }
203 if (numstr[0] == '\0')
204 /* We should always have a gid. */
205 return 0;
206 gr->gr_gid = strtoul (numstr, NULL, 10);
207
208 if (NISOBJLEN (3, obj) >= room_left)
209 goto no_more_room;
210
211 strncpy (first_unused, NISOBJVAL (3, obj), NISOBJLEN (3, obj));
212 first_unused[NISOBJLEN (3, obj)] = '\0';
213 line = first_unused;
214 len = strlen (line);
215 room_left -= len + 1;
216 first_unused += len + 1;
217 /* Adjust the pointer so it is aligned for
218 storing pointers. */
219 size_t adjust = ((__alignof__ (char *)
220 - (first_unused - (char *) 0) % __alignof__ (char *))
221 % __alignof__ (char *));
222 if (room_left < adjust)
223 goto no_more_room;
224 first_unused += adjust;
225 room_left -= adjust;
226 gr->gr_mem = (char **) first_unused;
227
228 count = 0;
229 while (*line != '\0')
230 {
231 /* Skip leading blanks. */
232 while (isspace (*line))
233 ++line;
234
235 if (*line == '\0')
236 break;
237
238 if (room_left < sizeof (char *))
239 goto no_more_room;
240 room_left -= sizeof (char *);
241 gr->gr_mem[count++] = line;
242
243 while (*line != '\0' && *line != ',' && !isspace (*line))
244 ++line;
245
246 if (*line == ',' || isspace (*line))
247 {
248 int is = isspace (*line);
249
250 *line++ = '\0';
251 if (is)
252 while (*line != '\0' && (*line == ',' || isspace (*line)))
253 ++line;
254 }
255 }
256 if (room_left < sizeof (char *))
257 goto no_more_room;
258 room_left -= sizeof (char *);
259 gr->gr_mem[count] = NULL;
260
261 return 1;
262 }
263
264
265 int
266 _nss_nisplus_parse_spent (nis_result *result, struct spwd *sp,
267 char *buffer, size_t buflen, int *errnop)
268 {
269 char *first_unused = buffer;
270 size_t room_left = buflen;
271 size_t len;
272
273 if (result == NULL)
274 return 0;
275
276 if ((result->status != NIS_SUCCESS && result->status != NIS_S_SUCCESS)
277 || NIS_RES_NUMOBJ (result) != 1
278 || __type_of(NIS_RES_OBJECT (result)) != NIS_ENTRY_OBJ
279 || strcmp (NIS_RES_OBJECT (result)->EN_data.en_type, "passwd_tbl") != 0
280 || NIS_RES_OBJECT (result)->EN_data.en_cols.en_cols_len < 8)
281 return 0;
282
283 if (NISENTRYLEN (0, 0, result) >= room_left)
284 {
285 /* The line is too long for our buffer. */
286 no_more_room:
287 *errnop = ERANGE;
288 return -1;
289 }
290
291 strncpy (first_unused, NISENTRYVAL (0, 0, result),
292 NISENTRYLEN (0, 0, result));
293 first_unused[NISENTRYLEN (0, 0, result)] = '\0';
294 len = strlen (first_unused);
295 if (len == 0)
296 return 0;
297 sp->sp_namp = first_unused;
298 room_left -= len + 1;
299 first_unused += len + 1;
300
301 if (NISENTRYLEN (0, 1, result) >= room_left)
302 goto no_more_room;
303
304 strncpy (first_unused, NISENTRYVAL (0, 1, result),
305 NISENTRYLEN (0, 1, result));
306 first_unused[NISENTRYLEN (0, 1, result)] = '\0';
307 sp->sp_pwdp = first_unused;
308 len = strlen (first_unused);
309 room_left -= len + 1;
310 first_unused += len + 1;
311
312 sp->sp_lstchg = sp->sp_min = sp->sp_max = sp->sp_warn = sp->sp_inact =
313 sp->sp_expire = -1;
314 sp->sp_flag = ~0ul;
315
316 if (NISENTRYLEN (0, 7, result) > 0)
317 {
318 char *line = NISENTRYVAL (0, 7, result);
319 char *cp = strchr (line, ':');
320 if (cp == NULL)
321 return 1;
322 *cp++ = '\0';
323 if (*line)
324 sp->sp_lstchg = atol (line);
325
326 line = cp;
327 cp = strchr (line, ':');
328 if (cp == NULL)
329 return 1;
330 *cp++ = '\0';
331 if (*line)
332 sp->sp_min = atol (line);
333
334 line = cp;
335 cp = strchr (line, ':');
336 if (cp == NULL)
337 return 1;
338 *cp++ = '\0';
339 if (*line)
340 sp->sp_max = atol (line);
341
342 line = cp;
343 cp = strchr (line, ':');
344 if (cp == NULL)
345 return 1;
346 *cp++ = '\0';
347 if (*line)
348 sp->sp_warn = atol (line);
349
350 line = cp;
351 cp = strchr (line, ':');
352 if (cp == NULL)
353 return 1;
354 *cp++ = '\0';
355 if (*line)
356 sp->sp_inact = atol (line);
357
358 line = cp;
359 cp = strchr (line, ':');
360 if (cp == NULL)
361 return 1;
362 *cp++ = '\0';
363 if (*line)
364 sp->sp_expire = atol (line);
365
366 line = cp;
367 if (line == NULL)
368 return 1;
369 if (*line)
370 sp->sp_flag = atol (line);
371 }
372
373 return 1;
374 }
0 /* Copyright (C) 1997-2015 Free Software Foundation, Inc.
1 This file is part of the GNU C Library.
2 Contributed by Thorsten Kukuk <kukuk@vt.uni-paderborn.de>, 1997.
3
4 The GNU C Library is free software; you can redistribute it and/or
5 modify it under the terms of the GNU Lesser General Public
6 License as published by the Free Software Foundation; either
7 version 2.1 of the License, or (at your option) any later version.
8
9 The GNU C Library is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 Lesser General Public License for more details.
13
14 You should have received a copy of the GNU Lesser General Public
15 License along with the GNU C Library; if not, see
16 <http://www.gnu.org/licenses/>. */
17
18 #include <atomic.h>
19 #include <ctype.h>
20 #include <errno.h>
21 #include <netdb.h>
22 #include <nss.h>
23 #include <string.h>
24 #include <rpcsvc/nis.h>
25 #include <bits/libc-lock.h>
26
27 #include "nss-nisplus.h"
28
29 __libc_lock_define_initialized (static, lock)
30
31 static nis_result *result;
32 static nis_name tablename_val;
33 static u_long tablename_len;
34
35 #define NISENTRYVAL(idx, col, res) \
36 (NIS_RES_OBJECT (res)[idx].EN_data.en_cols.en_cols_val[col].ec_value.ec_value_val)
37
38 #define NISENTRYLEN(idx, col, res) \
39 (NIS_RES_OBJECT (res)[idx].EN_data.en_cols.en_cols_val[col].ec_value.ec_value_len)
40
41
42 static int
43 _nss_nisplus_parse_protoent (nis_result *result, struct protoent *proto,
44 char *buffer, size_t buflen, int *errnop)
45 {
46 char *first_unused = buffer;
47 size_t room_left = buflen;
48 unsigned int i;
49
50 if (result == NULL)
51 return 0;
52
53 if ((result->status != NIS_SUCCESS && result->status != NIS_S_SUCCESS)
54 || __type_of (NIS_RES_OBJECT (result)) != NIS_ENTRY_OBJ
55 || strcmp (NIS_RES_OBJECT (result)->EN_data.en_type,
56 "protocols_tbl") != 0
57 || NIS_RES_OBJECT (result)->EN_data.en_cols.en_cols_len < 3)
58 return 0;
59
60 /* Generate the protocols entry format and use the normal parser */
61 if (NISENTRYLEN (0, 0, result) + 1 > room_left)
62 {
63 no_more_room:
64 *errnop = ERANGE;
65 return -1;
66 }
67 strncpy (first_unused, NISENTRYVAL (0, 0, result),
68 NISENTRYLEN (0, 0, result));
69 first_unused[NISENTRYLEN (0, 0, result)] = '\0';
70 proto->p_name = first_unused;
71 size_t len = strlen (first_unused) + 1;
72 room_left -= len;
73 first_unused += len;
74
75
76 proto->p_proto = atoi (NISENTRYVAL (0, 2, result));
77
78 /* XXX Rewrite at some point to allocate the array first and then
79 copy the strings. It wasteful to first concatenate the strings
80 to just split them again later. */
81 char *line = first_unused;
82 for (i = 0; i < NIS_RES_NUMOBJ (result); ++i)
83 {
84 if (strcmp (NISENTRYVAL (i, 1, result), proto->p_name) != 0)
85 {
86 if (NISENTRYLEN (i, 1, result) + 2 > room_left)
87 goto no_more_room;
88 *first_unused++ = ' ';
89 first_unused = __stpncpy (first_unused, NISENTRYVAL (i, 1, result),
90 NISENTRYLEN (i, 1, result));
91 room_left -= NISENTRYLEN (i, 1, result) + 1;
92 }
93 }
94 *first_unused++ = '\0';
95
96 /* Adjust the pointer so it is aligned for
97 storing pointers. */
98 size_t adjust = ((__alignof__ (char *)
99 - (first_unused - (char *) 0) % __alignof__ (char *))
100 % __alignof__ (char *));
101 if (room_left < adjust + sizeof (char *))
102 goto no_more_room;
103 first_unused += adjust;
104 room_left -= adjust;
105 proto->p_aliases = (char **) first_unused;
106
107 /* For the terminating NULL pointer. */
108 room_left -= sizeof (char *);
109
110 i = 0;
111 while (*line != '\0')
112 {
113 /* Skip leading blanks. */
114 while (isspace (*line))
115 line++;
116 if (*line == '\0')
117 break;
118
119 if (room_left < sizeof (char *))
120 goto no_more_room;
121
122 room_left -= sizeof (char *);
123 proto->p_aliases[i++] = line;
124
125 while (*line != '\0' && *line != ' ')
126 ++line;
127
128 if (*line == ' ')
129 *line++ = '\0';
130 }
131 proto->p_aliases[i] = NULL;
132
133 return 1;
134 }
135
136 static enum nss_status
137 _nss_create_tablename (int *errnop)
138 {
139 if (tablename_val == NULL)
140 {
141 const char *local_dir = nis_local_directory ();
142 size_t local_dir_len = strlen (local_dir);
143 static const char prefix[] = "protocols.org_dir.";
144
145 char *p = malloc (sizeof (prefix) + local_dir_len);
146 if (p == NULL)
147 {
148 *errnop = errno;
149 return NSS_STATUS_TRYAGAIN;
150 }
151
152 memcpy (__stpcpy (p, prefix), local_dir, local_dir_len + 1);
153
154 tablename_len = sizeof (prefix) - 1 + local_dir_len;
155
156 atomic_write_barrier ();
157
158 tablename_val = p;
159 }
160
161 return NSS_STATUS_SUCCESS;
162 }
163
164 enum nss_status
165 _nss_nisplus_setprotoent (int stayopen)
166 {
167 enum nss_status status = NSS_STATUS_SUCCESS;
168
169 __libc_lock_lock (lock);
170
171 if (result != NULL)
172 {
173 nis_freeresult (result);
174 result = NULL;
175 }
176
177 if (tablename_val == NULL)
178 {
179 int err;
180 status = _nss_create_tablename (&err);
181 }
182
183 __libc_lock_unlock (lock);
184
185 return status;
186 }
187
188 enum nss_status
189 _nss_nisplus_endprotoent (void)
190 {
191 __libc_lock_lock (lock);
192
193 if (result != NULL)
194 {
195 nis_freeresult (result);
196 result = NULL;
197 }
198
199 __libc_lock_unlock (lock);
200
201 return NSS_STATUS_SUCCESS;
202 }
203
204 static enum nss_status
205 internal_nisplus_getprotoent_r (struct protoent *proto, char *buffer,
206 size_t buflen, int *errnop)
207 {
208 int parse_res;
209
210 /* Get the next entry until we found a correct one. */
211 do
212 {
213 nis_result *saved_res;
214
215 if (result == NULL)
216 {
217 saved_res = NULL;
218 if (tablename_val == NULL)
219 {
220 enum nss_status status = _nss_create_tablename (errnop);
221
222 if (status != NSS_STATUS_SUCCESS)
223 return status;
224 }
225
226 result = nis_first_entry (tablename_val);
227 if (result == NULL)
228 {
229 *errnop = errno;
230 return NSS_STATUS_TRYAGAIN;
231 }
232 if (niserr2nss (result->status) != NSS_STATUS_SUCCESS)
233 return niserr2nss (result->status);
234 }
235 else
236 {
237 saved_res = result;
238 result = nis_next_entry (tablename_val, &result->cookie);
239 if (result == NULL)
240 {
241 *errnop = errno;
242 return NSS_STATUS_TRYAGAIN;
243 }
244 if (niserr2nss (result->status) != NSS_STATUS_SUCCESS)
245 {
246 nis_freeresult (saved_res);
247 return niserr2nss (result->status);
248 }
249 }
250
251 parse_res = _nss_nisplus_parse_protoent (result, proto, buffer,
252 buflen, errnop);
253 if (parse_res == -1)
254 {
255 nis_freeresult (result);
256 result = saved_res;
257 *errnop = ERANGE;
258 return NSS_STATUS_TRYAGAIN;
259 }
260 else
261 {
262 if (saved_res)
263 nis_freeresult (saved_res);
264 }
265 }
266 while (!parse_res);
267
268 return NSS_STATUS_SUCCESS;
269 }
270
271 enum nss_status
272 _nss_nisplus_getprotoent_r (struct protoent *result, char *buffer,
273 size_t buflen, int *errnop)
274 {
275 int status;
276
277 __libc_lock_lock (lock);
278
279 status = internal_nisplus_getprotoent_r (result, buffer, buflen, errnop);
280
281 __libc_lock_unlock (lock);
282
283 return status;
284 }
285
286 enum nss_status
287 _nss_nisplus_getprotobyname_r (const char *name, struct protoent *proto,
288 char *buffer, size_t buflen, int *errnop)
289 {
290 int parse_res;
291
292 if (tablename_val == NULL)
293 {
294 __libc_lock_lock (lock);
295
296 enum nss_status status = _nss_create_tablename (errnop);
297
298 __libc_lock_unlock (lock);
299
300 if (status != NSS_STATUS_SUCCESS)
301 return status;
302 }
303
304 if (name == NULL)
305 return NSS_STATUS_NOTFOUND;
306
307 char buf[strlen (name) + 10 + tablename_len];
308 int olderr = errno;
309
310 /* Search at first in the alias list, and use the correct name
311 for the next search */
312 snprintf (buf, sizeof (buf), "[name=%s],%s", name, tablename_val);
313 nis_result *result = nis_list (buf, FOLLOW_PATH | FOLLOW_LINKS, NULL, NULL);
314
315 if (result != NULL)
316 {
317 char *bufptr = buf;
318
319 /* If we did not find it, try it as original name. But if the
320 database is correct, we should find it in the first case, too */
321 if ((result->status != NIS_SUCCESS
322 && result->status != NIS_S_SUCCESS)
323 || __type_of (result->objects.objects_val) != NIS_ENTRY_OBJ
324 || strcmp (result->objects.objects_val->EN_data.en_type,
325 "protocols_tbl") != 0
326 || result->objects.objects_val->EN_data.en_cols.en_cols_len < 3)
327 snprintf (buf, sizeof (buf), "[cname=%s],%s", name, tablename_val);
328 else
329 {
330 /* We need to allocate a new buffer since there is no
331 guarantee the returned name has a length limit. */
332 const char *entryval = NISENTRYVAL (0, 0, result);
333 size_t buflen = strlen (entryval) + 10 + tablename_len;
334 bufptr = alloca (buflen);
335 snprintf (bufptr, buflen, "[cname=%s],%s",
336 entryval, tablename_val);
337 }
338
339 nis_freeresult (result);
340 result = nis_list (bufptr, FOLLOW_PATH | FOLLOW_LINKS, NULL, NULL);
341 }
342
343 if (result == NULL)
344 {
345 __set_errno (ENOMEM);
346 return NSS_STATUS_TRYAGAIN;
347 }
348
349 if (__glibc_unlikely (niserr2nss (result->status) != NSS_STATUS_SUCCESS))
350 {
351 enum nss_status status = niserr2nss (result->status);
352
353 __set_errno (olderr);
354
355 nis_freeresult (result);
356 return status;
357 }
358
359 parse_res = _nss_nisplus_parse_protoent (result, proto, buffer, buflen,
360 errnop);
361
362 nis_freeresult (result);
363
364 if (parse_res < 1)
365 {
366 if (parse_res == -1)
367 {
368 *errnop = ERANGE;
369 return NSS_STATUS_TRYAGAIN;
370 }
371 else
372 {
373 __set_errno (olderr);
374 return NSS_STATUS_NOTFOUND;
375 }
376 }
377
378 return NSS_STATUS_SUCCESS;
379 }
380
381 enum nss_status
382 _nss_nisplus_getprotobynumber_r (const int number, struct protoent *proto,
383 char *buffer, size_t buflen, int *errnop)
384 {
385 if (tablename_val == NULL)
386 {
387 __libc_lock_lock (lock);
388
389 enum nss_status status = _nss_create_tablename (errnop);
390
391 __libc_lock_unlock (lock);
392
393 if (status != NSS_STATUS_SUCCESS)
394 return status;
395 }
396
397 char buf[12 + 3 * sizeof (number) + tablename_len];
398 int olderr = errno;
399
400 snprintf (buf, sizeof (buf), "[number=%d],%s", number, tablename_val);
401
402 nis_result *result = nis_list (buf, FOLLOW_LINKS | FOLLOW_PATH, NULL, NULL);
403
404 if (result == NULL)
405 {
406 __set_errno (ENOMEM);
407 return NSS_STATUS_TRYAGAIN;
408 }
409
410 if (__glibc_unlikely (niserr2nss (result->status) != NSS_STATUS_SUCCESS))
411 {
412 enum nss_status status = niserr2nss (result->status);
413
414 __set_errno (olderr);
415
416 nis_freeresult (result);
417 return status;
418 }
419
420 int parse_res = _nss_nisplus_parse_protoent (result, proto, buffer, buflen,
421 errnop);
422
423 nis_freeresult (result);
424
425 if (parse_res < 1)
426 {
427 if (parse_res == -1)
428 {
429 *errnop = ERANGE;
430 return NSS_STATUS_TRYAGAIN;
431 }
432 else
433 {
434 __set_errno (olderr);
435 return NSS_STATUS_NOTFOUND;
436 }
437 }
438
439 return NSS_STATUS_SUCCESS;
440 }
0 /* Copyright (c) 1997-2015 Free Software Foundation, Inc.
1 This file is part of the GNU C Library.
2 Contributed by Thorsten Kukuk <kukuk@suse.de>, 1997.
3
4 The GNU C Library is free software; you can redistribute it and/or
5 modify it under the terms of the GNU Lesser General Public
6 License as published by the Free Software Foundation; either
7 version 2.1 of the License, or (at your option) any later version.
8
9 The GNU C Library is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 Lesser General Public License for more details.
13
14 You should have received a copy of the GNU Lesser General Public
15 License along with the GNU C Library; if not, see
16 <http://www.gnu.org/licenses/>. */
17
18 #include <nss.h>
19 #include <ctype.h>
20 #include <errno.h>
21 #include <stdio.h>
22 #include <string.h>
23 #include <libintl.h>
24 #include <syslog.h>
25 #include <rpc/rpc.h>
26 #include <rpcsvc/nis.h>
27 #include <rpc/key_prot.h>
28 extern int xdecrypt (char *, char *);
29
30 #include <nss-nisplus.h>
31
32 /* If we haven't found the entry, we give a SUCCESS and an empty key back. */
33 enum nss_status
34 _nss_nisplus_getpublickey (const char *netname, char *pkey, int *errnop)
35 {
36 nis_result *res;
37 enum nss_status retval;
38 char buf[NIS_MAXNAMELEN + 2];
39 size_t slen;
40 char *domain, *cptr;
41 int len;
42
43 pkey[0] = 0;
44
45 if (netname == NULL)
46 {
47 *errnop = EINVAL;
48 return NSS_STATUS_UNAVAIL;
49 }
50
51 domain = strchr (netname, '@');
52 if (!domain)
53 return NSS_STATUS_UNAVAIL;
54 domain++;
55
56 slen = snprintf (buf, NIS_MAXNAMELEN,
57 "[auth_name=%s,auth_type=DES],cred.org_dir.%s",
58 netname, domain);
59
60 if (slen >= NIS_MAXNAMELEN)
61 {
62 *errnop = EINVAL;
63 return NSS_STATUS_UNAVAIL;
64 }
65
66 if (buf[slen - 1] != '.')
67 {
68 buf[slen++] = '.';
69 buf[slen] = '\0';
70 }
71
72 res = nis_list (buf, USE_DGRAM+NO_AUTHINFO+FOLLOW_LINKS+FOLLOW_PATH,
73 NULL, NULL);
74
75 if (res == NULL)
76 {
77 *errnop = ENOMEM;
78 return NSS_STATUS_TRYAGAIN;
79 }
80 retval = niserr2nss (res->status);
81
82 if (retval != NSS_STATUS_SUCCESS)
83 {
84 if (retval == NSS_STATUS_TRYAGAIN)
85 *errnop = errno;
86 if (res->status == NIS_NOTFOUND)
87 retval = NSS_STATUS_SUCCESS;
88 nis_freeresult (res);
89 return retval;
90 }
91
92 if (NIS_RES_NUMOBJ (res) > 1)
93 {
94 /*
95 * More than one principal with same uid?
96 * something wrong with cred table. Should be unique
97 * Warn user and continue.
98 */
99 syslog (LOG_ERR, _("DES entry for netname %s not unique\n"), netname);
100 nis_freeresult (res);
101 return NSS_STATUS_SUCCESS;
102 }
103
104 len = ENTRY_LEN (NIS_RES_OBJECT (res), 3);
105 memcpy (pkey, ENTRY_VAL (NIS_RES_OBJECT (res),3), len);
106 pkey[len] = 0;
107 cptr = strchr (pkey, ':');
108 if (cptr)
109 cptr[0] = '\0';
110 nis_freeresult (res);
111
112 return NSS_STATUS_SUCCESS;
113 }
114
115
116 enum nss_status
117 _nss_nisplus_getsecretkey (const char *netname, char *skey, char *passwd,
118 int *errnop)
119 {
120 nis_result *res;
121 enum nss_status retval;
122 char buf[NIS_MAXNAMELEN + 2];
123 size_t slen;
124 char *domain, *cptr;
125 int len;
126
127 skey[0] = 0;
128
129 if (netname == NULL)
130 {
131 *errnop = EINVAL;
132 return NSS_STATUS_UNAVAIL;
133 }
134
135 domain = strchr (netname, '@');
136 if (!domain)
137 return NSS_STATUS_UNAVAIL;
138 domain++;
139
140 slen = snprintf (buf, NIS_MAXNAMELEN,
141 "[auth_name=%s,auth_type=DES],cred.org_dir.%s",
142 netname, domain);
143
144 if (slen >= NIS_MAXNAMELEN)
145 {
146 *errnop = EINVAL;
147 return NSS_STATUS_UNAVAIL;
148 }
149
150 if (buf[slen - 1] != '.')
151 {
152 buf[slen++] = '.';
153 buf[slen] = '\0';
154 }
155
156 res = nis_list (buf, USE_DGRAM | NO_AUTHINFO | FOLLOW_LINKS | FOLLOW_PATH,
157 NULL, NULL);
158
159 if (res == NULL)
160 {
161 *errnop = ENOMEM;
162 return NSS_STATUS_TRYAGAIN;
163 }
164 retval = niserr2nss (res->status);
165
166 if (retval != NSS_STATUS_SUCCESS)
167 {
168 if (retval == NSS_STATUS_TRYAGAIN)
169 *errnop = errno;
170 nis_freeresult (res);
171 return retval;
172 }
173
174 if (NIS_RES_NUMOBJ (res) > 1)
175 {
176 /*
177 * More than one principal with same uid?
178 * something wrong with cred table. Should be unique
179 * Warn user and continue.
180 */
181 syslog (LOG_ERR, _("DES entry for netname %s not unique\n"), netname);
182 nis_freeresult (res);
183 return NSS_STATUS_SUCCESS;
184 }
185
186 len = ENTRY_LEN (NIS_RES_OBJECT (res), 4);
187 memcpy (buf, ENTRY_VAL (NIS_RES_OBJECT (res), 4), len);
188 buf[len] = '\0';
189 cptr = strchr (buf, ':');
190 if (cptr)
191 cptr[0] = '\0';
192 nis_freeresult (res);
193
194 if (!xdecrypt (buf, passwd))
195 return NSS_STATUS_SUCCESS;
196
197 if (memcmp (buf, &(buf[HEXKEYBYTES]), KEYCHECKSUMSIZE) != 0)
198 return NSS_STATUS_SUCCESS;
199
200 buf[HEXKEYBYTES] = 0;
201 strcpy (skey, buf);
202
203 return NSS_STATUS_SUCCESS;
204 }
205
206
207 /* Parse information from the passed string.
208 The format of the string passed is gid,grp,grp, ... */
209 static enum nss_status
210 parse_grp_str (const char *s, gid_t *gidp, int *gidlenp, gid_t *gidlist,
211 int *errnop)
212 {
213 char *ep;
214 int gidlen;
215
216 if (!s || (!isdigit (*s)))
217 {
218 syslog (LOG_ERR, _("netname2user: missing group id list in `%s'"), s);
219 return NSS_STATUS_NOTFOUND;
220 }
221
222 *gidp = strtoul (s, &ep, 10);
223
224 gidlen = 0;
225
226 /* After strtoul() ep should point to the marker ',', which means
227 here starts a new value.
228
229 The Sun man pages show that GIDLIST should contain at least NGRPS
230 elements. Limiting the number written by this value is the best
231 we can do. */
232 while (ep != NULL && *ep == ',' && gidlen < NGRPS)
233 {
234 ep++;
235 s = ep;
236 gidlist[gidlen++] = strtoul (s, &ep, 10);
237 }
238 *gidlenp = gidlen;
239
240 return NSS_STATUS_SUCCESS;
241 }
242
243 enum nss_status
244 _nss_nisplus_netname2user (char netname[MAXNETNAMELEN + 1], uid_t *uidp,
245 gid_t *gidp, int *gidlenp, gid_t *gidlist, int *errnop)
246 {
247 char *domain;
248 nis_result *res;
249 char sname[NIS_MAXNAMELEN + 2]; /* search criteria + table name */
250 size_t slen;
251 char principal[NIS_MAXNAMELEN + 1];
252 int len;
253
254 /* 1. Get home domain of user. */
255 domain = strchr (netname, '@');
256 if (! domain)
257 return NSS_STATUS_UNAVAIL;
258
259 ++domain; /* skip '@' */
260
261 /* 2. Get user's nisplus principal name. */
262 slen = snprintf (sname, NIS_MAXNAMELEN,
263 "[auth_name=%s,auth_type=DES],cred.org_dir.%s",
264 netname, domain);
265
266 if (slen >= NIS_MAXNAMELEN)
267 {
268 *errnop = EINVAL;
269 return NSS_STATUS_UNAVAIL;
270 }
271
272 if (sname[slen - 1] != '.')
273 {
274 sname[slen++] = '.';
275 sname[slen] = '\0';
276 }
277
278 /* must use authenticated call here */
279 /* XXX but we cant, for now. XXX */
280 res = nis_list (sname, USE_DGRAM+NO_AUTHINFO+FOLLOW_LINKS+FOLLOW_PATH,
281 NULL, NULL);
282 if (res == NULL)
283 {
284 *errnop = ENOMEM;
285 return NSS_STATUS_TRYAGAIN;
286 }
287 switch (res->status)
288 {
289 case NIS_SUCCESS:
290 case NIS_S_SUCCESS:
291 break; /* go and do something useful */
292 case NIS_NOTFOUND:
293 case NIS_PARTIAL:
294 case NIS_NOSUCHNAME:
295 case NIS_NOSUCHTABLE:
296 nis_freeresult (res);
297 return NSS_STATUS_NOTFOUND;
298 case NIS_S_NOTFOUND:
299 case NIS_TRYAGAIN:
300 syslog (LOG_ERR, _("netname2user: (nis+ lookup): %s\n"),
301 nis_sperrno (res->status));
302 nis_freeresult (res);
303 *errnop = errno;
304 return NSS_STATUS_TRYAGAIN;
305 default:
306 syslog (LOG_ERR, _("netname2user: (nis+ lookup): %s\n"),
307 nis_sperrno (res->status));
308 nis_freeresult (res);
309 return NSS_STATUS_UNAVAIL;
310 }
311
312 if (NIS_RES_NUMOBJ (res) > 1)
313 /*
314 * A netname belonging to more than one principal?
315 * Something wrong with cred table. should be unique.
316 * Warn user and continue.
317 */
318 syslog (LOG_ALERT,
319 _("netname2user: DES entry for %s in directory %s not unique"),
320 netname, domain);
321
322 len = ENTRY_LEN (NIS_RES_OBJECT (res), 0);
323 strncpy (principal, ENTRY_VAL (NIS_RES_OBJECT (res), 0), len);
324 principal[len] = '\0';
325 nis_freeresult (res);
326
327 if (principal[0] == '\0')
328 return NSS_STATUS_UNAVAIL;
329
330 /*
331 * 3. Use principal name to look up uid/gid information in
332 * LOCAL entry in **local** cred table.
333 */
334 domain = nis_local_directory ();
335 if (strlen (principal) + strlen (domain) + 45 > (size_t) NIS_MAXNAMELEN)
336 {
337 syslog (LOG_ERR, _("netname2user: principal name `%s' too long"),
338 principal);
339 return NSS_STATUS_UNAVAIL;
340 }
341
342 slen = snprintf (sname, sizeof (sname),
343 "[cname=%s,auth_type=LOCAL],cred.org_dir.%s",
344 principal, domain);
345
346 if (sname[slen - 1] != '.')
347 {
348 sname[slen++] = '.';
349 sname[slen] = '\0';
350 }
351
352 /* must use authenticated call here */
353 /* XXX but we cant, for now. XXX */
354 res = nis_list (sname, USE_DGRAM+NO_AUTHINFO+FOLLOW_LINKS+FOLLOW_PATH,
355 NULL, NULL);
356 if (res == NULL)
357 {
358 *errnop = ENOMEM;
359 return NSS_STATUS_TRYAGAIN;
360 }
361 switch(res->status)
362 {
363 case NIS_NOTFOUND:
364 case NIS_PARTIAL:
365 case NIS_NOSUCHNAME:
366 case NIS_NOSUCHTABLE:
367 nis_freeresult (res);
368 return NSS_STATUS_NOTFOUND;
369 case NIS_S_NOTFOUND:
370 case NIS_TRYAGAIN:
371 syslog (LOG_ERR, _("netname2user: (nis+ lookup): %s\n"),
372 nis_sperrno (res->status));
373 nis_freeresult (res);
374 *errnop = errno;
375 return NSS_STATUS_TRYAGAIN;
376 case NIS_SUCCESS:
377 case NIS_S_SUCCESS:
378 break; /* go and do something useful */
379 default:
380 syslog (LOG_ERR, _("netname2user: (nis+ lookup): %s\n"),
381 nis_sperrno (res->status));
382 nis_freeresult (res);
383 return NSS_STATUS_UNAVAIL;
384 }
385
386 if (NIS_RES_NUMOBJ (res) > 1)
387 /*
388 * A principal can have more than one LOCAL entry?
389 * Something wrong with cred table.
390 * Warn user and continue.
391 */
392 syslog (LOG_ALERT,
393 _("netname2user: LOCAL entry for %s in directory %s not unique"),
394 netname, domain);
395 /* Fetch the uid */
396 *uidp = strtoul (ENTRY_VAL (NIS_RES_OBJECT (res), 2), NULL, 10);
397
398 if (*uidp == 0)
399 {
400 syslog (LOG_ERR, _("netname2user: should not have uid 0"));
401 nis_freeresult (res);
402 return NSS_STATUS_NOTFOUND;
403 }
404
405 parse_grp_str (ENTRY_VAL (NIS_RES_OBJECT (res), 3),
406 gidp, gidlenp, gidlist, errnop);
407
408 nis_freeresult (res);
409 return NSS_STATUS_SUCCESS;
410 }
0 /* Copyright (C) 1997-2015 Free Software Foundation, Inc.
1 This file is part of the GNU C Library.
2 Contributed by Thorsten Kukuk <kukuk@vt.uni-paderborn.de>, 1997.
3
4 The GNU C Library is free software; you can redistribute it and/or
5 modify it under the terms of the GNU Lesser General Public
6 License as published by the Free Software Foundation; either
7 version 2.1 of the License, or (at your option) any later version.
8
9 The GNU C Library is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 Lesser General Public License for more details.
13
14 You should have received a copy of the GNU Lesser General Public
15 License along with the GNU C Library; if not, see
16 <http://www.gnu.org/licenses/>. */
17
18 #include <atomic.h>
19 #include <nss.h>
20 #include <errno.h>
21 #include <pwd.h>
22 #include <string.h>
23 #include <bits/libc-lock.h>
24 #include <rpcsvc/nis.h>
25
26 #include "nss-nisplus.h"
27 #include "nisplus-parser.h"
28 #include <libnsl.h>
29 #include <nis_intern.h>
30 #include <nis_xdr.h>
31
32
33 __libc_lock_define_initialized (static, lock)
34
35 /* Connection information. */
36 static ib_request *ibreq;
37 static directory_obj *dir;
38 static dir_binding bptr;
39 static char *tablepath;
40 static char *tableptr;
41 /* Cursor. */
42 static netobj cursor;
43
44
45 nis_name pwd_tablename_val attribute_hidden;
46 size_t pwd_tablename_len attribute_hidden;
47
48 enum nss_status
49 _nss_pwd_create_tablename (int *errnop)
50 {
51 if (pwd_tablename_val == NULL)
52 {
53 const char *local_dir = nis_local_directory ();
54 size_t local_dir_len = strlen (local_dir);
55 static const char prefix[] = "passwd.org_dir.";
56
57 char *p = malloc (sizeof (prefix) + local_dir_len);
58 if (p == NULL)
59 {
60 *errnop = errno;
61 return NSS_STATUS_TRYAGAIN;
62 }
63
64 memcpy (__stpcpy (p, prefix), local_dir, local_dir_len + 1);
65
66 pwd_tablename_len = sizeof (prefix) - 1 + local_dir_len;
67
68 atomic_write_barrier ();
69
70 if (atomic_compare_and_exchange_bool_acq (&pwd_tablename_val, p, NULL))
71 {
72 /* Another thread already installed the value. */
73 free (p);
74 pwd_tablename_len = strlen (pwd_tablename_val);
75 }
76 }
77
78 return NSS_STATUS_SUCCESS;
79 }
80
81
82 static void
83 internal_nisplus_endpwent (void)
84 {
85 __nisbind_destroy (&bptr);
86 memset (&bptr, '\0', sizeof (bptr));
87
88 nis_free_directory (dir);
89 dir = NULL;
90
91 nis_free_request (ibreq);
92 ibreq = NULL;
93
94 xdr_free ((xdrproc_t) xdr_netobj, (char *) &cursor);
95 memset (&cursor, '\0', sizeof (cursor));
96
97 free (tablepath);
98 tableptr = tablepath = NULL;
99 }
100
101
102 static enum nss_status
103 internal_nisplus_setpwent (int *errnop)
104 {
105 enum nss_status status = NSS_STATUS_SUCCESS;
106
107 if (pwd_tablename_val == NULL)
108 status = _nss_pwd_create_tablename (errnop);
109
110 if (status == NSS_STATUS_SUCCESS)
111 {
112 ibreq = __create_ib_request (pwd_tablename_val, 0);
113 if (ibreq == NULL)
114 {
115 *errnop = errno;
116 return NSS_STATUS_TRYAGAIN;
117 }
118
119 nis_error retcode = __prepare_niscall (pwd_tablename_val, &dir,
120 &bptr, 0);
121 if (retcode != NIS_SUCCESS)
122 {
123 nis_free_request (ibreq);
124 ibreq = NULL;
125 status = niserr2nss (retcode);
126 }
127 }
128
129 return status;
130 }
131
132
133 enum nss_status
134 _nss_nisplus_setpwent (int stayopen)
135 {
136 enum nss_status status;
137
138 __libc_lock_lock (lock);
139
140 internal_nisplus_endpwent ();
141
142 // XXX We need to be able to set errno. Pass in new parameter.
143 int err;
144 status = internal_nisplus_setpwent (&err);
145
146 __libc_lock_unlock (lock);
147
148 return status;
149 }
150
151
152 enum nss_status
153 _nss_nisplus_endpwent (void)
154 {
155 __libc_lock_lock (lock);
156
157 internal_nisplus_endpwent ();
158
159 __libc_lock_unlock (lock);
160
161 return NSS_STATUS_SUCCESS;
162 }
163
164
165 static enum nss_status
166 internal_nisplus_getpwent_r (struct passwd *pw, char *buffer, size_t buflen,
167 int *errnop)
168 {
169 int parse_res = -1;
170 enum nss_status retval = NSS_STATUS_SUCCESS;
171
172 /* Get the next entry until we found a correct one. */
173 do
174 {
175 nis_error status;
176 nis_result result;
177 memset (&result, '\0', sizeof (result));
178
179 if (cursor.n_bytes == NULL)
180 {
181 if (ibreq == NULL)
182 {
183 retval = internal_nisplus_setpwent (errnop);
184 if (retval != NSS_STATUS_SUCCESS)
185 return retval;
186 }
187
188 status = __do_niscall3 (&bptr, NIS_IBFIRST,
189 (xdrproc_t) _xdr_ib_request,
190 (caddr_t) ibreq,
191 (xdrproc_t) _xdr_nis_result,
192 (caddr_t) &result,
193 0, NULL);
194 }
195 else
196 {
197 ibreq->ibr_cookie.n_bytes = cursor.n_bytes;
198 ibreq->ibr_cookie.n_len = cursor.n_len;
199
200 status = __do_niscall3 (&bptr, NIS_IBNEXT,
201 (xdrproc_t) _xdr_ib_request,
202 (caddr_t) ibreq,
203 (xdrproc_t) _xdr_nis_result,
204 (caddr_t) &result,
205 0, NULL);
206
207 ibreq->ibr_cookie.n_bytes = NULL;
208 ibreq->ibr_cookie.n_len = 0;
209 }
210
211 if (status != NIS_SUCCESS)
212 return niserr2nss (status);
213
214 if (NIS_RES_STATUS (&result) == NIS_NOTFOUND)
215 {
216 /* No more entries on this server. This means we have to go
217 to the next server on the path. */
218 status = __follow_path (&tablepath, &tableptr, ibreq, &bptr);
219 if (status != NIS_SUCCESS)
220 return niserr2nss (status);
221
222 directory_obj *newdir = NULL;
223 dir_binding newbptr;
224 status = __prepare_niscall (ibreq->ibr_name, &newdir, &newbptr, 0);
225 if (status != NIS_SUCCESS)
226 return niserr2nss (status);
227
228 nis_free_directory (dir);
229 dir = newdir;
230 __nisbind_destroy (&bptr);
231 bptr = newbptr;
232
233 xdr_free ((xdrproc_t) xdr_netobj, (char *) &result.cookie);
234 result.cookie.n_bytes = NULL;
235 result.cookie.n_len = 0;
236 parse_res = 0;
237 goto next;
238 }
239 else if (NIS_RES_STATUS (&result) != NIS_SUCCESS)
240 return niserr2nss (NIS_RES_STATUS (&result));
241
242 parse_res = _nss_nisplus_parse_pwent (&result, pw, buffer,
243 buflen, errnop);
244
245 if (__glibc_unlikely (parse_res == -1))
246 {
247 *errnop = ERANGE;
248 retval = NSS_STATUS_TRYAGAIN;
249 goto freeres;
250 }
251
252 next:
253 /* Free the old cursor. */
254 xdr_free ((xdrproc_t) xdr_netobj, (char *) &cursor);
255 /* Remember the new one. */
256 cursor.n_bytes = result.cookie.n_bytes;
257 cursor.n_len = result.cookie.n_len;
258 /* Free the result structure. NB: we do not remove the cookie. */
259 result.cookie.n_bytes = NULL;
260 result.cookie.n_len = 0;
261 freeres:
262 xdr_free ((xdrproc_t) _xdr_nis_result, (char *) &result);
263 memset (&result, '\0', sizeof (result));
264 }
265 while (!parse_res);
266
267 return retval;
268 }
269
270 enum nss_status
271 _nss_nisplus_getpwent_r (struct passwd *result, char *buffer, size_t buflen,
272 int *errnop)
273 {
274 int status;
275
276 __libc_lock_lock (lock);
277
278 status = internal_nisplus_getpwent_r (result, buffer, buflen, errnop);
279
280 __libc_lock_unlock (lock);
281
282 return status;
283 }
284
285 enum nss_status
286 _nss_nisplus_getpwnam_r (const char *name, struct passwd *pw,
287 char *buffer, size_t buflen, int *errnop)
288 {
289 int parse_res;
290
291 if (pwd_tablename_val == NULL)
292 {
293 enum nss_status status = _nss_pwd_create_tablename (errnop);
294
295 if (status != NSS_STATUS_SUCCESS)
296 return status;
297 }
298
299 if (name == NULL)
300 {
301 *errnop = EINVAL;
302 return NSS_STATUS_UNAVAIL;
303 }
304
305 nis_result *result;
306 char buf[strlen (name) + 9 + pwd_tablename_len];
307 int olderr = errno;
308
309 snprintf (buf, sizeof (buf), "[name=%s],%s", name, pwd_tablename_val);
310
311 result = nis_list (buf, FOLLOW_PATH | FOLLOW_LINKS | USE_DGRAM, NULL, NULL);
312
313 if (result == NULL)
314 {
315 *errnop = ENOMEM;
316 return NSS_STATUS_TRYAGAIN;
317 }
318
319 if (__glibc_unlikely (niserr2nss (result->status) != NSS_STATUS_SUCCESS))
320 {
321 enum nss_status status = niserr2nss (result->status);
322
323 __set_errno (olderr);
324
325 nis_freeresult (result);
326 return status;
327 }
328
329 parse_res = _nss_nisplus_parse_pwent (result, pw, buffer, buflen, errnop);
330
331 nis_freeresult (result);
332
333 if (__glibc_unlikely (parse_res < 1))
334 {
335 if (parse_res == -1)
336 {
337 *errnop = ERANGE;
338 return NSS_STATUS_TRYAGAIN;
339 }
340 else
341 {
342 __set_errno (olderr);
343 return NSS_STATUS_NOTFOUND;
344 }
345 }
346
347 return NSS_STATUS_SUCCESS;
348 }
349
350 enum nss_status
351 _nss_nisplus_getpwuid_r (const uid_t uid, struct passwd *pw,
352 char *buffer, size_t buflen, int *errnop)
353 {
354 if (pwd_tablename_val == NULL)
355 {
356 enum nss_status status = _nss_pwd_create_tablename (errnop);
357
358 if (status != NSS_STATUS_SUCCESS)
359 return status;
360 }
361
362 int parse_res;
363 nis_result *result;
364 char buf[8 + 3 * sizeof (unsigned long int) + pwd_tablename_len];
365 int olderr = errno;
366
367 snprintf (buf, sizeof (buf), "[uid=%lu],%s",
368 (unsigned long int) uid, pwd_tablename_val);
369
370 result = nis_list (buf, FOLLOW_PATH | FOLLOW_LINKS | USE_DGRAM, NULL, NULL);
371
372 if (result == NULL)
373 {
374 *errnop = ENOMEM;
375 return NSS_STATUS_TRYAGAIN;
376 }
377
378 if (__glibc_unlikely (niserr2nss (result->status) != NSS_STATUS_SUCCESS))
379 {
380 enum nss_status status = niserr2nss (result->status);
381
382 __set_errno (olderr);
383
384 nis_freeresult (result);
385 return status;
386 }
387
388 parse_res = _nss_nisplus_parse_pwent (result, pw, buffer, buflen, errnop);
389
390 nis_freeresult (result);
391
392 if (__glibc_unlikely (parse_res < 1))
393 {
394 if (parse_res == -1)
395 {
396 *errnop = ERANGE;
397 return NSS_STATUS_TRYAGAIN;
398 }
399 else
400 {
401 __set_errno (olderr);
402 return NSS_STATUS_NOTFOUND;
403 }
404 }
405
406 return NSS_STATUS_SUCCESS;
407 }
0 /* Copyright (C) 1997-2015 Free Software Foundation, Inc.
1 This file is part of the GNU C Library.
2 Contributed by Thorsten Kukuk <kukuk@vt.uni-paderborn.de>, 1997.
3
4 The GNU C Library is free software; you can redistribute it and/or
5 modify it under the terms of the GNU Lesser General Public
6 License as published by the Free Software Foundation; either
7 version 2.1 of the License, or (at your option) any later version.
8
9 The GNU C Library is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 Lesser General Public License for more details.
13
14 You should have received a copy of the GNU Lesser General Public
15 License along with the GNU C Library; if not, see
16 <http://www.gnu.org/licenses/>. */
17
18 #include <atomic.h>
19 #include <ctype.h>
20 #include <errno.h>
21 #include <nss.h>
22 #include <string.h>
23 #include <rpc/netdb.h>
24 #include <rpcsvc/nis.h>
25 #include <bits/libc-lock.h>
26
27 #include "nss-nisplus.h"
28
29 __libc_lock_define_initialized (static, lock)
30
31 static nis_result *result;
32 static nis_name tablename_val;
33 static u_long tablename_len;
34
35 #define NISENTRYVAL(idx, col, res) \
36 (NIS_RES_OBJECT (res)[idx].EN_data.en_cols.en_cols_val[col].ec_value.ec_value_val)
37
38 #define NISENTRYLEN(idx, col, res) \
39 (NIS_RES_OBJECT (res)[idx].EN_data.en_cols.en_cols_val[col].ec_value.ec_value_len)
40
41
42 static int
43 _nss_nisplus_parse_rpcent (nis_result *result, struct rpcent *rpc,
44 char *buffer, size_t buflen, int *errnop)
45 {
46 char *first_unused = buffer;
47 size_t room_left = buflen;
48 unsigned int i;
49 char *line;
50
51
52 if (result == NULL)
53 return 0;
54
55 if ((result->status != NIS_SUCCESS && result->status != NIS_S_SUCCESS)
56 || __type_of (NIS_RES_OBJECT (result)) != NIS_ENTRY_OBJ
57 || strcmp (NIS_RES_OBJECT (result)[0].EN_data.en_type, "rpc_tbl") != 0
58 || NIS_RES_OBJECT (result)[0].EN_data.en_cols.en_cols_len < 3)
59 return 0;
60
61 if (NISENTRYLEN (0, 0, result) >= room_left)
62 {
63 no_more_room:
64 *errnop = ERANGE;
65 return -1;
66 }
67 strncpy (first_unused, NISENTRYVAL (0, 0, result),
68 NISENTRYLEN (0, 0, result));
69 first_unused[NISENTRYLEN (0, 0, result)] = '\0';
70 rpc->r_name = first_unused;
71 size_t len = strlen (first_unused) + 1;
72 room_left -= len;
73 first_unused += len;
74
75 rpc->r_number = atoi (NISENTRYVAL (0, 2, result));
76
77 /* XXX Rewrite at some point to allocate the array first and then
78 copy the strings. It wasteful to first concatenate the strings
79 to just split them again later. */
80 line = first_unused;
81 for (i = 0; i < NIS_RES_NUMOBJ (result); ++i)
82 {
83 if (strcmp (NISENTRYVAL (i, 1, result), rpc->r_name) != 0)
84 {
85 if (NISENTRYLEN (i, 1, result) + 2 > room_left)
86 goto no_more_room;
87 *first_unused++ = ' ';
88 first_unused = __stpncpy (first_unused, NISENTRYVAL (i, 1, result),
89 NISENTRYLEN (i, 1, result));
90 room_left -= NISENTRYLEN (i, 1, result) + 1;
91 }
92 }
93 *first_unused++ = '\0';
94
95 /* Adjust the pointer so it is aligned for
96 storing pointers. */
97 size_t adjust = ((__alignof__ (char *)
98 - (first_unused - (char *) 0) % __alignof__ (char *))
99 % __alignof__ (char *));
100 if (room_left < adjust + sizeof (char *))
101 goto no_more_room;
102 first_unused += adjust;
103 room_left -= adjust;
104 rpc->r_aliases = (char **) first_unused;
105
106 /* For the terminating NULL pointer. */
107 room_left -= sizeof (char *);
108
109 i = 0;
110 while (*line != '\0')
111 {
112 /* Skip leading blanks. */
113 while (isspace (*line))
114 ++line;
115
116 if (*line == '\0')
117 break;
118
119 if (room_left < sizeof (char *))
120 goto no_more_room;
121
122 room_left -= sizeof (char *);
123 rpc->r_aliases[i++] = line;
124
125 while (*line != '\0' && *line != ' ')
126 ++line;
127
128 if (*line == ' ')
129 *line++ = '\0';
130 }
131 rpc->r_aliases[i] = NULL;
132
133 return 1;
134 }
135
136
137 static enum nss_status
138 _nss_create_tablename (int *errnop)
139 {
140 if (tablename_val == NULL)
141 {
142 const char *local_dir = nis_local_directory ();
143 size_t local_dir_len = strlen (local_dir);
144 static const char prefix[] = "rpc.org_dir.";
145
146 char *p = malloc (sizeof (prefix) + local_dir_len);
147 if (p == NULL)
148 {
149 *errnop = errno;
150 return NSS_STATUS_TRYAGAIN;
151 }
152
153 memcpy (__stpcpy (p, prefix), local_dir, local_dir_len + 1);
154
155 tablename_len = sizeof (prefix) - 1 + local_dir_len;
156
157 atomic_write_barrier ();
158
159 tablename_val = p;
160 }
161
162 return NSS_STATUS_SUCCESS;
163 }
164
165
166 enum nss_status
167 _nss_nisplus_setrpcent (int stayopen)
168 {
169 enum nss_status status = NSS_STATUS_SUCCESS;
170
171 __libc_lock_lock (lock);
172
173 if (result != NULL)
174 {
175 nis_freeresult (result);
176 result = NULL;
177 }
178
179 if (tablename_val == NULL)
180 {
181 int err;
182 status = _nss_create_tablename (&err);
183 }
184
185 __libc_lock_unlock (lock);
186
187 return status;
188 }
189
190 enum nss_status
191 _nss_nisplus_endrpcent (void)
192 {
193 __libc_lock_lock (lock);
194
195 if (result != NULL)
196 {
197 nis_freeresult (result);
198 result = NULL;
199 }
200
201 __libc_lock_unlock (lock);
202
203 return NSS_STATUS_SUCCESS;
204 }
205
206 static enum nss_status
207 internal_nisplus_getrpcent_r (struct rpcent *rpc, char *buffer,
208 size_t buflen, int *errnop)
209 {
210 int parse_res;
211
212 /* Get the next entry until we found a correct one. */
213 do
214 {
215 nis_result *saved_res;
216
217 if (result == NULL)
218 {
219 saved_res = NULL;
220 if (tablename_val == NULL)
221 {
222 enum nss_status status = _nss_create_tablename (errnop);
223
224 if (status != NSS_STATUS_SUCCESS)
225 return status;
226 }
227
228 result = nis_first_entry (tablename_val);
229 if (result == NULL)
230 {
231 *errnop = errno;
232 return NSS_STATUS_TRYAGAIN;
233 }
234 if (niserr2nss (result->status) != NSS_STATUS_SUCCESS)
235 return niserr2nss (result->status);
236 }
237 else
238 {
239 saved_res = result;
240 result = nis_next_entry (tablename_val, &result->cookie);
241 if (result == NULL)
242 {
243 *errnop = errno;
244 return NSS_STATUS_TRYAGAIN;
245 }
246 if (niserr2nss (result->status) != NSS_STATUS_SUCCESS)
247 {
248 nis_freeresult (saved_res);
249 return niserr2nss (result->status);
250 }
251 }
252
253 parse_res = _nss_nisplus_parse_rpcent (result, rpc, buffer,
254 buflen, errnop);
255 if (parse_res == -1)
256 {
257 nis_freeresult (result);
258 result = saved_res;
259 *errnop = ERANGE;
260 return NSS_STATUS_TRYAGAIN;
261 }
262 else
263 {
264 if (saved_res)
265 nis_freeresult (saved_res);
266 }
267 }
268 while (!parse_res);
269
270 return NSS_STATUS_SUCCESS;
271 }
272
273 enum nss_status
274 _nss_nisplus_getrpcent_r (struct rpcent *result, char *buffer,
275 size_t buflen, int *errnop)
276 {
277 int status;
278
279 __libc_lock_lock (lock);
280
281 status = internal_nisplus_getrpcent_r (result, buffer, buflen, errnop);
282
283 __libc_lock_unlock (lock);
284
285 return status;
286 }
287
288 enum nss_status
289 _nss_nisplus_getrpcbyname_r (const char *name, struct rpcent *rpc,
290 char *buffer, size_t buflen, int *errnop)
291 {
292 int parse_res;
293
294 if (tablename_val == NULL)
295 {
296 __libc_lock_lock (lock);
297
298 enum nss_status status = _nss_create_tablename (errnop);
299
300 __libc_lock_unlock (lock);
301
302 if (status != NSS_STATUS_SUCCESS)
303 return status;
304 }
305
306 if (name == NULL)
307 return NSS_STATUS_NOTFOUND;
308
309 char buf[strlen (name) + 10 + tablename_len];
310 int olderr = errno;
311
312 /* Search at first in the alias list, and use the correct name
313 for the next search */
314 snprintf (buf, sizeof (buf), "[name=%s],%s", name, tablename_val);
315 nis_result *result = nis_list (buf, FOLLOW_PATH | FOLLOW_LINKS | USE_DGRAM,
316 NULL, NULL);
317
318 if (result != NULL)
319 {
320 char *bufptr = buf;
321
322 /* If we did not find it, try it as original name. But if the
323 database is correct, we should find it in the first case, too */
324 if ((result->status != NIS_SUCCESS
325 && result->status != NIS_S_SUCCESS)
326 || __type_of (result->objects.objects_val) != NIS_ENTRY_OBJ
327 || strcmp (result->objects.objects_val->EN_data.en_type,
328 "rpc_tbl") != 0
329 || result->objects.objects_val->EN_data.en_cols.en_cols_len < 3)
330 snprintf (buf, sizeof (buf), "[cname=%s],%s", name, tablename_val);
331 else
332 {
333 /* We need to allocate a new buffer since there is no
334 guarantee the returned name has a length limit. */
335 const char *entryval = NISENTRYVAL (0, 0, result);
336 size_t buflen = strlen (entryval) + 10 + tablename_len;
337 bufptr = alloca (buflen);
338 snprintf (bufptr, buflen, "[cname=%s],%s",
339 entryval, tablename_val);
340 }
341
342 nis_freeresult (result);
343 result = nis_list (bufptr, FOLLOW_PATH | FOLLOW_LINKS | USE_DGRAM,
344 NULL, NULL);
345 }
346
347 if (result == NULL)
348 {
349 *errnop = ENOMEM;
350 return NSS_STATUS_TRYAGAIN;
351 }
352
353 if (__glibc_unlikely (niserr2nss (result->status) != NSS_STATUS_SUCCESS))
354 {
355 enum nss_status status = niserr2nss (result->status);
356
357 __set_errno (olderr);
358
359 nis_freeresult (result);
360 return status;
361 }
362
363 parse_res = _nss_nisplus_parse_rpcent (result, rpc, buffer, buflen,
364 errnop);
365
366 nis_freeresult (result);
367
368 if (parse_res < 1)
369 {
370 if (parse_res == -1)
371 {
372 *errnop = ERANGE;
373 return NSS_STATUS_TRYAGAIN;
374 }
375
376 __set_errno (olderr);
377 return NSS_STATUS_NOTFOUND;
378 }
379
380 return NSS_STATUS_SUCCESS;
381 }
382
383 enum nss_status
384 _nss_nisplus_getrpcbynumber_r (const int number, struct rpcent *rpc,
385 char *buffer, size_t buflen, int *errnop)
386 {
387 if (tablename_val == NULL)
388 {
389 __libc_lock_lock (lock);
390
391 enum nss_status status = _nss_create_tablename (errnop);
392
393 __libc_lock_unlock (lock);
394
395 if (status != NSS_STATUS_SUCCESS)
396 return status;
397 }
398
399 char buf[12 + 3 * sizeof (number) + tablename_len];
400 int olderr = errno;
401
402 snprintf (buf, sizeof (buf), "[number=%d],%s", number, tablename_val);
403
404 nis_result *result = nis_list (buf, FOLLOW_LINKS | FOLLOW_PATH | USE_DGRAM,
405 NULL, NULL);
406
407 if (result == NULL)
408 {
409 *errnop = ENOMEM;
410 return NSS_STATUS_TRYAGAIN;
411 }
412
413 if (__builtin_expect (niserr2nss (result->status) != NSS_STATUS_SUCCESS, 0))
414 {
415 enum nss_status status = niserr2nss (result->status);
416
417 __set_errno (olderr);
418
419 nis_freeresult (result);
420 return status;
421 }
422
423 int parse_res = _nss_nisplus_parse_rpcent (result, rpc, buffer, buflen,
424 errnop);
425
426 nis_freeresult (result);
427
428 if (parse_res < 1)
429 {
430 if (parse_res == -1)
431 {
432 *errnop = ERANGE;
433 return NSS_STATUS_TRYAGAIN;
434 }
435 else
436 {
437 __set_errno (olderr);
438 return NSS_STATUS_NOTFOUND;
439 }
440 }
441
442 return NSS_STATUS_SUCCESS;
443 }
0 /* Copyright (C) 1997-2015 Free Software Foundation, Inc.
1 This file is part of the GNU C Library.
2 Contributed by Thorsten Kukuk <kukuk@suse.de>, 1997.
3
4 The GNU C Library is free software; you can redistribute it and/or
5 modify it under the terms of the GNU Lesser General Public
6 License as published by the Free Software Foundation; either
7 version 2.1 of the License, or (at your option) any later version.
8
9 The GNU C Library is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 Lesser General Public License for more details.
13
14 You should have received a copy of the GNU Lesser General Public
15 License along with the GNU C Library; if not, see
16 <http://www.gnu.org/licenses/>. */
17
18 #include <atomic.h>
19 #include <ctype.h>
20 #include <errno.h>
21 #include <netdb.h>
22 #include <nss.h>
23 #include <string.h>
24 #include <rpcsvc/nis.h>
25 #include <bits/libc-lock.h>
26
27 #include "nss-nisplus.h"
28
29 __libc_lock_define_initialized (static, lock);
30
31 static nis_result *result;
32 static nis_name tablename_val;
33 static u_long tablename_len;
34
35 #define NISENTRYVAL(idx, col, res) \
36 (NIS_RES_OBJECT (res)[idx].EN_data.en_cols.en_cols_val[col].ec_value.ec_value_val)
37
38 #define NISENTRYLEN(idx, col, res) \
39 (NIS_RES_OBJECT (res)[idx].EN_data.en_cols.en_cols_val[col].ec_value.ec_value_len)
40
41
42 static int
43 _nss_nisplus_parse_servent (nis_result *result, struct servent *serv,
44 char *buffer, size_t buflen, int *errnop)
45 {
46 char *first_unused = buffer;
47 size_t room_left = buflen;
48
49 if (result == NULL)
50 return 0;
51
52 if ((result->status != NIS_SUCCESS && result->status != NIS_S_SUCCESS)
53 || __type_of (NIS_RES_OBJECT (result)) != NIS_ENTRY_OBJ
54 || strcmp (NIS_RES_OBJECT (result)->EN_data.en_type, "services_tbl") != 0
55 || NIS_RES_OBJECT (result)->EN_data.en_cols.en_cols_len < 4)
56 return 0;
57
58 if (NISENTRYLEN (0, 0, result) >= room_left)
59 {
60 no_more_room:
61 *errnop = ERANGE;
62 return -1;
63 }
64 strncpy (first_unused, NISENTRYVAL (0, 0, result),
65 NISENTRYLEN (0, 0, result));
66 first_unused[NISENTRYLEN (0, 0, result)] = '\0';
67 serv->s_name = first_unused;
68 size_t len = strlen (first_unused) + 1;
69 room_left -= len;
70 first_unused += len;
71
72 if (NISENTRYLEN (0, 2, result) >= room_left)
73 goto no_more_room;
74 strncpy (first_unused, NISENTRYVAL (0, 2, result),
75 NISENTRYLEN (0, 2, result));
76 first_unused[NISENTRYLEN (0, 2, result)] = '\0';
77 serv->s_proto = first_unused;
78 len = strlen (first_unused) + 1;
79 room_left -= len;
80 first_unused += len;
81
82 serv->s_port = htons (atoi (NISENTRYVAL (0, 3, result)));
83
84 /* XXX Rewrite at some point to allocate the array first and then
85 copy the strings. It wasteful to first concatenate the strings
86 to just split them again later. */
87 char *line = first_unused;
88 for (unsigned int i = 0; i < NIS_RES_NUMOBJ (result); ++i)
89 {
90 if (strcmp (NISENTRYVAL (i, 1, result), serv->s_name) != 0)
91 {
92 if (NISENTRYLEN (i, 1, result) + 2 > room_left)
93 goto no_more_room;
94 *first_unused++ = ' ';
95 first_unused = __stpncpy (first_unused, NISENTRYVAL (i, 1, result),
96 NISENTRYLEN (i, 1, result));
97 room_left -= NISENTRYLEN (i, 1, result) + 1;
98 }
99 }
100 *first_unused++ = '\0';
101
102 /* Adjust the pointer so it is aligned for
103 storing pointers. */
104 size_t adjust = ((__alignof__ (char *)
105 - (first_unused - (char *) 0) % __alignof__ (char *))
106 % __alignof__ (char *));
107 if (room_left < adjust + sizeof (char *))
108 goto no_more_room;
109 first_unused += adjust;
110 room_left -= adjust;
111 serv->s_aliases = (char **) first_unused;
112
113 /* For the terminating NULL pointer. */
114 room_left -= (sizeof (char *));
115
116 unsigned int i = 0;
117 while (*line != '\0')
118 {
119 /* Skip leading blanks. */
120 while (isspace (*line))
121 ++line;
122
123 if (*line == '\0')
124 break;
125
126 if (room_left < sizeof (char *))
127 goto no_more_room;
128
129 room_left -= sizeof (char *);
130 serv->s_aliases[i++] = line;
131
132 while (*line != '\0' && *line != ' ')
133 ++line;
134
135 if (*line == ' ')
136 *line++ = '\0';
137 }
138 serv->s_aliases[i] = NULL;
139
140 return 1;
141 }
142
143
144 static enum nss_status
145 _nss_create_tablename (int *errnop)
146 {
147 if (tablename_val == NULL)
148 {
149 const char *local_dir = nis_local_directory ();
150 size_t local_dir_len = strlen (local_dir);
151 static const char prefix[] = "services.org_dir.";
152
153 char *p = malloc (sizeof (prefix) + local_dir_len);
154 if (p == NULL)
155 {
156 *errnop = errno;
157 return NSS_STATUS_TRYAGAIN;
158 }
159
160 memcpy (__stpcpy (p, prefix), local_dir, local_dir_len + 1);
161
162 tablename_len = sizeof (prefix) - 1 + local_dir_len;
163
164 atomic_write_barrier ();
165
166 tablename_val = p;
167 }
168
169 return NSS_STATUS_SUCCESS;
170 }
171
172
173 enum nss_status
174 _nss_nisplus_setservent (int stayopen)
175 {
176 enum nss_status status = NSS_STATUS_SUCCESS;
177 int err;
178
179 __libc_lock_lock (lock);
180
181 if (result != NULL)
182 {
183 nis_freeresult (result);
184 result = NULL;
185 }
186
187 if (tablename_val == NULL)
188 status = _nss_create_tablename (&err);
189
190 __libc_lock_unlock (lock);
191
192 return status;
193 }
194
195 enum nss_status
196 _nss_nisplus_endservent (void)
197 {
198 __libc_lock_lock (lock);
199
200 if (result != NULL)
201 {
202 nis_freeresult (result);
203 result = NULL;
204 }
205
206 __libc_lock_unlock (lock);
207
208 return NSS_STATUS_SUCCESS;
209 }
210
211 static enum nss_status
212 internal_nisplus_getservent_r (struct servent *serv, char *buffer,
213 size_t buflen, int *errnop)
214 {
215 int parse_res;
216
217 /* Get the next entry until we found a correct one. */
218 do
219 {
220 nis_result *saved_res;
221
222 if (result == NULL)
223 {
224 saved_res = NULL;
225 if (tablename_val == NULL)
226 {
227 enum nss_status status = _nss_create_tablename (errnop);
228
229 if (status != NSS_STATUS_SUCCESS)
230 return status;
231 }
232
233 result = nis_first_entry (tablename_val);
234 if (result == NULL)
235 {
236 *errnop = errno;
237 return NSS_STATUS_TRYAGAIN;
238 }
239 if (niserr2nss (result->status) != NSS_STATUS_SUCCESS)
240 return niserr2nss (result->status);
241 }
242 else
243 {
244 saved_res = result;
245 result = nis_next_entry (tablename_val, &result->cookie);
246 if (result == NULL)
247 {
248 *errnop = errno;
249 return NSS_STATUS_TRYAGAIN;
250 }
251 if (niserr2nss (result->status) != NSS_STATUS_SUCCESS)
252 {
253 nis_freeresult (saved_res);
254 return niserr2nss (result->status);
255 }
256 }
257
258 parse_res = _nss_nisplus_parse_servent (result, serv, buffer,
259 buflen, errnop);
260 if (__glibc_unlikely (parse_res == -1))
261 {
262 nis_freeresult (result);
263 result = saved_res;
264 *errnop = ERANGE;
265 return NSS_STATUS_TRYAGAIN;
266 }
267 else
268 {
269 if (saved_res)
270 nis_freeresult (saved_res);
271 }
272 }
273 while (!parse_res);
274
275 return NSS_STATUS_SUCCESS;
276 }
277
278 enum nss_status
279 _nss_nisplus_getservent_r (struct servent *result, char *buffer,
280 size_t buflen, int *errnop)
281 {
282 __libc_lock_lock (lock);
283
284 int status = internal_nisplus_getservent_r (result, buffer, buflen, errnop);
285
286 __libc_lock_unlock (lock);
287
288 return status;
289 }
290
291 enum nss_status
292 _nss_nisplus_getservbyname_r (const char *name, const char *protocol,
293 struct servent *serv,
294 char *buffer, size_t buflen, int *errnop)
295 {
296 if (tablename_val == NULL)
297 {
298 __libc_lock_lock (lock);
299
300 enum nss_status status = _nss_create_tablename (errnop);
301
302 __libc_lock_unlock (lock);
303
304 if (status != NSS_STATUS_SUCCESS)
305 return status;
306 }
307
308 if (name == NULL || protocol == NULL)
309 {
310 *errnop = EINVAL;
311 return NSS_STATUS_NOTFOUND;
312 }
313
314 size_t protocol_len = strlen (protocol);
315 char buf[strlen (name) + protocol_len + 17 + tablename_len];
316 int olderr = errno;
317
318 /* Search at first in the alias list, and use the correct name
319 for the next search */
320 snprintf (buf, sizeof (buf), "[name=%s,proto=%s],%s", name, protocol,
321 tablename_val);
322 nis_result *result = nis_list (buf, FOLLOW_PATH | FOLLOW_LINKS | USE_DGRAM,
323 NULL, NULL);
324
325 if (result != NULL)
326 {
327 char *bufptr = buf;
328
329 /* If we did not find it, try it as original name. But if the
330 database is correct, we should find it in the first case, too */
331 if ((result->status != NIS_SUCCESS
332 && result->status != NIS_S_SUCCESS)
333 || __type_of (NIS_RES_OBJECT (result)) != NIS_ENTRY_OBJ
334 || strcmp (NIS_RES_OBJECT (result)->EN_data.en_type,
335 "services_tbl") != 0
336 || NIS_RES_OBJECT (result)->EN_data.en_cols.en_cols_len < 4)
337 snprintf (buf, sizeof (buf), "[cname=%s,proto=%s],%s", name, protocol,
338 tablename_val);
339 else
340 {
341 /* We need to allocate a new buffer since there is no
342 guarantee the returned name has a length limit. */
343 const char *entryval = NISENTRYVAL(0, 0, result);
344 size_t buflen = (strlen (entryval) + protocol_len + 17
345 + tablename_len);
346 bufptr = alloca (buflen);
347 snprintf (bufptr, buflen, "[cname=%s,proto=%s],%s",
348 entryval, protocol, tablename_val);
349 }
350
351 nis_freeresult (result);
352 result = nis_list (bufptr, FOLLOW_PATH | FOLLOW_LINKS | USE_DGRAM,
353 NULL, NULL);
354 }
355
356 if (result == NULL)
357 {
358 *errnop = ENOMEM;
359 return NSS_STATUS_TRYAGAIN;
360 }
361
362 if (__glibc_unlikely (niserr2nss (result->status) != NSS_STATUS_SUCCESS))
363 {
364 enum nss_status status = niserr2nss (result->status);
365
366 __set_errno (olderr);
367
368 nis_freeresult (result);
369 return status;
370 }
371
372 int parse_res = _nss_nisplus_parse_servent (result, serv, buffer, buflen,
373 errnop);
374 nis_freeresult (result);
375
376 if (__glibc_unlikely (parse_res < 1))
377 {
378 if (parse_res == -1)
379 {
380 *errnop = ERANGE;
381 return NSS_STATUS_TRYAGAIN;
382 }
383 else
384 {
385 __set_errno (olderr);
386 return NSS_STATUS_NOTFOUND;
387 }
388 }
389
390 return NSS_STATUS_SUCCESS;
391 }
392
393 enum nss_status
394 _nss_nisplus_getservbyport_r (const int number, const char *protocol,
395 struct servent *serv,
396 char *buffer, size_t buflen, int *errnop)
397 {
398 if (tablename_val == NULL)
399 {
400 __libc_lock_lock (lock);
401
402 enum nss_status status = _nss_create_tablename (errnop);
403
404 __libc_lock_unlock (lock);
405
406 if (status != NSS_STATUS_SUCCESS)
407 return status;
408 }
409
410 if (protocol == NULL)
411 {
412 *errnop = EINVAL;
413 return NSS_STATUS_NOTFOUND;
414 }
415
416 char buf[17 + 3 * sizeof (int) + strlen (protocol) + tablename_len];
417 int olderr = errno;
418
419 snprintf (buf, sizeof (buf), "[port=%d,proto=%s],%s",
420 number, protocol, tablename_val);
421
422 nis_result *result = nis_list (buf, FOLLOW_PATH | FOLLOW_LINKS | USE_DGRAM,
423 NULL, NULL);
424
425 if (result == NULL)
426 {
427 *errnop = ENOMEM;
428 return NSS_STATUS_TRYAGAIN;
429 }
430
431 if (__glibc_unlikely (niserr2nss (result->status) != NSS_STATUS_SUCCESS))
432 {
433 enum nss_status status = niserr2nss (result->status);
434
435 __set_errno (olderr);
436
437 nis_freeresult (result);
438 return status;
439 }
440
441 int parse_res = _nss_nisplus_parse_servent (result, serv, buffer, buflen,
442 errnop);
443 nis_freeresult (result);
444
445 if (__glibc_unlikely (parse_res < 1))
446 {
447 if (parse_res == -1)
448 {
449 *errnop = ERANGE;
450 return NSS_STATUS_TRYAGAIN;
451 }
452 else
453 {
454 __set_errno (olderr);
455 return NSS_STATUS_NOTFOUND;
456 }
457 }
458
459 return NSS_STATUS_SUCCESS;
460 }
0 /* Copyright (C) 1997-2015 Free Software Foundation, Inc.
1 This file is part of the GNU C Library.
2 Contributed by Thorsten Kukuk <kukuk@vt.uni-paderborn.de>, 1997.
3
4 The GNU C Library is free software; you can redistribute it and/or
5 modify it under the terms of the GNU Lesser General Public
6 License as published by the Free Software Foundation; either
7 version 2.1 of the License, or (at your option) any later version.
8
9 The GNU C Library is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 Lesser General Public License for more details.
13
14 You should have received a copy of the GNU Lesser General Public
15 License along with the GNU C Library; if not, see
16 <http://www.gnu.org/licenses/>. */
17
18 #include <nss.h>
19 #include <errno.h>
20 #include <shadow.h>
21 #include <string.h>
22 #include <bits/libc-lock.h>
23 #include <rpcsvc/nis.h>
24
25 #include "nss-nisplus.h"
26 #include "nisplus-parser.h"
27
28 __libc_lock_define_initialized (static, lock)
29
30 static nis_result *result;
31
32 /* Defined in nisplus-pwd.c. */
33 extern nis_name pwd_tablename_val attribute_hidden;
34 extern size_t pwd_tablename_len attribute_hidden;
35 extern enum nss_status _nss_pwd_create_tablename (int *errnop);
36
37
38 enum nss_status
39 _nss_nisplus_setspent (int stayopen)
40 {
41 enum nss_status status = NSS_STATUS_SUCCESS;
42 int err;
43
44 __libc_lock_lock (lock);
45
46 if (result != NULL)
47 {
48 nis_freeresult (result);
49 result = NULL;
50 }
51
52 if (pwd_tablename_val == NULL)
53 status = _nss_pwd_create_tablename (&err);
54
55 __libc_lock_unlock (lock);
56
57 return status;
58 }
59
60 enum nss_status
61 _nss_nisplus_endspent (void)
62 {
63 __libc_lock_lock (lock);
64
65 if (result != NULL)
66 {
67 nis_freeresult (result);
68 result = NULL;
69 }
70
71 __libc_lock_unlock (lock);
72
73 return NSS_STATUS_SUCCESS;
74 }
75
76 static enum nss_status
77 internal_nisplus_getspent_r (struct spwd *sp, char *buffer, size_t buflen,
78 int *errnop)
79 {
80 int parse_res;
81
82 /* Get the next entry until we found a correct one. */
83 do
84 {
85 nis_result *saved_res;
86
87 if (result == NULL)
88 {
89 saved_res = NULL;
90
91 if (pwd_tablename_val == NULL)
92 {
93 enum nss_status status = _nss_pwd_create_tablename (errnop);
94
95 if (status != NSS_STATUS_SUCCESS)
96 return status;
97 }
98
99 result = nis_first_entry (pwd_tablename_val);
100 if (result == NULL)
101 {
102 *errnop = errno;
103 return NSS_STATUS_TRYAGAIN;
104 }
105 if (niserr2nss (result->status) != NSS_STATUS_SUCCESS)
106 return niserr2nss (result->status);
107 }
108 else
109 {
110 saved_res = result;
111 result = nis_next_entry (pwd_tablename_val, &result->cookie);
112 if (result == NULL)
113 {
114 *errnop = errno;
115 return NSS_STATUS_TRYAGAIN;
116 }
117 if (niserr2nss (result->status) != NSS_STATUS_SUCCESS)
118 {
119 nis_freeresult (saved_res);
120 return niserr2nss (result->status);
121 }
122 }
123
124 parse_res = _nss_nisplus_parse_spent (result, sp, buffer,
125 buflen, errnop);
126 if (__glibc_unlikely (parse_res == -1))
127 {
128 nis_freeresult (result);
129 result = saved_res;
130 *errnop = ERANGE;
131 return NSS_STATUS_TRYAGAIN;
132 }
133
134 if (saved_res != NULL)
135 nis_freeresult (saved_res);
136 }
137 while (!parse_res);
138
139 return NSS_STATUS_SUCCESS;
140 }
141
142 enum nss_status
143 _nss_nisplus_getspent_r (struct spwd *result, char *buffer, size_t buflen,
144 int *errnop)
145 {
146 int status;
147
148 __libc_lock_lock (lock);
149
150 status = internal_nisplus_getspent_r (result, buffer, buflen, errnop);
151
152 __libc_lock_unlock (lock);
153
154 return status;
155 }
156
157 enum nss_status
158 _nss_nisplus_getspnam_r (const char *name, struct spwd *sp,
159 char *buffer, size_t buflen, int *errnop)
160 {
161 int parse_res;
162
163 if (pwd_tablename_val == NULL)
164 {
165 enum nss_status status = _nss_pwd_create_tablename (errnop);
166
167 if (status != NSS_STATUS_SUCCESS)
168 return status;
169 }
170
171 if (name == NULL)
172 {
173 *errnop = EINVAL;
174 return NSS_STATUS_NOTFOUND;
175 }
176
177 nis_result *result;
178 char buf[strlen (name) + 9 + pwd_tablename_len];
179 int olderr = errno;
180
181 snprintf (buf, sizeof (buf), "[name=%s],%s", name, pwd_tablename_val);
182
183 result = nis_list (buf, FOLLOW_PATH | FOLLOW_LINKS | USE_DGRAM, NULL, NULL);
184
185 if (result == NULL)
186 {
187 *errnop = ENOMEM;
188 return NSS_STATUS_TRYAGAIN;
189 }
190
191 if (__glibc_unlikely (niserr2nss (result->status) != NSS_STATUS_SUCCESS))
192 {
193 enum nss_status status = niserr2nss (result->status);
194
195 __set_errno (olderr);
196
197 nis_freeresult (result);
198 return status;
199 }
200
201 parse_res = _nss_nisplus_parse_spent (result, sp, buffer, buflen, errnop);
202 nis_freeresult (result);
203
204 if (__glibc_unlikely (parse_res < 1))
205 {
206 if (parse_res == -1)
207 {
208 *errnop = ERANGE;
209 return NSS_STATUS_TRYAGAIN;
210 }
211 else
212 {
213 __set_errno (olderr);
214 return NSS_STATUS_NOTFOUND;
215 }
216 }
217
218 return NSS_STATUS_SUCCESS;
219 }
0 /* Copyright (C) 2014 Thorsten Kukuk
1 Author: Thorsten Kukuk <kukuk@suse.de>
2
3 This program is free software; you can redistribute it and/or modify
4 it under the terms of the GNU General Public License version 2 as
5 published by the Free Software Foundation.
6
7 This program is distributed in the hope that it will be useful,
8 but WITHOUT ANY WARRANTY; without even the implied warranty of
9 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10 GNU General Public License for more details.
11
12 You should have received a copy of the GNU General Public License
13 along with this program; if not, write to the Free Software Foundation,
14 Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
15
16 #ifdef HAVE_CONFIG_H
17 #include <config.h>
18 #endif
19
20 #include <nss.h>
21 #include <pwd.h>
22 #include <dlfcn.h>
23 #include <errno.h>
24 #include <stdio.h>
25 #include <unistd.h>
26 #include <sys/stat.h>
27
28 int
29 main (void)
30 {
31 enum nss_status (*nss_getpwnam_r)(const char *name, struct passwd *pwd,
32 char *buffer, size_t buflen, int *errnop);
33 enum nss_status status;
34 char *error;
35 void *nss_handle = NULL;
36 size_t pwdbuflen = 2048;
37 char pwdbuffer[2048];
38 struct passwd pw;
39
40 nss_handle = dlopen (".libs/libnss_nisplus.so.2", RTLD_NOW);
41 if (!nss_handle)
42 {
43 fprintf (stderr, "dlopen(\".libs/libnss_nisplus.so.2\") failed:\n%s\n",
44 dlerror ());
45 return 1;
46 }
47
48 nss_getpwnam_r = dlsym (nss_handle, "_nss_nisplus_getpwnam_r");
49 if ((error = dlerror ()) != NULL)
50 {
51 fprintf (stderr, "dlsym(\"_nss_nisplus_getpwnam_r\") failed: %s\n",
52 error);
53 dlclose (nss_handle);
54 return 1;
55 }
56
57 /* Get NIS passwd entry... */
58 do {
59 errno = 0;
60 status = (*nss_getpwnam_r)("kukuk", &pw, pwdbuffer,
61 pwdbuflen, &errno);
62 } while (status == NSS_STATUS_TRYAGAIN && errno == ERANGE);
63
64 if (status != NSS_STATUS_SUCCESS)
65 {
66 dlclose (nss_handle);
67 fprintf (stderr, "nss_getpwnam_r(\"kukuk\") failed! (%i)\n",
68 status);
69 return 1;
70 }
71
72 return 0;
73 }