Codebase list getdns / upstream/0.1.0+20140307+8e144d56
New upstream version 0.1.0+20140307+8e144d56 Ondřej Surý 10 years ago
64 changed file(s) with 14137 addition(s) and 11000 deletion(s). Raw diff Collapse all Expand all
0 *~
1 .DS_Store
2 getdns*.tar.gz
3 *.o
4 *.so
5 .*.swp
6 .deps/
7 .libs/
8 Makefile
9 *.lo
10 *.la
11 *.dSYM/
12 config.status
13 autom4te.cache
14 missing
15 libtool
16 example-all-functions
17 example-reverse
18 example-simple-answers
19 example-synchronous
20 example-tree
21 example_all_functions
22 example_reverse
23 example_simple_answers
24 example_synchronous
25 example_tree
26 src/doc/
27 src/config.h
28 tests_dict
29 tests_list
30 tests_stub_async
31 tests_stub_sync
32 src/test/tests_dnssec
33 src/example/example-reverse
34 check_getdns
35 check_getdns_event
36 check_getdns_uv
37 check_getdns_ev
38 doc/*.3
39 src/getdns/getdns.h
40 *.log
0 -bap
1 -br
2 -ce
3 -ci4
4 -cli0
5 -d0
6 -di0
7 -i8
8 -ip0
9 -l79
10 -nbc
11 -ncdb
12 -ndj
13 -nfc1
14 -nlp
15 -npcs
16 -psl
17 -sc
18 -sob
0 language: c
1 compiler:
2 - gcc
3 - clang
4 before_script:
5 - sudo apt-get update
6 - sudo apt-get install libunbound-dev libldns-dev libidn11-dev check libevent-dev
7 script:
8 - ./configure --with-libevent
9 - make
10 - sudo make install
11 - make test
12 - sudo make uninstall
+0
-24
COPYING less more
0 Copyright (c) 2013, Verisign, Inc., NLnet Labs
1 All rights reserved.
2
3 Redistribution and use in source and binary forms, with or without
4 modification, are permitted provided that the following conditions are met:
5 * Redistributions of source code must retain the above copyright
6 notice, this list of conditions and the following disclaimer.
7 * Redistributions in binary form must reproduce the above copyright
8 notice, this list of conditions and the following disclaimer in the
9 documentation and/or other materials provided with the distribution.
10 * Neither the names of the copyright holders nor the
11 names of its contributors may be used to endorse or promote products
12 derived from this software without specific prior written permission.
13
14 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
15 ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
16 WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
17 DISCLAIMED. IN NO EVENT SHALL Verisign, Inc. BE LIABLE FOR ANY
18 DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
19 (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
20 LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
21 ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22 (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
23 SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
0 LICENSE
0 * 2014-xx-xx : Version x.x.x
1 * default to NOT build extensions (libev, libuv, libevent), handle
2 --with/--without optiosn to configure for them
3 * respect configure --docdir=X
4 * Documentation/man page updates
5 * Fix install and cpp guards in getdns_extra.h
6 * Add method to switch between threads and fork mode for unbound
7 * Fixes for libuv integration (saghul)
8 * Fixes for calling getdns_destroy_context within a callback
9
010 * 2014-02-25 : Version 0.1.0
111 * Initial public release of the getdns API
0 /* $NetBSD: style,v 1.51 2013/03/08 16:50:02 christos Exp $ */
1
2 /*
3 * The revision control tag appears first, with a blank line after it.
4 * Copyright text appears after the revision control tag.
5 */
6
7 /*
8 * The NetBSD source code style guide.
9 * (Previously known as KNF - Kernel Normal Form).
10 *
11 * from: @(#)style 1.12 (Berkeley) 3/18/94
12 */
13 /*
14 * An indent(1) profile approximating the style outlined in
15 * this document lives in /usr/share/misc/indent.pro. It is a
16 * useful tool to assist in converting code to KNF, but indent(1)
17 * output generated using this profile must not be considered to
18 * be an authoritative reference.
19 */
20
21 /*
22 * Source code revision control identifiers appear after any copyright
23 * text. Use the appropriate macros from <sys/cdefs.h>. Usually only one
24 * source file per program contains a __COPYRIGHT() section.
25 * Historic Berkeley code may also have an __SCCSID() section.
26 * Only one instance of each of these macros can occur in each file.
27 * Don't use newlines in the identifiers.
28 */
29 #include <sys/cdefs.h>
30 __COPYRIGHT("@(#) Copyright (c) 2008\
31 The NetBSD Foundation, inc. All rights reserved.");
32 __RCSID("$NetBSD: style,v 1.51 2013/03/08 16:50:02 christos Exp $");
33
34 /*
35 * VERY important single-line comments look like this.
36 */
37
38 /* Most single-line comments look like this. */
39
40 /*
41 * Multi-line comments look like this. Make them real sentences. Fill
42 * them so they look like real paragraphs.
43 */
44
45 /*
46 * Attempt to wrap lines longer than 80 characters appropriately.
47 * Refer to the examples below for more information.
48 */
49
50 /*
51 * EXAMPLE HEADER FILE:
52 *
53 * A header file should protect itself against multiple inclusion.
54 * E.g, <sys/socket.h> would contain something like:
55 */
56 #ifndef _SYS_SOCKET_H_
57 #define _SYS_SOCKET_H_
58 /*
59 * Contents of #include file go between the #ifndef and the #endif at the end.
60 */
61 #endif /* !_SYS_SOCKET_H_ */
62 /*
63 * END OF EXAMPLE HEADER FILE.
64 */
65
66 /*
67 * If a header file requires structures, defines, typedefs, etc. from
68 * another header file it should include that header file and not depend
69 * on the including file for that header including both. If there are
70 * exceptions to this for specific headers it should be clearly documented
71 * in the headers and, if appropriate, the documentation. Nothing in this
72 * rule should suggest relaxation of the multiple inclusion rule and the
73 * application programmer should be free to include both regardless.
74 */
75
76 /*
77 * Kernel include files come first.
78 */
79 #include <sys/param.h> /* <sys/param.h> first, */
80 #include <sys/types.h> /* <sys/types.h> next, */
81 #include <sys/ioctl.h> /* and then the rest, */
82 #include <sys/socket.h> /* sorted lexicographically. */
83 #include <sys/stat.h>
84 #include <sys/wait.h> /* Non-local includes in brackets. */
85
86 /*
87 * If it's a network program, put the network include files next.
88 * Group the includes files by subdirectory.
89 */
90 #include <net/if.h>
91 #include <net/if_dl.h>
92 #include <net/route.h>
93 #include <netinet/in.h>
94 #include <protocols/rwhod.h>
95
96 /*
97 * Then there's a blank line, followed by the /usr include files.
98 * The /usr include files should be sorted lexicographically!
99 */
100 #include <assert.h>
101 #include <errno.h>
102 #include <inttypes.h>
103 #include <stdio.h>
104 #include <stdlib.h>
105
106 /*
107 * Global pathnames are defined in /usr/include/paths.h. Pathnames local
108 * to the program go in pathnames.h in the local directory.
109 */
110 #include <paths.h>
111
112 /* Then, there's a blank line, and the user include files. */
113 #include "pathnames.h" /* Local includes in double quotes. */
114
115 /*
116 * ANSI function declarations for private functions (i.e. functions not used
117 * elsewhere) and the main() function go at the top of the source module.
118 * Don't associate a name with the types. I.e. use:
119 * void function(int);
120 * Use your discretion on indenting between the return type and the name, and
121 * how to wrap a prototype too long for a single line. In the latter case,
122 * lining up under the initial left parenthesis may be more readable.
123 * In any case, consistency is important!
124 */
125 static char *function(int, int, float, int);
126 static int dirinfo(const char *, struct stat *, struct dirent *,
127 struct statfs *, int *, char **[]);
128 static void usage(void) __dead; /* declare functions that don't return dead */
129
130 /*
131 * Macros are capitalized, parenthesized, and should avoid side-effects.
132 * Spacing before and after the macro name may be any whitespace, though
133 * use of TABs should be consistent through a file.
134 * If they are an inline expansion of a function, the function is defined
135 * all in lowercase, the macro has the same name all in uppercase.
136 * If the macro is an expression, wrap the expression in parenthesis.
137 * If the macro is more than a single statement, use ``do { ... } while (0)'',
138 * so that a trailing semicolon works. Right-justify the backslashes; it
139 * makes it easier to read. The CONSTCOND comment is to satisfy lint(1).
140 */
141 #define MACRO(v, w, x, y) \
142 do { \
143 v = (x) + (y); \
144 w = (y) + 2; \
145 } while (/* CONSTCOND */ 0)
146
147 #define DOUBLE(x) ((x) * 2)
148
149 /* Enum types are capitalized. No comma on the last element. */
150 enum enumtype {
151 ONE,
152 TWO
153 } et;
154
155 /*
156 * When declaring variables in structures, declare them organized by use in
157 * a manner to attempt to minimize memory wastage because of compiler alignment
158 * issues, then by size, and then by alphabetical order. E.g, don't use
159 * ``int a; char *b; int c; char *d''; use ``int a; int b; char *c; char *d''.
160 * Each variable gets its own type and line, although an exception can be made
161 * when declaring bitfields (to clarify that it's part of the one bitfield).
162 * Note that the use of bitfields in general is discouraged.
163 *
164 * Major structures should be declared at the top of the file in which they
165 * are used, or in separate header files, if they are used in multiple
166 * source files. Use of the structures should be by separate declarations
167 * and should be "extern" if they are declared in a header file.
168 *
169 * It may be useful to use a meaningful prefix for each member name.
170 * E.g, for ``struct softc'' the prefix could be ``sc_''.
171 */
172 struct foo {
173 struct foo *next; /* List of active foo */
174 struct mumble amumble; /* Comment for mumble */
175 int bar;
176 unsigned int baz:1, /* Bitfield; line up entries if desired */
177 fuz:5,
178 zap:2;
179 uint8_t flag;
180 };
181 struct foo *foohead; /* Head of global foo list */
182
183 /* Make the structure name match the typedef. */
184 typedef struct BAR {
185 int level;
186 } BAR;
187
188 /* C99 uintN_t is preferred over u_intN_t. */
189 uint32_t zero;
190
191 /*
192 * All major routines should have a comment briefly describing what
193 * they do. The comment before the "main" routine should describe
194 * what the program does.
195 */
196 int
197 main(int argc, char *argv[])
198 {
199 long num;
200 int ch;
201 char *ep;
202
203 /*
204 * At the start of main(), call setprogname() to set the program
205 * name. This does nothing on NetBSD, but increases portability
206 * to other systems.
207 */
208 setprogname(argv[0]);
209
210 /*
211 * For consistency, getopt should be used to parse options.
212 * Options should be sorted in the getopt call and the switch
213 * statement, unless parts of the switch cascade. For the
214 * sorting order, see the usage() example below. Don't forget
215 * to add option descriptions to the usage and the manpage.
216 * Elements in a switch statement that cascade should have a
217 * FALLTHROUGH comment. Numerical arguments should be checked
218 * for accuracy. Code that cannot be reached should have a
219 * NOTREACHED comment.
220 */
221 while ((ch = getopt(argc, argv, "abn:")) != -1) {
222 switch (ch) { /* Indent the switch. */
223 case 'a': /* Don't indent the case. */
224 aflag = 1;
225 /* FALLTHROUGH */
226 case 'b':
227 bflag = 1;
228 break;
229 case 'n':
230 errno = 0;
231 num = strtol(optarg, &ep, 10);
232 if (num <= 0 || *ep != '\0' || (errno == ERANGE &&
233 (num == LONG_MAX || num == LONG_MIN)) )
234 errx(1, "illegal number -- %s", optarg);
235 break;
236 case '?':
237 default:
238 usage();
239 /* NOTREACHED */
240 }
241 }
242 argc -= optind;
243 argv += optind;
244
245 /*
246 * Space after keywords (while, for, return, switch). No braces are
247 * required for control statements with only a single statement,
248 * unless it's a long statement.
249 *
250 * Forever loops are done with for's, not while's.
251 */
252 for (p = buf; *p != '\0'; ++p)
253 continue; /* Explicit no-op */
254 for (;;)
255 stmt;
256
257 /*
258 * Braces are required for control statements with a single statement
259 * that may expand to nothing.
260 */
261 #ifdef DEBUG_FOO
262 #define DPRINTF(a) printf a
263 #else
264 #define DPRINTF(a)
265 #endif
266 if (broken) {
267 DPRINTF(("broken is %d\n", broken));
268 }
269
270 /*
271 * Parts of a for loop may be left empty. Don't put declarations
272 * inside blocks unless the routine is unusually complicated.
273 */
274 for (; cnt < 15; cnt++) {
275 stmt1;
276 stmt2;
277 }
278
279 /* Second level indents are four spaces. */
280 while (cnt < 20)
281 z = a + really + long + statement + that + needs + two + lines +
282 gets + indented + four + spaces + on + the + second +
283 and + subsequent + lines;
284
285 /*
286 * Closing and opening braces go on the same line as the else.
287 * Don't add braces that aren't necessary except in cases where
288 * there are ambiguity or readability issues.
289 */
290 if (test) {
291 /*
292 * I have a long comment here.
293 */
294 #ifdef zorro
295 z = 1;
296 #else
297 b = 3;
298 #endif
299 } else if (bar) {
300 stmt;
301 stmt;
302 } else
303 stmt;
304
305 /* No spaces after function names. */
306 if ((result = function(a1, a2, a3, a4)) == NULL)
307 exit(1);
308
309 /*
310 * Unary operators don't require spaces, binary operators do.
311 * Don't excessively use parenthesis, but they should be used if
312 * statement is really confusing without them, such as:
313 * a = b->c[0] + ~d == (e || f) || g && h ? i : j >> 1;
314 */
315 a = ((b->c[0] + ~d == (e || f)) || (g && h)) ? i : (j >> 1);
316 k = !(l & FLAGS);
317
318 /*
319 * Exits should be EXIT_SUCCESS on success, and EXIT_FAILURE on
320 * failure. Don't denote all the possible exit points, using the
321 * integers 1 through 127. Avoid obvious comments such as "Exit
322 * 0 on success.". Since main is a function that returns an int,
323 * prefer returning from it, than calling exit.
324 */
325 return EXIT_SUCCESS;
326 }
327
328 /*
329 * The function type must be declared on a line by itself
330 * preceding the function.
331 */
332 static char *
333 function(int a1, int a2, float fl, int a4)
334 {
335 /*
336 * When declaring variables in functions declare them sorted by size,
337 * then in alphabetical order; multiple ones per line are okay.
338 * Function prototypes should go in the include file "extern.h".
339 * If a line overflows reuse the type keyword.
340 *
341 * DO NOT initialize variables in the declarations.
342 */
343 extern u_char one;
344 extern char two;
345 struct foo three, *four;
346 double five;
347 int *six, seven;
348 char *eight, *nine, ten, eleven, twelve, thirteen;
349 char fourteen, fifteen, sixteen;
350
351 /*
352 * Casts and sizeof's are not followed by a space. NULL is any
353 * pointer type, and doesn't need to be cast, so use NULL instead
354 * of (struct foo *)0 or (struct foo *)NULL. Also, test pointers
355 * against NULL. I.e. use:
356 *
357 * (p = f()) == NULL
358 * not:
359 * !(p = f())
360 *
361 * The notable exception here is variadic functions. Since our
362 * code is designed to compile and work on different environments
363 * where we don't have control over the NULL definition (on NetBSD
364 * it is defined as ((void *)0), but on other systems it can be
365 * defined as (0) and both definitions are valid under ANSI C), it
366 * it advised to cast NULL to a pointer on varyadic functions,
367 * because on machines where sizeof(pointer) != sizeof(int) and in
368 * the absence of a prototype in scope, passing an un-casted NULL,
369 * will result in passing an int on the stack instead of a pointer.
370 *
371 * Don't use `!' for tests unless it's a boolean.
372 * E.g. use "if (*p == '\0')", not "if (!*p)".
373 *
374 * Routines returning ``void *'' should not have their return
375 * values cast to more specific pointer types.
376 *
377 * Prefer sizeof(*var) over sizeof(type) because if type changes,
378 * the change needs to be done in one place.
379 *
380 * Use err/warn(3), don't roll your own!
381 */
382 if ((four = malloc(sizeof(*four))) == NULL)
383 err(1, NULL);
384 if ((six = (int *)overflow()) == NULL)
385 errx(1, "Number overflowed.");
386
387 /* No parentheses are needed around the return value. */
388 return eight;
389 }
390
391 /*
392 * Use ANSI function declarations. ANSI function braces look like
393 * old-style (K&R) function braces.
394 * As per the wrapped prototypes, use your discretion on how to format
395 * the subsequent lines.
396 */
397 static int
398 dirinfo(const char *p, struct stat *sb, struct dirent *de, struct statfs *sf,
399 int *rargc, char **rargv[])
400 { /* Insert an empty line if the function has no local variables. */
401
402 /*
403 * In system libraries, catch obviously invalid function arguments
404 * using _DIAGASSERT(3).
405 */
406 _DIAGASSERT(p != NULL);
407 _DIAGASSERT(filedesc != -1);
408
409 if (stat(p, sb) < 0)
410 err(1, "Unable to stat %s", p);
411
412 /*
413 * To printf quantities that might be larger that "long", include
414 * <inttypes.h>, cast quantities to intmax_t or uintmax_t and use
415 * PRI?MAX constants.
416 */
417 (void)printf("The size of %s is %" PRIdMAX " (%#" PRIxMAX ")\n", p,
418 (intmax_t)sb->st_size, (uintmax_t)sb->st_size);
419
420 /*
421 * To printf quantities of known bit-width, use the corresponding
422 * defines (generally only done within NetBSD for quantities that
423 * exceed 32-bits).
424 */
425 (void)printf("%s uses %" PRId64 " blocks and has flags %#" PRIx32 "\n",
426 p, sb->st_blocks, sb->st_flags);
427
428 /*
429 * There are similar constants that should be used with the *scanf(3)
430 * family of functions: SCN?MAX, SCN?64, etc.
431 */
432 }
433
434 /*
435 * Functions that support variable numbers of arguments should look like this.
436 * (With the #include <stdarg.h> appearing at the top of the file with the
437 * other include files.)
438 */
439 #include <stdarg.h>
440
441 void
442 vaf(const char *fmt, ...)
443 {
444 va_list ap;
445
446 va_start(ap, fmt);
447 STUFF;
448 va_end(ap);
449 /* No return needed for void functions. */
450 }
451
452 static void
453 usage(void)
454 {
455
456 /*
457 * Use printf(3), not fputs/puts/putchar/whatever, it's faster and
458 * usually cleaner, not to mention avoiding stupid bugs.
459 * Use snprintf(3) or strlcpy(3)/strlcat(3) instead of sprintf(3);
460 * again to avoid stupid bugs.
461 *
462 * Usage statements should look like the manual pages.
463 * Options w/o operands come first, in alphabetical order
464 * inside a single set of braces, upper case before lower case
465 * (AaBbCc...). Next are options with operands, in the same
466 * order, each in braces. Then required arguments in the
467 * order they are specified, followed by optional arguments in
468 * the order they are specified. A bar (`|') separates
469 * either/or options/arguments, and multiple options/arguments
470 * which are specified together are placed in a single set of
471 * braces.
472 *
473 * Use getprogname() instead of hardcoding the program name.
474 *
475 * "usage: f [-aDde] [-b b_arg] [-m m_arg] req1 req2 [opt1 [opt2]]\n"
476 * "usage: f [-a | -b] [-c [-de] [-n number]]\n"
477 */
478 (void)fprintf(stderr, "usage: %s [-ab]\n", getprogname());
479 exit(EXIT_FAILURE);
480 }
2929 package = @PACKAGE_NAME@
3030 version = @PACKAGE_VERSION@
3131 tarname = @PACKAGE_TARNAME@
32 PACKAGE_TARNAME = @PACKAGE_TARNAME@
3233 distdir = $(tarname)-$(version)
3334 bintar = $(distdir)-bin.tar.gz
3435
3536 prefix = @prefix@
37 datarootdir=@datarootdir@
3638 exec_prefix = @exec_prefix@
3739 bindir = @bindir@
38 sharedoc = $(prefix)/share/doc/getdns-$(version)
40 docdir = @docdir@
3941
4042 srcdir = @srcdir@
4143 VPATH = @srcdir@
4749 all : default
4850
4951 install: all
50 $(INSTALL) -m 755 -d $(sharedoc)
51 $(INSTALL) -m 644 AUTHORS $(sharedoc)
52 $(INSTALL) -m 644 ChangeLog $(sharedoc)
53 $(INSTALL) -m 644 COPYING $(sharedoc)
54 $(INSTALL) -m 644 INSTALL $(sharedoc)
55 $(INSTALL) -m 644 LICENSE $(sharedoc)
56 $(INSTALL) -m 644 NEWS $(sharedoc)
57 $(INSTALL) -m 644 README.md $(sharedoc)
58 $(INSTALL) -m 755 -d $(sharedoc)/spec
59 $(INSTALL) -m 644 spec/index.html $(sharedoc)/spec
60 $(INSTALL) -m 644 spec/getdns*tgz $(sharedoc)/spec
52 $(INSTALL) -m 755 -d $(DESTDIR)$(docdir)
53 $(INSTALL) -m 644 AUTHORS $(DESTDIR)$(docdir)
54 $(INSTALL) -m 644 ChangeLog $(DESTDIR)$(docdir)
55 $(INSTALL) -m 644 COPYING $(DESTDIR)$(docdir)
56 $(INSTALL) -m 644 INSTALL $(DESTDIR)$(docdir)
57 $(INSTALL) -m 644 LICENSE $(DESTDIR)$(docdir)
58 $(INSTALL) -m 644 NEWS $(DESTDIR)$(docdir)
59 $(INSTALL) -m 644 README.md $(DESTDIR)$(docdir)
60 $(INSTALL) -m 755 -d $(DESTDIR)$(docdir)/spec
61 $(INSTALL) -m 644 spec/index.html $(DESTDIR)$(docdir)/spec
62 $(INSTALL) -m 644 spec/getdns*tgz $(DESTDIR)$(docdir)/spec
6163 cd src && $(MAKE) $@
6264 cd doc && $(MAKE) $@
6365 @echo "***"
7880 @echo "***"
7981
8082 uninstall:
81 rm -rf -d $(sharedoc)
83 rm -rf $(DESTDIR)$(docdir)
8284 cd doc && $(MAKE) $@
8385 cd src && $(MAKE) $@
8486
0 Please see README.md
0 [![Build Status](https://magnum.travis-ci.com/verisign/getdns.png?token=J2HZXstzJqePUsG523am&branch=develop)](https://magnum.travis-ci.com/verisign/getdns)
1
2 getdns API {#mainpage}
0 getdns API
31 ==========
42
53 * Date: 2014-02-26
6 * GitHub: <https://github.com/verisign/getdns>
4 * GitHub: <https://github.com/getdnsapi/getdns>
75
86 getdns is a [modern asynchronous DNS API](http://www.vpnc.org/getdns-api/) intended to make all types of DNS information easily available as described by Paul Hoffman. This implementation is licensed under the New BSD License (BSD-new).
97
2422 * Document code using doxygen
2523 * Leverage github as much as possible for project coordination
2624 * Coding style/standards follow the BSD coding style <ftp://ftp.netbsd.org/pub/NetBSD/NetBSD-current/src/share/misc/style>
27 * Follow the git flow branching model described at <http://nvie.com/posts/a-successful-git-branching-model/>
28 ** the master branch is always in a production ready state
29 ** the develop branch contains the latest development changes which are merged from develop into master once they are considered production ready
3025
3126 Non-goals (things we will not be doing at least initially) include:
3227 * implementation of the traditional DNS related routines (gethostbyname, etc.)
3328
3429 ## Language Bindings
3530
36 In parallel, the team is actively developing bindings for various languages. For more information, visit the [wiki](https://github.com/verisign/getdns/wiki/Language-Bindings).
31 In parallel, the team is actively developing bindings for various languages. For more information, visit the [wiki](https://github.com/getdnsapi/getdns/wiki/Language-Bindings).
3732
3833 Motivation for providing the API
3934 ================================
5449
5550 Tickets/Bug Reports
5651 ===================
57 Tickets and bug reports should be reported via the [GitHub issues list](https://github.com/verisign/getdns/issues).
52 Tickets and bug reports should be reported via the [GitHub issues list](https://github.com/getdnsapi/getdns/issues).
5853
5954 Additionally, we have a mailing list at users@getdns.net.
6055
7671
7772 ## Extensions / Event loop dependencies
7873
79 The implementation works with a variety of event loops, each built as a separate shared library. See [the wiki](https://github.com/verisign/getdns/wiki/Asynchronous-Support#wiki-included-event-loop-integrations) for more details.
74 The implementation works with a variety of event loops, each built as a separate shared library. See [the wiki](https://github.com/getdnsapi/getdns/wiki/Asynchronous-Support#wiki-included-event-loop-integrations) for more details.
8075
8176 * [libevent](http://libevent.org). Note: the examples *require* this and should work with either libevent 1.x or 2.x. 2.x is preferred.
8277 * [libuv](https://github.com/joyent/libuv)
157152
158153 ##Build Reports
159154
155 [![Build Status](https://travis-ci.org/getdnsapi/getdns.png?branch=master)](https://travis-ci.org/getdnsapi/getdns)
156
157 ###FreeBSD
158
159 If you're using [FreeBSD](http://www.freebsd.org/), you may install getdns via the [ports tree](http://www.freshports.org/dns/getdns/) by running: `cd /usr/ports/dns/getdns && make install clean`
160160
161161 ###CentOS/RHEL 6.5
162162
182182 ProductName: Mac OS X
183183 ProductVersion: 10.8.5
184184 BuildVersion: 12F45
185
185
186186 Built using PackageMaker.
187
188 #### Homebrew
189
190 If you're using [Homebrew](http://brew.sh/), you may run `brew install getdns`.
187191
188192 Contributors
189193 ============
190194 * Craig Despeaux, Verisign, Inc.
191195 * Neel Goyal, Verisign, Inc.
196 * Olaf Kolkman, NLnet Labs
192197 * Allison Mankin, Verisign, Inc. - Verisign Labs.
193198 * Melinda Shore, No Mountain Software LLC
194199 * Willem Toorop, NLnet Labs
0 # generated automatically by aclocal 1.14.1 -*- Autoconf -*-
1
2 # Copyright (C) 1996-2013 Free Software Foundation, Inc.
3
4 # This file is free software; the Free Software Foundation
5 # gives unlimited permission to copy and/or distribute it,
6 # with or without modifications, as long as this notice is preserved.
7
8 # This program is distributed in the hope that it will be useful,
9 # but WITHOUT ANY WARRANTY, to the extent permitted by law; without
10 # even the implied warranty of MERCHANTABILITY or FITNESS FOR A
11 # PARTICULAR PURPOSE.
12
13 m4_ifndef([AC_CONFIG_MACRO_DIRS], [m4_defun([_AM_CONFIG_MACRO_DIRS], [])m4_defun([AC_CONFIG_MACRO_DIRS], [_AM_CONFIG_MACRO_DIRS($@)])])
14 m4_include([m4/libtool.m4])
15 m4_include([m4/ltoptions.m4])
16 m4_include([m4/ltsugar.m4])
17 m4_include([m4/ltversion.m4])
18 m4_include([m4/lt~obsolete.m4])
634634 ac_subst_vars='LTLIBOBJS
635635 LIBOBJS
636636 TRUST_ANCHOR_FILE
637 EXTENSION_LDFLAGS
638637 CHECK_EV_PROG
638 EXTENSION_LIBEV_LDFLAGS
639639 EXTENSION_LIBEV_EXT_LIBS
640640 EXTENSION_LIBEV_LIB
641641 have_libev
642642 CHECK_UV_PROG
643 EXTENSION_LIBUV_LDFLAGS
643644 EXTENSION_LIBUV_EXT_LIBS
644645 EXTENSION_LIBUV_LIB
645646 have_libuv
646647 CHECK_EVENT_PROG
648 EXTENSION_LIBEVENT_LDFLAGS
647649 EXTENSION_LIBEVENT_EXT_LIBS
648650 EXTENSION_LIBEVENT_LIB
649651 have_libevent
744746 with_libidn
745747 with_libldns
746748 with_libunbound
749 with_libevent
750 with_libuv
751 with_libev
747752 with_trust_anchor
748753 '
749754 ac_precious_vars='build_alias
13871392 --with-libldns=pathname path to libldns (default: search /usr/local ..)
13881393 --with-libunbound=pathname
13891394 path to libunbound (default: search /usr/local ..)
1395 --with-libevent path to libevent (default: search /usr/local ..)
1396 --with-libuv path to libuv (default: search /usr/local ..)
1397 --with-libev path to libev (default: search /usr/local ..)
13901398 --with-trust-anchor=KEYFILE
13911399 Default location of the trust anchor file.
13921400 [default=SYSCONFDIR/unbound/getdns-root.key]
1103611044 as_fn_error $? "libunbound is missing." "$LINENO" 5
1103711045 fi
1103811046
11039 for ac_prog in doxygen
11040 do
11041 # Extract the first word of "$ac_prog", so it can be a program name with args.
11042 set dummy $ac_prog; ac_word=$2
11047 # Extract the first word of "doxygen", so it can be a program name with args.
11048 set dummy doxygen; ac_word=$2
1104311049 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
1104411050 $as_echo_n "checking for $ac_word... " >&6; }
1104511051 if ${ac_cv_prog_DOXYGEN+:} false; then :
1105511061 test -z "$as_dir" && as_dir=.
1105611062 for ac_exec_ext in '' $ac_executable_extensions; do
1105711063 if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
11058 ac_cv_prog_DOXYGEN="$ac_prog"
11064 ac_cv_prog_DOXYGEN=""
1105911065 $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
1106011066 break 2
1106111067 fi
1107511081 fi
1107611082
1107711083
11078 test -n "$DOXYGEN" && break
11079 done
11080
1108111084 if test -z "$DOXYGEN";
11082 then { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Doxygen not found, continuing without" >&5
11083 $as_echo "$as_me: WARNING: Doxygen not found, continuing without" >&2;}
11085 then { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: doxygen not found, continuing without" >&5
11086 $as_echo "$as_me: WARNING: doxygen not found, continuing without" >&2;}
1108411087 fi
1108511088
1108611089 # Checks for header files.
1116511168 ;;
1116611169 esac
1116711170
11171 ac_fn_c_check_type "$LINENO" "u_char" "ac_cv_type_u_char" "$ac_includes_default"
11172 if test "x$ac_cv_type_u_char" = xyes; then :
11173
11174 cat >>confdefs.h <<_ACEOF
11175 #define HAVE_U_CHAR 1
11176 _ACEOF
11177
11178
11179 fi
11180
1116811181
1116911182 getdns_LIBS=$LIBS
1117011183 getdns_LDFLAGS=$LDFLAGS
1117111184
11172 EXTENSION_LDFLAGS=$LDFLAGS
11173
11174 # libevent extension
11185 #-------------------- libevent extension
11186
11187 # Check whether --with-libevent was given.
11188 if test "${with_libevent+set}" = set; then :
11189 withval=$with_libevent; with_libevent=search
11190 else
11191 withval=no
11192 fi
11193
11194
1117511195 have_libevent=0
11176 EXTENSION_LIBEVENT_LIB="libgetdns_ext_event.la"
1117711196 EXTENSION_LIBEVENT_EXT_LIBS=""
11197 EXTENSION_LIBEVENT_LIB=""
11198 EXTENSION_LIBEVENT_LDFLAGS=""
1117811199 CHECK_EVENT_PROG=""
11179 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing event_loop" >&5
11200 if test x_$withval = x_no; then :
11201
11202 else
11203 if test x_$withval = x_yes; then :
11204 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing event_loop" >&5
1118011205 $as_echo_n "checking for library containing event_loop... " >&6; }
1118111206 if ${ac_cv_search_event_loop+:} false; then :
1118211207 $as_echo_n "(cached) " >&6
1124111266 fi
1124211267 done
1124311268
11244 for ac_header in event2/event.h
11269 for ac_header in event2/event.h
1124511270 do :
1124611271 ac_fn_c_check_header_compile "$LINENO" "event2/event.h" "ac_cv_header_event2_event_h" "$ac_includes_default
1124711272 "
1124911274 cat >>confdefs.h <<_ACEOF
1125011275 #define HAVE_EVENT2_EVENT_H 1
1125111276 _ACEOF
11252 # event2/event.h found
11253 have_libevent=1
11254 EXTENSION_LIBEVENT_EXT_LIBS="$ac_cv_search_event_loop"
11255 CHECK_EVENT_PROG=check_getdns_event
11256 else
11257 # not found - look for event.h
11258 ac_fn_c_check_type "$LINENO" "u_char" "ac_cv_type_u_char" "$ac_includes_default"
11259 if test "x$ac_cv_type_u_char" = xyes; then :
11260
11261 else
11262
11263 cat >>confdefs.h <<_ACEOF
11264 #define u_char unsigned char
11265 _ACEOF
11266
11267 fi
11268
11269 for ac_header in event.h
11277 have_libevent=1
11278 EXTENSION_LIBEVENT_EXT_LIBS="$ac_cv_search_event_loop"
11279 else
11280 for ac_header in event.h
1127011281 do :
1127111282 ac_fn_c_check_header_compile "$LINENO" "event.h" "ac_cv_header_event_h" "$ac_includes_default
1127211283 "
1127411285 cat >>confdefs.h <<_ACEOF
1127511286 #define HAVE_EVENT_H 1
1127611287 _ACEOF
11277 # found
11278 have_libevent=1
11279 EXTENSION_LIBEVENT_EXT_LIBS="$ac_cv_search_event_loop"
11280 CHECK_EVENT_PROG=check_getdns_event
11281 else
11282 # not found - give up
11283 EXTENSION_LIBEVENT_LIB=""
11288 have_libevent=1
11289 EXTENSION_LIBEVENT_EXT_LIBS="$ac_cv_search_event_loop"
11290 else
11291 as_fn_error $? "event2/event.h and event.h missing, try without libevent" "$LINENO" 5
11292 have_libevent=0
1128411293 fi
1128511294
1128611295 done
1128711296
11288
1128911297 fi
1129011298
1129111299 done
1129211300
1129311301 else
11294 # libs not found
11295 have_libevent=0
11296 EXTENSION_LIBEVENT_LIB=""
11297 fi
11298
11299
11300
11301
11302
11303
11304
11305 # libuv extension
11306 have_libuv=1
11307 EXTENSION_LIBUV_LIB="libgetdns_ext_uv.la"
11302 as_fn_error $? "libevent missing, try without libevent" "$LINENO" 5
11303
11304 fi
11305
11306 else
11307 have_libevent=1
11308 { $as_echo "$as_me:${as_lineno-$LINENO}: assuming libevent in $withval" >&5
11309 $as_echo "$as_me: assuming libevent in $withval" >&6;}
11310 CFLAGS="$CFLAGS -I$withval/include"
11311 EXTENSION_LIBEVENT_LDFLAGS="-L$withval/lib"
11312 EXTENSION_LIBEVENT_EXT_LIBS="-levent"
11313 fi
11314
11315 fi
11316
11317 if test x_$have_libevent = x_1; then :
11318 EXTENSION_LIBEVENT_LIB="libgetdns_ext_event.la"
11319 CHECK_EVENT_PROG=check_getdns_event
11320 fi
11321
11322
11323
11324
11325
11326
11327
11328 # end libevent extension
11329
11330 #-------------------- libuv extension
11331 # if user says nothing about libuv, or specifies --with-libuv=no or --without-libuv
11332 # then we do not want libuv extensions built
11333 # if user specifies --with-libuv then search for it
11334 # if user specifies --with-libuv=/path then check the lib at that path
11335
11336 # Check whether --with-libuv was given.
11337 if test "${with_libuv+set}" = set; then :
11338 withval=$with_libuv; with_libuv=search
11339 else
11340 withval=no
11341 fi
11342
11343
11344 have_libuv=0
1130811345 EXTENSION_LIBUV_EXT_LIBS=""
11346 EXTENSION_LIBUV_LIB=""
11347 EXTENSION_LIBUV_LDFLAGS=""
1130911348 CHECK_UV_PROG=""
11310 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing uv_run" >&5
11349 if test x_$withval = x_no; then :
11350
11351 else
11352 if test x_$withval = x_yes; then :
11353 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing uv_run" >&5
1131111354 $as_echo_n "checking for library containing uv_run... " >&6; }
1131211355 if ${ac_cv_search_uv_run+:} false; then :
1131311356 $as_echo_n "(cached) " >&6
1136811411 cat >>confdefs.h <<_ACEOF
1136911412 #define HAVE_UV_H 1
1137011413 _ACEOF
11371 EXTENSION_LIBUV_EXT_LIBS="$ac_cv_search_uv_run"
11372 CHECK_UV_PROG=check_getdns_uv
11373 else
11374 have_libuv=0
11375 EXTENSION_LIBUV_LIB=""
11414 have_libuv=1
11415 EXTENSION_LIBUV_EXT_LIBS="$ac_cv_search_uv_run"
11416 else
11417 as_fn_error $? "uv.h missing, try without libuv" "$LINENO" 5
11418 have_libuv=0
1137611419 fi
1137711420
1137811421 done
1137911422
1138011423 else
11381 have_libuv=0
11382 EXTENSION_LIBUV_LIB=""
11383 fi
11384
11385
11386
11387
11388
11389
11390
11391 # libev extension
11392 have_libev=1
11393 EXTENSION_LIBEV_LIB="libgetdns_ext_ev.la"
11424 as_fn_error $? "libuv missing, try without libuv" "$LINENO" 5
11425
11426 fi
11427
11428 else
11429 have_libuv=1
11430 { $as_echo "$as_me:${as_lineno-$LINENO}: assuming libuv in $withval" >&5
11431 $as_echo "$as_me: assuming libuv in $withval" >&6;}
11432 CFLAGS="$CFLAGS -I$withval/include"
11433 EXTENSION_LIBUV_LDFLAGS="-L$withval/lib"
11434 EXTENSION_LIBUV_EXT_LIBS="-luv"
11435 fi
11436
11437 fi
11438
11439 if test x_$have_libuv = x_1; then :
11440 EXTENSION_LIBUV_LIB="libgetdns_ext_uv.la"
11441 CHECK_UV_PROG=check_getdns_uv
11442 fi
11443
11444
11445
11446
11447
11448
11449
11450 # end libuv extension
11451
11452 #-------------------- libev extension
11453
11454 # Check whether --with-libev was given.
11455 if test "${with_libev+set}" = set; then :
11456 withval=$with_libev; with_libev=search
11457 else
11458 withval=no
11459 fi
11460
11461
11462 have_libev=0
1139411463 EXTENSION_LIBEV_EXT_LIBS=""
11395
11396 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing ev_run" >&5
11464 EXTENSION_LIBEV_LIB=""
11465 EXTENSION_LIBEV_LDFLAGS=""
11466 CHECK_EV_PROG=""
11467 if test x_$withval = x_no; then :
11468
11469 else
11470 if test x_$withval = x_yes; then :
11471 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing ev_run" >&5
1139711472 $as_echo_n "checking for library containing ev_run... " >&6; }
1139811473 if ${ac_cv_search_ev_run+:} false; then :
1139911474 $as_echo_n "(cached) " >&6
1145411529 cat >>confdefs.h <<_ACEOF
1145511530 #define HAVE_EV_H 1
1145611531 _ACEOF
11457 EXTENSION_LIBEV_EXT_LIBS="$ac_cv_search_ev_run"
11458 CHECK_EV_PROG=check_getdns_ev
11459 else
11460 have_libev=0
11461 EXTENSION_LIBUV_LIB=""
11532 have_libev=1
11533 EXTENSION_LIBEV_EXT_LIBS="$ac_cv_search_ev_run"
11534 else
11535 as_fn_error $? "ev.h missing, try without libev" "$LINENO" 5
11536 have_libev=0
1146211537 fi
1146311538
1146411539 done
1146511540
1146611541 else
11467 have_libev=0
11468 EXTENSION_LIBEV_LIB=""
11469 fi
11470
11471
11472
11473
11474
11475
11476
11477
11542 as_fn_error $? "libev missing, try without libev" "$LINENO" 5
11543
11544 fi
11545
11546 else
11547 have_libev=1
11548 { $as_echo "$as_me:${as_lineno-$LINENO}: assuming libev in $withval" >&5
11549 $as_echo "$as_me: assuming libev in $withval" >&6;}
11550 CFLAGS="$CFLAGS -I$withval/include"
11551 EXTENSION_LIBEV_LDFLAGS="-L$withval/lib"
11552 EXTENSION_LIBEV_EXT_LIBS="-lev"
11553 fi
11554
11555 fi
11556
11557 if test x_$have_libev = x_1; then :
11558 EXTENSION_LIBEV_LIB="libgetdns_ext_ev.la"
11559 CHECK_EV_PROG=check_getdns_ev
11560 fi
11561
11562
11563
11564
11565
11566
11567
11568 # end libev extension
1147811569
1147911570 LIBS=$getdns_LIBS
1148011571 LDFLAGS=$getdns_LDFLAGS
8282
8383 # search to set include and library paths right
8484 # find libidn
85 AC_ARG_WITH(libidn, AC_HELP_STRING([--with-libidn=pathname],
85 AC_ARG_WITH(libidn, AS_HELP_STRING([--with-libidn=pathname],
8686 [path to libidn (default: search /usr/local ..)]),
8787 [], [withval="yes"])
8888 if test x_$withval = x_yes; then
113113 fi
114114
115115 # find libldns
116 AC_ARG_WITH(libldns, AC_HELP_STRING([--with-libldns=pathname],
116 AC_ARG_WITH(libldns, AS_HELP_STRING([--with-libldns=pathname],
117117 [path to libldns (default: search /usr/local ..)]),
118118 [], [withval="yes"])
119119 if test x_$withval = x_yes; then
133133 fi
134134
135135 # find libunbound
136 AC_ARG_WITH(libunbound, AC_HELP_STRING([--with-libunbound=pathname],
136 AC_ARG_WITH(libunbound, AS_HELP_STRING([--with-libunbound=pathname],
137137 [path to libunbound (default: search /usr/local ..)]),
138138 [], [withval="yes"])
139139 if test x_$withval = x_yes; then
174174 AC_MSG_ERROR([libunbound is missing.])
175175 fi
176176
177 AC_CHECK_PROGS([DOXYGEN], [doxygen])
177 AC_CHECK_PROG([DOXYGEN], [doxygen])
178178 if test -z "$DOXYGEN";
179 then AC_MSG_WARN([Doxygen not found, continuing without])
179 then AC_MSG_WARN([doxygen not found, continuing without])
180180 fi
181181
182182 # Checks for header files.
188188 AC_TYPE_UINT32_T
189189 AC_TYPE_UINT64_T
190190 AC_TYPE_UINT8_T
191 AC_CHECK_TYPES([u_char])
191192
192193 getdns_LIBS=$LIBS
193194 getdns_LDFLAGS=$LDFLAGS
194195
195 EXTENSION_LDFLAGS=$LDFLAGS
196
197 # libevent extension
196 #-------------------- libevent extension
197 AC_ARG_WITH([libevent],
198 [AS_HELP_STRING([--with-libevent], [path to libevent (default: search /usr/local ..)])],
199 [with_libevent=search],
200 [withval=no])
201
198202 have_libevent=0
199 EXTENSION_LIBEVENT_LIB="libgetdns_ext_event.la"
200203 EXTENSION_LIBEVENT_EXT_LIBS=""
204 EXTENSION_LIBEVENT_LIB=""
205 EXTENSION_LIBEVENT_LDFLAGS=""
201206 CHECK_EVENT_PROG=""
202 AC_SEARCH_LIBS([event_loop],
203 [event_core event],
204 [AC_CHECK_FUNCS([event_base_new event_base_free])]
205 [AC_CHECK_HEADERS([event2/event.h],
206 # event2/event.h found
207 [have_libevent=1]
208 [EXTENSION_LIBEVENT_EXT_LIBS="$ac_cv_search_event_loop"]
209 [CHECK_EVENT_PROG=check_getdns_event],
210 # not found - look for event.h
211 [AC_CHECK_TYPE(u_char, unsigned char)]
212 [AC_CHECK_HEADERS([event.h],
213 # found
214 [have_libevent=1]
215 [EXTENSION_LIBEVENT_EXT_LIBS="$ac_cv_search_event_loop"]
216 [CHECK_EVENT_PROG=check_getdns_event],
217 # not found - give up
218 [EXTENSION_LIBEVENT_LIB=""],
219 [AC_INCLUDES_DEFAULT])]
220 ,[AC_INCLUDES_DEFAULT])],
221 # libs not found
222 [have_libevent=0]
223 [EXTENSION_LIBEVENT_LIB=""])
207 AS_IF([test x_$withval = x_no],
208 [],
209 [AS_IF([test x_$withval = x_yes],
210 [AC_SEARCH_LIBS([event_loop],
211 [event_core event],
212 [AC_CHECK_FUNCS([event_base_new event_base_free])]
213 [AC_CHECK_HEADERS([event2/event.h],
214 [have_libevent=1]
215 [EXTENSION_LIBEVENT_EXT_LIBS="$ac_cv_search_event_loop"],
216 [AC_CHECK_HEADERS([event.h],
217 [have_libevent=1]
218 [EXTENSION_LIBEVENT_EXT_LIBS="$ac_cv_search_event_loop"],
219 [AC_MSG_ERROR([event2/event.h and event.h missing, try without libevent])]
220 [have_libevent=0],
221 [AC_INCLUDES_DEFAULT])],
222 [AC_INCLUDES_DEFAULT])],
223 [AC_MSG_ERROR([libevent missing, try without libevent])]
224 )],
225 [have_libevent=1]
226 [AC_MSG_NOTICE([assuming libevent in $withval])]
227 [CFLAGS="$CFLAGS -I$withval/include"]
228 [EXTENSION_LIBEVENT_LDFLAGS="-L$withval/lib"]
229 [EXTENSION_LIBEVENT_EXT_LIBS="-levent"])]
230 )
231
232 AS_IF([test x_$have_libevent = x_1],
233 [EXTENSION_LIBEVENT_LIB="libgetdns_ext_event.la"]
234 [CHECK_EVENT_PROG=check_getdns_event])
224235
225236 AC_SUBST(have_libevent)
226237 AC_SUBST(EXTENSION_LIBEVENT_LIB)
227238 AC_SUBST(EXTENSION_LIBEVENT_EXT_LIBS)
239 AC_SUBST(EXTENSION_LIBEVENT_LDFLAGS)
228240 AC_SUBST(CHECK_EVENT_PROG)
229241
230 # libuv extension
231 have_libuv=1
232 EXTENSION_LIBUV_LIB="libgetdns_ext_uv.la"
242 # end libevent extension
243
244 #-------------------- libuv extension
245 # if user says nothing about libuv, or specifies --with-libuv=no or --without-libuv
246 # then we do not want libuv extensions built
247 # if user specifies --with-libuv then search for it
248 # if user specifies --with-libuv=/path then check the lib at that path
249 AC_ARG_WITH([libuv],
250 [AS_HELP_STRING([--with-libuv], [path to libuv (default: search /usr/local ..)])],
251 [with_libuv=search],
252 [withval=no])
253
254 have_libuv=0
233255 EXTENSION_LIBUV_EXT_LIBS=""
256 EXTENSION_LIBUV_LIB=""
257 EXTENSION_LIBUV_LDFLAGS=""
234258 CHECK_UV_PROG=""
235 AC_SEARCH_LIBS([uv_run],
236 [uv],
237 [AC_CHECK_HEADERS([uv.h],
238 [EXTENSION_LIBUV_EXT_LIBS="$ac_cv_search_uv_run"]
239 [CHECK_UV_PROG=check_getdns_uv],
240 [have_libuv=0]
241 [EXTENSION_LIBUV_LIB=""],
242 [AC_INCLUDES_DEFAULT])],
243 [have_libuv=0]
244 [EXTENSION_LIBUV_LIB=""])
259 AS_IF([test x_$withval = x_no],
260 [],
261 [AS_IF([test x_$withval = x_yes],
262 [AC_SEARCH_LIBS([uv_run],
263 [uv],
264 [AC_CHECK_HEADERS([uv.h],
265 [have_libuv=1]
266 [EXTENSION_LIBUV_EXT_LIBS="$ac_cv_search_uv_run"],
267 [AC_MSG_ERROR([uv.h missing, try without libuv])]
268 [have_libuv=0],
269 [AC_INCLUDES_DEFAULT])],
270 [AC_MSG_ERROR([libuv missing, try without libuv])]
271 )],
272 [have_libuv=1]
273 [AC_MSG_NOTICE([assuming libuv in $withval])]
274 [CFLAGS="$CFLAGS -I$withval/include"]
275 [EXTENSION_LIBUV_LDFLAGS="-L$withval/lib"]
276 [EXTENSION_LIBUV_EXT_LIBS="-luv"])]
277 )
278
279 AS_IF([test x_$have_libuv = x_1],
280 [EXTENSION_LIBUV_LIB="libgetdns_ext_uv.la"]
281 [CHECK_UV_PROG=check_getdns_uv])
245282
246283 AC_SUBST(have_libuv)
247284 AC_SUBST(EXTENSION_LIBUV_LIB)
248285 AC_SUBST(EXTENSION_LIBUV_EXT_LIBS)
286 AC_SUBST(EXTENSION_LIBUV_LDFLAGS)
249287 AC_SUBST(CHECK_UV_PROG)
250288
251 # libev extension
252 have_libev=1
253 EXTENSION_LIBEV_LIB="libgetdns_ext_ev.la"
289 # end libuv extension
290
291 #-------------------- libev extension
292 AC_ARG_WITH([libev],
293 [AS_HELP_STRING([--with-libev], [path to libev (default: search /usr/local ..)])],
294 [with_libev=search],
295 [withval=no])
296
297 have_libev=0
254298 EXTENSION_LIBEV_EXT_LIBS=""
255
256 AC_SEARCH_LIBS([ev_run],
257 [ev],
258 [AC_CHECK_HEADERS([ev.h],
259 [EXTENSION_LIBEV_EXT_LIBS="$ac_cv_search_ev_run"]
260 [CHECK_EV_PROG=check_getdns_ev],
261 [have_libev=0]
262 [EXTENSION_LIBUV_LIB=""],
263 [AC_INCLUDES_DEFAULT])],
264 [have_libev=0]
265 [EXTENSION_LIBEV_LIB=""])
299 EXTENSION_LIBEV_LIB=""
300 EXTENSION_LIBEV_LDFLAGS=""
301 CHECK_EV_PROG=""
302 AS_IF([test x_$withval = x_no],
303 [],
304 [AS_IF([test x_$withval = x_yes],
305 [AC_SEARCH_LIBS([ev_run],
306 [ev],
307 [AC_CHECK_HEADERS([ev.h],
308 [have_libev=1]
309 [EXTENSION_LIBEV_EXT_LIBS="$ac_cv_search_ev_run"],
310 [AC_MSG_ERROR([ev.h missing, try without libev])]
311 [have_libev=0],
312 [AC_INCLUDES_DEFAULT])],
313 [AC_MSG_ERROR([libev missing, try without libev])]
314 )],
315 [have_libev=1]
316 [AC_MSG_NOTICE([assuming libev in $withval])]
317 [CFLAGS="$CFLAGS -I$withval/include"]
318 [EXTENSION_LIBEV_LDFLAGS="-L$withval/lib"]
319 [EXTENSION_LIBEV_EXT_LIBS="-lev"])]
320 )
321
322 AS_IF([test x_$have_libev = x_1],
323 [EXTENSION_LIBEV_LIB="libgetdns_ext_ev.la"]
324 [CHECK_EV_PROG=check_getdns_ev])
266325
267326 AC_SUBST(have_libev)
268327 AC_SUBST(EXTENSION_LIBEV_LIB)
269328 AC_SUBST(EXTENSION_LIBEV_EXT_LIBS)
329 AC_SUBST(EXTENSION_LIBEV_LDFLAGS)
270330 AC_SUBST(CHECK_EV_PROG)
271331
272 AC_SUBST(EXTENSION_LDFLAGS)
332 # end libev extension
273333
274334 LIBS=$getdns_LIBS
275335 LDFLAGS=$getdns_LDFLAGS
276336
277337 # --with-trust-anchor=
278338 AC_DEFINE([SYSCONFDIR], [sysconfdir], [System configuration dir])
279 AC_ARG_WITH(trust-anchor, AC_HELP_STRING([--with-trust-anchor=KEYFILE], [Default location of the trust anchor file. [default=SYSCONFDIR/unbound/getdns-root.key]]), [
339 AC_ARG_WITH(trust-anchor, AS_HELP_STRING([--with-trust-anchor=KEYFILE], [Default location of the trust anchor file. [default=SYSCONFDIR/unbound/getdns-root.key]]), [
280340 TRUST_ANCHOR_FILE="$withval"
281341 ],[
282342 if test "x$TRUST_ANCHOR_FILE" = "x"; then
4343 VPATH = @srcdir@
4444
4545 EDITS=-e 's/@''version@/$(version)/g'
46 DOXYGEN = @DOXYGEN@
4647
4748 DOCDIRS = html latex man
4849 MANPAGES3 = libgetdns.3 getdns_address.3 getdns_cancel_callback.3 getdns_context.3 getdns_context_create.3 getdns_context_set.3 getdns_convert.3 getdns_dict.3 getdns_dict_get.3 getdns_dict_set.3 getdns_free_sync_request_memory.3 getdns_general.3 getdns_hostname.3 getdns_list.3 getdns_list_get.3 getdns_list_set.3 getdns_service.3
5253 all: doc
5354
5455 doc: $(MANPAGES3)
55 cd ../src && doxygen
56 if test x_$(DOXYGEN) != x_ ; then cd ../src; doxygen; fi
5657
5758 .SUFFIXES: .3.in .3
5859 .3.in.3:
124124 getdns_context_destroy() returns after all of the needed cleanup is done and
125125 callbacks are made.
126126
127 .HP 3
128 .I context
129 .RP
130 Used to return the pointer to an opaque structure. The caller passes the address of a pointer (decl: getdns_context *context; passed as &context) which will be populated as a result of returning from the function. The result is a newly allocated and initialized context (if there are no errors). In the getdns_destroy_context function this is the context whose associated memory will be released.
131
132 .HP 3
133 .I set_from_os
134 .RP
135 If set_from_os is 0 then the caller must provide forwarding name servers if running in stub mode. If set_from_os is 1 then the system files are used to initialize the context. /etc/resolv.conf is used to populate forwarders when running as a stub resolver (only "nameserver" lines are recognized). If set_from_os is 1 /etc/hosts entries are preferred before resorting to a DNS query. Errors in the system files will not prevent the context form being constructed.
136
137 .HP 3
138 .I userarg
139 .RP
140 In the extended use case this argument is passed unchanged to each of the memory management functions each time they are called.
141
142 .HP 3
143 .I malloc
144 .RP
145 The function that will be used for creating response dicts (and the members within the response dicts). By default the system malloc is used.
146
147 .HP 3
148 .I realloc
149 .RP
150 The function that will be used for creating response dicts (and the members within the response dicts). By default the system realloc is used.
151
152 .HP 3
153 .I free
154 .RP
155 The function that will be used for releasing storage for response dicts (and the members within the response dicts). By default the system free is used.
156
157
127158 .SH DESCRIPTION (LONG)
128159
129160 .LP
137168
138169 .LP
139170 When the context is used in the API for the first time and set_from_os is 1, the API starts replacing some of the values with values from the OS, such as those that would be found in res_query(3), /etc/resolv.conf, and so on, then proceeds with the new function. Some advanced users will not want the API to change the values to the OS's defaults; if set_from_os is 0, the API will not do any updates to the initial values based on changes in the OS. For example, this might be useful if the API is acting as a stub resolver that is using a specific upstream recursive resolver chosen by the application, not the one that might come back from DHCP.
140
141 .HP 3
142 .I context
143 .RP
144 In calls to the getdns_create_context functions this parameter is used to return a newly allocated and initialized context (if there are no errors). In the getdns_destroy_context function this is the context whose associated memory will be released.
145
146 .HP 3
147 .I set_from_os
148 .RP
149 If set_from_os is 0 then the caller must provide forwarding name servers if running in stub mode. If set_from_os is 1 then the system files are used to initialize the context. /etc/resolv.conf is used to populate forwarders when running as a stub resolver (only "nameserver" lines are recognized). If set_from_os is 1 /etc/hosts entries are preferred before resorting to a DNS query. Errors in the system files will not prevent the context form being constructed.
150
151 .HP 3
152 .I userarg
153 .RP
154 In the extended use case this argument is passed unchanged to each of the memory management functions each time they are called.
155
156 .HP 3
157 .I malloc
158 .RP
159 The function that will be used for creating response dicts (and the members within the response dicts). By default the system malloc is used.
160
161 .HP 3
162 .I realloc
163 .RP
164 The function that will be used for creating response dicts (and the members within the response dicts). By default the system realloc is used.
165
166 .HP 3
167 .I free
168 .RP
169 The function that will be used for releasing storage for response dicts (and the members within the response dicts). By default the system free is used.
170171
171172 .HP
172173 .SH "RETURN VALUES"
+0
-208
doc/getdns_context_create.3.in less more
0 .\" The "BSD-New" License
1 .\"
2 .\" Copyright (c) 2013, NLNet Labs, Verisign, Inc.
3 .\" All rights reserved.
4 .\"
5 .\" Redistribution and use in source and binary forms, with or without
6 .\" modification, are permitted provided that the following conditions are met:
7 .\" * Redistributions of source code must retain the above copyright
8 .\" notice, this list of conditions and the following disclaimer.
9 .\" * Redistributions in binary form must reproduce the above copyright
10 .\" notice, this list of conditions and the following disclaimer in the
11 .\" documentation and/or other materials provided with the distribution.
12 .\" * Neither the names of the copyright holders nor the
13 .\" names of its contributors may be used to endorse or promote products
14 .\" derived from this software without specific prior written permission.
15 .\"
16 .\" THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
17 .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 .\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 .\" DISCLAIMED. IN NO EVENT SHALL Verisign, Inc. BE LIABLE FOR ANY
20 .\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 .\" (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 .\" LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 .\" ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 .\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 .\" SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 .\"
27
28 .TH getdns_context 3 "@date@" "getdns @version@" getdns
29 .SH NAME
30 .B getdns_context_create,
31 .B getdns_context_create_with_memory_functions,
32 .B getdns_context_create_with_extended_memory_functions,
33 .B getdns_context_destroy
34 -- getdns context create and destroy routines
35
36 .SH LIBRARY
37 DNS Resolver library (libgetdns, -lgetdns)
38
39 .SH SYNOPSIS
40 #include <getdns.h>
41
42 getdns_return_t
43 .br
44 .B getdns_context_create
45 (getdns_context ** context,
46 .RS 3
47 .br
48 int set_from_os)
49 .RE
50
51 getdns_return_t
52 .br
53 .B getdns_context_create_with_memory_functions
54 (getdns_context ** context,
55 .RS 3
56 .br
57 int set_from_os,
58 .br
59 void *(*malloc) (size_t),
60 .br
61 void *(*realloc) (void *, size_t),
62 .br
63 void (*free) (void *))
64 .RE
65
66 getdns_return_t
67 .br
68 .B getdns_context_create_with_extended_memory_functions
69 (getdns_context **context,
70 .RS 3
71 .br
72 int set_from_os,
73 .br
74 void *userarg,
75 .br
76 void *(*malloc) (void *userarg, size_t),
77 .br
78 void *(*realloc) (void *userarg, void *, size_t),
79 .br
80 void (*free) (void *userarg, void *))
81 .RE
82
83 void
84 .br
85 .B getdns_context_destroy
86 (getdns_context *context)
87
88 .SH DESCRIPTION
89
90 .LP
91 Calls to getdns functions require a DNS context, which is a group of API
92 settings that affect how DNS calls are made. For most applications, a default
93 context is sufficient.
94
95 .LP
96 To create a new DNS context, use the function:
97 .RS 3
98 .br
99 getdns_return_t
100 .B getdns_context_create
101 (getdns_context_t *context, bool set_from_os)
102 .RE
103
104 .LP
105 The call to getdns_context_create immediately returns a context that can be
106 used with other API calls; that context contains the API's default values. Most
107 applications will want set_from_os set to true.
108
109 .LP
110 To clean up the context, including cleaning up all outstanding transactions
111 that were called using this context, use the function:
112 .RS 3
113 .br
114 void
115 .B getdns_context_destroy
116 (getdns_context_t context)
117 .RE
118
119 .LP
120 When getdns_context_destroy() returns, the application knows that all
121 outstanding transactions associated with this context will have been called;
122 callbacks that had not been called before getdns_context_destroy() was called
123 will be called with a callback_type of GETDNS_CALLBACK_CANCEL.
124 getdns_context_destroy() returns after all of the needed cleanup is done and
125 callbacks are made.
126
127 .SH DESCRIPTION (LONG)
128
129 .LP
130 Many calls in the DNS API require a DNS context. A DNS context contains the information that the API needs in order to process DNS calls, such as the locations of upstream DNS servers, DNSSEC trust anchors, and so on. The internal structure of the DNS context is opaque, and might be different on each OS. When a context is passed to any function, it must be an allocated context; the context must not be NULL.
131
132 .LP
133 A typical application using this API doesn't need to know anything about contexts. Basically, the application creates a default context, uses it in the functions that require a context, and then deallocates it when done. Context manipulation is available for more DNS-aware programs, but is unlikely to be of interest to applications that just want the results of lookups for A, AAAA, SRV, and PTR records.
134
135 .LP
136 It is expected that contexts in implementations of the API will not necessarily be thread-safe, but they will not be thread-hostile. A context should not be used by multiple threads: create a new context for use on a different thread. It is just fine for an application to have many contexts, and some DNS-heavy applications will certainly want to have many even if the application uses a single thread.
137
138 .LP
139 When the context is used in the API for the first time and set_from_os is 1, the API starts replacing some of the values with values from the OS, such as those that would be found in res_query(3), /etc/resolv.conf, and so on, then proceeds with the new function. Some advanced users will not want the API to change the values to the OS's defaults; if set_from_os is 0, the API will not do any updates to the initial values based on changes in the OS. For example, this might be useful if the API is acting as a stub resolver that is using a specific upstream recursive resolver chosen by the application, not the one that might come back from DHCP.
140
141 .HP 3
142 .I context
143 .RP
144 In calls to the getdns_create_context functions this parameter is used to return a newly allocated and initialized context (if there are no errors). In the getdns_destroy_context function this is the context whose associated memory will be released.
145
146 .HP 3
147 .I set_from_os
148 .RP
149 If set_from_os is 0 then the caller must provide forwarding name servers if running in stub mode. If set_from_os is 1 then the system files are used to initialize the context. /etc/resolv.conf is used to populate forwarders when running as a stub resolver (only "nameserver" lines are recognized). If set_from_os is 1 /etc/hosts entries are preferred before resorting to a DNS query. Errors in the system files will not prevent the context form being constructed.
150
151 .HP 3
152 .I userarg
153 .RP
154 In the extended use case this argument is passed unchanged to each of the memory management functions each time they are called.
155
156 .HP 3
157 .I malloc
158 .RP
159 The function that will be used for creating response dicts (and the members within the response dicts). By default the system malloc is used.
160
161 .HP 3
162 .I realloc
163 .RP
164 The function that will be used for creating response dicts (and the members within the response dicts). By default the system realloc is used.
165
166 .HP 3
167 .I free
168 .RP
169 The function that will be used for releasing storage for response dicts (and the members within the response dicts). By default the system free is used.
170
171 .HP
172 .SH "RETURN VALUES"
173
174 Upon successful completion each of these functions return
175 .B GETDNS_RETURN_GOOD
176 , otherwise the following error values are returned:
177
178 .LP
179 .B GETDNS_RETURN_GENERIC_ERROR
180 memory allocation failed or some other untoward thing happened while initializing the context
181
182 .LP
183 .B GETDNS_RETURN_BAD_CONTEXT
184 if the context pointer is invalid (getdns_context_destroy)
185
186 .SH EXAMPLES
187
188 TBD
189
190 .SH FILES
191 .br
192 /etc/hosts
193 .br
194 /etc/resolv.conf
195
196 .SH SEE ALSO
197 .BR libgetdns (3),
198 .BR getdns_address (3),
199 .BR getdns_address_sync (3),
200 .BR getdns_context_set (3),
201 .BR getdns_general (3),
202 .BR getdns_general_sync (3),
203 .BR getdns_hostname (3),
204 .BR getdns_hostname_sync (3),
205 .BR getdns_service (3),
206 .BR getdns_service_sync (3).
207
0 getdns_context.3.in
8888 .SH ASYNCHRONOUS USE
8989
9090 .LP
91 TBD
91 The getdns specification emphasizes the asynchronous nature of the API and
92 allows implementations to define their own approach. This page documents this
93 implementation's decisions and facilities provided to the developer.
94
95 .LP
96 This implementation provides asynchronous support via the following mechanisms:
97
98 .RS 3
99 File Descriptor Polling
100 .br
101 Event Loop Integrations:
102 .RS 3
103 libevent
104 .br
105 libuv
106 .br
107 libev
108 .RE
109 Custom Event Loop Integrations
110 .RE
111
112 .LP
113 All functions and types discussed in this page are declared in getdns_extra.h
114
115 .SS "File Descriptor Polling"
116
117 A common approach used in asynchronous applications is to poll a file
118 descriptor via system calls like select and poll and then yielding CPU when
119 ready. The API provides the following functions to support this approach:
120
121 .HP 3
122 int getdns_context_fd(getdns_context* context)
123
124 Get the file descriptor to poll for a given context. Callers should never read from this result. It is meant strictly for polling.Returns -1 if the context is NULL.
125
126 .HP 3
127 uint32_t getdns_context_get_num_pending_requests(getdns_context* context, struct timeval* next_timeout)
128
129 Get the number of outstanding asynchronous requests for a given context as well as the the amount of time until the next timeout. The next_timeout struct can be NULL. If supplied and the number of outstanding requests is > 0, then the timeout represents the relative time until the next timeout.
130
131 .HP 3
132 getdns_return_t getdns_context_process_async(getdns_context* context)
133
134 Inform the context to process its outstanding requests. Users should call this when either a timeout has occurred or the file descriptor signals that it is ready. User callbacks are fired during this call.
135
136 .SS "Example Event Loop"
137
138 The following is an example event loop leveraging select:
139
140 .Bd -literal -compact
141 struct timeval tv;
142 /* Keep looping while there are outstanding requests */
143 while (getdns_context_get_num_pending_requests(context, &tv) > 0)
144 {
145 /* setup the read FD_SET to pass to select */
146 int fd = getdns_context_fd(context);
147 fd_set read_fds;
148 FD_ZERO(&read_fds);
149 FD_SET(fd, &read_fds);
150 /* Wait on the FD or for a timeout */
151 select(fd + 1, &read_fds, NULL, NULL, &tv);
152 getdns_context_process_async(context);
153 }
154 .Ed
155
156 .SS "Included Event Loop Integrations"
157
158 .LP
159 A number of applications achieve asynchronous behavior by leveraging event loop abstraction libraries. If the build system discovers a supported event loop, the event loop extension is built in addition to the getdns library. Extensions are built as an additional shared library. The following event loop libraries are supported:
160
161 .B
162 libevent1 and libevent2
163
164 .LP
165 The libevent extension allows a context to attach to a event_base. The event loop is then run like any other application using libevent via event_base_dispatch or event_base_loop and expect getdns callbacks to fire.
166
167 .LP
168 Note that if both libevent1 and libevent2 reside on system, the extension uses libevent2.
169
170 .RS 3
171 Extension library: libgetdns_ext_event.[shared_lib_ext]
172 .br
173 Extension header: getdns/getdns_ext_libevent.h
174 .RE
175
176 .B
177 libuv
178
179 .LP
180 The libuv extension allows a context to attach to a uv_loop_s. The event loop can then be run like any other application using libuv via uv_run and expect getdns callbacks to fire.
181
182 .RS 3
183 Extension library: libgetdns_ext_uv.[shared_lib_ext]
184 .br
185 Extension header: getdns_ext_libuv.h
186 .RE
187
188 .B
189 libev
190
191 .LP
192 The libev extension allows a context to attach to a ev_loop. The event loop can then be run like any other application using libev via ev_run and expect getdns callbacks to fire.
193
194 .RS 3
195 Extension library: libgetdns_ext_ev.[shared_lib_ext]
196 .br
197 Extension header: getdns_ext_libev.h
198 .RE
199
200 .SS "Custom Event Loop Integrations"
201
202 .LP
203 The event loop integrations documented above all leverage the same event loop extension API provided by this library. The mechanism is exposed to developers who wish to integrate their own event loop. And includes the following functions and structures:
204
205 .LP
206 The application provides a callback to indicate that a timeout has occurred.
207
208 .IP
209 typedef void (*getdns_timeout_callback) (void* userarg);
210
211 .LP
212 Timeout data provided when scheduling a timeout is captured in this structure:
213
214 .Bd -literal -compact
215 typedef struct getdns_timeout_data {
216 /* a timeout id */
217 getdns_transaction_t transaction_id;
218 /* absolute time of the timeout */
219 struct timeval timeout_time;
220 /* the timeout callback to fire */
221 getdns_timeout_callback callback;
222 /* user arg to callback */
223 void* userarg;
224 /* pointer to the underlying extension pointer that the extension will create and free */
225 void* extension_timer;
226 struct getdns_context* context;
227 } getdns_timeout_data_t;
228 .Ed
229
230 .LP
231 The application calls the extension to schedule a timer. Any timer data that needs to be tracked should be stored in eventloop_timer.
232
233 .IP
234 typedef getdns_return_t (*getdns_eventloop_schedule_timeout_t)(struct getdns_context* context,
235 void* eventloop_data, uint16_t timeout,
236 getdns_timeout_data_t* timeout_data,
237 void** eventloop_timer);
238
239 .LP
240 The application calls the extension to free a timer. The timer passed in is the same as that returned in the schedule timeout. This is the only place where it is safe to free timer data. Extensions can expect this will be called for every schedule_timeout call.
241
242 .IP
243 typedef getdns_return_t (*getdns_eventloop_clear_timeout_t)(struct getdns_context* context,
244 void* eventloop_data, void* eventloop_timer);
245
246 .LP
247 The application informs the extension that the number of outbound requests has changed. This is called when an asynchronous request is submitted or canceled by the user.
248
249 .IP
250 typedef getdns_return_t (*getdns_eventloop_request_count_changed_t)(struct getdns_context* context, uint32_t request_count, void* eventloop_data);
251
252 .LP
253 The application tell the extension to free up any data associated with the extension functions. This is called when a context is destroyed, or the extension is being detached.
254
255 .IP
256 typedef getdns_return_t (*getdns_eventloop_cleanup_t)(struct getdns_context* context, void* eventloop_data);
257
258 .LP
259 The extension structure used by the getdns_context.
260
261 .IP
262 typedef struct getdns_eventloop_extension {
263 getdns_eventloop_cleanup_t cleanup_data;
264 getdns_eventloop_schedule_timeout_t schedule_timeout;
265 getdns_eventloop_clear_timeout_t clear_timeout;
266 getdns_eventloop_request_count_changed_t request_count_changed;
267 } getdns_eventloop_extension;
268
269 .Ed
270
271 .SS "getdns_context event loop extension functions"
272
273 .LP
274 The following are functions used by the extension entry point to attach to a particular context.
275
276 .LP
277 The application sets an event loop extension on a context. The extension_data is optional data that is passed into the extension methods. If an event loop is already set on a context then it is cleaned up. All outstanding requests are also canceled.
278
279 .IP
280 getdns_return_t getdns_extension_set_eventloop(struct getdns_context* context, getdns_eventloop_extension* extension, void* extension_data);
281
282 .LP
283 The application gets the extension data associated with a context.
284
285 .IP
286 void* getdns_context_get_extension_data(struct getdns_context* context);
287
288 .LP
289 When no more work must be done the application detaches an event loop from a context
290
291 .IP
292 getdns_return_t getdns_extension_detach_eventloop(struct getdns_context* context);
293
92294
93295 .SH SYNCHRONOUS USE
94296
0 <pkg-contents spec="1.12"><f n="include" o="root" g="wheel" p="16877" pt="/Users/gwiley/getdnsosx/export/include" m="false" t="file"><f n="getdns" o="root" g="wheel" p="16877"><f n="getdns.h" o="root" g="wheel" p="33188"/><f n="getdns_ext_libevent.h" o="root" g="wheel" p="33188"/><f n="getdns_extra.h" o="root" g="wheel" p="33188"/></f></f></pkg-contents>
0 <pkgref spec="1.12" uuid="09533AB8-5081-4C20-B228-051BC89644B1"><config><identifier>verisigninc.com.getdnsApi.include.pkg</identifier><version>0.1.0</version><description></description><post-install type="none"/><requireAuthorization/><installFrom relative="true">../getdnsosx/export/include</installFrom><installTo mod="true">/usr/local</installTo><flags><followSymbolicLinks/></flags><packageStore type="internal"></packageStore><mod>requireAuthorization</mod><mod>installTo</mod><mod>extraFiles</mod><mod>identifier</mod><mod>parent</mod><mod>includeRoot</mod><mod>installTo.path</mod><mod>version</mod><mod>installFrom.isAbsoluteType</mod></config><contents><file-list>01include-contents.xml</file-list><filter>/CVS$</filter><filter>/\.svn$</filter><filter>/\.cvsignore$</filter><filter>/\.cvspass$</filter><filter>/\.DS_Store$</filter></contents><extra-files/></pkgref>
0 <pkg-contents spec="1.12"><f n="lib" o="root" g="wheel" p="16877" pt="/Users/gwiley/getdnsosx/export/lib" m="false" t="file"><f n="libgetdns-0.1.0.0.dylib" o="root" g="wheel" p="33261"/><f n="libgetdns.a" o="root" g="wheel" p="33188"/><f n="libgetdns.dylib" o="root" g="wheel" p="41453"/><f n="libgetdns.la" o="root" g="wheel" p="33188"/><f n="libgetdns_ext_event-0.1.0.0.dylib" o="root" g="wheel" p="33261"/><f n="libgetdns_ext_event.a" o="root" g="wheel" p="33188"/><f n="libgetdns_ext_event.dylib" o="root" g="wheel" p="41453"/><f n="libgetdns_ext_event.la" o="root" g="wheel" p="33188"/></f></pkg-contents>
0 <pkgref spec="1.12" uuid="FE53C8A7-F9E8-4B77-9634-6D2B93FF4242"><config><identifier>verisigninc.com.getdnsApi.lib.pkg</identifier><version>1.0</version><description></description><post-install type="none"/><requireAuthorization/><installFrom>/Users/gwiley/getdnsosx/export/lib</installFrom><installTo mod="true">/usr/local</installTo><flags><followSymbolicLinks/></flags><packageStore type="internal"></packageStore><mod>installTo</mod><mod>requireAuthorization</mod><mod>parent</mod><mod>version</mod><mod>installTo.path</mod><mod>extraFiles</mod><mod>identifier</mod></config><contents><file-list>02lib-contents.xml</file-list><filter>/CVS$</filter><filter>/\.svn$</filter><filter>/\.cvsignore$</filter><filter>/\.cvspass$</filter><filter>/\.DS_Store$</filter></contents><extra-files/></pkgref>
0 <pkg-contents spec="1.12"><f n="share" o="root" g="wheel" p="16877" pt="/Users/gwiley/getdnsosx/export/share" m="false" t="file"><f n="doc" o="root" g="wheel" p="16877"><f n="getdns-0.1.0" o="root" g="wheel" p="16877"><f n="AUTHORS" o="root" g="wheel" p="33188"/><f n="ChangeLog" o="root" g="wheel" p="33188"/><f n="COPYING" o="root" g="wheel" p="33188"/><f n="INSTALL" o="root" g="wheel" p="33188"/><f n="LICENSE" o="root" g="wheel" p="33188"/><f n="NEWS" o="root" g="wheel" p="33188"/><f n="README.md" o="root" g="wheel" p="33188"/><f n="spec" o="root" g="wheel" p="16877"><f n="getdns-0.5.tgz" o="root" g="wheel" p="33188"/><f n="index.html" o="root" g="wheel" p="33188"/></f></f></f><f n="man" o="root" g="wheel" p="16877"><f n="man3" o="root" g="wheel" p="16877"><f n="getdns_address.3" o="root" g="wheel" p="33188"/><f n="getdns_address_sync.3" o="root" g="wheel" p="33188"/><f n="getdns_cancel_callback.3" o="root" g="wheel" p="33188"/><f n="getdns_context.3" o="root" g="wheel" p="33188"/><f n="getdns_context_create.3" o="root" g="wheel" p="33188"/><f n="getdns_context_create_with_extended_memory_functions.3" o="root" g="wheel" p="33188"/><f n="getdns_context_create_with_memory_functions.3" o="root" g="wheel" p="33188"/><f n="getdns_context_destroy.3" o="root" g="wheel" p="33188"/><f n="getdns_context_set.3" o="root" g="wheel" p="33188"/><f n="getdns_context_set_append_name.3" o="root" g="wheel" p="33188"/><f n="getdns_context_set_context_update_callback.3" o="root" g="wheel" p="33188"/><f n="getdns_context_set_dns_root_servers.3" o="root" g="wheel" p="33188"/><f n="getdns_context_set_dns_transport.3" o="root" g="wheel" p="33188"/><f n="getdns_context_set_follow_redirects.3" o="root" g="wheel" p="33188"/><f n="getdns_context_set_limit_outstanding_queries.3" o="root" g="wheel" p="33188"/><f n="getdns_context_set_namespaces.3" o="root" g="wheel" p="33188"/><f n="getdns_context_set_resolution_type.3" o="root" g="wheel" p="33188"/><f n="getdns_context_set_timeout.3" o="root" g="wheel" p="33188"/><f n="getdns_convert.3" o="root" g="wheel" p="33188"/><f n="getdns_convert_dns_name_to_fqdn.3" o="root" g="wheel" p="33188"/><f n="getdns_convert_fqdn_to_dns_name.3" o="root" g="wheel" p="33188"/><f n="getdns_dict.3" o="root" g="wheel" p="33188"/><f n="getdns_dict_create.3" o="root" g="wheel" p="33188"/><f n="getdns_dict_destroy.3" o="root" g="wheel" p="33188"/><f n="getdns_dict_get.3" o="root" g="wheel" p="33188"/><f n="getdns_dict_get_bindata.3" o="root" g="wheel" p="33188"/><f n="getdns_dict_get_data_type.3" o="root" g="wheel" p="33188"/><f n="getdns_dict_get_dict.3" o="root" g="wheel" p="33188"/><f n="getdns_dict_get_int.3" o="root" g="wheel" p="33188"/><f n="getdns_dict_get_list.3" o="root" g="wheel" p="33188"/><f n="getdns_dict_get_names.3" o="root" g="wheel" p="33188"/><f n="getdns_dict_set.3" o="root" g="wheel" p="33188"/><f n="getdns_dict_set_bindata.3" o="root" g="wheel" p="33188"/><f n="getdns_dict_set_dict.3" o="root" g="wheel" p="33188"/><f n="getdns_dict_set_int.3" o="root" g="wheel" p="33188"/><f n="getdns_dict_set_list.3" o="root" g="wheel" p="33188"/><f n="getdns_free_sync_request_memory.3" o="root" g="wheel" p="33188"/><f n="getdns_general.3" o="root" g="wheel" p="33188"/><f n="getdns_general_sync.3" o="root" g="wheel" p="33188"/><f n="getdns_hostname.3" o="root" g="wheel" p="33188"/><f n="getdns_hostname_sync.3" o="root" g="wheel" p="33188"/><f n="getdns_list.3" o="root" g="wheel" p="33188"/><f n="getdns_list_create.3" o="root" g="wheel" p="33188"/><f n="getdns_list_destroy.3" o="root" g="wheel" p="33188"/><f n="getdns_list_get.3" o="root" g="wheel" p="33188"/><f n="getdns_list_get_bindata.3" o="root" g="wheel" p="33188"/><f n="getdns_list_get_data_type.3" o="root" g="wheel" p="33188"/><f n="getdns_list_get_dict.3" o="root" g="wheel" p="33188"/><f n="getdns_list_get_int.3" o="root" g="wheel" p="33188"/><f n="getdns_list_get_length.3" o="root" g="wheel" p="33188"/><f n="getdns_list_get_list.3" o="root" g="wheel" p="33188"/><f n="getdns_list_set.3" o="root" g="wheel" p="33188"/><f n="getdns_list_set_bindata.3" o="root" g="wheel" p="33188"/><f n="getdns_list_set_dict.3" o="root" g="wheel" p="33188"/><f n="getdns_list_set_int.3" o="root" g="wheel" p="33188"/><f n="getdns_list_set_list.3" o="root" g="wheel" p="33188"/><f n="getdns_service.3" o="root" g="wheel" p="33188"/><f n="getdns_service_sync.3" o="root" g="wheel" p="33188"/><f n="libgetdns.3" o="root" g="wheel" p="33188"/></f></f></f></pkg-contents>
0 <pkgref spec="1.12" uuid="48C4E6AC-5FE3-43BB-98FE-206052823135"><config><identifier>verisigninc.com.getdnsApi.share.pkg</identifier><version>0.1.0</version><description></description><post-install type="none"/><requireAuthorization/><installFrom>/Users/gwiley/getdnsosx/export/share</installFrom><installTo mod="true">/usr/local</installTo><flags><followSymbolicLinks/></flags><packageStore type="internal"></packageStore><mod>installTo</mod><mod>identifier</mod><mod>requireAuthorization</mod><mod>parent</mod><mod>installTo.path</mod><mod>extraFiles</mod><mod>version</mod></config><contents><file-list>03share-contents.xml</file-list><filter>/CVS$</filter><filter>/\.svn$</filter><filter>/\.cvsignore$</filter><filter>/\.cvspass$</filter><filter>/\.DS_Store$</filter></contents><extra-files/></pkgref>
0 <pkmkdoc spec="1.12"><properties><title>getdns API</title><build>/Users/gwiley/getdns-bin/getdns-0.1.0-OSX10_8.mpkg</build><organization>getdnsapi.net</organization><userSees ui="easy"/><min-target os="2"/><domain anywhere="true" system="true"/></properties><distribution><versions min-spec="1.000000"/><scripts></scripts></distribution><description>Modern API that provides asynchronous access to the modern features of the DNS. See http://getdnsapi.net for more details.</description><contents><choice title="include" id="choice0" starts_selected="true" starts_enabled="true" starts_hidden="false"><pkgref id="verisigninc.com.getdnsApi.include.pkg"/></choice><choice title="lib" id="choice1" starts_selected="true" starts_enabled="true" starts_hidden="false"><pkgref id="verisigninc.com.getdnsApi.lib.pkg"/></choice><choice title="share" id="choice2" starts_selected="true" starts_enabled="true" starts_hidden="false"><pkgref id="verisigninc.com.getdnsApi.share.pkg"/></choice></contents><resources bg-scale="none" bg-align="topleft"><locale lang="en"><resource mod="true" type="license">/Users/gwiley/getdns/LICENSE</resource><resource mod="true" type="readme">/Users/gwiley/getdns/README.md</resource><resource mime-type="text/rtf" kind="embedded" type="welcome"><![CDATA[{\rtf1\ansi\ansicpg1252\cocoartf1187\cocoasubrtf400
1 {\fonttbl\f0\fnil\fcharset0 LucidaGrande;}
2 {\colortbl;\red255\green255\blue255;}
3 \pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\pardirnatural
4
5 \f0\fs26 \cf0 getdns is a modern asynchronous DNS API intended to make all types of DNS information easily available as described by Paul Hoffman. \
6 \
7 This implementation is licensed under the New BSD License (BSD-new).\
8 \
9 The project page is at http://www.getdnsapi.net\
10 \
11 This binary distribution requires:\
12 \
13 libevent\
14 libidn\
15 libldns\
16 libunbound\
17 }]]></resource></locale></resources><flags/><extra-files/><item type="file">01include.xml</item><item type="file">02lib.xml</item><item type="file">03share.xml</item><mod>extraFiles</mod><mod>properties.title</mod><mod>properties.customizeOption</mod><mod>description</mod><mod>properties.systemDomain</mod></pkmkdoc>
+0
-10074
libtool less more
0 #! /bin/sh
1
2 # libtool - Provide generalized library-building support services.
3 # Generated automatically by config.status ()
4 # Libtool was configured on host DUL1GWILEY-M2:
5 # NOTE: Changes made to this file will be lost: look at ltmain.sh.
6 #
7 # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005,
8 # 2006, 2007, 2008, 2009, 2010, 2011 Free Software
9 # Foundation, Inc.
10 # Written by Gordon Matzigkeit, 1996
11 #
12 # This file is part of GNU Libtool.
13 #
14 # GNU Libtool is free software; you can redistribute it and/or
15 # modify it under the terms of the GNU General Public License as
16 # published by the Free Software Foundation; either version 2 of
17 # the License, or (at your option) any later version.
18 #
19 # As a special exception to the GNU General Public License,
20 # if you distribute this file as part of a program or library that
21 # is built using GNU Libtool, you may include this file under the
22 # same distribution terms that you use for the rest of that program.
23 #
24 # GNU Libtool is distributed in the hope that it will be useful,
25 # but WITHOUT ANY WARRANTY; without even the implied warranty of
26 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
27 # GNU General Public License for more details.
28 #
29 # You should have received a copy of the GNU General Public License
30 # along with GNU Libtool; see the file COPYING. If not, a copy
31 # can be downloaded from http://www.gnu.org/licenses/gpl.html, or
32 # obtained by writing to the Free Software Foundation, Inc.,
33 # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
34
35
36 # The names of the tagged configurations supported by this script.
37 available_tags=""
38
39 # ### BEGIN LIBTOOL CONFIG
40
41 # Which release of libtool.m4 was used?
42 macro_version=2.4.2
43 macro_revision=1.3337
44
45 # Whether or not to build shared libraries.
46 build_libtool_libs=yes
47
48 # Whether or not to build static libraries.
49 build_old_libs=yes
50
51 # What type of objects to build.
52 pic_mode=default
53
54 # Whether or not to optimize for fast installation.
55 fast_install=needless
56
57 # Shell to use when invoking shell scripts.
58 SHELL="/bin/sh"
59
60 # An echo program that protects backslashes.
61 ECHO="printf %s\\n"
62
63 # The PATH separator for the build system.
64 PATH_SEPARATOR=":"
65
66 # The host system.
67 host_alias=
68 host=x86_64-apple-darwin12.5.0
69 host_os=darwin12.5.0
70
71 # The build system.
72 build_alias=
73 build=x86_64-apple-darwin12.5.0
74 build_os=darwin12.5.0
75
76 # A sed program that does not truncate output.
77 SED="/usr/bin/sed"
78
79 # Sed that helps us avoid accidentally triggering echo(1) options like -n.
80 Xsed="$SED -e 1s/^X//"
81
82 # A grep program that handles long lines.
83 GREP="/usr/bin/grep"
84
85 # An ERE matcher.
86 EGREP="/usr/bin/grep -E"
87
88 # A literal string matcher.
89 FGREP="/usr/bin/grep -F"
90
91 # A BSD- or MS-compatible name lister.
92 NM="/usr/bin/nm"
93
94 # Whether we need soft or hard links.
95 LN_S="ln -s"
96
97 # What is the maximum length of a command?
98 max_cmd_len=196608
99
100 # Object file suffix (normally "o").
101 objext=o
102
103 # Executable file suffix (normally "").
104 exeext=
105
106 # whether the shell understands "unset".
107 lt_unset=unset
108
109 # turn spaces into newlines.
110 SP2NL="tr \\040 \\012"
111
112 # turn newlines into spaces.
113 NL2SP="tr \\015\\012 \\040\\040"
114
115 # convert $build file names to $host format.
116 to_host_file_cmd=func_convert_file_noop
117
118 # convert $build files to toolchain format.
119 to_tool_file_cmd=func_convert_file_noop
120
121 # An object symbol dumper.
122 OBJDUMP="false"
123
124 # Method to check whether dependent libraries are shared objects.
125 deplibs_check_method="pass_all"
126
127 # Command to use when deplibs_check_method = "file_magic".
128 file_magic_cmd="\$MAGIC_CMD"
129
130 # How to find potential files when deplibs_check_method = "file_magic".
131 file_magic_glob=""
132
133 # Find potential files using nocaseglob when deplibs_check_method = "file_magic".
134 want_nocaseglob="no"
135
136 # DLL creation program.
137 DLLTOOL="false"
138
139 # Command to associate shared and link libraries.
140 sharedlib_from_linklib_cmd="printf %s\\n"
141
142 # The archiver.
143 AR="ar"
144
145 # Flags to create an archive.
146 AR_FLAGS="cru"
147
148 # How to feed a file listing to the archiver.
149 archiver_list_spec=""
150
151 # A symbol stripping program.
152 STRIP="strip"
153
154 # Commands used to install an old-style archive.
155 RANLIB="ranlib"
156 old_postinstall_cmds="chmod 644 \$oldlib~\$RANLIB \$tool_oldlib"
157 old_postuninstall_cmds=""
158
159 # Whether to use a lock for old archive extraction.
160 lock_old_archive_extraction=yes
161
162 # A C compiler.
163 LTCC="gcc"
164
165 # LTCC compiler flags.
166 LTCFLAGS="-g -O2 -I/opt/local/include -I/usr/local/include -I/usr/local/include"
167
168 # Take the output of nm and produce a listing of raw symbols and C names.
169 global_symbol_pipe="sed -n -e 's/^.*[ ]\\([BCDEGRST][BCDEGRST]*\\)[ ][ ]*_\\([_A-Za-z][_A-Za-z0-9]*\\)\$/\\1 _\\2 \\2/p' | sed '/ __gnu_lto/d'"
170
171 # Transform the output of nm in a proper C declaration.
172 global_symbol_to_cdecl="sed -n -e 's/^T .* \\(.*\\)\$/extern int \\1();/p' -e 's/^[BCDEGRST]* .* \\(.*\\)\$/extern char \\1;/p'"
173
174 # Transform the output of nm in a C name address pair.
175 global_symbol_to_c_name_address="sed -n -e 's/^: \\([^ ]*\\)[ ]*\$/ {\\\"\\1\\\", (void *) 0},/p' -e 's/^[BCDEGRST]* \\([^ ]*\\) \\([^ ]*\\)\$/ {\"\\2\", (void *) \\&\\2},/p'"
176
177 # Transform the output of nm in a C name address pair when lib prefix is needed.
178 global_symbol_to_c_name_address_lib_prefix="sed -n -e 's/^: \\([^ ]*\\)[ ]*\$/ {\\\"\\1\\\", (void *) 0},/p' -e 's/^[BCDEGRST]* \\([^ ]*\\) \\(lib[^ ]*\\)\$/ {\"\\2\", (void *) \\&\\2},/p' -e 's/^[BCDEGRST]* \\([^ ]*\\) \\([^ ]*\\)\$/ {\"lib\\2\", (void *) \\&\\2},/p'"
179
180 # Specify filename containing input files for $NM.
181 nm_file_list_spec=""
182
183 # The root where to search for dependent libraries,and in which our libraries should be installed.
184 lt_sysroot=
185
186 # The name of the directory that contains temporary libtool files.
187 objdir=.libs
188
189 # Used to examine libraries when file_magic_cmd begins with "file".
190 MAGIC_CMD=file
191
192 # Must we lock files when doing compilation?
193 need_locks="no"
194
195 # Manifest tool.
196 MANIFEST_TOOL=":"
197
198 # Tool to manipulate archived DWARF debug symbol files on Mac OS X.
199 DSYMUTIL="dsymutil"
200
201 # Tool to change global to local symbols on Mac OS X.
202 NMEDIT="nmedit"
203
204 # Tool to manipulate fat objects and archives on Mac OS X.
205 LIPO="lipo"
206
207 # ldd/readelf like tool for Mach-O binaries on Mac OS X.
208 OTOOL="otool"
209
210 # ldd/readelf like tool for 64 bit Mach-O binaries on Mac OS X 10.4.
211 OTOOL64=":"
212
213 # Old archive suffix (normally "a").
214 libext=a
215
216 # Shared library suffix (normally ".so").
217 shrext_cmds="\`test .\$module = .yes && echo .so || echo .dylib\`"
218
219 # The commands to extract the exported symbol list from a shared archive.
220 extract_expsyms_cmds=""
221
222 # Variables whose values should be saved in libtool wrapper scripts and
223 # restored at link time.
224 variables_saved_for_relink="PATH DYLD_LIBRARY_PATH GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH"
225
226 # Do we need the "lib" prefix for modules?
227 need_lib_prefix=no
228
229 # Do we need a version for libraries?
230 need_version=no
231
232 # Library versioning type.
233 version_type=darwin
234
235 # Shared library runtime path variable.
236 runpath_var=
237
238 # Shared library path variable.
239 shlibpath_var=DYLD_LIBRARY_PATH
240
241 # Is shlibpath searched before the hard-coded library search path?
242 shlibpath_overrides_runpath=yes
243
244 # Format of library name prefix.
245 libname_spec="lib\$name"
246
247 # List of archive names. First name is the real one, the rest are links.
248 # The last name is the one that the linker finds with -lNAME
249 library_names_spec="\${libname}\${release}\${major}\$shared_ext \${libname}\$shared_ext"
250
251 # The coded name of the library, if different from the real name.
252 soname_spec="\${libname}\${release}\${major}\$shared_ext"
253
254 # Permission mode override for installation of shared libraries.
255 install_override_mode=""
256
257 # Command to use after installation of a shared archive.
258 postinstall_cmds=""
259
260 # Command to use after uninstallation of a shared archive.
261 postuninstall_cmds=""
262
263 # Commands used to finish a libtool library installation in a directory.
264 finish_cmds=""
265
266 # As "finish_cmds", except a single script fragment to be evaled but
267 # not shown.
268 finish_eval=""
269
270 # Whether we should hardcode library paths into libraries.
271 hardcode_into_libs=no
272
273 # Compile-time system search path for libraries.
274 sys_lib_search_path_spec="/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/5.0 /usr/local/lib"
275
276 # Run-time system search path for libraries.
277 sys_lib_dlsearch_path_spec="/usr/local/lib /lib /usr/lib"
278
279 # Whether dlopen is supported.
280 dlopen_support=unknown
281
282 # Whether dlopen of programs is supported.
283 dlopen_self=unknown
284
285 # Whether dlopen of statically linked programs is supported.
286 dlopen_self_static=unknown
287
288 # Commands to strip libraries.
289 old_striplib="strip -S"
290 striplib="strip -x"
291
292
293 # The linker used to build libraries.
294 LD="/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ld"
295
296 # How to create reloadable object files.
297 reload_flag=" -r"
298 reload_cmds="\$LTCC \$LTCFLAGS -nostdlib \${wl}-r -o \$output\$reload_objs"
299
300 # Commands used to build an old-style archive.
301 old_archive_cmds="\$AR \$AR_FLAGS \$oldlib\$oldobjs~\$RANLIB \$tool_oldlib"
302
303 # A language specific compiler.
304 CC="gcc"
305
306 # Is the compiler the GNU compiler?
307 with_gcc=yes
308
309 # Compiler flag to turn off builtin functions.
310 no_builtin_flag=" -fno-builtin -fno-rtti -fno-exceptions"
311
312 # Additional compiler flags for building library objects.
313 pic_flag=" -fno-common -DPIC"
314
315 # How to pass a linker flag through the compiler.
316 wl="-Wl,"
317
318 # Compiler flag to prevent dynamic linking.
319 link_static_flag=""
320
321 # Does compiler simultaneously support -c and -o options?
322 compiler_c_o="yes"
323
324 # Whether or not to add -lc for building shared libraries.
325 build_libtool_need_lc=no
326
327 # Whether or not to disallow shared libs when runtime libs are static.
328 allow_libtool_libs_with_static_runtimes=no
329
330 # Compiler flag to allow reflexive dlopens.
331 export_dynamic_flag_spec=""
332
333 # Compiler flag to generate shared objects directly from archives.
334 whole_archive_flag_spec="\`for conv in \$convenience\\\"\\\"; do test -n \\\"\$conv\\\" && new_convenience=\\\"\$new_convenience \${wl}-force_load,\$conv\\\"; done; func_echo_all \\\"\$new_convenience\\\"\`"
335
336 # Whether the compiler copes with passing no objects directly.
337 compiler_needs_object="no"
338
339 # Create an old-style archive from a shared archive.
340 old_archive_from_new_cmds=""
341
342 # Create a temporary old-style archive to link instead of a shared archive.
343 old_archive_from_expsyms_cmds=""
344
345 # Commands used to build a shared archive.
346 archive_cmds="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring \$single_module"
347 archive_expsym_cmds="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 \$single_module \${wl}-exported_symbols_list,\$output_objdir/\${libname}-symbols.expsym"
348
349 # Commands used to build a loadable module if different from building
350 # a shared archive.
351 module_cmds="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags"
352 module_expsym_cmds="sed -e 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags \${wl}-exported_symbols_list,\$output_objdir/\${libname}-symbols.expsym"
353
354 # Whether we are building with GNU ld or not.
355 with_gnu_ld="no"
356
357 # Flag that allows shared libraries with undefined symbols to be built.
358 allow_undefined_flag="\${wl}-undefined \${wl}dynamic_lookup"
359
360 # Flag that enforces no undefined symbols.
361 no_undefined_flag=""
362
363 # Flag to hardcode $libdir into a binary during linking.
364 # This must work even if $libdir does not exist
365 hardcode_libdir_flag_spec=""
366
367 # Whether we need a single "-rpath" flag with a separated argument.
368 hardcode_libdir_separator=""
369
370 # Set to "yes" if using DIR/libNAME${shared_ext} during linking hardcodes
371 # DIR into the resulting binary.
372 hardcode_direct=no
373
374 # Set to "yes" if using DIR/libNAME${shared_ext} during linking hardcodes
375 # DIR into the resulting binary and the resulting library dependency is
376 # "absolute",i.e impossible to change by setting ${shlibpath_var} if the
377 # library is relocated.
378 hardcode_direct_absolute=no
379
380 # Set to "yes" if using the -LDIR flag during linking hardcodes DIR
381 # into the resulting binary.
382 hardcode_minus_L=no
383
384 # Set to "yes" if using SHLIBPATH_VAR=DIR during linking hardcodes DIR
385 # into the resulting binary.
386 hardcode_shlibpath_var=unsupported
387
388 # Set to "yes" if building a shared library automatically hardcodes DIR
389 # into the library and all subsequent libraries and executables linked
390 # against it.
391 hardcode_automatic=yes
392
393 # Set to yes if linker adds runtime paths of dependent libraries
394 # to runtime path list.
395 inherit_rpath=no
396
397 # Whether libtool must link a program against all its dependency libraries.
398 link_all_deplibs=yes
399
400 # Set to "yes" if exported symbols are required.
401 always_export_symbols=no
402
403 # The commands to list exported symbols.
404 export_symbols_cmds="\$NM \$libobjs \$convenience | \$global_symbol_pipe | \$SED 's/.* //' | sort | uniq > \$export_symbols"
405
406 # Symbols that should not be listed in the preloaded symbols.
407 exclude_expsyms="_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*"
408
409 # Symbols that must always be exported.
410 include_expsyms=""
411
412 # Commands necessary for linking programs (against libraries) with templates.
413 prelink_cmds=""
414
415 # Commands necessary for finishing linking programs.
416 postlink_cmds=""
417
418 # Specify filename containing input files.
419 file_list_spec=""
420
421 # How to hardcode a shared library path into an executable.
422 hardcode_action=immediate
423
424 # ### END LIBTOOL CONFIG
425
426
427 # libtool (GNU libtool) 2.4.2
428 # Written by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996
429
430 # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, 2006,
431 # 2007, 2008, 2009, 2010, 2011 Free Software Foundation, Inc.
432 # This is free software; see the source for copying conditions. There is NO
433 # warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
434
435 # GNU Libtool is free software; you can redistribute it and/or modify
436 # it under the terms of the GNU General Public License as published by
437 # the Free Software Foundation; either version 2 of the License, or
438 # (at your option) any later version.
439 #
440 # As a special exception to the GNU General Public License,
441 # if you distribute this file as part of a program or library that
442 # is built using GNU Libtool, you may include this file under the
443 # same distribution terms that you use for the rest of that program.
444 #
445 # GNU Libtool is distributed in the hope that it will be useful, but
446 # WITHOUT ANY WARRANTY; without even the implied warranty of
447 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
448 # General Public License for more details.
449 #
450 # You should have received a copy of the GNU General Public License
451 # along with GNU Libtool; see the file COPYING. If not, a copy
452 # can be downloaded from http://www.gnu.org/licenses/gpl.html,
453 # or obtained by writing to the Free Software Foundation, Inc.,
454 # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
455
456 # Usage: $progname [OPTION]... [MODE-ARG]...
457 #
458 # Provide generalized library-building support services.
459 #
460 # --config show all configuration variables
461 # --debug enable verbose shell tracing
462 # -n, --dry-run display commands without modifying any files
463 # --features display basic configuration information and exit
464 # --mode=MODE use operation mode MODE
465 # --preserve-dup-deps don't remove duplicate dependency libraries
466 # --quiet, --silent don't print informational messages
467 # --no-quiet, --no-silent
468 # print informational messages (default)
469 # --no-warn don't display warning messages
470 # --tag=TAG use configuration variables from tag TAG
471 # -v, --verbose print more informational messages than default
472 # --no-verbose don't print the extra informational messages
473 # --version print version information
474 # -h, --help, --help-all print short, long, or detailed help message
475 #
476 # MODE must be one of the following:
477 #
478 # clean remove files from the build directory
479 # compile compile a source file into a libtool object
480 # execute automatically set library path, then run a program
481 # finish complete the installation of libtool libraries
482 # install install libraries or executables
483 # link create a library or an executable
484 # uninstall remove libraries from an installed directory
485 #
486 # MODE-ARGS vary depending on the MODE. When passed as first option,
487 # `--mode=MODE' may be abbreviated as `MODE' or a unique abbreviation of that.
488 # Try `$progname --help --mode=MODE' for a more detailed description of MODE.
489 #
490 # When reporting a bug, please describe a test case to reproduce it and
491 # include the following information:
492 #
493 # host-triplet: $host
494 # shell: $SHELL
495 # compiler: $LTCC
496 # compiler flags: $LTCFLAGS
497 # linker: $LD (gnu? $with_gnu_ld)
498 # $progname: (GNU libtool) 2.4.2
499 # automake: $automake_version
500 # autoconf: $autoconf_version
501 #
502 # Report bugs to <bug-libtool@gnu.org>.
503 # GNU libtool home page: <http://www.gnu.org/software/libtool/>.
504 # General help using GNU software: <http://www.gnu.org/gethelp/>.
505
506 PROGRAM=libtool
507 PACKAGE=libtool
508 VERSION=2.4.2
509 TIMESTAMP=""
510 package_revision=1.3337
511
512 # Be Bourne compatible
513 if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
514 emulate sh
515 NULLCMD=:
516 # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which
517 # is contrary to our usage. Disable this feature.
518 alias -g '${1+"$@"}'='"$@"'
519 setopt NO_GLOB_SUBST
520 else
521 case `(set -o) 2>/dev/null` in *posix*) set -o posix;; esac
522 fi
523 BIN_SH=xpg4; export BIN_SH # for Tru64
524 DUALCASE=1; export DUALCASE # for MKS sh
525
526 # A function that is used when there is no print builtin or printf.
527 func_fallback_echo ()
528 {
529 eval 'cat <<_LTECHO_EOF
530 $1
531 _LTECHO_EOF'
532 }
533
534 # NLS nuisances: We save the old values to restore during execute mode.
535 lt_user_locale=
536 lt_safe_locale=
537 for lt_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES
538 do
539 eval "if test \"\${$lt_var+set}\" = set; then
540 save_$lt_var=\$$lt_var
541 $lt_var=C
542 export $lt_var
543 lt_user_locale=\"$lt_var=\\\$save_\$lt_var; \$lt_user_locale\"
544 lt_safe_locale=\"$lt_var=C; \$lt_safe_locale\"
545 fi"
546 done
547 LC_ALL=C
548 LANGUAGE=C
549 export LANGUAGE LC_ALL
550
551 $lt_unset CDPATH
552
553
554 # Work around backward compatibility issue on IRIX 6.5. On IRIX 6.4+, sh
555 # is ksh but when the shell is invoked as "sh" and the current value of
556 # the _XPG environment variable is not equal to 1 (one), the special
557 # positional parameter $0, within a function call, is the name of the
558 # function.
559 progpath="$0"
560
561
562
563 : ${CP="cp -f"}
564 test "${ECHO+set}" = set || ECHO=${as_echo-'printf %s\n'}
565 : ${MAKE="make"}
566 : ${MKDIR="mkdir"}
567 : ${MV="mv -f"}
568 : ${RM="rm -f"}
569 : ${SHELL="${CONFIG_SHELL-/bin/sh}"}
570 : ${Xsed="$SED -e 1s/^X//"}
571
572 # Global variables:
573 EXIT_SUCCESS=0
574 EXIT_FAILURE=1
575 EXIT_MISMATCH=63 # $? = 63 is used to indicate version mismatch to missing.
576 EXIT_SKIP=77 # $? = 77 is used to indicate a skipped test to automake.
577
578 exit_status=$EXIT_SUCCESS
579
580 # Make sure IFS has a sensible default
581 lt_nl='
582 '
583 IFS=" $lt_nl"
584
585 dirname="s,/[^/]*$,,"
586 basename="s,^.*/,,"
587
588 # func_dirname file append nondir_replacement
589 # Compute the dirname of FILE. If nonempty, add APPEND to the result,
590 # otherwise set result to NONDIR_REPLACEMENT.
591 func_dirname ()
592 {
593 case ${1} in
594 */*) func_dirname_result="${1%/*}${2}" ;;
595 * ) func_dirname_result="${3}" ;;
596 esac
597 } # Extended-shell func_dirname implementation
598
599
600 # func_basename file
601 func_basename ()
602 {
603 func_basename_result="${1##*/}"
604 } # Extended-shell func_basename implementation
605
606
607 # func_dirname_and_basename file append nondir_replacement
608 # perform func_basename and func_dirname in a single function
609 # call:
610 # dirname: Compute the dirname of FILE. If nonempty,
611 # add APPEND to the result, otherwise set result
612 # to NONDIR_REPLACEMENT.
613 # value returned in "$func_dirname_result"
614 # basename: Compute filename of FILE.
615 # value retuned in "$func_basename_result"
616 # Implementation must be kept synchronized with func_dirname
617 # and func_basename. For efficiency, we do not delegate to
618 # those functions but instead duplicate the functionality here.
619 func_dirname_and_basename ()
620 {
621 case ${1} in
622 */*) func_dirname_result="${1%/*}${2}" ;;
623 * ) func_dirname_result="${3}" ;;
624 esac
625 func_basename_result="${1##*/}"
626 } # Extended-shell func_dirname_and_basename implementation
627
628
629 # func_stripname prefix suffix name
630 # strip PREFIX and SUFFIX off of NAME.
631 # PREFIX and SUFFIX must not contain globbing or regex special
632 # characters, hashes, percent signs, but SUFFIX may contain a leading
633 # dot (in which case that matches only a dot).
634 # func_strip_suffix prefix name
635 func_stripname ()
636 {
637 # pdksh 5.2.14 does not do ${X%$Y} correctly if both X and Y are
638 # positional parameters, so assign one to ordinary parameter first.
639 func_stripname_result=${3}
640 func_stripname_result=${func_stripname_result#"${1}"}
641 func_stripname_result=${func_stripname_result%"${2}"}
642 } # Extended-shell func_stripname implementation
643
644
645 # These SED scripts presuppose an absolute path with a trailing slash.
646 pathcar='s,^/\([^/]*\).*$,\1,'
647 pathcdr='s,^/[^/]*,,'
648 removedotparts=':dotsl
649 s@/\./@/@g
650 t dotsl
651 s,/\.$,/,'
652 collapseslashes='s@/\{1,\}@/@g'
653 finalslash='s,/*$,/,'
654
655 # func_normal_abspath PATH
656 # Remove doubled-up and trailing slashes, "." path components,
657 # and cancel out any ".." path components in PATH after making
658 # it an absolute path.
659 # value returned in "$func_normal_abspath_result"
660 func_normal_abspath ()
661 {
662 # Start from root dir and reassemble the path.
663 func_normal_abspath_result=
664 func_normal_abspath_tpath=$1
665 func_normal_abspath_altnamespace=
666 case $func_normal_abspath_tpath in
667 "")
668 # Empty path, that just means $cwd.
669 func_stripname '' '/' "`pwd`"
670 func_normal_abspath_result=$func_stripname_result
671 return
672 ;;
673 # The next three entries are used to spot a run of precisely
674 # two leading slashes without using negated character classes;
675 # we take advantage of case's first-match behaviour.
676 ///*)
677 # Unusual form of absolute path, do nothing.
678 ;;
679 //*)
680 # Not necessarily an ordinary path; POSIX reserves leading '//'
681 # and for example Cygwin uses it to access remote file shares
682 # over CIFS/SMB, so we conserve a leading double slash if found.
683 func_normal_abspath_altnamespace=/
684 ;;
685 /*)
686 # Absolute path, do nothing.
687 ;;
688 *)
689 # Relative path, prepend $cwd.
690 func_normal_abspath_tpath=`pwd`/$func_normal_abspath_tpath
691 ;;
692 esac
693 # Cancel out all the simple stuff to save iterations. We also want
694 # the path to end with a slash for ease of parsing, so make sure
695 # there is one (and only one) here.
696 func_normal_abspath_tpath=`$ECHO "$func_normal_abspath_tpath" | $SED \
697 -e "$removedotparts" -e "$collapseslashes" -e "$finalslash"`
698 while :; do
699 # Processed it all yet?
700 if test "$func_normal_abspath_tpath" = / ; then
701 # If we ascended to the root using ".." the result may be empty now.
702 if test -z "$func_normal_abspath_result" ; then
703 func_normal_abspath_result=/
704 fi
705 break
706 fi
707 func_normal_abspath_tcomponent=`$ECHO "$func_normal_abspath_tpath" | $SED \
708 -e "$pathcar"`
709 func_normal_abspath_tpath=`$ECHO "$func_normal_abspath_tpath" | $SED \
710 -e "$pathcdr"`
711 # Figure out what to do with it
712 case $func_normal_abspath_tcomponent in
713 "")
714 # Trailing empty path component, ignore it.
715 ;;
716 ..)
717 # Parent dir; strip last assembled component from result.
718 func_dirname "$func_normal_abspath_result"
719 func_normal_abspath_result=$func_dirname_result
720 ;;
721 *)
722 # Actual path component, append it.
723 func_normal_abspath_result=$func_normal_abspath_result/$func_normal_abspath_tcomponent
724 ;;
725 esac
726 done
727 # Restore leading double-slash if one was found on entry.
728 func_normal_abspath_result=$func_normal_abspath_altnamespace$func_normal_abspath_result
729 }
730
731 # func_relative_path SRCDIR DSTDIR
732 # generates a relative path from SRCDIR to DSTDIR, with a trailing
733 # slash if non-empty, suitable for immediately appending a filename
734 # without needing to append a separator.
735 # value returned in "$func_relative_path_result"
736 func_relative_path ()
737 {
738 func_relative_path_result=
739 func_normal_abspath "$1"
740 func_relative_path_tlibdir=$func_normal_abspath_result
741 func_normal_abspath "$2"
742 func_relative_path_tbindir=$func_normal_abspath_result
743
744 # Ascend the tree starting from libdir
745 while :; do
746 # check if we have found a prefix of bindir
747 case $func_relative_path_tbindir in
748 $func_relative_path_tlibdir)
749 # found an exact match
750 func_relative_path_tcancelled=
751 break
752 ;;
753 $func_relative_path_tlibdir*)
754 # found a matching prefix
755 func_stripname "$func_relative_path_tlibdir" '' "$func_relative_path_tbindir"
756 func_relative_path_tcancelled=$func_stripname_result
757 if test -z "$func_relative_path_result"; then
758 func_relative_path_result=.
759 fi
760 break
761 ;;
762 *)
763 func_dirname $func_relative_path_tlibdir
764 func_relative_path_tlibdir=${func_dirname_result}
765 if test "x$func_relative_path_tlibdir" = x ; then
766 # Have to descend all the way to the root!
767 func_relative_path_result=../$func_relative_path_result
768 func_relative_path_tcancelled=$func_relative_path_tbindir
769 break
770 fi
771 func_relative_path_result=../$func_relative_path_result
772 ;;
773 esac
774 done
775
776 # Now calculate path; take care to avoid doubling-up slashes.
777 func_stripname '' '/' "$func_relative_path_result"
778 func_relative_path_result=$func_stripname_result
779 func_stripname '/' '/' "$func_relative_path_tcancelled"
780 if test "x$func_stripname_result" != x ; then
781 func_relative_path_result=${func_relative_path_result}/${func_stripname_result}
782 fi
783
784 # Normalisation. If bindir is libdir, return empty string,
785 # else relative path ending with a slash; either way, target
786 # file name can be directly appended.
787 if test ! -z "$func_relative_path_result"; then
788 func_stripname './' '' "$func_relative_path_result/"
789 func_relative_path_result=$func_stripname_result
790 fi
791 }
792
793 # The name of this program:
794 func_dirname_and_basename "$progpath"
795 progname=$func_basename_result
796
797 # Make sure we have an absolute path for reexecution:
798 case $progpath in
799 [\\/]*|[A-Za-z]:\\*) ;;
800 *[\\/]*)
801 progdir=$func_dirname_result
802 progdir=`cd "$progdir" && pwd`
803 progpath="$progdir/$progname"
804 ;;
805 *)
806 save_IFS="$IFS"
807 IFS=${PATH_SEPARATOR-:}
808 for progdir in $PATH; do
809 IFS="$save_IFS"
810 test -x "$progdir/$progname" && break
811 done
812 IFS="$save_IFS"
813 test -n "$progdir" || progdir=`pwd`
814 progpath="$progdir/$progname"
815 ;;
816 esac
817
818 # Sed substitution that helps us do robust quoting. It backslashifies
819 # metacharacters that are still active within double-quoted strings.
820 Xsed="${SED}"' -e 1s/^X//'
821 sed_quote_subst='s/\([`"$\\]\)/\\\1/g'
822
823 # Same as above, but do not quote variable references.
824 double_quote_subst='s/\(["`\\]\)/\\\1/g'
825
826 # Sed substitution that turns a string into a regex matching for the
827 # string literally.
828 sed_make_literal_regex='s,[].[^$\\*\/],\\&,g'
829
830 # Sed substitution that converts a w32 file name or path
831 # which contains forward slashes, into one that contains
832 # (escaped) backslashes. A very naive implementation.
833 lt_sed_naive_backslashify='s|\\\\*|\\|g;s|/|\\|g;s|\\|\\\\|g'
834
835 # Re-`\' parameter expansions in output of double_quote_subst that were
836 # `\'-ed in input to the same. If an odd number of `\' preceded a '$'
837 # in input to double_quote_subst, that '$' was protected from expansion.
838 # Since each input `\' is now two `\'s, look for any number of runs of
839 # four `\'s followed by two `\'s and then a '$'. `\' that '$'.
840 bs='\\'
841 bs2='\\\\'
842 bs4='\\\\\\\\'
843 dollar='\$'
844 sed_double_backslash="\
845 s/$bs4/&\\
846 /g
847 s/^$bs2$dollar/$bs&/
848 s/\\([^$bs]\\)$bs2$dollar/\\1$bs2$bs$dollar/g
849 s/\n//g"
850
851 # Standard options:
852 opt_dry_run=false
853 opt_help=false
854 opt_quiet=false
855 opt_verbose=false
856 opt_warning=:
857
858 # func_echo arg...
859 # Echo program name prefixed message, along with the current mode
860 # name if it has been set yet.
861 func_echo ()
862 {
863 $ECHO "$progname: ${opt_mode+$opt_mode: }$*"
864 }
865
866 # func_verbose arg...
867 # Echo program name prefixed message in verbose mode only.
868 func_verbose ()
869 {
870 $opt_verbose && func_echo ${1+"$@"}
871
872 # A bug in bash halts the script if the last line of a function
873 # fails when set -e is in force, so we need another command to
874 # work around that:
875 :
876 }
877
878 # func_echo_all arg...
879 # Invoke $ECHO with all args, space-separated.
880 func_echo_all ()
881 {
882 $ECHO "$*"
883 }
884
885 # func_error arg...
886 # Echo program name prefixed message to standard error.
887 func_error ()
888 {
889 $ECHO "$progname: ${opt_mode+$opt_mode: }"${1+"$@"} 1>&2
890 }
891
892 # func_warning arg...
893 # Echo program name prefixed warning message to standard error.
894 func_warning ()
895 {
896 $opt_warning && $ECHO "$progname: ${opt_mode+$opt_mode: }warning: "${1+"$@"} 1>&2
897
898 # bash bug again:
899 :
900 }
901
902 # func_fatal_error arg...
903 # Echo program name prefixed message to standard error, and exit.
904 func_fatal_error ()
905 {
906 func_error ${1+"$@"}
907 exit $EXIT_FAILURE
908 }
909
910 # func_fatal_help arg...
911 # Echo program name prefixed message to standard error, followed by
912 # a help hint, and exit.
913 func_fatal_help ()
914 {
915 func_error ${1+"$@"}
916 func_fatal_error "$help"
917 }
918 help="Try \`$progname --help' for more information." ## default
919
920
921 # func_grep expression filename
922 # Check whether EXPRESSION matches any line of FILENAME, without output.
923 func_grep ()
924 {
925 $GREP "$1" "$2" >/dev/null 2>&1
926 }
927
928
929 # func_mkdir_p directory-path
930 # Make sure the entire path to DIRECTORY-PATH is available.
931 func_mkdir_p ()
932 {
933 my_directory_path="$1"
934 my_dir_list=
935
936 if test -n "$my_directory_path" && test "$opt_dry_run" != ":"; then
937
938 # Protect directory names starting with `-'
939 case $my_directory_path in
940 -*) my_directory_path="./$my_directory_path" ;;
941 esac
942
943 # While some portion of DIR does not yet exist...
944 while test ! -d "$my_directory_path"; do
945 # ...make a list in topmost first order. Use a colon delimited
946 # list incase some portion of path contains whitespace.
947 my_dir_list="$my_directory_path:$my_dir_list"
948
949 # If the last portion added has no slash in it, the list is done
950 case $my_directory_path in */*) ;; *) break ;; esac
951
952 # ...otherwise throw away the child directory and loop
953 my_directory_path=`$ECHO "$my_directory_path" | $SED -e "$dirname"`
954 done
955 my_dir_list=`$ECHO "$my_dir_list" | $SED 's,:*$,,'`
956
957 save_mkdir_p_IFS="$IFS"; IFS=':'
958 for my_dir in $my_dir_list; do
959 IFS="$save_mkdir_p_IFS"
960 # mkdir can fail with a `File exist' error if two processes
961 # try to create one of the directories concurrently. Don't
962 # stop in that case!
963 $MKDIR "$my_dir" 2>/dev/null || :
964 done
965 IFS="$save_mkdir_p_IFS"
966
967 # Bail out if we (or some other process) failed to create a directory.
968 test -d "$my_directory_path" || \
969 func_fatal_error "Failed to create \`$1'"
970 fi
971 }
972
973
974 # func_mktempdir [string]
975 # Make a temporary directory that won't clash with other running
976 # libtool processes, and avoids race conditions if possible. If
977 # given, STRING is the basename for that directory.
978 func_mktempdir ()
979 {
980 my_template="${TMPDIR-/tmp}/${1-$progname}"
981
982 if test "$opt_dry_run" = ":"; then
983 # Return a directory name, but don't create it in dry-run mode
984 my_tmpdir="${my_template}-$$"
985 else
986
987 # If mktemp works, use that first and foremost
988 my_tmpdir=`mktemp -d "${my_template}-XXXXXXXX" 2>/dev/null`
989
990 if test ! -d "$my_tmpdir"; then
991 # Failing that, at least try and use $RANDOM to avoid a race
992 my_tmpdir="${my_template}-${RANDOM-0}$$"
993
994 save_mktempdir_umask=`umask`
995 umask 0077
996 $MKDIR "$my_tmpdir"
997 umask $save_mktempdir_umask
998 fi
999
1000 # If we're not in dry-run mode, bomb out on failure
1001 test -d "$my_tmpdir" || \
1002 func_fatal_error "cannot create temporary directory \`$my_tmpdir'"
1003 fi
1004
1005 $ECHO "$my_tmpdir"
1006 }
1007
1008
1009 # func_quote_for_eval arg
1010 # Aesthetically quote ARG to be evaled later.
1011 # This function returns two values: FUNC_QUOTE_FOR_EVAL_RESULT
1012 # is double-quoted, suitable for a subsequent eval, whereas
1013 # FUNC_QUOTE_FOR_EVAL_UNQUOTED_RESULT has merely all characters
1014 # which are still active within double quotes backslashified.
1015 func_quote_for_eval ()
1016 {
1017 case $1 in
1018 *[\\\`\"\$]*)
1019 func_quote_for_eval_unquoted_result=`$ECHO "$1" | $SED "$sed_quote_subst"` ;;
1020 *)
1021 func_quote_for_eval_unquoted_result="$1" ;;
1022 esac
1023
1024 case $func_quote_for_eval_unquoted_result in
1025 # Double-quote args containing shell metacharacters to delay
1026 # word splitting, command substitution and and variable
1027 # expansion for a subsequent eval.
1028 # Many Bourne shells cannot handle close brackets correctly
1029 # in scan sets, so we specify it separately.
1030 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
1031 func_quote_for_eval_result="\"$func_quote_for_eval_unquoted_result\""
1032 ;;
1033 *)
1034 func_quote_for_eval_result="$func_quote_for_eval_unquoted_result"
1035 esac
1036 }
1037
1038
1039 # func_quote_for_expand arg
1040 # Aesthetically quote ARG to be evaled later; same as above,
1041 # but do not quote variable references.
1042 func_quote_for_expand ()
1043 {
1044 case $1 in
1045 *[\\\`\"]*)
1046 my_arg=`$ECHO "$1" | $SED \
1047 -e "$double_quote_subst" -e "$sed_double_backslash"` ;;
1048 *)
1049 my_arg="$1" ;;
1050 esac
1051
1052 case $my_arg in
1053 # Double-quote args containing shell metacharacters to delay
1054 # word splitting and command substitution for a subsequent eval.
1055 # Many Bourne shells cannot handle close brackets correctly
1056 # in scan sets, so we specify it separately.
1057 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
1058 my_arg="\"$my_arg\""
1059 ;;
1060 esac
1061
1062 func_quote_for_expand_result="$my_arg"
1063 }
1064
1065
1066 # func_show_eval cmd [fail_exp]
1067 # Unless opt_silent is true, then output CMD. Then, if opt_dryrun is
1068 # not true, evaluate CMD. If the evaluation of CMD fails, and FAIL_EXP
1069 # is given, then evaluate it.
1070 func_show_eval ()
1071 {
1072 my_cmd="$1"
1073 my_fail_exp="${2-:}"
1074
1075 ${opt_silent-false} || {
1076 func_quote_for_expand "$my_cmd"
1077 eval "func_echo $func_quote_for_expand_result"
1078 }
1079
1080 if ${opt_dry_run-false}; then :; else
1081 eval "$my_cmd"
1082 my_status=$?
1083 if test "$my_status" -eq 0; then :; else
1084 eval "(exit $my_status); $my_fail_exp"
1085 fi
1086 fi
1087 }
1088
1089
1090 # func_show_eval_locale cmd [fail_exp]
1091 # Unless opt_silent is true, then output CMD. Then, if opt_dryrun is
1092 # not true, evaluate CMD. If the evaluation of CMD fails, and FAIL_EXP
1093 # is given, then evaluate it. Use the saved locale for evaluation.
1094 func_show_eval_locale ()
1095 {
1096 my_cmd="$1"
1097 my_fail_exp="${2-:}"
1098
1099 ${opt_silent-false} || {
1100 func_quote_for_expand "$my_cmd"
1101 eval "func_echo $func_quote_for_expand_result"
1102 }
1103
1104 if ${opt_dry_run-false}; then :; else
1105 eval "$lt_user_locale
1106 $my_cmd"
1107 my_status=$?
1108 eval "$lt_safe_locale"
1109 if test "$my_status" -eq 0; then :; else
1110 eval "(exit $my_status); $my_fail_exp"
1111 fi
1112 fi
1113 }
1114
1115 # func_tr_sh
1116 # Turn $1 into a string suitable for a shell variable name.
1117 # Result is stored in $func_tr_sh_result. All characters
1118 # not in the set a-zA-Z0-9_ are replaced with '_'. Further,
1119 # if $1 begins with a digit, a '_' is prepended as well.
1120 func_tr_sh ()
1121 {
1122 case $1 in
1123 [0-9]* | *[!a-zA-Z0-9_]*)
1124 func_tr_sh_result=`$ECHO "$1" | $SED 's/^\([0-9]\)/_\1/; s/[^a-zA-Z0-9_]/_/g'`
1125 ;;
1126 * )
1127 func_tr_sh_result=$1
1128 ;;
1129 esac
1130 }
1131
1132
1133 # func_version
1134 # Echo version message to standard output and exit.
1135 func_version ()
1136 {
1137 $opt_debug
1138
1139 $SED -n '/(C)/!b go
1140 :more
1141 /\./!{
1142 N
1143 s/\n# / /
1144 b more
1145 }
1146 :go
1147 /^# '$PROGRAM' (GNU /,/# warranty; / {
1148 s/^# //
1149 s/^# *$//
1150 s/\((C)\)[ 0-9,-]*\( [1-9][0-9]*\)/\1\2/
1151 p
1152 }' < "$progpath"
1153 exit $?
1154 }
1155
1156 # func_usage
1157 # Echo short help message to standard output and exit.
1158 func_usage ()
1159 {
1160 $opt_debug
1161
1162 $SED -n '/^# Usage:/,/^# *.*--help/ {
1163 s/^# //
1164 s/^# *$//
1165 s/\$progname/'$progname'/
1166 p
1167 }' < "$progpath"
1168 echo
1169 $ECHO "run \`$progname --help | more' for full usage"
1170 exit $?
1171 }
1172
1173 # func_help [NOEXIT]
1174 # Echo long help message to standard output and exit,
1175 # unless 'noexit' is passed as argument.
1176 func_help ()
1177 {
1178 $opt_debug
1179
1180 $SED -n '/^# Usage:/,/# Report bugs to/ {
1181 :print
1182 s/^# //
1183 s/^# *$//
1184 s*\$progname*'$progname'*
1185 s*\$host*'"$host"'*
1186 s*\$SHELL*'"$SHELL"'*
1187 s*\$LTCC*'"$LTCC"'*
1188 s*\$LTCFLAGS*'"$LTCFLAGS"'*
1189 s*\$LD*'"$LD"'*
1190 s/\$with_gnu_ld/'"$with_gnu_ld"'/
1191 s/\$automake_version/'"`(${AUTOMAKE-automake} --version) 2>/dev/null |$SED 1q`"'/
1192 s/\$autoconf_version/'"`(${AUTOCONF-autoconf} --version) 2>/dev/null |$SED 1q`"'/
1193 p
1194 d
1195 }
1196 /^# .* home page:/b print
1197 /^# General help using/b print
1198 ' < "$progpath"
1199 ret=$?
1200 if test -z "$1"; then
1201 exit $ret
1202 fi
1203 }
1204
1205 # func_missing_arg argname
1206 # Echo program name prefixed message to standard error and set global
1207 # exit_cmd.
1208 func_missing_arg ()
1209 {
1210 $opt_debug
1211
1212 func_error "missing argument for $1."
1213 exit_cmd=exit
1214 }
1215
1216
1217 # func_split_short_opt shortopt
1218 # Set func_split_short_opt_name and func_split_short_opt_arg shell
1219 # variables after splitting SHORTOPT after the 2nd character.
1220 func_split_short_opt ()
1221 {
1222 func_split_short_opt_arg=${1#??}
1223 func_split_short_opt_name=${1%"$func_split_short_opt_arg"}
1224 } # Extended-shell func_split_short_opt implementation
1225
1226
1227 # func_split_long_opt longopt
1228 # Set func_split_long_opt_name and func_split_long_opt_arg shell
1229 # variables after splitting LONGOPT at the `=' sign.
1230 func_split_long_opt ()
1231 {
1232 func_split_long_opt_name=${1%%=*}
1233 func_split_long_opt_arg=${1#*=}
1234 } # Extended-shell func_split_long_opt implementation
1235
1236 exit_cmd=:
1237
1238
1239
1240
1241
1242 magic="%%%MAGIC variable%%%"
1243 magic_exe="%%%MAGIC EXE variable%%%"
1244
1245 # Global variables.
1246 nonopt=
1247 preserve_args=
1248 lo2o="s/\\.lo\$/.${objext}/"
1249 o2lo="s/\\.${objext}\$/.lo/"
1250 extracted_archives=
1251 extracted_serial=0
1252
1253 # If this variable is set in any of the actions, the command in it
1254 # will be execed at the end. This prevents here-documents from being
1255 # left over by shells.
1256 exec_cmd=
1257
1258 # func_append var value
1259 # Append VALUE to the end of shell variable VAR.
1260 func_append ()
1261 {
1262 eval "${1}+=\${2}"
1263 } # Extended-shell func_append implementation
1264
1265 # func_append_quoted var value
1266 # Quote VALUE and append to the end of shell variable VAR, separated
1267 # by a space.
1268 func_append_quoted ()
1269 {
1270 func_quote_for_eval "${2}"
1271 eval "${1}+=\\ \$func_quote_for_eval_result"
1272 } # Extended-shell func_append_quoted implementation
1273
1274
1275 # func_arith arithmetic-term...
1276 func_arith ()
1277 {
1278 func_arith_result=$(( $* ))
1279 } # Extended-shell func_arith implementation
1280
1281
1282 # func_len string
1283 # STRING may not start with a hyphen.
1284 func_len ()
1285 {
1286 func_len_result=${#1}
1287 } # Extended-shell func_len implementation
1288
1289
1290 # func_lo2o object
1291 func_lo2o ()
1292 {
1293 case ${1} in
1294 *.lo) func_lo2o_result=${1%.lo}.${objext} ;;
1295 *) func_lo2o_result=${1} ;;
1296 esac
1297 } # Extended-shell func_lo2o implementation
1298
1299
1300 # func_xform libobj-or-source
1301 func_xform ()
1302 {
1303 func_xform_result=${1%.*}.lo
1304 } # Extended-shell func_xform implementation
1305
1306
1307 # func_fatal_configuration arg...
1308 # Echo program name prefixed message to standard error, followed by
1309 # a configuration failure hint, and exit.
1310 func_fatal_configuration ()
1311 {
1312 func_error ${1+"$@"}
1313 func_error "See the $PACKAGE documentation for more information."
1314 func_fatal_error "Fatal configuration error."
1315 }
1316
1317
1318 # func_config
1319 # Display the configuration for all the tags in this script.
1320 func_config ()
1321 {
1322 re_begincf='^# ### BEGIN LIBTOOL'
1323 re_endcf='^# ### END LIBTOOL'
1324
1325 # Default configuration.
1326 $SED "1,/$re_begincf CONFIG/d;/$re_endcf CONFIG/,\$d" < "$progpath"
1327
1328 # Now print the configurations for the tags.
1329 for tagname in $taglist; do
1330 $SED -n "/$re_begincf TAG CONFIG: $tagname\$/,/$re_endcf TAG CONFIG: $tagname\$/p" < "$progpath"
1331 done
1332
1333 exit $?
1334 }
1335
1336 # func_features
1337 # Display the features supported by this script.
1338 func_features ()
1339 {
1340 echo "host: $host"
1341 if test "$build_libtool_libs" = yes; then
1342 echo "enable shared libraries"
1343 else
1344 echo "disable shared libraries"
1345 fi
1346 if test "$build_old_libs" = yes; then
1347 echo "enable static libraries"
1348 else
1349 echo "disable static libraries"
1350 fi
1351
1352 exit $?
1353 }
1354
1355 # func_enable_tag tagname
1356 # Verify that TAGNAME is valid, and either flag an error and exit, or
1357 # enable the TAGNAME tag. We also add TAGNAME to the global $taglist
1358 # variable here.
1359 func_enable_tag ()
1360 {
1361 # Global variable:
1362 tagname="$1"
1363
1364 re_begincf="^# ### BEGIN LIBTOOL TAG CONFIG: $tagname\$"
1365 re_endcf="^# ### END LIBTOOL TAG CONFIG: $tagname\$"
1366 sed_extractcf="/$re_begincf/,/$re_endcf/p"
1367
1368 # Validate tagname.
1369 case $tagname in
1370 *[!-_A-Za-z0-9,/]*)
1371 func_fatal_error "invalid tag name: $tagname"
1372 ;;
1373 esac
1374
1375 # Don't test for the "default" C tag, as we know it's
1376 # there but not specially marked.
1377 case $tagname in
1378 CC) ;;
1379 *)
1380 if $GREP "$re_begincf" "$progpath" >/dev/null 2>&1; then
1381 taglist="$taglist $tagname"
1382
1383 # Evaluate the configuration. Be careful to quote the path
1384 # and the sed script, to avoid splitting on whitespace, but
1385 # also don't use non-portable quotes within backquotes within
1386 # quotes we have to do it in 2 steps:
1387 extractedcf=`$SED -n -e "$sed_extractcf" < "$progpath"`
1388 eval "$extractedcf"
1389 else
1390 func_error "ignoring unknown tag $tagname"
1391 fi
1392 ;;
1393 esac
1394 }
1395
1396 # func_check_version_match
1397 # Ensure that we are using m4 macros, and libtool script from the same
1398 # release of libtool.
1399 func_check_version_match ()
1400 {
1401 if test "$package_revision" != "$macro_revision"; then
1402 if test "$VERSION" != "$macro_version"; then
1403 if test -z "$macro_version"; then
1404 cat >&2 <<_LT_EOF
1405 $progname: Version mismatch error. This is $PACKAGE $VERSION, but the
1406 $progname: definition of this LT_INIT comes from an older release.
1407 $progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION
1408 $progname: and run autoconf again.
1409 _LT_EOF
1410 else
1411 cat >&2 <<_LT_EOF
1412 $progname: Version mismatch error. This is $PACKAGE $VERSION, but the
1413 $progname: definition of this LT_INIT comes from $PACKAGE $macro_version.
1414 $progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION
1415 $progname: and run autoconf again.
1416 _LT_EOF
1417 fi
1418 else
1419 cat >&2 <<_LT_EOF
1420 $progname: Version mismatch error. This is $PACKAGE $VERSION, revision $package_revision,
1421 $progname: but the definition of this LT_INIT comes from revision $macro_revision.
1422 $progname: You should recreate aclocal.m4 with macros from revision $package_revision
1423 $progname: of $PACKAGE $VERSION and run autoconf again.
1424 _LT_EOF
1425 fi
1426
1427 exit $EXIT_MISMATCH
1428 fi
1429 }
1430
1431
1432 # Shorthand for --mode=foo, only valid as the first argument
1433 case $1 in
1434 clean|clea|cle|cl)
1435 shift; set dummy --mode clean ${1+"$@"}; shift
1436 ;;
1437 compile|compil|compi|comp|com|co|c)
1438 shift; set dummy --mode compile ${1+"$@"}; shift
1439 ;;
1440 execute|execut|execu|exec|exe|ex|e)
1441 shift; set dummy --mode execute ${1+"$@"}; shift
1442 ;;
1443 finish|finis|fini|fin|fi|f)
1444 shift; set dummy --mode finish ${1+"$@"}; shift
1445 ;;
1446 install|instal|insta|inst|ins|in|i)
1447 shift; set dummy --mode install ${1+"$@"}; shift
1448 ;;
1449 link|lin|li|l)
1450 shift; set dummy --mode link ${1+"$@"}; shift
1451 ;;
1452 uninstall|uninstal|uninsta|uninst|unins|unin|uni|un|u)
1453 shift; set dummy --mode uninstall ${1+"$@"}; shift
1454 ;;
1455 esac
1456
1457
1458
1459 # Option defaults:
1460 opt_debug=:
1461 opt_dry_run=false
1462 opt_config=false
1463 opt_preserve_dup_deps=false
1464 opt_features=false
1465 opt_finish=false
1466 opt_help=false
1467 opt_help_all=false
1468 opt_silent=:
1469 opt_warning=:
1470 opt_verbose=:
1471 opt_silent=false
1472 opt_verbose=false
1473
1474
1475 # Parse options once, thoroughly. This comes as soon as possible in the
1476 # script to make things like `--version' happen as quickly as we can.
1477 {
1478 # this just eases exit handling
1479 while test $# -gt 0; do
1480 opt="$1"
1481 shift
1482 case $opt in
1483 --debug|-x) opt_debug='set -x'
1484 func_echo "enabling shell trace mode"
1485 $opt_debug
1486 ;;
1487 --dry-run|--dryrun|-n)
1488 opt_dry_run=:
1489 ;;
1490 --config)
1491 opt_config=:
1492 func_config
1493 ;;
1494 --dlopen|-dlopen)
1495 optarg="$1"
1496 opt_dlopen="${opt_dlopen+$opt_dlopen
1497 }$optarg"
1498 shift
1499 ;;
1500 --preserve-dup-deps)
1501 opt_preserve_dup_deps=:
1502 ;;
1503 --features)
1504 opt_features=:
1505 func_features
1506 ;;
1507 --finish)
1508 opt_finish=:
1509 set dummy --mode finish ${1+"$@"}; shift
1510 ;;
1511 --help)
1512 opt_help=:
1513 ;;
1514 --help-all)
1515 opt_help_all=:
1516 opt_help=': help-all'
1517 ;;
1518 --mode)
1519 test $# = 0 && func_missing_arg $opt && break
1520 optarg="$1"
1521 opt_mode="$optarg"
1522 case $optarg in
1523 # Valid mode arguments:
1524 clean|compile|execute|finish|install|link|relink|uninstall) ;;
1525
1526 # Catch anything else as an error
1527 *) func_error "invalid argument for $opt"
1528 exit_cmd=exit
1529 break
1530 ;;
1531 esac
1532 shift
1533 ;;
1534 --no-silent|--no-quiet)
1535 opt_silent=false
1536 preserve_args+=" $opt"
1537 ;;
1538 --no-warning|--no-warn)
1539 opt_warning=false
1540 preserve_args+=" $opt"
1541 ;;
1542 --no-verbose)
1543 opt_verbose=false
1544 preserve_args+=" $opt"
1545 ;;
1546 --silent|--quiet)
1547 opt_silent=:
1548 preserve_args+=" $opt"
1549 opt_verbose=false
1550 ;;
1551 --verbose|-v)
1552 opt_verbose=:
1553 preserve_args+=" $opt"
1554 opt_silent=false
1555 ;;
1556 --tag)
1557 test $# = 0 && func_missing_arg $opt && break
1558 optarg="$1"
1559 opt_tag="$optarg"
1560 preserve_args+=" $opt $optarg"
1561 func_enable_tag "$optarg"
1562 shift
1563 ;;
1564
1565 -\?|-h) func_usage ;;
1566 --help) func_help ;;
1567 --version) func_version ;;
1568
1569 # Separate optargs to long options:
1570 --*=*)
1571 func_split_long_opt "$opt"
1572 set dummy "$func_split_long_opt_name" "$func_split_long_opt_arg" ${1+"$@"}
1573 shift
1574 ;;
1575
1576 # Separate non-argument short options:
1577 -\?*|-h*|-n*|-v*)
1578 func_split_short_opt "$opt"
1579 set dummy "$func_split_short_opt_name" "-$func_split_short_opt_arg" ${1+"$@"}
1580 shift
1581 ;;
1582
1583 --) break ;;
1584 -*) func_fatal_help "unrecognized option \`$opt'" ;;
1585 *) set dummy "$opt" ${1+"$@"}; shift; break ;;
1586 esac
1587 done
1588
1589 # Validate options:
1590
1591 # save first non-option argument
1592 if test "$#" -gt 0; then
1593 nonopt="$opt"
1594 shift
1595 fi
1596
1597 # preserve --debug
1598 test "$opt_debug" = : || preserve_args+=" --debug"
1599
1600 case $host in
1601 *cygwin* | *mingw* | *pw32* | *cegcc*)
1602 # don't eliminate duplications in $postdeps and $predeps
1603 opt_duplicate_compiler_generated_deps=:
1604 ;;
1605 *)
1606 opt_duplicate_compiler_generated_deps=$opt_preserve_dup_deps
1607 ;;
1608 esac
1609
1610 $opt_help || {
1611 # Sanity checks first:
1612 func_check_version_match
1613
1614 if test "$build_libtool_libs" != yes && test "$build_old_libs" != yes; then
1615 func_fatal_configuration "not configured to build any kind of library"
1616 fi
1617
1618 # Darwin sucks
1619 eval std_shrext=\"$shrext_cmds\"
1620
1621 # Only execute mode is allowed to have -dlopen flags.
1622 if test -n "$opt_dlopen" && test "$opt_mode" != execute; then
1623 func_error "unrecognized option \`-dlopen'"
1624 $ECHO "$help" 1>&2
1625 exit $EXIT_FAILURE
1626 fi
1627
1628 # Change the help message to a mode-specific one.
1629 generic_help="$help"
1630 help="Try \`$progname --help --mode=$opt_mode' for more information."
1631 }
1632
1633
1634 # Bail if the options were screwed
1635 $exit_cmd $EXIT_FAILURE
1636 }
1637
1638
1639
1640
1641 ## ----------- ##
1642 ## Main. ##
1643 ## ----------- ##
1644
1645 # func_lalib_p file
1646 # True iff FILE is a libtool `.la' library or `.lo' object file.
1647 # This function is only a basic sanity check; it will hardly flush out
1648 # determined imposters.
1649 func_lalib_p ()
1650 {
1651 test -f "$1" &&
1652 $SED -e 4q "$1" 2>/dev/null \
1653 | $GREP "^# Generated by .*$PACKAGE" > /dev/null 2>&1
1654 }
1655
1656 # func_lalib_unsafe_p file
1657 # True iff FILE is a libtool `.la' library or `.lo' object file.
1658 # This function implements the same check as func_lalib_p without
1659 # resorting to external programs. To this end, it redirects stdin and
1660 # closes it afterwards, without saving the original file descriptor.
1661 # As a safety measure, use it only where a negative result would be
1662 # fatal anyway. Works if `file' does not exist.
1663 func_lalib_unsafe_p ()
1664 {
1665 lalib_p=no
1666 if test -f "$1" && test -r "$1" && exec 5<&0 <"$1"; then
1667 for lalib_p_l in 1 2 3 4
1668 do
1669 read lalib_p_line
1670 case "$lalib_p_line" in
1671 \#\ Generated\ by\ *$PACKAGE* ) lalib_p=yes; break;;
1672 esac
1673 done
1674 exec 0<&5 5<&-
1675 fi
1676 test "$lalib_p" = yes
1677 }
1678
1679 # func_ltwrapper_script_p file
1680 # True iff FILE is a libtool wrapper script
1681 # This function is only a basic sanity check; it will hardly flush out
1682 # determined imposters.
1683 func_ltwrapper_script_p ()
1684 {
1685 func_lalib_p "$1"
1686 }
1687
1688 # func_ltwrapper_executable_p file
1689 # True iff FILE is a libtool wrapper executable
1690 # This function is only a basic sanity check; it will hardly flush out
1691 # determined imposters.
1692 func_ltwrapper_executable_p ()
1693 {
1694 func_ltwrapper_exec_suffix=
1695 case $1 in
1696 *.exe) ;;
1697 *) func_ltwrapper_exec_suffix=.exe ;;
1698 esac
1699 $GREP "$magic_exe" "$1$func_ltwrapper_exec_suffix" >/dev/null 2>&1
1700 }
1701
1702 # func_ltwrapper_scriptname file
1703 # Assumes file is an ltwrapper_executable
1704 # uses $file to determine the appropriate filename for a
1705 # temporary ltwrapper_script.
1706 func_ltwrapper_scriptname ()
1707 {
1708 func_dirname_and_basename "$1" "" "."
1709 func_stripname '' '.exe' "$func_basename_result"
1710 func_ltwrapper_scriptname_result="$func_dirname_result/$objdir/${func_stripname_result}_ltshwrapper"
1711 }
1712
1713 # func_ltwrapper_p file
1714 # True iff FILE is a libtool wrapper script or wrapper executable
1715 # This function is only a basic sanity check; it will hardly flush out
1716 # determined imposters.
1717 func_ltwrapper_p ()
1718 {
1719 func_ltwrapper_script_p "$1" || func_ltwrapper_executable_p "$1"
1720 }
1721
1722
1723 # func_execute_cmds commands fail_cmd
1724 # Execute tilde-delimited COMMANDS.
1725 # If FAIL_CMD is given, eval that upon failure.
1726 # FAIL_CMD may read-access the current command in variable CMD!
1727 func_execute_cmds ()
1728 {
1729 $opt_debug
1730 save_ifs=$IFS; IFS='~'
1731 for cmd in $1; do
1732 IFS=$save_ifs
1733 eval cmd=\"$cmd\"
1734 func_show_eval "$cmd" "${2-:}"
1735 done
1736 IFS=$save_ifs
1737 }
1738
1739
1740 # func_source file
1741 # Source FILE, adding directory component if necessary.
1742 # Note that it is not necessary on cygwin/mingw to append a dot to
1743 # FILE even if both FILE and FILE.exe exist: automatic-append-.exe
1744 # behavior happens only for exec(3), not for open(2)! Also, sourcing
1745 # `FILE.' does not work on cygwin managed mounts.
1746 func_source ()
1747 {
1748 $opt_debug
1749 case $1 in
1750 */* | *\\*) . "$1" ;;
1751 *) . "./$1" ;;
1752 esac
1753 }
1754
1755
1756 # func_resolve_sysroot PATH
1757 # Replace a leading = in PATH with a sysroot. Store the result into
1758 # func_resolve_sysroot_result
1759 func_resolve_sysroot ()
1760 {
1761 func_resolve_sysroot_result=$1
1762 case $func_resolve_sysroot_result in
1763 =*)
1764 func_stripname '=' '' "$func_resolve_sysroot_result"
1765 func_resolve_sysroot_result=$lt_sysroot$func_stripname_result
1766 ;;
1767 esac
1768 }
1769
1770 # func_replace_sysroot PATH
1771 # If PATH begins with the sysroot, replace it with = and
1772 # store the result into func_replace_sysroot_result.
1773 func_replace_sysroot ()
1774 {
1775 case "$lt_sysroot:$1" in
1776 ?*:"$lt_sysroot"*)
1777 func_stripname "$lt_sysroot" '' "$1"
1778 func_replace_sysroot_result="=$func_stripname_result"
1779 ;;
1780 *)
1781 # Including no sysroot.
1782 func_replace_sysroot_result=$1
1783 ;;
1784 esac
1785 }
1786
1787 # func_infer_tag arg
1788 # Infer tagged configuration to use if any are available and
1789 # if one wasn't chosen via the "--tag" command line option.
1790 # Only attempt this if the compiler in the base compile
1791 # command doesn't match the default compiler.
1792 # arg is usually of the form 'gcc ...'
1793 func_infer_tag ()
1794 {
1795 $opt_debug
1796 if test -n "$available_tags" && test -z "$tagname"; then
1797 CC_quoted=
1798 for arg in $CC; do
1799 func_append_quoted CC_quoted "$arg"
1800 done
1801 CC_expanded=`func_echo_all $CC`
1802 CC_quoted_expanded=`func_echo_all $CC_quoted`
1803 case $@ in
1804 # Blanks in the command may have been stripped by the calling shell,
1805 # but not from the CC environment variable when configure was run.
1806 " $CC "* | "$CC "* | " $CC_expanded "* | "$CC_expanded "* | \
1807 " $CC_quoted"* | "$CC_quoted "* | " $CC_quoted_expanded "* | "$CC_quoted_expanded "*) ;;
1808 # Blanks at the start of $base_compile will cause this to fail
1809 # if we don't check for them as well.
1810 *)
1811 for z in $available_tags; do
1812 if $GREP "^# ### BEGIN LIBTOOL TAG CONFIG: $z$" < "$progpath" > /dev/null; then
1813 # Evaluate the configuration.
1814 eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^# ### END LIBTOOL TAG CONFIG: '$z'$/p' < $progpath`"
1815 CC_quoted=
1816 for arg in $CC; do
1817 # Double-quote args containing other shell metacharacters.
1818 func_append_quoted CC_quoted "$arg"
1819 done
1820 CC_expanded=`func_echo_all $CC`
1821 CC_quoted_expanded=`func_echo_all $CC_quoted`
1822 case "$@ " in
1823 " $CC "* | "$CC "* | " $CC_expanded "* | "$CC_expanded "* | \
1824 " $CC_quoted"* | "$CC_quoted "* | " $CC_quoted_expanded "* | "$CC_quoted_expanded "*)
1825 # The compiler in the base compile command matches
1826 # the one in the tagged configuration.
1827 # Assume this is the tagged configuration we want.
1828 tagname=$z
1829 break
1830 ;;
1831 esac
1832 fi
1833 done
1834 # If $tagname still isn't set, then no tagged configuration
1835 # was found and let the user know that the "--tag" command
1836 # line option must be used.
1837 if test -z "$tagname"; then
1838 func_echo "unable to infer tagged configuration"
1839 func_fatal_error "specify a tag with \`--tag'"
1840 # else
1841 # func_verbose "using $tagname tagged configuration"
1842 fi
1843 ;;
1844 esac
1845 fi
1846 }
1847
1848
1849
1850 # func_write_libtool_object output_name pic_name nonpic_name
1851 # Create a libtool object file (analogous to a ".la" file),
1852 # but don't create it if we're doing a dry run.
1853 func_write_libtool_object ()
1854 {
1855 write_libobj=${1}
1856 if test "$build_libtool_libs" = yes; then
1857 write_lobj=\'${2}\'
1858 else
1859 write_lobj=none
1860 fi
1861
1862 if test "$build_old_libs" = yes; then
1863 write_oldobj=\'${3}\'
1864 else
1865 write_oldobj=none
1866 fi
1867
1868 $opt_dry_run || {
1869 cat >${write_libobj}T <<EOF
1870 # $write_libobj - a libtool object file
1871 # Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION
1872 #
1873 # Please DO NOT delete this file!
1874 # It is necessary for linking the library.
1875
1876 # Name of the PIC object.
1877 pic_object=$write_lobj
1878
1879 # Name of the non-PIC object
1880 non_pic_object=$write_oldobj
1881
1882 EOF
1883 $MV "${write_libobj}T" "${write_libobj}"
1884 }
1885 }
1886
1887
1888 ##################################################
1889 # FILE NAME AND PATH CONVERSION HELPER FUNCTIONS #
1890 ##################################################
1891
1892 # func_convert_core_file_wine_to_w32 ARG
1893 # Helper function used by file name conversion functions when $build is *nix,
1894 # and $host is mingw, cygwin, or some other w32 environment. Relies on a
1895 # correctly configured wine environment available, with the winepath program
1896 # in $build's $PATH.
1897 #
1898 # ARG is the $build file name to be converted to w32 format.
1899 # Result is available in $func_convert_core_file_wine_to_w32_result, and will
1900 # be empty on error (or when ARG is empty)
1901 func_convert_core_file_wine_to_w32 ()
1902 {
1903 $opt_debug
1904 func_convert_core_file_wine_to_w32_result="$1"
1905 if test -n "$1"; then
1906 # Unfortunately, winepath does not exit with a non-zero error code, so we
1907 # are forced to check the contents of stdout. On the other hand, if the
1908 # command is not found, the shell will set an exit code of 127 and print
1909 # *an error message* to stdout. So we must check for both error code of
1910 # zero AND non-empty stdout, which explains the odd construction:
1911 func_convert_core_file_wine_to_w32_tmp=`winepath -w "$1" 2>/dev/null`
1912 if test "$?" -eq 0 && test -n "${func_convert_core_file_wine_to_w32_tmp}"; then
1913 func_convert_core_file_wine_to_w32_result=`$ECHO "$func_convert_core_file_wine_to_w32_tmp" |
1914 $SED -e "$lt_sed_naive_backslashify"`
1915 else
1916 func_convert_core_file_wine_to_w32_result=
1917 fi
1918 fi
1919 }
1920 # end: func_convert_core_file_wine_to_w32
1921
1922
1923 # func_convert_core_path_wine_to_w32 ARG
1924 # Helper function used by path conversion functions when $build is *nix, and
1925 # $host is mingw, cygwin, or some other w32 environment. Relies on a correctly
1926 # configured wine environment available, with the winepath program in $build's
1927 # $PATH. Assumes ARG has no leading or trailing path separator characters.
1928 #
1929 # ARG is path to be converted from $build format to win32.
1930 # Result is available in $func_convert_core_path_wine_to_w32_result.
1931 # Unconvertible file (directory) names in ARG are skipped; if no directory names
1932 # are convertible, then the result may be empty.
1933 func_convert_core_path_wine_to_w32 ()
1934 {
1935 $opt_debug
1936 # unfortunately, winepath doesn't convert paths, only file names
1937 func_convert_core_path_wine_to_w32_result=""
1938 if test -n "$1"; then
1939 oldIFS=$IFS
1940 IFS=:
1941 for func_convert_core_path_wine_to_w32_f in $1; do
1942 IFS=$oldIFS
1943 func_convert_core_file_wine_to_w32 "$func_convert_core_path_wine_to_w32_f"
1944 if test -n "$func_convert_core_file_wine_to_w32_result" ; then
1945 if test -z "$func_convert_core_path_wine_to_w32_result"; then
1946 func_convert_core_path_wine_to_w32_result="$func_convert_core_file_wine_to_w32_result"
1947 else
1948 func_append func_convert_core_path_wine_to_w32_result ";$func_convert_core_file_wine_to_w32_result"
1949 fi
1950 fi
1951 done
1952 IFS=$oldIFS
1953 fi
1954 }
1955 # end: func_convert_core_path_wine_to_w32
1956
1957
1958 # func_cygpath ARGS...
1959 # Wrapper around calling the cygpath program via LT_CYGPATH. This is used when
1960 # when (1) $build is *nix and Cygwin is hosted via a wine environment; or (2)
1961 # $build is MSYS and $host is Cygwin, or (3) $build is Cygwin. In case (1) or
1962 # (2), returns the Cygwin file name or path in func_cygpath_result (input
1963 # file name or path is assumed to be in w32 format, as previously converted
1964 # from $build's *nix or MSYS format). In case (3), returns the w32 file name
1965 # or path in func_cygpath_result (input file name or path is assumed to be in
1966 # Cygwin format). Returns an empty string on error.
1967 #
1968 # ARGS are passed to cygpath, with the last one being the file name or path to
1969 # be converted.
1970 #
1971 # Specify the absolute *nix (or w32) name to cygpath in the LT_CYGPATH
1972 # environment variable; do not put it in $PATH.
1973 func_cygpath ()
1974 {
1975 $opt_debug
1976 if test -n "$LT_CYGPATH" && test -f "$LT_CYGPATH"; then
1977 func_cygpath_result=`$LT_CYGPATH "$@" 2>/dev/null`
1978 if test "$?" -ne 0; then
1979 # on failure, ensure result is empty
1980 func_cygpath_result=
1981 fi
1982 else
1983 func_cygpath_result=
1984 func_error "LT_CYGPATH is empty or specifies non-existent file: \`$LT_CYGPATH'"
1985 fi
1986 }
1987 #end: func_cygpath
1988
1989
1990 # func_convert_core_msys_to_w32 ARG
1991 # Convert file name or path ARG from MSYS format to w32 format. Return
1992 # result in func_convert_core_msys_to_w32_result.
1993 func_convert_core_msys_to_w32 ()
1994 {
1995 $opt_debug
1996 # awkward: cmd appends spaces to result
1997 func_convert_core_msys_to_w32_result=`( cmd //c echo "$1" ) 2>/dev/null |
1998 $SED -e 's/[ ]*$//' -e "$lt_sed_naive_backslashify"`
1999 }
2000 #end: func_convert_core_msys_to_w32
2001
2002
2003 # func_convert_file_check ARG1 ARG2
2004 # Verify that ARG1 (a file name in $build format) was converted to $host
2005 # format in ARG2. Otherwise, emit an error message, but continue (resetting
2006 # func_to_host_file_result to ARG1).
2007 func_convert_file_check ()
2008 {
2009 $opt_debug
2010 if test -z "$2" && test -n "$1" ; then
2011 func_error "Could not determine host file name corresponding to"
2012 func_error " \`$1'"
2013 func_error "Continuing, but uninstalled executables may not work."
2014 # Fallback:
2015 func_to_host_file_result="$1"
2016 fi
2017 }
2018 # end func_convert_file_check
2019
2020
2021 # func_convert_path_check FROM_PATHSEP TO_PATHSEP FROM_PATH TO_PATH
2022 # Verify that FROM_PATH (a path in $build format) was converted to $host
2023 # format in TO_PATH. Otherwise, emit an error message, but continue, resetting
2024 # func_to_host_file_result to a simplistic fallback value (see below).
2025 func_convert_path_check ()
2026 {
2027 $opt_debug
2028 if test -z "$4" && test -n "$3"; then
2029 func_error "Could not determine the host path corresponding to"
2030 func_error " \`$3'"
2031 func_error "Continuing, but uninstalled executables may not work."
2032 # Fallback. This is a deliberately simplistic "conversion" and
2033 # should not be "improved". See libtool.info.
2034 if test "x$1" != "x$2"; then
2035 lt_replace_pathsep_chars="s|$1|$2|g"
2036 func_to_host_path_result=`echo "$3" |
2037 $SED -e "$lt_replace_pathsep_chars"`
2038 else
2039 func_to_host_path_result="$3"
2040 fi
2041 fi
2042 }
2043 # end func_convert_path_check
2044
2045
2046 # func_convert_path_front_back_pathsep FRONTPAT BACKPAT REPL ORIG
2047 # Modifies func_to_host_path_result by prepending REPL if ORIG matches FRONTPAT
2048 # and appending REPL if ORIG matches BACKPAT.
2049 func_convert_path_front_back_pathsep ()
2050 {
2051 $opt_debug
2052 case $4 in
2053 $1 ) func_to_host_path_result="$3$func_to_host_path_result"
2054 ;;
2055 esac
2056 case $4 in
2057 $2 ) func_to_host_path_result+="$3"
2058 ;;
2059 esac
2060 }
2061 # end func_convert_path_front_back_pathsep
2062
2063
2064 ##################################################
2065 # $build to $host FILE NAME CONVERSION FUNCTIONS #
2066 ##################################################
2067 # invoked via `$to_host_file_cmd ARG'
2068 #
2069 # In each case, ARG is the path to be converted from $build to $host format.
2070 # Result will be available in $func_to_host_file_result.
2071
2072
2073 # func_to_host_file ARG
2074 # Converts the file name ARG from $build format to $host format. Return result
2075 # in func_to_host_file_result.
2076 func_to_host_file ()
2077 {
2078 $opt_debug
2079 $to_host_file_cmd "$1"
2080 }
2081 # end func_to_host_file
2082
2083
2084 # func_to_tool_file ARG LAZY
2085 # converts the file name ARG from $build format to toolchain format. Return
2086 # result in func_to_tool_file_result. If the conversion in use is listed
2087 # in (the comma separated) LAZY, no conversion takes place.
2088 func_to_tool_file ()
2089 {
2090 $opt_debug
2091 case ,$2, in
2092 *,"$to_tool_file_cmd",*)
2093 func_to_tool_file_result=$1
2094 ;;
2095 *)
2096 $to_tool_file_cmd "$1"
2097 func_to_tool_file_result=$func_to_host_file_result
2098 ;;
2099 esac
2100 }
2101 # end func_to_tool_file
2102
2103
2104 # func_convert_file_noop ARG
2105 # Copy ARG to func_to_host_file_result.
2106 func_convert_file_noop ()
2107 {
2108 func_to_host_file_result="$1"
2109 }
2110 # end func_convert_file_noop
2111
2112
2113 # func_convert_file_msys_to_w32 ARG
2114 # Convert file name ARG from (mingw) MSYS to (mingw) w32 format; automatic
2115 # conversion to w32 is not available inside the cwrapper. Returns result in
2116 # func_to_host_file_result.
2117 func_convert_file_msys_to_w32 ()
2118 {
2119 $opt_debug
2120 func_to_host_file_result="$1"
2121 if test -n "$1"; then
2122 func_convert_core_msys_to_w32 "$1"
2123 func_to_host_file_result="$func_convert_core_msys_to_w32_result"
2124 fi
2125 func_convert_file_check "$1" "$func_to_host_file_result"
2126 }
2127 # end func_convert_file_msys_to_w32
2128
2129
2130 # func_convert_file_cygwin_to_w32 ARG
2131 # Convert file name ARG from Cygwin to w32 format. Returns result in
2132 # func_to_host_file_result.
2133 func_convert_file_cygwin_to_w32 ()
2134 {
2135 $opt_debug
2136 func_to_host_file_result="$1"
2137 if test -n "$1"; then
2138 # because $build is cygwin, we call "the" cygpath in $PATH; no need to use
2139 # LT_CYGPATH in this case.
2140 func_to_host_file_result=`cygpath -m "$1"`
2141 fi
2142 func_convert_file_check "$1" "$func_to_host_file_result"
2143 }
2144 # end func_convert_file_cygwin_to_w32
2145
2146
2147 # func_convert_file_nix_to_w32 ARG
2148 # Convert file name ARG from *nix to w32 format. Requires a wine environment
2149 # and a working winepath. Returns result in func_to_host_file_result.
2150 func_convert_file_nix_to_w32 ()
2151 {
2152 $opt_debug
2153 func_to_host_file_result="$1"
2154 if test -n "$1"; then
2155 func_convert_core_file_wine_to_w32 "$1"
2156 func_to_host_file_result="$func_convert_core_file_wine_to_w32_result"
2157 fi
2158 func_convert_file_check "$1" "$func_to_host_file_result"
2159 }
2160 # end func_convert_file_nix_to_w32
2161
2162
2163 # func_convert_file_msys_to_cygwin ARG
2164 # Convert file name ARG from MSYS to Cygwin format. Requires LT_CYGPATH set.
2165 # Returns result in func_to_host_file_result.
2166 func_convert_file_msys_to_cygwin ()
2167 {
2168 $opt_debug
2169 func_to_host_file_result="$1"
2170 if test -n "$1"; then
2171 func_convert_core_msys_to_w32 "$1"
2172 func_cygpath -u "$func_convert_core_msys_to_w32_result"
2173 func_to_host_file_result="$func_cygpath_result"
2174 fi
2175 func_convert_file_check "$1" "$func_to_host_file_result"
2176 }
2177 # end func_convert_file_msys_to_cygwin
2178
2179
2180 # func_convert_file_nix_to_cygwin ARG
2181 # Convert file name ARG from *nix to Cygwin format. Requires Cygwin installed
2182 # in a wine environment, working winepath, and LT_CYGPATH set. Returns result
2183 # in func_to_host_file_result.
2184 func_convert_file_nix_to_cygwin ()
2185 {
2186 $opt_debug
2187 func_to_host_file_result="$1"
2188 if test -n "$1"; then
2189 # convert from *nix to w32, then use cygpath to convert from w32 to cygwin.
2190 func_convert_core_file_wine_to_w32 "$1"
2191 func_cygpath -u "$func_convert_core_file_wine_to_w32_result"
2192 func_to_host_file_result="$func_cygpath_result"
2193 fi
2194 func_convert_file_check "$1" "$func_to_host_file_result"
2195 }
2196 # end func_convert_file_nix_to_cygwin
2197
2198
2199 #############################################
2200 # $build to $host PATH CONVERSION FUNCTIONS #
2201 #############################################
2202 # invoked via `$to_host_path_cmd ARG'
2203 #
2204 # In each case, ARG is the path to be converted from $build to $host format.
2205 # The result will be available in $func_to_host_path_result.
2206 #
2207 # Path separators are also converted from $build format to $host format. If
2208 # ARG begins or ends with a path separator character, it is preserved (but
2209 # converted to $host format) on output.
2210 #
2211 # All path conversion functions are named using the following convention:
2212 # file name conversion function : func_convert_file_X_to_Y ()
2213 # path conversion function : func_convert_path_X_to_Y ()
2214 # where, for any given $build/$host combination the 'X_to_Y' value is the
2215 # same. If conversion functions are added for new $build/$host combinations,
2216 # the two new functions must follow this pattern, or func_init_to_host_path_cmd
2217 # will break.
2218
2219
2220 # func_init_to_host_path_cmd
2221 # Ensures that function "pointer" variable $to_host_path_cmd is set to the
2222 # appropriate value, based on the value of $to_host_file_cmd.
2223 to_host_path_cmd=
2224 func_init_to_host_path_cmd ()
2225 {
2226 $opt_debug
2227 if test -z "$to_host_path_cmd"; then
2228 func_stripname 'func_convert_file_' '' "$to_host_file_cmd"
2229 to_host_path_cmd="func_convert_path_${func_stripname_result}"
2230 fi
2231 }
2232
2233
2234 # func_to_host_path ARG
2235 # Converts the path ARG from $build format to $host format. Return result
2236 # in func_to_host_path_result.
2237 func_to_host_path ()
2238 {
2239 $opt_debug
2240 func_init_to_host_path_cmd
2241 $to_host_path_cmd "$1"
2242 }
2243 # end func_to_host_path
2244
2245
2246 # func_convert_path_noop ARG
2247 # Copy ARG to func_to_host_path_result.
2248 func_convert_path_noop ()
2249 {
2250 func_to_host_path_result="$1"
2251 }
2252 # end func_convert_path_noop
2253
2254
2255 # func_convert_path_msys_to_w32 ARG
2256 # Convert path ARG from (mingw) MSYS to (mingw) w32 format; automatic
2257 # conversion to w32 is not available inside the cwrapper. Returns result in
2258 # func_to_host_path_result.
2259 func_convert_path_msys_to_w32 ()
2260 {
2261 $opt_debug
2262 func_to_host_path_result="$1"
2263 if test -n "$1"; then
2264 # Remove leading and trailing path separator characters from ARG. MSYS
2265 # behavior is inconsistent here; cygpath turns them into '.;' and ';.';
2266 # and winepath ignores them completely.
2267 func_stripname : : "$1"
2268 func_to_host_path_tmp1=$func_stripname_result
2269 func_convert_core_msys_to_w32 "$func_to_host_path_tmp1"
2270 func_to_host_path_result="$func_convert_core_msys_to_w32_result"
2271 func_convert_path_check : ";" \
2272 "$func_to_host_path_tmp1" "$func_to_host_path_result"
2273 func_convert_path_front_back_pathsep ":*" "*:" ";" "$1"
2274 fi
2275 }
2276 # end func_convert_path_msys_to_w32
2277
2278
2279 # func_convert_path_cygwin_to_w32 ARG
2280 # Convert path ARG from Cygwin to w32 format. Returns result in
2281 # func_to_host_file_result.
2282 func_convert_path_cygwin_to_w32 ()
2283 {
2284 $opt_debug
2285 func_to_host_path_result="$1"
2286 if test -n "$1"; then
2287 # See func_convert_path_msys_to_w32:
2288 func_stripname : : "$1"
2289 func_to_host_path_tmp1=$func_stripname_result
2290 func_to_host_path_result=`cygpath -m -p "$func_to_host_path_tmp1"`
2291 func_convert_path_check : ";" \
2292 "$func_to_host_path_tmp1" "$func_to_host_path_result"
2293 func_convert_path_front_back_pathsep ":*" "*:" ";" "$1"
2294 fi
2295 }
2296 # end func_convert_path_cygwin_to_w32
2297
2298
2299 # func_convert_path_nix_to_w32 ARG
2300 # Convert path ARG from *nix to w32 format. Requires a wine environment and
2301 # a working winepath. Returns result in func_to_host_file_result.
2302 func_convert_path_nix_to_w32 ()
2303 {
2304 $opt_debug
2305 func_to_host_path_result="$1"
2306 if test -n "$1"; then
2307 # See func_convert_path_msys_to_w32:
2308 func_stripname : : "$1"
2309 func_to_host_path_tmp1=$func_stripname_result
2310 func_convert_core_path_wine_to_w32 "$func_to_host_path_tmp1"
2311 func_to_host_path_result="$func_convert_core_path_wine_to_w32_result"
2312 func_convert_path_check : ";" \
2313 "$func_to_host_path_tmp1" "$func_to_host_path_result"
2314 func_convert_path_front_back_pathsep ":*" "*:" ";" "$1"
2315 fi
2316 }
2317 # end func_convert_path_nix_to_w32
2318
2319
2320 # func_convert_path_msys_to_cygwin ARG
2321 # Convert path ARG from MSYS to Cygwin format. Requires LT_CYGPATH set.
2322 # Returns result in func_to_host_file_result.
2323 func_convert_path_msys_to_cygwin ()
2324 {
2325 $opt_debug
2326 func_to_host_path_result="$1"
2327 if test -n "$1"; then
2328 # See func_convert_path_msys_to_w32:
2329 func_stripname : : "$1"
2330 func_to_host_path_tmp1=$func_stripname_result
2331 func_convert_core_msys_to_w32 "$func_to_host_path_tmp1"
2332 func_cygpath -u -p "$func_convert_core_msys_to_w32_result"
2333 func_to_host_path_result="$func_cygpath_result"
2334 func_convert_path_check : : \
2335 "$func_to_host_path_tmp1" "$func_to_host_path_result"
2336 func_convert_path_front_back_pathsep ":*" "*:" : "$1"
2337 fi
2338 }
2339 # end func_convert_path_msys_to_cygwin
2340
2341
2342 # func_convert_path_nix_to_cygwin ARG
2343 # Convert path ARG from *nix to Cygwin format. Requires Cygwin installed in a
2344 # a wine environment, working winepath, and LT_CYGPATH set. Returns result in
2345 # func_to_host_file_result.
2346 func_convert_path_nix_to_cygwin ()
2347 {
2348 $opt_debug
2349 func_to_host_path_result="$1"
2350 if test -n "$1"; then
2351 # Remove leading and trailing path separator characters from
2352 # ARG. msys behavior is inconsistent here, cygpath turns them
2353 # into '.;' and ';.', and winepath ignores them completely.
2354 func_stripname : : "$1"
2355 func_to_host_path_tmp1=$func_stripname_result
2356 func_convert_core_path_wine_to_w32 "$func_to_host_path_tmp1"
2357 func_cygpath -u -p "$func_convert_core_path_wine_to_w32_result"
2358 func_to_host_path_result="$func_cygpath_result"
2359 func_convert_path_check : : \
2360 "$func_to_host_path_tmp1" "$func_to_host_path_result"
2361 func_convert_path_front_back_pathsep ":*" "*:" : "$1"
2362 fi
2363 }
2364 # end func_convert_path_nix_to_cygwin
2365
2366
2367 # func_mode_compile arg...
2368 func_mode_compile ()
2369 {
2370 $opt_debug
2371 # Get the compilation command and the source file.
2372 base_compile=
2373 srcfile="$nonopt" # always keep a non-empty value in "srcfile"
2374 suppress_opt=yes
2375 suppress_output=
2376 arg_mode=normal
2377 libobj=
2378 later=
2379 pie_flag=
2380
2381 for arg
2382 do
2383 case $arg_mode in
2384 arg )
2385 # do not "continue". Instead, add this to base_compile
2386 lastarg="$arg"
2387 arg_mode=normal
2388 ;;
2389
2390 target )
2391 libobj="$arg"
2392 arg_mode=normal
2393 continue
2394 ;;
2395
2396 normal )
2397 # Accept any command-line options.
2398 case $arg in
2399 -o)
2400 test -n "$libobj" && \
2401 func_fatal_error "you cannot specify \`-o' more than once"
2402 arg_mode=target
2403 continue
2404 ;;
2405
2406 -pie | -fpie | -fPIE)
2407 pie_flag+=" $arg"
2408 continue
2409 ;;
2410
2411 -shared | -static | -prefer-pic | -prefer-non-pic)
2412 later+=" $arg"
2413 continue
2414 ;;
2415
2416 -no-suppress)
2417 suppress_opt=no
2418 continue
2419 ;;
2420
2421 -Xcompiler)
2422 arg_mode=arg # the next one goes into the "base_compile" arg list
2423 continue # The current "srcfile" will either be retained or
2424 ;; # replaced later. I would guess that would be a bug.
2425
2426 -Wc,*)
2427 func_stripname '-Wc,' '' "$arg"
2428 args=$func_stripname_result
2429 lastarg=
2430 save_ifs="$IFS"; IFS=','
2431 for arg in $args; do
2432 IFS="$save_ifs"
2433 func_append_quoted lastarg "$arg"
2434 done
2435 IFS="$save_ifs"
2436 func_stripname ' ' '' "$lastarg"
2437 lastarg=$func_stripname_result
2438
2439 # Add the arguments to base_compile.
2440 base_compile+=" $lastarg"
2441 continue
2442 ;;
2443
2444 *)
2445 # Accept the current argument as the source file.
2446 # The previous "srcfile" becomes the current argument.
2447 #
2448 lastarg="$srcfile"
2449 srcfile="$arg"
2450 ;;
2451 esac # case $arg
2452 ;;
2453 esac # case $arg_mode
2454
2455 # Aesthetically quote the previous argument.
2456 func_append_quoted base_compile "$lastarg"
2457 done # for arg
2458
2459 case $arg_mode in
2460 arg)
2461 func_fatal_error "you must specify an argument for -Xcompile"
2462 ;;
2463 target)
2464 func_fatal_error "you must specify a target with \`-o'"
2465 ;;
2466 *)
2467 # Get the name of the library object.
2468 test -z "$libobj" && {
2469 func_basename "$srcfile"
2470 libobj="$func_basename_result"
2471 }
2472 ;;
2473 esac
2474
2475 # Recognize several different file suffixes.
2476 # If the user specifies -o file.o, it is replaced with file.lo
2477 case $libobj in
2478 *.[cCFSifmso] | \
2479 *.ada | *.adb | *.ads | *.asm | \
2480 *.c++ | *.cc | *.ii | *.class | *.cpp | *.cxx | \
2481 *.[fF][09]? | *.for | *.java | *.go | *.obj | *.sx | *.cu | *.cup)
2482 func_xform "$libobj"
2483 libobj=$func_xform_result
2484 ;;
2485 esac
2486
2487 case $libobj in
2488 *.lo) func_lo2o "$libobj"; obj=$func_lo2o_result ;;
2489 *)
2490 func_fatal_error "cannot determine name of library object from \`$libobj'"
2491 ;;
2492 esac
2493
2494 func_infer_tag $base_compile
2495
2496 for arg in $later; do
2497 case $arg in
2498 -shared)
2499 test "$build_libtool_libs" != yes && \
2500 func_fatal_configuration "can not build a shared library"
2501 build_old_libs=no
2502 continue
2503 ;;
2504
2505 -static)
2506 build_libtool_libs=no
2507 build_old_libs=yes
2508 continue
2509 ;;
2510
2511 -prefer-pic)
2512 pic_mode=yes
2513 continue
2514 ;;
2515
2516 -prefer-non-pic)
2517 pic_mode=no
2518 continue
2519 ;;
2520 esac
2521 done
2522
2523 func_quote_for_eval "$libobj"
2524 test "X$libobj" != "X$func_quote_for_eval_result" \
2525 && $ECHO "X$libobj" | $GREP '[]~#^*{};<>?"'"'"' &()|`$[]' \
2526 && func_warning "libobj name \`$libobj' may not contain shell special characters."
2527 func_dirname_and_basename "$obj" "/" ""
2528 objname="$func_basename_result"
2529 xdir="$func_dirname_result"
2530 lobj=${xdir}$objdir/$objname
2531
2532 test -z "$base_compile" && \
2533 func_fatal_help "you must specify a compilation command"
2534
2535 # Delete any leftover library objects.
2536 if test "$build_old_libs" = yes; then
2537 removelist="$obj $lobj $libobj ${libobj}T"
2538 else
2539 removelist="$lobj $libobj ${libobj}T"
2540 fi
2541
2542 # On Cygwin there's no "real" PIC flag so we must build both object types
2543 case $host_os in
2544 cygwin* | mingw* | pw32* | os2* | cegcc*)
2545 pic_mode=default
2546 ;;
2547 esac
2548 if test "$pic_mode" = no && test "$deplibs_check_method" != pass_all; then
2549 # non-PIC code in shared libraries is not supported
2550 pic_mode=default
2551 fi
2552
2553 # Calculate the filename of the output object if compiler does
2554 # not support -o with -c
2555 if test "$compiler_c_o" = no; then
2556 output_obj=`$ECHO "$srcfile" | $SED 's%^.*/%%; s%\.[^.]*$%%'`.${objext}
2557 lockfile="$output_obj.lock"
2558 else
2559 output_obj=
2560 need_locks=no
2561 lockfile=
2562 fi
2563
2564 # Lock this critical section if it is needed
2565 # We use this script file to make the link, it avoids creating a new file
2566 if test "$need_locks" = yes; then
2567 until $opt_dry_run || ln "$progpath" "$lockfile" 2>/dev/null; do
2568 func_echo "Waiting for $lockfile to be removed"
2569 sleep 2
2570 done
2571 elif test "$need_locks" = warn; then
2572 if test -f "$lockfile"; then
2573 $ECHO "\
2574 *** ERROR, $lockfile exists and contains:
2575 `cat $lockfile 2>/dev/null`
2576
2577 This indicates that another process is trying to use the same
2578 temporary object file, and libtool could not work around it because
2579 your compiler does not support \`-c' and \`-o' together. If you
2580 repeat this compilation, it may succeed, by chance, but you had better
2581 avoid parallel builds (make -j) in this platform, or get a better
2582 compiler."
2583
2584 $opt_dry_run || $RM $removelist
2585 exit $EXIT_FAILURE
2586 fi
2587 removelist+=" $output_obj"
2588 $ECHO "$srcfile" > "$lockfile"
2589 fi
2590
2591 $opt_dry_run || $RM $removelist
2592 removelist+=" $lockfile"
2593 trap '$opt_dry_run || $RM $removelist; exit $EXIT_FAILURE' 1 2 15
2594
2595 func_to_tool_file "$srcfile" func_convert_file_msys_to_w32
2596 srcfile=$func_to_tool_file_result
2597 func_quote_for_eval "$srcfile"
2598 qsrcfile=$func_quote_for_eval_result
2599
2600 # Only build a PIC object if we are building libtool libraries.
2601 if test "$build_libtool_libs" = yes; then
2602 # Without this assignment, base_compile gets emptied.
2603 fbsd_hideous_sh_bug=$base_compile
2604
2605 if test "$pic_mode" != no; then
2606 command="$base_compile $qsrcfile $pic_flag"
2607 else
2608 # Don't build PIC code
2609 command="$base_compile $qsrcfile"
2610 fi
2611
2612 func_mkdir_p "$xdir$objdir"
2613
2614 if test -z "$output_obj"; then
2615 # Place PIC objects in $objdir
2616 command+=" -o $lobj"
2617 fi
2618
2619 func_show_eval_locale "$command" \
2620 'test -n "$output_obj" && $RM $removelist; exit $EXIT_FAILURE'
2621
2622 if test "$need_locks" = warn &&
2623 test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then
2624 $ECHO "\
2625 *** ERROR, $lockfile contains:
2626 `cat $lockfile 2>/dev/null`
2627
2628 but it should contain:
2629 $srcfile
2630
2631 This indicates that another process is trying to use the same
2632 temporary object file, and libtool could not work around it because
2633 your compiler does not support \`-c' and \`-o' together. If you
2634 repeat this compilation, it may succeed, by chance, but you had better
2635 avoid parallel builds (make -j) in this platform, or get a better
2636 compiler."
2637
2638 $opt_dry_run || $RM $removelist
2639 exit $EXIT_FAILURE
2640 fi
2641
2642 # Just move the object if needed, then go on to compile the next one
2643 if test -n "$output_obj" && test "X$output_obj" != "X$lobj"; then
2644 func_show_eval '$MV "$output_obj" "$lobj"' \
2645 'error=$?; $opt_dry_run || $RM $removelist; exit $error'
2646 fi
2647
2648 # Allow error messages only from the first compilation.
2649 if test "$suppress_opt" = yes; then
2650 suppress_output=' >/dev/null 2>&1'
2651 fi
2652 fi
2653
2654 # Only build a position-dependent object if we build old libraries.
2655 if test "$build_old_libs" = yes; then
2656 if test "$pic_mode" != yes; then
2657 # Don't build PIC code
2658 command="$base_compile $qsrcfile$pie_flag"
2659 else
2660 command="$base_compile $qsrcfile $pic_flag"
2661 fi
2662 if test "$compiler_c_o" = yes; then
2663 command+=" -o $obj"
2664 fi
2665
2666 # Suppress compiler output if we already did a PIC compilation.
2667 command+="$suppress_output"
2668 func_show_eval_locale "$command" \
2669 '$opt_dry_run || $RM $removelist; exit $EXIT_FAILURE'
2670
2671 if test "$need_locks" = warn &&
2672 test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then
2673 $ECHO "\
2674 *** ERROR, $lockfile contains:
2675 `cat $lockfile 2>/dev/null`
2676
2677 but it should contain:
2678 $srcfile
2679
2680 This indicates that another process is trying to use the same
2681 temporary object file, and libtool could not work around it because
2682 your compiler does not support \`-c' and \`-o' together. If you
2683 repeat this compilation, it may succeed, by chance, but you had better
2684 avoid parallel builds (make -j) in this platform, or get a better
2685 compiler."
2686
2687 $opt_dry_run || $RM $removelist
2688 exit $EXIT_FAILURE
2689 fi
2690
2691 # Just move the object if needed
2692 if test -n "$output_obj" && test "X$output_obj" != "X$obj"; then
2693 func_show_eval '$MV "$output_obj" "$obj"' \
2694 'error=$?; $opt_dry_run || $RM $removelist; exit $error'
2695 fi
2696 fi
2697
2698 $opt_dry_run || {
2699 func_write_libtool_object "$libobj" "$objdir/$objname" "$objname"
2700
2701 # Unlock the critical section if it was locked
2702 if test "$need_locks" != no; then
2703 removelist=$lockfile
2704 $RM "$lockfile"
2705 fi
2706 }
2707
2708 exit $EXIT_SUCCESS
2709 }
2710
2711 $opt_help || {
2712 test "$opt_mode" = compile && func_mode_compile ${1+"$@"}
2713 }
2714
2715 func_mode_help ()
2716 {
2717 # We need to display help for each of the modes.
2718 case $opt_mode in
2719 "")
2720 # Generic help is extracted from the usage comments
2721 # at the start of this file.
2722 func_help
2723 ;;
2724
2725 clean)
2726 $ECHO \
2727 "Usage: $progname [OPTION]... --mode=clean RM [RM-OPTION]... FILE...
2728
2729 Remove files from the build directory.
2730
2731 RM is the name of the program to use to delete files associated with each FILE
2732 (typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed
2733 to RM.
2734
2735 If FILE is a libtool library, object or program, all the files associated
2736 with it are deleted. Otherwise, only FILE itself is deleted using RM."
2737 ;;
2738
2739 compile)
2740 $ECHO \
2741 "Usage: $progname [OPTION]... --mode=compile COMPILE-COMMAND... SOURCEFILE
2742
2743 Compile a source file into a libtool library object.
2744
2745 This mode accepts the following additional options:
2746
2747 -o OUTPUT-FILE set the output file name to OUTPUT-FILE
2748 -no-suppress do not suppress compiler output for multiple passes
2749 -prefer-pic try to build PIC objects only
2750 -prefer-non-pic try to build non-PIC objects only
2751 -shared do not build a \`.o' file suitable for static linking
2752 -static only build a \`.o' file suitable for static linking
2753 -Wc,FLAG pass FLAG directly to the compiler
2754
2755 COMPILE-COMMAND is a command to be used in creating a \`standard' object file
2756 from the given SOURCEFILE.
2757
2758 The output file name is determined by removing the directory component from
2759 SOURCEFILE, then substituting the C source code suffix \`.c' with the
2760 library object suffix, \`.lo'."
2761 ;;
2762
2763 execute)
2764 $ECHO \
2765 "Usage: $progname [OPTION]... --mode=execute COMMAND [ARGS]...
2766
2767 Automatically set library path, then run a program.
2768
2769 This mode accepts the following additional options:
2770
2771 -dlopen FILE add the directory containing FILE to the library path
2772
2773 This mode sets the library path environment variable according to \`-dlopen'
2774 flags.
2775
2776 If any of the ARGS are libtool executable wrappers, then they are translated
2777 into their corresponding uninstalled binary, and any of their required library
2778 directories are added to the library path.
2779
2780 Then, COMMAND is executed, with ARGS as arguments."
2781 ;;
2782
2783 finish)
2784 $ECHO \
2785 "Usage: $progname [OPTION]... --mode=finish [LIBDIR]...
2786
2787 Complete the installation of libtool libraries.
2788
2789 Each LIBDIR is a directory that contains libtool libraries.
2790
2791 The commands that this mode executes may require superuser privileges. Use
2792 the \`--dry-run' option if you just want to see what would be executed."
2793 ;;
2794
2795 install)
2796 $ECHO \
2797 "Usage: $progname [OPTION]... --mode=install INSTALL-COMMAND...
2798
2799 Install executables or libraries.
2800
2801 INSTALL-COMMAND is the installation command. The first component should be
2802 either the \`install' or \`cp' program.
2803
2804 The following components of INSTALL-COMMAND are treated specially:
2805
2806 -inst-prefix-dir PREFIX-DIR Use PREFIX-DIR as a staging area for installation
2807
2808 The rest of the components are interpreted as arguments to that command (only
2809 BSD-compatible install options are recognized)."
2810 ;;
2811
2812 link)
2813 $ECHO \
2814 "Usage: $progname [OPTION]... --mode=link LINK-COMMAND...
2815
2816 Link object files or libraries together to form another library, or to
2817 create an executable program.
2818
2819 LINK-COMMAND is a command using the C compiler that you would use to create
2820 a program from several object files.
2821
2822 The following components of LINK-COMMAND are treated specially:
2823
2824 -all-static do not do any dynamic linking at all
2825 -avoid-version do not add a version suffix if possible
2826 -bindir BINDIR specify path to binaries directory (for systems where
2827 libraries must be found in the PATH setting at runtime)
2828 -dlopen FILE \`-dlpreopen' FILE if it cannot be dlopened at runtime
2829 -dlpreopen FILE link in FILE and add its symbols to lt_preloaded_symbols
2830 -export-dynamic allow symbols from OUTPUT-FILE to be resolved with dlsym(3)
2831 -export-symbols SYMFILE
2832 try to export only the symbols listed in SYMFILE
2833 -export-symbols-regex REGEX
2834 try to export only the symbols matching REGEX
2835 -LLIBDIR search LIBDIR for required installed libraries
2836 -lNAME OUTPUT-FILE requires the installed library libNAME
2837 -module build a library that can dlopened
2838 -no-fast-install disable the fast-install mode
2839 -no-install link a not-installable executable
2840 -no-undefined declare that a library does not refer to external symbols
2841 -o OUTPUT-FILE create OUTPUT-FILE from the specified objects
2842 -objectlist FILE Use a list of object files found in FILE to specify objects
2843 -precious-files-regex REGEX
2844 don't remove output files matching REGEX
2845 -release RELEASE specify package release information
2846 -rpath LIBDIR the created library will eventually be installed in LIBDIR
2847 -R[ ]LIBDIR add LIBDIR to the runtime path of programs and libraries
2848 -shared only do dynamic linking of libtool libraries
2849 -shrext SUFFIX override the standard shared library file extension
2850 -static do not do any dynamic linking of uninstalled libtool libraries
2851 -static-libtool-libs
2852 do not do any dynamic linking of libtool libraries
2853 -version-info CURRENT[:REVISION[:AGE]]
2854 specify library version info [each variable defaults to 0]
2855 -weak LIBNAME declare that the target provides the LIBNAME interface
2856 -Wc,FLAG
2857 -Xcompiler FLAG pass linker-specific FLAG directly to the compiler
2858 -Wl,FLAG
2859 -Xlinker FLAG pass linker-specific FLAG directly to the linker
2860 -XCClinker FLAG pass link-specific FLAG to the compiler driver (CC)
2861
2862 All other options (arguments beginning with \`-') are ignored.
2863
2864 Every other argument is treated as a filename. Files ending in \`.la' are
2865 treated as uninstalled libtool libraries, other files are standard or library
2866 object files.
2867
2868 If the OUTPUT-FILE ends in \`.la', then a libtool library is created,
2869 only library objects (\`.lo' files) may be specified, and \`-rpath' is
2870 required, except when creating a convenience library.
2871
2872 If OUTPUT-FILE ends in \`.a' or \`.lib', then a standard library is created
2873 using \`ar' and \`ranlib', or on Windows using \`lib'.
2874
2875 If OUTPUT-FILE ends in \`.lo' or \`.${objext}', then a reloadable object file
2876 is created, otherwise an executable program is created."
2877 ;;
2878
2879 uninstall)
2880 $ECHO \
2881 "Usage: $progname [OPTION]... --mode=uninstall RM [RM-OPTION]... FILE...
2882
2883 Remove libraries from an installation directory.
2884
2885 RM is the name of the program to use to delete files associated with each FILE
2886 (typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed
2887 to RM.
2888
2889 If FILE is a libtool library, all the files associated with it are deleted.
2890 Otherwise, only FILE itself is deleted using RM."
2891 ;;
2892
2893 *)
2894 func_fatal_help "invalid operation mode \`$opt_mode'"
2895 ;;
2896 esac
2897
2898 echo
2899 $ECHO "Try \`$progname --help' for more information about other modes."
2900 }
2901
2902 # Now that we've collected a possible --mode arg, show help if necessary
2903 if $opt_help; then
2904 if test "$opt_help" = :; then
2905 func_mode_help
2906 else
2907 {
2908 func_help noexit
2909 for opt_mode in compile link execute install finish uninstall clean; do
2910 func_mode_help
2911 done
2912 } | sed -n '1p; 2,$s/^Usage:/ or: /p'
2913 {
2914 func_help noexit
2915 for opt_mode in compile link execute install finish uninstall clean; do
2916 echo
2917 func_mode_help
2918 done
2919 } |
2920 sed '1d
2921 /^When reporting/,/^Report/{
2922 H
2923 d
2924 }
2925 $x
2926 /information about other modes/d
2927 /more detailed .*MODE/d
2928 s/^Usage:.*--mode=\([^ ]*\) .*/Description of \1 mode:/'
2929 fi
2930 exit $?
2931 fi
2932
2933
2934 # func_mode_execute arg...
2935 func_mode_execute ()
2936 {
2937 $opt_debug
2938 # The first argument is the command name.
2939 cmd="$nonopt"
2940 test -z "$cmd" && \
2941 func_fatal_help "you must specify a COMMAND"
2942
2943 # Handle -dlopen flags immediately.
2944 for file in $opt_dlopen; do
2945 test -f "$file" \
2946 || func_fatal_help "\`$file' is not a file"
2947
2948 dir=
2949 case $file in
2950 *.la)
2951 func_resolve_sysroot "$file"
2952 file=$func_resolve_sysroot_result
2953
2954 # Check to see that this really is a libtool archive.
2955 func_lalib_unsafe_p "$file" \
2956 || func_fatal_help "\`$lib' is not a valid libtool archive"
2957
2958 # Read the libtool library.
2959 dlname=
2960 library_names=
2961 func_source "$file"
2962
2963 # Skip this library if it cannot be dlopened.
2964 if test -z "$dlname"; then
2965 # Warn if it was a shared library.
2966 test -n "$library_names" && \
2967 func_warning "\`$file' was not linked with \`-export-dynamic'"
2968 continue
2969 fi
2970
2971 func_dirname "$file" "" "."
2972 dir="$func_dirname_result"
2973
2974 if test -f "$dir/$objdir/$dlname"; then
2975 dir+="/$objdir"
2976 else
2977 if test ! -f "$dir/$dlname"; then
2978 func_fatal_error "cannot find \`$dlname' in \`$dir' or \`$dir/$objdir'"
2979 fi
2980 fi
2981 ;;
2982
2983 *.lo)
2984 # Just add the directory containing the .lo file.
2985 func_dirname "$file" "" "."
2986 dir="$func_dirname_result"
2987 ;;
2988
2989 *)
2990 func_warning "\`-dlopen' is ignored for non-libtool libraries and objects"
2991 continue
2992 ;;
2993 esac
2994
2995 # Get the absolute pathname.
2996 absdir=`cd "$dir" && pwd`
2997 test -n "$absdir" && dir="$absdir"
2998
2999 # Now add the directory to shlibpath_var.
3000 if eval "test -z \"\$$shlibpath_var\""; then
3001 eval "$shlibpath_var=\"\$dir\""
3002 else
3003 eval "$shlibpath_var=\"\$dir:\$$shlibpath_var\""
3004 fi
3005 done
3006
3007 # This variable tells wrapper scripts just to set shlibpath_var
3008 # rather than running their programs.
3009 libtool_execute_magic="$magic"
3010
3011 # Check if any of the arguments is a wrapper script.
3012 args=
3013 for file
3014 do
3015 case $file in
3016 -* | *.la | *.lo ) ;;
3017 *)
3018 # Do a test to see if this is really a libtool program.
3019 if func_ltwrapper_script_p "$file"; then
3020 func_source "$file"
3021 # Transform arg to wrapped name.
3022 file="$progdir/$program"
3023 elif func_ltwrapper_executable_p "$file"; then
3024 func_ltwrapper_scriptname "$file"
3025 func_source "$func_ltwrapper_scriptname_result"
3026 # Transform arg to wrapped name.
3027 file="$progdir/$program"
3028 fi
3029 ;;
3030 esac
3031 # Quote arguments (to preserve shell metacharacters).
3032 func_append_quoted args "$file"
3033 done
3034
3035 if test "X$opt_dry_run" = Xfalse; then
3036 if test -n "$shlibpath_var"; then
3037 # Export the shlibpath_var.
3038 eval "export $shlibpath_var"
3039 fi
3040
3041 # Restore saved environment variables
3042 for lt_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES
3043 do
3044 eval "if test \"\${save_$lt_var+set}\" = set; then
3045 $lt_var=\$save_$lt_var; export $lt_var
3046 else
3047 $lt_unset $lt_var
3048 fi"
3049 done
3050
3051 # Now prepare to actually exec the command.
3052 exec_cmd="\$cmd$args"
3053 else
3054 # Display what would be done.
3055 if test -n "$shlibpath_var"; then
3056 eval "\$ECHO \"\$shlibpath_var=\$$shlibpath_var\""
3057 echo "export $shlibpath_var"
3058 fi
3059 $ECHO "$cmd$args"
3060 exit $EXIT_SUCCESS
3061 fi
3062 }
3063
3064 test "$opt_mode" = execute && func_mode_execute ${1+"$@"}
3065
3066
3067 # func_mode_finish arg...
3068 func_mode_finish ()
3069 {
3070 $opt_debug
3071 libs=
3072 libdirs=
3073 admincmds=
3074
3075 for opt in "$nonopt" ${1+"$@"}
3076 do
3077 if test -d "$opt"; then
3078 libdirs+=" $opt"
3079
3080 elif test -f "$opt"; then
3081 if func_lalib_unsafe_p "$opt"; then
3082 libs+=" $opt"
3083 else
3084 func_warning "\`$opt' is not a valid libtool archive"
3085 fi
3086
3087 else
3088 func_fatal_error "invalid argument \`$opt'"
3089 fi
3090 done
3091
3092 if test -n "$libs"; then
3093 if test -n "$lt_sysroot"; then
3094 sysroot_regex=`$ECHO "$lt_sysroot" | $SED "$sed_make_literal_regex"`
3095 sysroot_cmd="s/\([ ']\)$sysroot_regex/\1/g;"
3096 else
3097 sysroot_cmd=
3098 fi
3099
3100 # Remove sysroot references
3101 if $opt_dry_run; then
3102 for lib in $libs; do
3103 echo "removing references to $lt_sysroot and \`=' prefixes from $lib"
3104 done
3105 else
3106 tmpdir=`func_mktempdir`
3107 for lib in $libs; do
3108 sed -e "${sysroot_cmd} s/\([ ']-[LR]\)=/\1/g; s/\([ ']\)=/\1/g" $lib \
3109 > $tmpdir/tmp-la
3110 mv -f $tmpdir/tmp-la $lib
3111 done
3112 ${RM}r "$tmpdir"
3113 fi
3114 fi
3115
3116 if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then
3117 for libdir in $libdirs; do
3118 if test -n "$finish_cmds"; then
3119 # Do each command in the finish commands.
3120 func_execute_cmds "$finish_cmds" 'admincmds="$admincmds
3121 '"$cmd"'"'
3122 fi
3123 if test -n "$finish_eval"; then
3124 # Do the single finish_eval.
3125 eval cmds=\"$finish_eval\"
3126 $opt_dry_run || eval "$cmds" || admincmds+="
3127 $cmds"
3128 fi
3129 done
3130 fi
3131
3132 # Exit here if they wanted silent mode.
3133 $opt_silent && exit $EXIT_SUCCESS
3134
3135 if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then
3136 echo "----------------------------------------------------------------------"
3137 echo "Libraries have been installed in:"
3138 for libdir in $libdirs; do
3139 $ECHO " $libdir"
3140 done
3141 echo
3142 echo "If you ever happen to want to link against installed libraries"
3143 echo "in a given directory, LIBDIR, you must either use libtool, and"
3144 echo "specify the full pathname of the library, or use the \`-LLIBDIR'"
3145 echo "flag during linking and do at least one of the following:"
3146 if test -n "$shlibpath_var"; then
3147 echo " - add LIBDIR to the \`$shlibpath_var' environment variable"
3148 echo " during execution"
3149 fi
3150 if test -n "$runpath_var"; then
3151 echo " - add LIBDIR to the \`$runpath_var' environment variable"
3152 echo " during linking"
3153 fi
3154 if test -n "$hardcode_libdir_flag_spec"; then
3155 libdir=LIBDIR
3156 eval flag=\"$hardcode_libdir_flag_spec\"
3157
3158 $ECHO " - use the \`$flag' linker flag"
3159 fi
3160 if test -n "$admincmds"; then
3161 $ECHO " - have your system administrator run these commands:$admincmds"
3162 fi
3163 if test -f /etc/ld.so.conf; then
3164 echo " - have your system administrator add LIBDIR to \`/etc/ld.so.conf'"
3165 fi
3166 echo
3167
3168 echo "See any operating system documentation about shared libraries for"
3169 case $host in
3170 solaris2.[6789]|solaris2.1[0-9])
3171 echo "more information, such as the ld(1), crle(1) and ld.so(8) manual"
3172 echo "pages."
3173 ;;
3174 *)
3175 echo "more information, such as the ld(1) and ld.so(8) manual pages."
3176 ;;
3177 esac
3178 echo "----------------------------------------------------------------------"
3179 fi
3180 exit $EXIT_SUCCESS
3181 }
3182
3183 test "$opt_mode" = finish && func_mode_finish ${1+"$@"}
3184
3185
3186 # func_mode_install arg...
3187 func_mode_install ()
3188 {
3189 $opt_debug
3190 # There may be an optional sh(1) argument at the beginning of
3191 # install_prog (especially on Windows NT).
3192 if test "$nonopt" = "$SHELL" || test "$nonopt" = /bin/sh ||
3193 # Allow the use of GNU shtool's install command.
3194 case $nonopt in *shtool*) :;; *) false;; esac; then
3195 # Aesthetically quote it.
3196 func_quote_for_eval "$nonopt"
3197 install_prog="$func_quote_for_eval_result "
3198 arg=$1
3199 shift
3200 else
3201 install_prog=
3202 arg=$nonopt
3203 fi
3204
3205 # The real first argument should be the name of the installation program.
3206 # Aesthetically quote it.
3207 func_quote_for_eval "$arg"
3208 install_prog+="$func_quote_for_eval_result"
3209 install_shared_prog=$install_prog
3210 case " $install_prog " in
3211 *[\\\ /]cp\ *) install_cp=: ;;
3212 *) install_cp=false ;;
3213 esac
3214
3215 # We need to accept at least all the BSD install flags.
3216 dest=
3217 files=
3218 opts=
3219 prev=
3220 install_type=
3221 isdir=no
3222 stripme=
3223 no_mode=:
3224 for arg
3225 do
3226 arg2=
3227 if test -n "$dest"; then
3228 files+=" $dest"
3229 dest=$arg
3230 continue
3231 fi
3232
3233 case $arg in
3234 -d) isdir=yes ;;
3235 -f)
3236 if $install_cp; then :; else
3237 prev=$arg
3238 fi
3239 ;;
3240 -g | -m | -o)
3241 prev=$arg
3242 ;;
3243 -s)
3244 stripme=" -s"
3245 continue
3246 ;;
3247 -*)
3248 ;;
3249 *)
3250 # If the previous option needed an argument, then skip it.
3251 if test -n "$prev"; then
3252 if test "x$prev" = x-m && test -n "$install_override_mode"; then
3253 arg2=$install_override_mode
3254 no_mode=false
3255 fi
3256 prev=
3257 else
3258 dest=$arg
3259 continue
3260 fi
3261 ;;
3262 esac
3263
3264 # Aesthetically quote the argument.
3265 func_quote_for_eval "$arg"
3266 install_prog+=" $func_quote_for_eval_result"
3267 if test -n "$arg2"; then
3268 func_quote_for_eval "$arg2"
3269 fi
3270 install_shared_prog+=" $func_quote_for_eval_result"
3271 done
3272
3273 test -z "$install_prog" && \
3274 func_fatal_help "you must specify an install program"
3275
3276 test -n "$prev" && \
3277 func_fatal_help "the \`$prev' option requires an argument"
3278
3279 if test -n "$install_override_mode" && $no_mode; then
3280 if $install_cp; then :; else
3281 func_quote_for_eval "$install_override_mode"
3282 install_shared_prog+=" -m $func_quote_for_eval_result"
3283 fi
3284 fi
3285
3286 if test -z "$files"; then
3287 if test -z "$dest"; then
3288 func_fatal_help "no file or destination specified"
3289 else
3290 func_fatal_help "you must specify a destination"
3291 fi
3292 fi
3293
3294 # Strip any trailing slash from the destination.
3295 func_stripname '' '/' "$dest"
3296 dest=$func_stripname_result
3297
3298 # Check to see that the destination is a directory.
3299 test -d "$dest" && isdir=yes
3300 if test "$isdir" = yes; then
3301 destdir="$dest"
3302 destname=
3303 else
3304 func_dirname_and_basename "$dest" "" "."
3305 destdir="$func_dirname_result"
3306 destname="$func_basename_result"
3307
3308 # Not a directory, so check to see that there is only one file specified.
3309 set dummy $files; shift
3310 test "$#" -gt 1 && \
3311 func_fatal_help "\`$dest' is not a directory"
3312 fi
3313 case $destdir in
3314 [\\/]* | [A-Za-z]:[\\/]*) ;;
3315 *)
3316 for file in $files; do
3317 case $file in
3318 *.lo) ;;
3319 *)
3320 func_fatal_help "\`$destdir' must be an absolute directory name"
3321 ;;
3322 esac
3323 done
3324 ;;
3325 esac
3326
3327 # This variable tells wrapper scripts just to set variables rather
3328 # than running their programs.
3329 libtool_install_magic="$magic"
3330
3331 staticlibs=
3332 future_libdirs=
3333 current_libdirs=
3334 for file in $files; do
3335
3336 # Do each installation.
3337 case $file in
3338 *.$libext)
3339 # Do the static libraries later.
3340 staticlibs+=" $file"
3341 ;;
3342
3343 *.la)
3344 func_resolve_sysroot "$file"
3345 file=$func_resolve_sysroot_result
3346
3347 # Check to see that this really is a libtool archive.
3348 func_lalib_unsafe_p "$file" \
3349 || func_fatal_help "\`$file' is not a valid libtool archive"
3350
3351 library_names=
3352 old_library=
3353 relink_command=
3354 func_source "$file"
3355
3356 # Add the libdir to current_libdirs if it is the destination.
3357 if test "X$destdir" = "X$libdir"; then
3358 case "$current_libdirs " in
3359 *" $libdir "*) ;;
3360 *) current_libdirs+=" $libdir" ;;
3361 esac
3362 else
3363 # Note the libdir as a future libdir.
3364 case "$future_libdirs " in
3365 *" $libdir "*) ;;
3366 *) future_libdirs+=" $libdir" ;;
3367 esac
3368 fi
3369
3370 func_dirname "$file" "/" ""
3371 dir="$func_dirname_result"
3372 dir+="$objdir"
3373
3374 if test -n "$relink_command"; then
3375 # Determine the prefix the user has applied to our future dir.
3376 inst_prefix_dir=`$ECHO "$destdir" | $SED -e "s%$libdir\$%%"`
3377
3378 # Don't allow the user to place us outside of our expected
3379 # location b/c this prevents finding dependent libraries that
3380 # are installed to the same prefix.
3381 # At present, this check doesn't affect windows .dll's that
3382 # are installed into $libdir/../bin (currently, that works fine)
3383 # but it's something to keep an eye on.
3384 test "$inst_prefix_dir" = "$destdir" && \
3385 func_fatal_error "error: cannot install \`$file' to a directory not ending in $libdir"
3386
3387 if test -n "$inst_prefix_dir"; then
3388 # Stick the inst_prefix_dir data into the link command.
3389 relink_command=`$ECHO "$relink_command" | $SED "s%@inst_prefix_dir@%-inst-prefix-dir $inst_prefix_dir%"`
3390 else
3391 relink_command=`$ECHO "$relink_command" | $SED "s%@inst_prefix_dir@%%"`
3392 fi
3393
3394 func_warning "relinking \`$file'"
3395 func_show_eval "$relink_command" \
3396 'func_fatal_error "error: relink \`$file'\'' with the above command before installing it"'
3397 fi
3398
3399 # See the names of the shared library.
3400 set dummy $library_names; shift
3401 if test -n "$1"; then
3402 realname="$1"
3403 shift
3404
3405 srcname="$realname"
3406 test -n "$relink_command" && srcname="$realname"T
3407
3408 # Install the shared library and build the symlinks.
3409 func_show_eval "$install_shared_prog $dir/$srcname $destdir/$realname" \
3410 'exit $?'
3411 tstripme="$stripme"
3412 case $host_os in
3413 cygwin* | mingw* | pw32* | cegcc*)
3414 case $realname in
3415 *.dll.a)
3416 tstripme=""
3417 ;;
3418 esac
3419 ;;
3420 esac
3421 if test -n "$tstripme" && test -n "$striplib"; then
3422 func_show_eval "$striplib $destdir/$realname" 'exit $?'
3423 fi
3424
3425 if test "$#" -gt 0; then
3426 # Delete the old symlinks, and create new ones.
3427 # Try `ln -sf' first, because the `ln' binary might depend on
3428 # the symlink we replace! Solaris /bin/ln does not understand -f,
3429 # so we also need to try rm && ln -s.
3430 for linkname
3431 do
3432 test "$linkname" != "$realname" \
3433 && func_show_eval "(cd $destdir && { $LN_S -f $realname $linkname || { $RM $linkname && $LN_S $realname $linkname; }; })"
3434 done
3435 fi
3436
3437 # Do each command in the postinstall commands.
3438 lib="$destdir/$realname"
3439 func_execute_cmds "$postinstall_cmds" 'exit $?'
3440 fi
3441
3442 # Install the pseudo-library for information purposes.
3443 func_basename "$file"
3444 name="$func_basename_result"
3445 instname="$dir/$name"i
3446 func_show_eval "$install_prog $instname $destdir/$name" 'exit $?'
3447
3448 # Maybe install the static library, too.
3449 test -n "$old_library" && staticlibs+=" $dir/$old_library"
3450 ;;
3451
3452 *.lo)
3453 # Install (i.e. copy) a libtool object.
3454
3455 # Figure out destination file name, if it wasn't already specified.
3456 if test -n "$destname"; then
3457 destfile="$destdir/$destname"
3458 else
3459 func_basename "$file"
3460 destfile="$func_basename_result"
3461 destfile="$destdir/$destfile"
3462 fi
3463
3464 # Deduce the name of the destination old-style object file.
3465 case $destfile in
3466 *.lo)
3467 func_lo2o "$destfile"
3468 staticdest=$func_lo2o_result
3469 ;;
3470 *.$objext)
3471 staticdest="$destfile"
3472 destfile=
3473 ;;
3474 *)
3475 func_fatal_help "cannot copy a libtool object to \`$destfile'"
3476 ;;
3477 esac
3478
3479 # Install the libtool object if requested.
3480 test -n "$destfile" && \
3481 func_show_eval "$install_prog $file $destfile" 'exit $?'
3482
3483 # Install the old object if enabled.
3484 if test "$build_old_libs" = yes; then
3485 # Deduce the name of the old-style object file.
3486 func_lo2o "$file"
3487 staticobj=$func_lo2o_result
3488 func_show_eval "$install_prog \$staticobj \$staticdest" 'exit $?'
3489 fi
3490 exit $EXIT_SUCCESS
3491 ;;
3492
3493 *)
3494 # Figure out destination file name, if it wasn't already specified.
3495 if test -n "$destname"; then
3496 destfile="$destdir/$destname"
3497 else
3498 func_basename "$file"
3499 destfile="$func_basename_result"
3500 destfile="$destdir/$destfile"
3501 fi
3502
3503 # If the file is missing, and there is a .exe on the end, strip it
3504 # because it is most likely a libtool script we actually want to
3505 # install
3506 stripped_ext=""
3507 case $file in
3508 *.exe)
3509 if test ! -f "$file"; then
3510 func_stripname '' '.exe' "$file"
3511 file=$func_stripname_result
3512 stripped_ext=".exe"
3513 fi
3514 ;;
3515 esac
3516
3517 # Do a test to see if this is really a libtool program.
3518 case $host in
3519 *cygwin* | *mingw*)
3520 if func_ltwrapper_executable_p "$file"; then
3521 func_ltwrapper_scriptname "$file"
3522 wrapper=$func_ltwrapper_scriptname_result
3523 else
3524 func_stripname '' '.exe' "$file"
3525 wrapper=$func_stripname_result
3526 fi
3527 ;;
3528 *)
3529 wrapper=$file
3530 ;;
3531 esac
3532 if func_ltwrapper_script_p "$wrapper"; then
3533 notinst_deplibs=
3534 relink_command=
3535
3536 func_source "$wrapper"
3537
3538 # Check the variables that should have been set.
3539 test -z "$generated_by_libtool_version" && \
3540 func_fatal_error "invalid libtool wrapper script \`$wrapper'"
3541
3542 finalize=yes
3543 for lib in $notinst_deplibs; do
3544 # Check to see that each library is installed.
3545 libdir=
3546 if test -f "$lib"; then
3547 func_source "$lib"
3548 fi
3549 libfile="$libdir/"`$ECHO "$lib" | $SED 's%^.*/%%g'` ### testsuite: skip nested quoting test
3550 if test -n "$libdir" && test ! -f "$libfile"; then
3551 func_warning "\`$lib' has not been installed in \`$libdir'"
3552 finalize=no
3553 fi
3554 done
3555
3556 relink_command=
3557 func_source "$wrapper"
3558
3559 outputname=
3560 if test "$fast_install" = no && test -n "$relink_command"; then
3561 $opt_dry_run || {
3562 if test "$finalize" = yes; then
3563 tmpdir=`func_mktempdir`
3564 func_basename "$file$stripped_ext"
3565 file="$func_basename_result"
3566 outputname="$tmpdir/$file"
3567 # Replace the output file specification.
3568 relink_command=`$ECHO "$relink_command" | $SED 's%@OUTPUT@%'"$outputname"'%g'`
3569
3570 $opt_silent || {
3571 func_quote_for_expand "$relink_command"
3572 eval "func_echo $func_quote_for_expand_result"
3573 }
3574 if eval "$relink_command"; then :
3575 else
3576 func_error "error: relink \`$file' with the above command before installing it"
3577 $opt_dry_run || ${RM}r "$tmpdir"
3578 continue
3579 fi
3580 file="$outputname"
3581 else
3582 func_warning "cannot relink \`$file'"
3583 fi
3584 }
3585 else
3586 # Install the binary that we compiled earlier.
3587 file=`$ECHO "$file$stripped_ext" | $SED "s%\([^/]*\)$%$objdir/\1%"`
3588 fi
3589 fi
3590
3591 # remove .exe since cygwin /usr/bin/install will append another
3592 # one anyway
3593 case $install_prog,$host in
3594 */usr/bin/install*,*cygwin*)
3595 case $file:$destfile in
3596 *.exe:*.exe)
3597 # this is ok
3598 ;;
3599 *.exe:*)
3600 destfile=$destfile.exe
3601 ;;
3602 *:*.exe)
3603 func_stripname '' '.exe' "$destfile"
3604 destfile=$func_stripname_result
3605 ;;
3606 esac
3607 ;;
3608 esac
3609 func_show_eval "$install_prog\$stripme \$file \$destfile" 'exit $?'
3610 $opt_dry_run || if test -n "$outputname"; then
3611 ${RM}r "$tmpdir"
3612 fi
3613 ;;
3614 esac
3615 done
3616
3617 for file in $staticlibs; do
3618 func_basename "$file"
3619 name="$func_basename_result"
3620
3621 # Set up the ranlib parameters.
3622 oldlib="$destdir/$name"
3623 func_to_tool_file "$oldlib" func_convert_file_msys_to_w32
3624 tool_oldlib=$func_to_tool_file_result
3625
3626 func_show_eval "$install_prog \$file \$oldlib" 'exit $?'
3627
3628 if test -n "$stripme" && test -n "$old_striplib"; then
3629 func_show_eval "$old_striplib $tool_oldlib" 'exit $?'
3630 fi
3631
3632 # Do each command in the postinstall commands.
3633 func_execute_cmds "$old_postinstall_cmds" 'exit $?'
3634 done
3635
3636 test -n "$future_libdirs" && \
3637 func_warning "remember to run \`$progname --finish$future_libdirs'"
3638
3639 if test -n "$current_libdirs"; then
3640 # Maybe just do a dry run.
3641 $opt_dry_run && current_libdirs=" -n$current_libdirs"
3642 exec_cmd='$SHELL $progpath $preserve_args --finish$current_libdirs'
3643 else
3644 exit $EXIT_SUCCESS
3645 fi
3646 }
3647
3648 test "$opt_mode" = install && func_mode_install ${1+"$@"}
3649
3650
3651 # func_generate_dlsyms outputname originator pic_p
3652 # Extract symbols from dlprefiles and create ${outputname}S.o with
3653 # a dlpreopen symbol table.
3654 func_generate_dlsyms ()
3655 {
3656 $opt_debug
3657 my_outputname="$1"
3658 my_originator="$2"
3659 my_pic_p="${3-no}"
3660 my_prefix=`$ECHO "$my_originator" | sed 's%[^a-zA-Z0-9]%_%g'`
3661 my_dlsyms=
3662
3663 if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
3664 if test -n "$NM" && test -n "$global_symbol_pipe"; then
3665 my_dlsyms="${my_outputname}S.c"
3666 else
3667 func_error "not configured to extract global symbols from dlpreopened files"
3668 fi
3669 fi
3670
3671 if test -n "$my_dlsyms"; then
3672 case $my_dlsyms in
3673 "") ;;
3674 *.c)
3675 # Discover the nlist of each of the dlfiles.
3676 nlist="$output_objdir/${my_outputname}.nm"
3677
3678 func_show_eval "$RM $nlist ${nlist}S ${nlist}T"
3679
3680 # Parse the name list into a source file.
3681 func_verbose "creating $output_objdir/$my_dlsyms"
3682
3683 $opt_dry_run || $ECHO > "$output_objdir/$my_dlsyms" "\
3684 /* $my_dlsyms - symbol resolution table for \`$my_outputname' dlsym emulation. */
3685 /* Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION */
3686
3687 #ifdef __cplusplus
3688 extern \"C\" {
3689 #endif
3690
3691 #if defined(__GNUC__) && (((__GNUC__ == 4) && (__GNUC_MINOR__ >= 4)) || (__GNUC__ > 4))
3692 #pragma GCC diagnostic ignored \"-Wstrict-prototypes\"
3693 #endif
3694
3695 /* Keep this code in sync between libtool.m4, ltmain, lt_system.h, and tests. */
3696 #if defined(_WIN32) || defined(__CYGWIN__) || defined(_WIN32_WCE)
3697 /* DATA imports from DLLs on WIN32 con't be const, because runtime
3698 relocations are performed -- see ld's documentation on pseudo-relocs. */
3699 # define LT_DLSYM_CONST
3700 #elif defined(__osf__)
3701 /* This system does not cope well with relocations in const data. */
3702 # define LT_DLSYM_CONST
3703 #else
3704 # define LT_DLSYM_CONST const
3705 #endif
3706
3707 /* External symbol declarations for the compiler. */\
3708 "
3709
3710 if test "$dlself" = yes; then
3711 func_verbose "generating symbol list for \`$output'"
3712
3713 $opt_dry_run || echo ': @PROGRAM@ ' > "$nlist"
3714
3715 # Add our own program objects to the symbol list.
3716 progfiles=`$ECHO "$objs$old_deplibs" | $SP2NL | $SED "$lo2o" | $NL2SP`
3717 for progfile in $progfiles; do
3718 func_to_tool_file "$progfile" func_convert_file_msys_to_w32
3719 func_verbose "extracting global C symbols from \`$func_to_tool_file_result'"
3720 $opt_dry_run || eval "$NM $func_to_tool_file_result | $global_symbol_pipe >> '$nlist'"
3721 done
3722
3723 if test -n "$exclude_expsyms"; then
3724 $opt_dry_run || {
3725 eval '$EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T'
3726 eval '$MV "$nlist"T "$nlist"'
3727 }
3728 fi
3729
3730 if test -n "$export_symbols_regex"; then
3731 $opt_dry_run || {
3732 eval '$EGREP -e "$export_symbols_regex" "$nlist" > "$nlist"T'
3733 eval '$MV "$nlist"T "$nlist"'
3734 }
3735 fi
3736
3737 # Prepare the list of exported symbols
3738 if test -z "$export_symbols"; then
3739 export_symbols="$output_objdir/$outputname.exp"
3740 $opt_dry_run || {
3741 $RM $export_symbols
3742 eval "${SED} -n -e '/^: @PROGRAM@ $/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"'
3743 case $host in
3744 *cygwin* | *mingw* | *cegcc* )
3745 eval "echo EXPORTS "'> "$output_objdir/$outputname.def"'
3746 eval 'cat "$export_symbols" >> "$output_objdir/$outputname.def"'
3747 ;;
3748 esac
3749 }
3750 else
3751 $opt_dry_run || {
3752 eval "${SED} -e 's/\([].[*^$]\)/\\\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$outputname.exp"'
3753 eval '$GREP -f "$output_objdir/$outputname.exp" < "$nlist" > "$nlist"T'
3754 eval '$MV "$nlist"T "$nlist"'
3755 case $host in
3756 *cygwin* | *mingw* | *cegcc* )
3757 eval "echo EXPORTS "'> "$output_objdir/$outputname.def"'
3758 eval 'cat "$nlist" >> "$output_objdir/$outputname.def"'
3759 ;;
3760 esac
3761 }
3762 fi
3763 fi
3764
3765 for dlprefile in $dlprefiles; do
3766 func_verbose "extracting global C symbols from \`$dlprefile'"
3767 func_basename "$dlprefile"
3768 name="$func_basename_result"
3769 case $host in
3770 *cygwin* | *mingw* | *cegcc* )
3771 # if an import library, we need to obtain dlname
3772 if func_win32_import_lib_p "$dlprefile"; then
3773 func_tr_sh "$dlprefile"
3774 eval "curr_lafile=\$libfile_$func_tr_sh_result"
3775 dlprefile_dlbasename=""
3776 if test -n "$curr_lafile" && func_lalib_p "$curr_lafile"; then
3777 # Use subshell, to avoid clobbering current variable values
3778 dlprefile_dlname=`source "$curr_lafile" && echo "$dlname"`
3779 if test -n "$dlprefile_dlname" ; then
3780 func_basename "$dlprefile_dlname"
3781 dlprefile_dlbasename="$func_basename_result"
3782 else
3783 # no lafile. user explicitly requested -dlpreopen <import library>.
3784 $sharedlib_from_linklib_cmd "$dlprefile"
3785 dlprefile_dlbasename=$sharedlib_from_linklib_result
3786 fi
3787 fi
3788 $opt_dry_run || {
3789 if test -n "$dlprefile_dlbasename" ; then
3790 eval '$ECHO ": $dlprefile_dlbasename" >> "$nlist"'
3791 else
3792 func_warning "Could not compute DLL name from $name"
3793 eval '$ECHO ": $name " >> "$nlist"'
3794 fi
3795 func_to_tool_file "$dlprefile" func_convert_file_msys_to_w32
3796 eval "$NM \"$func_to_tool_file_result\" 2>/dev/null | $global_symbol_pipe |
3797 $SED -e '/I __imp/d' -e 's/I __nm_/D /;s/_nm__//' >> '$nlist'"
3798 }
3799 else # not an import lib
3800 $opt_dry_run || {
3801 eval '$ECHO ": $name " >> "$nlist"'
3802 func_to_tool_file "$dlprefile" func_convert_file_msys_to_w32
3803 eval "$NM \"$func_to_tool_file_result\" 2>/dev/null | $global_symbol_pipe >> '$nlist'"
3804 }
3805 fi
3806 ;;
3807 *)
3808 $opt_dry_run || {
3809 eval '$ECHO ": $name " >> "$nlist"'
3810 func_to_tool_file "$dlprefile" func_convert_file_msys_to_w32
3811 eval "$NM \"$func_to_tool_file_result\" 2>/dev/null | $global_symbol_pipe >> '$nlist'"
3812 }
3813 ;;
3814 esac
3815 done
3816
3817 $opt_dry_run || {
3818 # Make sure we have at least an empty file.
3819 test -f "$nlist" || : > "$nlist"
3820
3821 if test -n "$exclude_expsyms"; then
3822 $EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T
3823 $MV "$nlist"T "$nlist"
3824 fi
3825
3826 # Try sorting and uniquifying the output.
3827 if $GREP -v "^: " < "$nlist" |
3828 if sort -k 3 </dev/null >/dev/null 2>&1; then
3829 sort -k 3
3830 else
3831 sort +2
3832 fi |
3833 uniq > "$nlist"S; then
3834 :
3835 else
3836 $GREP -v "^: " < "$nlist" > "$nlist"S
3837 fi
3838
3839 if test -f "$nlist"S; then
3840 eval "$global_symbol_to_cdecl"' < "$nlist"S >> "$output_objdir/$my_dlsyms"'
3841 else
3842 echo '/* NONE */' >> "$output_objdir/$my_dlsyms"
3843 fi
3844
3845 echo >> "$output_objdir/$my_dlsyms" "\
3846
3847 /* The mapping between symbol names and symbols. */
3848 typedef struct {
3849 const char *name;
3850 void *address;
3851 } lt_dlsymlist;
3852 extern LT_DLSYM_CONST lt_dlsymlist
3853 lt_${my_prefix}_LTX_preloaded_symbols[];
3854 LT_DLSYM_CONST lt_dlsymlist
3855 lt_${my_prefix}_LTX_preloaded_symbols[] =
3856 {\
3857 { \"$my_originator\", (void *) 0 },"
3858
3859 case $need_lib_prefix in
3860 no)
3861 eval "$global_symbol_to_c_name_address" < "$nlist" >> "$output_objdir/$my_dlsyms"
3862 ;;
3863 *)
3864 eval "$global_symbol_to_c_name_address_lib_prefix" < "$nlist" >> "$output_objdir/$my_dlsyms"
3865 ;;
3866 esac
3867 echo >> "$output_objdir/$my_dlsyms" "\
3868 {0, (void *) 0}
3869 };
3870
3871 /* This works around a problem in FreeBSD linker */
3872 #ifdef FREEBSD_WORKAROUND
3873 static const void *lt_preloaded_setup() {
3874 return lt_${my_prefix}_LTX_preloaded_symbols;
3875 }
3876 #endif
3877
3878 #ifdef __cplusplus
3879 }
3880 #endif\
3881 "
3882 } # !$opt_dry_run
3883
3884 pic_flag_for_symtable=
3885 case "$compile_command " in
3886 *" -static "*) ;;
3887 *)
3888 case $host in
3889 # compiling the symbol table file with pic_flag works around
3890 # a FreeBSD bug that causes programs to crash when -lm is
3891 # linked before any other PIC object. But we must not use
3892 # pic_flag when linking with -static. The problem exists in
3893 # FreeBSD 2.2.6 and is fixed in FreeBSD 3.1.
3894 *-*-freebsd2.*|*-*-freebsd3.0*|*-*-freebsdelf3.0*)
3895 pic_flag_for_symtable=" $pic_flag -DFREEBSD_WORKAROUND" ;;
3896 *-*-hpux*)
3897 pic_flag_for_symtable=" $pic_flag" ;;
3898 *)
3899 if test "X$my_pic_p" != Xno; then
3900 pic_flag_for_symtable=" $pic_flag"
3901 fi
3902 ;;
3903 esac
3904 ;;
3905 esac
3906 symtab_cflags=
3907 for arg in $LTCFLAGS; do
3908 case $arg in
3909 -pie | -fpie | -fPIE) ;;
3910 *) symtab_cflags+=" $arg" ;;
3911 esac
3912 done
3913
3914 # Now compile the dynamic symbol file.
3915 func_show_eval '(cd $output_objdir && $LTCC$symtab_cflags -c$no_builtin_flag$pic_flag_for_symtable "$my_dlsyms")' 'exit $?'
3916
3917 # Clean up the generated files.
3918 func_show_eval '$RM "$output_objdir/$my_dlsyms" "$nlist" "${nlist}S" "${nlist}T"'
3919
3920 # Transform the symbol file into the correct name.
3921 symfileobj="$output_objdir/${my_outputname}S.$objext"
3922 case $host in
3923 *cygwin* | *mingw* | *cegcc* )
3924 if test -f "$output_objdir/$my_outputname.def"; then
3925 compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%"`
3926 finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%"`
3927 else
3928 compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$symfileobj%"`
3929 finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$symfileobj%"`
3930 fi
3931 ;;
3932 *)
3933 compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$symfileobj%"`
3934 finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$symfileobj%"`
3935 ;;
3936 esac
3937 ;;
3938 *)
3939 func_fatal_error "unknown suffix for \`$my_dlsyms'"
3940 ;;
3941 esac
3942 else
3943 # We keep going just in case the user didn't refer to
3944 # lt_preloaded_symbols. The linker will fail if global_symbol_pipe
3945 # really was required.
3946
3947 # Nullify the symbol file.
3948 compile_command=`$ECHO "$compile_command" | $SED "s% @SYMFILE@%%"`
3949 finalize_command=`$ECHO "$finalize_command" | $SED "s% @SYMFILE@%%"`
3950 fi
3951 }
3952
3953 # func_win32_libid arg
3954 # return the library type of file 'arg'
3955 #
3956 # Need a lot of goo to handle *both* DLLs and import libs
3957 # Has to be a shell function in order to 'eat' the argument
3958 # that is supplied when $file_magic_command is called.
3959 # Despite the name, also deal with 64 bit binaries.
3960 func_win32_libid ()
3961 {
3962 $opt_debug
3963 win32_libid_type="unknown"
3964 win32_fileres=`file -L $1 2>/dev/null`
3965 case $win32_fileres in
3966 *ar\ archive\ import\ library*) # definitely import
3967 win32_libid_type="x86 archive import"
3968 ;;
3969 *ar\ archive*) # could be an import, or static
3970 # Keep the egrep pattern in sync with the one in _LT_CHECK_MAGIC_METHOD.
3971 if eval $OBJDUMP -f $1 | $SED -e '10q' 2>/dev/null |
3972 $EGREP 'file format (pei*-i386(.*architecture: i386)?|pe-arm-wince|pe-x86-64)' >/dev/null; then
3973 func_to_tool_file "$1" func_convert_file_msys_to_w32
3974 win32_nmres=`eval $NM -f posix -A \"$func_to_tool_file_result\" |
3975 $SED -n -e '
3976 1,100{
3977 / I /{
3978 s,.*,import,
3979 p
3980 q
3981 }
3982 }'`
3983 case $win32_nmres in
3984 import*) win32_libid_type="x86 archive import";;
3985 *) win32_libid_type="x86 archive static";;
3986 esac
3987 fi
3988 ;;
3989 *DLL*)
3990 win32_libid_type="x86 DLL"
3991 ;;
3992 *executable*) # but shell scripts are "executable" too...
3993 case $win32_fileres in
3994 *MS\ Windows\ PE\ Intel*)
3995 win32_libid_type="x86 DLL"
3996 ;;
3997 esac
3998 ;;
3999 esac
4000 $ECHO "$win32_libid_type"
4001 }
4002
4003 # func_cygming_dll_for_implib ARG
4004 #
4005 # Platform-specific function to extract the
4006 # name of the DLL associated with the specified
4007 # import library ARG.
4008 # Invoked by eval'ing the libtool variable
4009 # $sharedlib_from_linklib_cmd
4010 # Result is available in the variable
4011 # $sharedlib_from_linklib_result
4012 func_cygming_dll_for_implib ()
4013 {
4014 $opt_debug
4015 sharedlib_from_linklib_result=`$DLLTOOL --identify-strict --identify "$1"`
4016 }
4017
4018 # func_cygming_dll_for_implib_fallback_core SECTION_NAME LIBNAMEs
4019 #
4020 # The is the core of a fallback implementation of a
4021 # platform-specific function to extract the name of the
4022 # DLL associated with the specified import library LIBNAME.
4023 #
4024 # SECTION_NAME is either .idata$6 or .idata$7, depending
4025 # on the platform and compiler that created the implib.
4026 #
4027 # Echos the name of the DLL associated with the
4028 # specified import library.
4029 func_cygming_dll_for_implib_fallback_core ()
4030 {
4031 $opt_debug
4032 match_literal=`$ECHO "$1" | $SED "$sed_make_literal_regex"`
4033 $OBJDUMP -s --section "$1" "$2" 2>/dev/null |
4034 $SED '/^Contents of section '"$match_literal"':/{
4035 # Place marker at beginning of archive member dllname section
4036 s/.*/====MARK====/
4037 p
4038 d
4039 }
4040 # These lines can sometimes be longer than 43 characters, but
4041 # are always uninteresting
4042 /:[ ]*file format pe[i]\{,1\}-/d
4043 /^In archive [^:]*:/d
4044 # Ensure marker is printed
4045 /^====MARK====/p
4046 # Remove all lines with less than 43 characters
4047 /^.\{43\}/!d
4048 # From remaining lines, remove first 43 characters
4049 s/^.\{43\}//' |
4050 $SED -n '
4051 # Join marker and all lines until next marker into a single line
4052 /^====MARK====/ b para
4053 H
4054 $ b para
4055 b
4056 :para
4057 x
4058 s/\n//g
4059 # Remove the marker
4060 s/^====MARK====//
4061 # Remove trailing dots and whitespace
4062 s/[\. \t]*$//
4063 # Print
4064 /./p' |
4065 # we now have a list, one entry per line, of the stringified
4066 # contents of the appropriate section of all members of the
4067 # archive which possess that section. Heuristic: eliminate
4068 # all those which have a first or second character that is
4069 # a '.' (that is, objdump's representation of an unprintable
4070 # character.) This should work for all archives with less than
4071 # 0x302f exports -- but will fail for DLLs whose name actually
4072 # begins with a literal '.' or a single character followed by
4073 # a '.'.
4074 #
4075 # Of those that remain, print the first one.
4076 $SED -e '/^\./d;/^.\./d;q'
4077 }
4078
4079 # func_cygming_gnu_implib_p ARG
4080 # This predicate returns with zero status (TRUE) if
4081 # ARG is a GNU/binutils-style import library. Returns
4082 # with nonzero status (FALSE) otherwise.
4083 func_cygming_gnu_implib_p ()
4084 {
4085 $opt_debug
4086 func_to_tool_file "$1" func_convert_file_msys_to_w32
4087 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)$'`
4088 test -n "$func_cygming_gnu_implib_tmp"
4089 }
4090
4091 # func_cygming_ms_implib_p ARG
4092 # This predicate returns with zero status (TRUE) if
4093 # ARG is an MS-style import library. Returns
4094 # with nonzero status (FALSE) otherwise.
4095 func_cygming_ms_implib_p ()
4096 {
4097 $opt_debug
4098 func_to_tool_file "$1" func_convert_file_msys_to_w32
4099 func_cygming_ms_implib_tmp=`$NM "$func_to_tool_file_result" | eval "$global_symbol_pipe" | $GREP '_NULL_IMPORT_DESCRIPTOR'`
4100 test -n "$func_cygming_ms_implib_tmp"
4101 }
4102
4103 # func_cygming_dll_for_implib_fallback ARG
4104 # Platform-specific function to extract the
4105 # name of the DLL associated with the specified
4106 # import library ARG.
4107 #
4108 # This fallback implementation is for use when $DLLTOOL
4109 # does not support the --identify-strict option.
4110 # Invoked by eval'ing the libtool variable
4111 # $sharedlib_from_linklib_cmd
4112 # Result is available in the variable
4113 # $sharedlib_from_linklib_result
4114 func_cygming_dll_for_implib_fallback ()
4115 {
4116 $opt_debug
4117 if func_cygming_gnu_implib_p "$1" ; then
4118 # binutils import library
4119 sharedlib_from_linklib_result=`func_cygming_dll_for_implib_fallback_core '.idata$7' "$1"`
4120 elif func_cygming_ms_implib_p "$1" ; then
4121 # ms-generated import library
4122 sharedlib_from_linklib_result=`func_cygming_dll_for_implib_fallback_core '.idata$6' "$1"`
4123 else
4124 # unknown
4125 sharedlib_from_linklib_result=""
4126 fi
4127 }
4128
4129
4130 # func_extract_an_archive dir oldlib
4131 func_extract_an_archive ()
4132 {
4133 $opt_debug
4134 f_ex_an_ar_dir="$1"; shift
4135 f_ex_an_ar_oldlib="$1"
4136 if test "$lock_old_archive_extraction" = yes; then
4137 lockfile=$f_ex_an_ar_oldlib.lock
4138 until $opt_dry_run || ln "$progpath" "$lockfile" 2>/dev/null; do
4139 func_echo "Waiting for $lockfile to be removed"
4140 sleep 2
4141 done
4142 fi
4143 func_show_eval "(cd \$f_ex_an_ar_dir && $AR x \"\$f_ex_an_ar_oldlib\")" \
4144 'stat=$?; rm -f "$lockfile"; exit $stat'
4145 if test "$lock_old_archive_extraction" = yes; then
4146 $opt_dry_run || rm -f "$lockfile"
4147 fi
4148 if ($AR t "$f_ex_an_ar_oldlib" | sort | sort -uc >/dev/null 2>&1); then
4149 :
4150 else
4151 func_fatal_error "object name conflicts in archive: $f_ex_an_ar_dir/$f_ex_an_ar_oldlib"
4152 fi
4153 }
4154
4155
4156 # func_extract_archives gentop oldlib ...
4157 func_extract_archives ()
4158 {
4159 $opt_debug
4160 my_gentop="$1"; shift
4161 my_oldlibs=${1+"$@"}
4162 my_oldobjs=""
4163 my_xlib=""
4164 my_xabs=""
4165 my_xdir=""
4166
4167 for my_xlib in $my_oldlibs; do
4168 # Extract the objects.
4169 case $my_xlib in
4170 [\\/]* | [A-Za-z]:[\\/]*) my_xabs="$my_xlib" ;;
4171 *) my_xabs=`pwd`"/$my_xlib" ;;
4172 esac
4173 func_basename "$my_xlib"
4174 my_xlib="$func_basename_result"
4175 my_xlib_u=$my_xlib
4176 while :; do
4177 case " $extracted_archives " in
4178 *" $my_xlib_u "*)
4179 func_arith $extracted_serial + 1
4180 extracted_serial=$func_arith_result
4181 my_xlib_u=lt$extracted_serial-$my_xlib ;;
4182 *) break ;;
4183 esac
4184 done
4185 extracted_archives="$extracted_archives $my_xlib_u"
4186 my_xdir="$my_gentop/$my_xlib_u"
4187
4188 func_mkdir_p "$my_xdir"
4189
4190 case $host in
4191 *-darwin*)
4192 func_verbose "Extracting $my_xabs"
4193 # Do not bother doing anything if just a dry run
4194 $opt_dry_run || {
4195 darwin_orig_dir=`pwd`
4196 cd $my_xdir || exit $?
4197 darwin_archive=$my_xabs
4198 darwin_curdir=`pwd`
4199 darwin_base_archive=`basename "$darwin_archive"`
4200 darwin_arches=`$LIPO -info "$darwin_archive" 2>/dev/null | $GREP Architectures 2>/dev/null || true`
4201 if test -n "$darwin_arches"; then
4202 darwin_arches=`$ECHO "$darwin_arches" | $SED -e 's/.*are://'`
4203 darwin_arch=
4204 func_verbose "$darwin_base_archive has multiple architectures $darwin_arches"
4205 for darwin_arch in $darwin_arches ; do
4206 func_mkdir_p "unfat-$$/${darwin_base_archive}-${darwin_arch}"
4207 $LIPO -thin $darwin_arch -output "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" "${darwin_archive}"
4208 cd "unfat-$$/${darwin_base_archive}-${darwin_arch}"
4209 func_extract_an_archive "`pwd`" "${darwin_base_archive}"
4210 cd "$darwin_curdir"
4211 $RM "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}"
4212 done # $darwin_arches
4213 ## Okay now we've a bunch of thin objects, gotta fatten them up :)
4214 darwin_filelist=`find unfat-$$ -type f -name \*.o -print -o -name \*.lo -print | $SED -e "$basename" | sort -u`
4215 darwin_file=
4216 darwin_files=
4217 for darwin_file in $darwin_filelist; do
4218 darwin_files=`find unfat-$$ -name $darwin_file -print | sort | $NL2SP`
4219 $LIPO -create -output "$darwin_file" $darwin_files
4220 done # $darwin_filelist
4221 $RM -rf unfat-$$
4222 cd "$darwin_orig_dir"
4223 else
4224 cd $darwin_orig_dir
4225 func_extract_an_archive "$my_xdir" "$my_xabs"
4226 fi # $darwin_arches
4227 } # !$opt_dry_run
4228 ;;
4229 *)
4230 func_extract_an_archive "$my_xdir" "$my_xabs"
4231 ;;
4232 esac
4233 my_oldobjs="$my_oldobjs "`find $my_xdir -name \*.$objext -print -o -name \*.lo -print | sort | $NL2SP`
4234 done
4235
4236 func_extract_archives_result="$my_oldobjs"
4237 }
4238
4239
4240 # func_emit_wrapper [arg=no]
4241 #
4242 # Emit a libtool wrapper script on stdout.
4243 # Don't directly open a file because we may want to
4244 # incorporate the script contents within a cygwin/mingw
4245 # wrapper executable. Must ONLY be called from within
4246 # func_mode_link because it depends on a number of variables
4247 # set therein.
4248 #
4249 # ARG is the value that the WRAPPER_SCRIPT_BELONGS_IN_OBJDIR
4250 # variable will take. If 'yes', then the emitted script
4251 # will assume that the directory in which it is stored is
4252 # the $objdir directory. This is a cygwin/mingw-specific
4253 # behavior.
4254 func_emit_wrapper ()
4255 {
4256 func_emit_wrapper_arg1=${1-no}
4257
4258 $ECHO "\
4259 #! $SHELL
4260
4261 # $output - temporary wrapper script for $objdir/$outputname
4262 # Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION
4263 #
4264 # The $output program cannot be directly executed until all the libtool
4265 # libraries that it depends on are installed.
4266 #
4267 # This wrapper script should never be moved out of the build directory.
4268 # If it is, it will not operate correctly.
4269
4270 # Sed substitution that helps us do robust quoting. It backslashifies
4271 # metacharacters that are still active within double-quoted strings.
4272 sed_quote_subst='$sed_quote_subst'
4273
4274 # Be Bourne compatible
4275 if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then
4276 emulate sh
4277 NULLCMD=:
4278 # Zsh 3.x and 4.x performs word splitting on \${1+\"\$@\"}, which
4279 # is contrary to our usage. Disable this feature.
4280 alias -g '\${1+\"\$@\"}'='\"\$@\"'
4281 setopt NO_GLOB_SUBST
4282 else
4283 case \`(set -o) 2>/dev/null\` in *posix*) set -o posix;; esac
4284 fi
4285 BIN_SH=xpg4; export BIN_SH # for Tru64
4286 DUALCASE=1; export DUALCASE # for MKS sh
4287
4288 # The HP-UX ksh and POSIX shell print the target directory to stdout
4289 # if CDPATH is set.
4290 (unset CDPATH) >/dev/null 2>&1 && unset CDPATH
4291
4292 relink_command=\"$relink_command\"
4293
4294 # This environment variable determines our operation mode.
4295 if test \"\$libtool_install_magic\" = \"$magic\"; then
4296 # install mode needs the following variables:
4297 generated_by_libtool_version='$macro_version'
4298 notinst_deplibs='$notinst_deplibs'
4299 else
4300 # When we are sourced in execute mode, \$file and \$ECHO are already set.
4301 if test \"\$libtool_execute_magic\" != \"$magic\"; then
4302 file=\"\$0\""
4303
4304 qECHO=`$ECHO "$ECHO" | $SED "$sed_quote_subst"`
4305 $ECHO "\
4306
4307 # A function that is used when there is no print builtin or printf.
4308 func_fallback_echo ()
4309 {
4310 eval 'cat <<_LTECHO_EOF
4311 \$1
4312 _LTECHO_EOF'
4313 }
4314 ECHO=\"$qECHO\"
4315 fi
4316
4317 # Very basic option parsing. These options are (a) specific to
4318 # the libtool wrapper, (b) are identical between the wrapper
4319 # /script/ and the wrapper /executable/ which is used only on
4320 # windows platforms, and (c) all begin with the string "--lt-"
4321 # (application programs are unlikely to have options which match
4322 # this pattern).
4323 #
4324 # There are only two supported options: --lt-debug and
4325 # --lt-dump-script. There is, deliberately, no --lt-help.
4326 #
4327 # The first argument to this parsing function should be the
4328 # script's $0 value, followed by "$@".
4329 lt_option_debug=
4330 func_parse_lt_options ()
4331 {
4332 lt_script_arg0=\$0
4333 shift
4334 for lt_opt
4335 do
4336 case \"\$lt_opt\" in
4337 --lt-debug) lt_option_debug=1 ;;
4338 --lt-dump-script)
4339 lt_dump_D=\`\$ECHO \"X\$lt_script_arg0\" | $SED -e 's/^X//' -e 's%/[^/]*$%%'\`
4340 test \"X\$lt_dump_D\" = \"X\$lt_script_arg0\" && lt_dump_D=.
4341 lt_dump_F=\`\$ECHO \"X\$lt_script_arg0\" | $SED -e 's/^X//' -e 's%^.*/%%'\`
4342 cat \"\$lt_dump_D/\$lt_dump_F\"
4343 exit 0
4344 ;;
4345 --lt-*)
4346 \$ECHO \"Unrecognized --lt- option: '\$lt_opt'\" 1>&2
4347 exit 1
4348 ;;
4349 esac
4350 done
4351
4352 # Print the debug banner immediately:
4353 if test -n \"\$lt_option_debug\"; then
4354 echo \"${outputname}:${output}:\${LINENO}: libtool wrapper (GNU $PACKAGE$TIMESTAMP) $VERSION\" 1>&2
4355 fi
4356 }
4357
4358 # Used when --lt-debug. Prints its arguments to stdout
4359 # (redirection is the responsibility of the caller)
4360 func_lt_dump_args ()
4361 {
4362 lt_dump_args_N=1;
4363 for lt_arg
4364 do
4365 \$ECHO \"${outputname}:${output}:\${LINENO}: newargv[\$lt_dump_args_N]: \$lt_arg\"
4366 lt_dump_args_N=\`expr \$lt_dump_args_N + 1\`
4367 done
4368 }
4369
4370 # Core function for launching the target application
4371 func_exec_program_core ()
4372 {
4373 "
4374 case $host in
4375 # Backslashes separate directories on plain windows
4376 *-*-mingw | *-*-os2* | *-cegcc*)
4377 $ECHO "\
4378 if test -n \"\$lt_option_debug\"; then
4379 \$ECHO \"${outputname}:${output}:\${LINENO}: newargv[0]: \$progdir\\\\\$program\" 1>&2
4380 func_lt_dump_args \${1+\"\$@\"} 1>&2
4381 fi
4382 exec \"\$progdir\\\\\$program\" \${1+\"\$@\"}
4383 "
4384 ;;
4385
4386 *)
4387 $ECHO "\
4388 if test -n \"\$lt_option_debug\"; then
4389 \$ECHO \"${outputname}:${output}:\${LINENO}: newargv[0]: \$progdir/\$program\" 1>&2
4390 func_lt_dump_args \${1+\"\$@\"} 1>&2
4391 fi
4392 exec \"\$progdir/\$program\" \${1+\"\$@\"}
4393 "
4394 ;;
4395 esac
4396 $ECHO "\
4397 \$ECHO \"\$0: cannot exec \$program \$*\" 1>&2
4398 exit 1
4399 }
4400
4401 # A function to encapsulate launching the target application
4402 # Strips options in the --lt-* namespace from \$@ and
4403 # launches target application with the remaining arguments.
4404 func_exec_program ()
4405 {
4406 case \" \$* \" in
4407 *\\ --lt-*)
4408 for lt_wr_arg
4409 do
4410 case \$lt_wr_arg in
4411 --lt-*) ;;
4412 *) set x \"\$@\" \"\$lt_wr_arg\"; shift;;
4413 esac
4414 shift
4415 done ;;
4416 esac
4417 func_exec_program_core \${1+\"\$@\"}
4418 }
4419
4420 # Parse options
4421 func_parse_lt_options \"\$0\" \${1+\"\$@\"}
4422
4423 # Find the directory that this script lives in.
4424 thisdir=\`\$ECHO \"\$file\" | $SED 's%/[^/]*$%%'\`
4425 test \"x\$thisdir\" = \"x\$file\" && thisdir=.
4426
4427 # Follow symbolic links until we get to the real thisdir.
4428 file=\`ls -ld \"\$file\" | $SED -n 's/.*-> //p'\`
4429 while test -n \"\$file\"; do
4430 destdir=\`\$ECHO \"\$file\" | $SED 's%/[^/]*\$%%'\`
4431
4432 # If there was a directory component, then change thisdir.
4433 if test \"x\$destdir\" != \"x\$file\"; then
4434 case \"\$destdir\" in
4435 [\\\\/]* | [A-Za-z]:[\\\\/]*) thisdir=\"\$destdir\" ;;
4436 *) thisdir=\"\$thisdir/\$destdir\" ;;
4437 esac
4438 fi
4439
4440 file=\`\$ECHO \"\$file\" | $SED 's%^.*/%%'\`
4441 file=\`ls -ld \"\$thisdir/\$file\" | $SED -n 's/.*-> //p'\`
4442 done
4443
4444 # Usually 'no', except on cygwin/mingw when embedded into
4445 # the cwrapper.
4446 WRAPPER_SCRIPT_BELONGS_IN_OBJDIR=$func_emit_wrapper_arg1
4447 if test \"\$WRAPPER_SCRIPT_BELONGS_IN_OBJDIR\" = \"yes\"; then
4448 # special case for '.'
4449 if test \"\$thisdir\" = \".\"; then
4450 thisdir=\`pwd\`
4451 fi
4452 # remove .libs from thisdir
4453 case \"\$thisdir\" in
4454 *[\\\\/]$objdir ) thisdir=\`\$ECHO \"\$thisdir\" | $SED 's%[\\\\/][^\\\\/]*$%%'\` ;;
4455 $objdir ) thisdir=. ;;
4456 esac
4457 fi
4458
4459 # Try to get the absolute directory name.
4460 absdir=\`cd \"\$thisdir\" && pwd\`
4461 test -n \"\$absdir\" && thisdir=\"\$absdir\"
4462 "
4463
4464 if test "$fast_install" = yes; then
4465 $ECHO "\
4466 program=lt-'$outputname'$exeext
4467 progdir=\"\$thisdir/$objdir\"
4468
4469 if test ! -f \"\$progdir/\$program\" ||
4470 { file=\`ls -1dt \"\$progdir/\$program\" \"\$progdir/../\$program\" 2>/dev/null | ${SED} 1q\`; \\
4471 test \"X\$file\" != \"X\$progdir/\$program\"; }; then
4472
4473 file=\"\$\$-\$program\"
4474
4475 if test ! -d \"\$progdir\"; then
4476 $MKDIR \"\$progdir\"
4477 else
4478 $RM \"\$progdir/\$file\"
4479 fi"
4480
4481 $ECHO "\
4482
4483 # relink executable if necessary
4484 if test -n \"\$relink_command\"; then
4485 if relink_command_output=\`eval \$relink_command 2>&1\`; then :
4486 else
4487 $ECHO \"\$relink_command_output\" >&2
4488 $RM \"\$progdir/\$file\"
4489 exit 1
4490 fi
4491 fi
4492
4493 $MV \"\$progdir/\$file\" \"\$progdir/\$program\" 2>/dev/null ||
4494 { $RM \"\$progdir/\$program\";
4495 $MV \"\$progdir/\$file\" \"\$progdir/\$program\"; }
4496 $RM \"\$progdir/\$file\"
4497 fi"
4498 else
4499 $ECHO "\
4500 program='$outputname'
4501 progdir=\"\$thisdir/$objdir\"
4502 "
4503 fi
4504
4505 $ECHO "\
4506
4507 if test -f \"\$progdir/\$program\"; then"
4508
4509 # fixup the dll searchpath if we need to.
4510 #
4511 # Fix the DLL searchpath if we need to. Do this before prepending
4512 # to shlibpath, because on Windows, both are PATH and uninstalled
4513 # libraries must come first.
4514 if test -n "$dllsearchpath"; then
4515 $ECHO "\
4516 # Add the dll search path components to the executable PATH
4517 PATH=$dllsearchpath:\$PATH
4518 "
4519 fi
4520
4521 # Export our shlibpath_var if we have one.
4522 if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then
4523 $ECHO "\
4524 # Add our own library path to $shlibpath_var
4525 $shlibpath_var=\"$temp_rpath\$$shlibpath_var\"
4526
4527 # Some systems cannot cope with colon-terminated $shlibpath_var
4528 # The second colon is a workaround for a bug in BeOS R4 sed
4529 $shlibpath_var=\`\$ECHO \"\$$shlibpath_var\" | $SED 's/::*\$//'\`
4530
4531 export $shlibpath_var
4532 "
4533 fi
4534
4535 $ECHO "\
4536 if test \"\$libtool_execute_magic\" != \"$magic\"; then
4537 # Run the actual program with our arguments.
4538 func_exec_program \${1+\"\$@\"}
4539 fi
4540 else
4541 # The program doesn't exist.
4542 \$ECHO \"\$0: error: \\\`\$progdir/\$program' does not exist\" 1>&2
4543 \$ECHO \"This script is just a wrapper for \$program.\" 1>&2
4544 \$ECHO \"See the $PACKAGE documentation for more information.\" 1>&2
4545 exit 1
4546 fi
4547 fi\
4548 "
4549 }
4550
4551
4552 # func_emit_cwrapperexe_src
4553 # emit the source code for a wrapper executable on stdout
4554 # Must ONLY be called from within func_mode_link because
4555 # it depends on a number of variable set therein.
4556 func_emit_cwrapperexe_src ()
4557 {
4558 cat <<EOF
4559
4560 /* $cwrappersource - temporary wrapper executable for $objdir/$outputname
4561 Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION
4562
4563 The $output program cannot be directly executed until all the libtool
4564 libraries that it depends on are installed.
4565
4566 This wrapper executable should never be moved out of the build directory.
4567 If it is, it will not operate correctly.
4568 */
4569 EOF
4570 cat <<"EOF"
4571 #ifdef _MSC_VER
4572 # define _CRT_SECURE_NO_DEPRECATE 1
4573 #endif
4574 #include <stdio.h>
4575 #include <stdlib.h>
4576 #ifdef _MSC_VER
4577 # include <direct.h>
4578 # include <process.h>
4579 # include <io.h>
4580 #else
4581 # include <unistd.h>
4582 # include <stdint.h>
4583 # ifdef __CYGWIN__
4584 # include <io.h>
4585 # endif
4586 #endif
4587 #include <malloc.h>
4588 #include <stdarg.h>
4589 #include <assert.h>
4590 #include <string.h>
4591 #include <ctype.h>
4592 #include <errno.h>
4593 #include <fcntl.h>
4594 #include <sys/stat.h>
4595
4596 /* declarations of non-ANSI functions */
4597 #if defined(__MINGW32__)
4598 # ifdef __STRICT_ANSI__
4599 int _putenv (const char *);
4600 # endif
4601 #elif defined(__CYGWIN__)
4602 # ifdef __STRICT_ANSI__
4603 char *realpath (const char *, char *);
4604 int putenv (char *);
4605 int setenv (const char *, const char *, int);
4606 # endif
4607 /* #elif defined (other platforms) ... */
4608 #endif
4609
4610 /* portability defines, excluding path handling macros */
4611 #if defined(_MSC_VER)
4612 # define setmode _setmode
4613 # define stat _stat
4614 # define chmod _chmod
4615 # define getcwd _getcwd
4616 # define putenv _putenv
4617 # define S_IXUSR _S_IEXEC
4618 # ifndef _INTPTR_T_DEFINED
4619 # define _INTPTR_T_DEFINED
4620 # define intptr_t int
4621 # endif
4622 #elif defined(__MINGW32__)
4623 # define setmode _setmode
4624 # define stat _stat
4625 # define chmod _chmod
4626 # define getcwd _getcwd
4627 # define putenv _putenv
4628 #elif defined(__CYGWIN__)
4629 # define HAVE_SETENV
4630 # define FOPEN_WB "wb"
4631 /* #elif defined (other platforms) ... */
4632 #endif
4633
4634 #if defined(PATH_MAX)
4635 # define LT_PATHMAX PATH_MAX
4636 #elif defined(MAXPATHLEN)
4637 # define LT_PATHMAX MAXPATHLEN
4638 #else
4639 # define LT_PATHMAX 1024
4640 #endif
4641
4642 #ifndef S_IXOTH
4643 # define S_IXOTH 0
4644 #endif
4645 #ifndef S_IXGRP
4646 # define S_IXGRP 0
4647 #endif
4648
4649 /* path handling portability macros */
4650 #ifndef DIR_SEPARATOR
4651 # define DIR_SEPARATOR '/'
4652 # define PATH_SEPARATOR ':'
4653 #endif
4654
4655 #if defined (_WIN32) || defined (__MSDOS__) || defined (__DJGPP__) || \
4656 defined (__OS2__)
4657 # define HAVE_DOS_BASED_FILE_SYSTEM
4658 # define FOPEN_WB "wb"
4659 # ifndef DIR_SEPARATOR_2
4660 # define DIR_SEPARATOR_2 '\\'
4661 # endif
4662 # ifndef PATH_SEPARATOR_2
4663 # define PATH_SEPARATOR_2 ';'
4664 # endif
4665 #endif
4666
4667 #ifndef DIR_SEPARATOR_2
4668 # define IS_DIR_SEPARATOR(ch) ((ch) == DIR_SEPARATOR)
4669 #else /* DIR_SEPARATOR_2 */
4670 # define IS_DIR_SEPARATOR(ch) \
4671 (((ch) == DIR_SEPARATOR) || ((ch) == DIR_SEPARATOR_2))
4672 #endif /* DIR_SEPARATOR_2 */
4673
4674 #ifndef PATH_SEPARATOR_2
4675 # define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR)
4676 #else /* PATH_SEPARATOR_2 */
4677 # define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR_2)
4678 #endif /* PATH_SEPARATOR_2 */
4679
4680 #ifndef FOPEN_WB
4681 # define FOPEN_WB "w"
4682 #endif
4683 #ifndef _O_BINARY
4684 # define _O_BINARY 0
4685 #endif
4686
4687 #define XMALLOC(type, num) ((type *) xmalloc ((num) * sizeof(type)))
4688 #define XFREE(stale) do { \
4689 if (stale) { free ((void *) stale); stale = 0; } \
4690 } while (0)
4691
4692 #if defined(LT_DEBUGWRAPPER)
4693 static int lt_debug = 1;
4694 #else
4695 static int lt_debug = 0;
4696 #endif
4697
4698 const char *program_name = "libtool-wrapper"; /* in case xstrdup fails */
4699
4700 void *xmalloc (size_t num);
4701 char *xstrdup (const char *string);
4702 const char *base_name (const char *name);
4703 char *find_executable (const char *wrapper);
4704 char *chase_symlinks (const char *pathspec);
4705 int make_executable (const char *path);
4706 int check_executable (const char *path);
4707 char *strendzap (char *str, const char *pat);
4708 void lt_debugprintf (const char *file, int line, const char *fmt, ...);
4709 void lt_fatal (const char *file, int line, const char *message, ...);
4710 static const char *nonnull (const char *s);
4711 static const char *nonempty (const char *s);
4712 void lt_setenv (const char *name, const char *value);
4713 char *lt_extend_str (const char *orig_value, const char *add, int to_end);
4714 void lt_update_exe_path (const char *name, const char *value);
4715 void lt_update_lib_path (const char *name, const char *value);
4716 char **prepare_spawn (char **argv);
4717 void lt_dump_script (FILE *f);
4718 EOF
4719
4720 cat <<EOF
4721 volatile const char * MAGIC_EXE = "$magic_exe";
4722 const char * LIB_PATH_VARNAME = "$shlibpath_var";
4723 EOF
4724
4725 if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then
4726 func_to_host_path "$temp_rpath"
4727 cat <<EOF
4728 const char * LIB_PATH_VALUE = "$func_to_host_path_result";
4729 EOF
4730 else
4731 cat <<"EOF"
4732 const char * LIB_PATH_VALUE = "";
4733 EOF
4734 fi
4735
4736 if test -n "$dllsearchpath"; then
4737 func_to_host_path "$dllsearchpath:"
4738 cat <<EOF
4739 const char * EXE_PATH_VARNAME = "PATH";
4740 const char * EXE_PATH_VALUE = "$func_to_host_path_result";
4741 EOF
4742 else
4743 cat <<"EOF"
4744 const char * EXE_PATH_VARNAME = "";
4745 const char * EXE_PATH_VALUE = "";
4746 EOF
4747 fi
4748
4749 if test "$fast_install" = yes; then
4750 cat <<EOF
4751 const char * TARGET_PROGRAM_NAME = "lt-$outputname"; /* hopefully, no .exe */
4752 EOF
4753 else
4754 cat <<EOF
4755 const char * TARGET_PROGRAM_NAME = "$outputname"; /* hopefully, no .exe */
4756 EOF
4757 fi
4758
4759
4760 cat <<"EOF"
4761
4762 #define LTWRAPPER_OPTION_PREFIX "--lt-"
4763
4764 static const char *ltwrapper_option_prefix = LTWRAPPER_OPTION_PREFIX;
4765 static const char *dumpscript_opt = LTWRAPPER_OPTION_PREFIX "dump-script";
4766 static const char *debug_opt = LTWRAPPER_OPTION_PREFIX "debug";
4767
4768 int
4769 main (int argc, char *argv[])
4770 {
4771 char **newargz;
4772 int newargc;
4773 char *tmp_pathspec;
4774 char *actual_cwrapper_path;
4775 char *actual_cwrapper_name;
4776 char *target_name;
4777 char *lt_argv_zero;
4778 intptr_t rval = 127;
4779
4780 int i;
4781
4782 program_name = (char *) xstrdup (base_name (argv[0]));
4783 newargz = XMALLOC (char *, argc + 1);
4784
4785 /* very simple arg parsing; don't want to rely on getopt
4786 * also, copy all non cwrapper options to newargz, except
4787 * argz[0], which is handled differently
4788 */
4789 newargc=0;
4790 for (i = 1; i < argc; i++)
4791 {
4792 if (strcmp (argv[i], dumpscript_opt) == 0)
4793 {
4794 EOF
4795 case "$host" in
4796 *mingw* | *cygwin* )
4797 # make stdout use "unix" line endings
4798 echo " setmode(1,_O_BINARY);"
4799 ;;
4800 esac
4801
4802 cat <<"EOF"
4803 lt_dump_script (stdout);
4804 return 0;
4805 }
4806 if (strcmp (argv[i], debug_opt) == 0)
4807 {
4808 lt_debug = 1;
4809 continue;
4810 }
4811 if (strcmp (argv[i], ltwrapper_option_prefix) == 0)
4812 {
4813 /* however, if there is an option in the LTWRAPPER_OPTION_PREFIX
4814 namespace, but it is not one of the ones we know about and
4815 have already dealt with, above (inluding dump-script), then
4816 report an error. Otherwise, targets might begin to believe
4817 they are allowed to use options in the LTWRAPPER_OPTION_PREFIX
4818 namespace. The first time any user complains about this, we'll
4819 need to make LTWRAPPER_OPTION_PREFIX a configure-time option
4820 or a configure.ac-settable value.
4821 */
4822 lt_fatal (__FILE__, __LINE__,
4823 "unrecognized %s option: '%s'",
4824 ltwrapper_option_prefix, argv[i]);
4825 }
4826 /* otherwise ... */
4827 newargz[++newargc] = xstrdup (argv[i]);
4828 }
4829 newargz[++newargc] = NULL;
4830
4831 EOF
4832 cat <<EOF
4833 /* The GNU banner must be the first non-error debug message */
4834 lt_debugprintf (__FILE__, __LINE__, "libtool wrapper (GNU $PACKAGE$TIMESTAMP) $VERSION\n");
4835 EOF
4836 cat <<"EOF"
4837 lt_debugprintf (__FILE__, __LINE__, "(main) argv[0]: %s\n", argv[0]);
4838 lt_debugprintf (__FILE__, __LINE__, "(main) program_name: %s\n", program_name);
4839
4840 tmp_pathspec = find_executable (argv[0]);
4841 if (tmp_pathspec == NULL)
4842 lt_fatal (__FILE__, __LINE__, "couldn't find %s", argv[0]);
4843 lt_debugprintf (__FILE__, __LINE__,
4844 "(main) found exe (before symlink chase) at: %s\n",
4845 tmp_pathspec);
4846
4847 actual_cwrapper_path = chase_symlinks (tmp_pathspec);
4848 lt_debugprintf (__FILE__, __LINE__,
4849 "(main) found exe (after symlink chase) at: %s\n",
4850 actual_cwrapper_path);
4851 XFREE (tmp_pathspec);
4852
4853 actual_cwrapper_name = xstrdup (base_name (actual_cwrapper_path));
4854 strendzap (actual_cwrapper_path, actual_cwrapper_name);
4855
4856 /* wrapper name transforms */
4857 strendzap (actual_cwrapper_name, ".exe");
4858 tmp_pathspec = lt_extend_str (actual_cwrapper_name, ".exe", 1);
4859 XFREE (actual_cwrapper_name);
4860 actual_cwrapper_name = tmp_pathspec;
4861 tmp_pathspec = 0;
4862
4863 /* target_name transforms -- use actual target program name; might have lt- prefix */
4864 target_name = xstrdup (base_name (TARGET_PROGRAM_NAME));
4865 strendzap (target_name, ".exe");
4866 tmp_pathspec = lt_extend_str (target_name, ".exe", 1);
4867 XFREE (target_name);
4868 target_name = tmp_pathspec;
4869 tmp_pathspec = 0;
4870
4871 lt_debugprintf (__FILE__, __LINE__,
4872 "(main) libtool target name: %s\n",
4873 target_name);
4874 EOF
4875
4876 cat <<EOF
4877 newargz[0] =
4878 XMALLOC (char, (strlen (actual_cwrapper_path) +
4879 strlen ("$objdir") + 1 + strlen (actual_cwrapper_name) + 1));
4880 strcpy (newargz[0], actual_cwrapper_path);
4881 strcat (newargz[0], "$objdir");
4882 strcat (newargz[0], "/");
4883 EOF
4884
4885 cat <<"EOF"
4886 /* stop here, and copy so we don't have to do this twice */
4887 tmp_pathspec = xstrdup (newargz[0]);
4888
4889 /* do NOT want the lt- prefix here, so use actual_cwrapper_name */
4890 strcat (newargz[0], actual_cwrapper_name);
4891
4892 /* DO want the lt- prefix here if it exists, so use target_name */
4893 lt_argv_zero = lt_extend_str (tmp_pathspec, target_name, 1);
4894 XFREE (tmp_pathspec);
4895 tmp_pathspec = NULL;
4896 EOF
4897
4898 case $host_os in
4899 mingw*)
4900 cat <<"EOF"
4901 {
4902 char* p;
4903 while ((p = strchr (newargz[0], '\\')) != NULL)
4904 {
4905 *p = '/';
4906 }
4907 while ((p = strchr (lt_argv_zero, '\\')) != NULL)
4908 {
4909 *p = '/';
4910 }
4911 }
4912 EOF
4913 ;;
4914 esac
4915
4916 cat <<"EOF"
4917 XFREE (target_name);
4918 XFREE (actual_cwrapper_path);
4919 XFREE (actual_cwrapper_name);
4920
4921 lt_setenv ("BIN_SH", "xpg4"); /* for Tru64 */
4922 lt_setenv ("DUALCASE", "1"); /* for MSK sh */
4923 /* Update the DLL searchpath. EXE_PATH_VALUE ($dllsearchpath) must
4924 be prepended before (that is, appear after) LIB_PATH_VALUE ($temp_rpath)
4925 because on Windows, both *_VARNAMEs are PATH but uninstalled
4926 libraries must come first. */
4927 lt_update_exe_path (EXE_PATH_VARNAME, EXE_PATH_VALUE);
4928 lt_update_lib_path (LIB_PATH_VARNAME, LIB_PATH_VALUE);
4929
4930 lt_debugprintf (__FILE__, __LINE__, "(main) lt_argv_zero: %s\n",
4931 nonnull (lt_argv_zero));
4932 for (i = 0; i < newargc; i++)
4933 {
4934 lt_debugprintf (__FILE__, __LINE__, "(main) newargz[%d]: %s\n",
4935 i, nonnull (newargz[i]));
4936 }
4937
4938 EOF
4939
4940 case $host_os in
4941 mingw*)
4942 cat <<"EOF"
4943 /* execv doesn't actually work on mingw as expected on unix */
4944 newargz = prepare_spawn (newargz);
4945 rval = _spawnv (_P_WAIT, lt_argv_zero, (const char * const *) newargz);
4946 if (rval == -1)
4947 {
4948 /* failed to start process */
4949 lt_debugprintf (__FILE__, __LINE__,
4950 "(main) failed to launch target \"%s\": %s\n",
4951 lt_argv_zero, nonnull (strerror (errno)));
4952 return 127;
4953 }
4954 return rval;
4955 EOF
4956 ;;
4957 *)
4958 cat <<"EOF"
4959 execv (lt_argv_zero, newargz);
4960 return rval; /* =127, but avoids unused variable warning */
4961 EOF
4962 ;;
4963 esac
4964
4965 cat <<"EOF"
4966 }
4967
4968 void *
4969 xmalloc (size_t num)
4970 {
4971 void *p = (void *) malloc (num);
4972 if (!p)
4973 lt_fatal (__FILE__, __LINE__, "memory exhausted");
4974
4975 return p;
4976 }
4977
4978 char *
4979 xstrdup (const char *string)
4980 {
4981 return string ? strcpy ((char *) xmalloc (strlen (string) + 1),
4982 string) : NULL;
4983 }
4984
4985 const char *
4986 base_name (const char *name)
4987 {
4988 const char *base;
4989
4990 #if defined (HAVE_DOS_BASED_FILE_SYSTEM)
4991 /* Skip over the disk name in MSDOS pathnames. */
4992 if (isalpha ((unsigned char) name[0]) && name[1] == ':')
4993 name += 2;
4994 #endif
4995
4996 for (base = name; *name; name++)
4997 if (IS_DIR_SEPARATOR (*name))
4998 base = name + 1;
4999 return base;
5000 }
5001
5002 int
5003 check_executable (const char *path)
5004 {
5005 struct stat st;
5006
5007 lt_debugprintf (__FILE__, __LINE__, "(check_executable): %s\n",
5008 nonempty (path));
5009 if ((!path) || (!*path))
5010 return 0;
5011
5012 if ((stat (path, &st) >= 0)
5013 && (st.st_mode & (S_IXUSR | S_IXGRP | S_IXOTH)))
5014 return 1;
5015 else
5016 return 0;
5017 }
5018
5019 int
5020 make_executable (const char *path)
5021 {
5022 int rval = 0;
5023 struct stat st;
5024
5025 lt_debugprintf (__FILE__, __LINE__, "(make_executable): %s\n",
5026 nonempty (path));
5027 if ((!path) || (!*path))
5028 return 0;
5029
5030 if (stat (path, &st) >= 0)
5031 {
5032 rval = chmod (path, st.st_mode | S_IXOTH | S_IXGRP | S_IXUSR);
5033 }
5034 return rval;
5035 }
5036
5037 /* Searches for the full path of the wrapper. Returns
5038 newly allocated full path name if found, NULL otherwise
5039 Does not chase symlinks, even on platforms that support them.
5040 */
5041 char *
5042 find_executable (const char *wrapper)
5043 {
5044 int has_slash = 0;
5045 const char *p;
5046 const char *p_next;
5047 /* static buffer for getcwd */
5048 char tmp[LT_PATHMAX + 1];
5049 int tmp_len;
5050 char *concat_name;
5051
5052 lt_debugprintf (__FILE__, __LINE__, "(find_executable): %s\n",
5053 nonempty (wrapper));
5054
5055 if ((wrapper == NULL) || (*wrapper == '\0'))
5056 return NULL;
5057
5058 /* Absolute path? */
5059 #if defined (HAVE_DOS_BASED_FILE_SYSTEM)
5060 if (isalpha ((unsigned char) wrapper[0]) && wrapper[1] == ':')
5061 {
5062 concat_name = xstrdup (wrapper);
5063 if (check_executable (concat_name))
5064 return concat_name;
5065 XFREE (concat_name);
5066 }
5067 else
5068 {
5069 #endif
5070 if (IS_DIR_SEPARATOR (wrapper[0]))
5071 {
5072 concat_name = xstrdup (wrapper);
5073 if (check_executable (concat_name))
5074 return concat_name;
5075 XFREE (concat_name);
5076 }
5077 #if defined (HAVE_DOS_BASED_FILE_SYSTEM)
5078 }
5079 #endif
5080
5081 for (p = wrapper; *p; p++)
5082 if (*p == '/')
5083 {
5084 has_slash = 1;
5085 break;
5086 }
5087 if (!has_slash)
5088 {
5089 /* no slashes; search PATH */
5090 const char *path = getenv ("PATH");
5091 if (path != NULL)
5092 {
5093 for (p = path; *p; p = p_next)
5094 {
5095 const char *q;
5096 size_t p_len;
5097 for (q = p; *q; q++)
5098 if (IS_PATH_SEPARATOR (*q))
5099 break;
5100 p_len = q - p;
5101 p_next = (*q == '\0' ? q : q + 1);
5102 if (p_len == 0)
5103 {
5104 /* empty path: current directory */
5105 if (getcwd (tmp, LT_PATHMAX) == NULL)
5106 lt_fatal (__FILE__, __LINE__, "getcwd failed: %s",
5107 nonnull (strerror (errno)));
5108 tmp_len = strlen (tmp);
5109 concat_name =
5110 XMALLOC (char, tmp_len + 1 + strlen (wrapper) + 1);
5111 memcpy (concat_name, tmp, tmp_len);
5112 concat_name[tmp_len] = '/';
5113 strcpy (concat_name + tmp_len + 1, wrapper);
5114 }
5115 else
5116 {
5117 concat_name =
5118 XMALLOC (char, p_len + 1 + strlen (wrapper) + 1);
5119 memcpy (concat_name, p, p_len);
5120 concat_name[p_len] = '/';
5121 strcpy (concat_name + p_len + 1, wrapper);
5122 }
5123 if (check_executable (concat_name))
5124 return concat_name;
5125 XFREE (concat_name);
5126 }
5127 }
5128 /* not found in PATH; assume curdir */
5129 }
5130 /* Relative path | not found in path: prepend cwd */
5131 if (getcwd (tmp, LT_PATHMAX) == NULL)
5132 lt_fatal (__FILE__, __LINE__, "getcwd failed: %s",
5133 nonnull (strerror (errno)));
5134 tmp_len = strlen (tmp);
5135 concat_name = XMALLOC (char, tmp_len + 1 + strlen (wrapper) + 1);
5136 memcpy (concat_name, tmp, tmp_len);
5137 concat_name[tmp_len] = '/';
5138 strcpy (concat_name + tmp_len + 1, wrapper);
5139
5140 if (check_executable (concat_name))
5141 return concat_name;
5142 XFREE (concat_name);
5143 return NULL;
5144 }
5145
5146 char *
5147 chase_symlinks (const char *pathspec)
5148 {
5149 #ifndef S_ISLNK
5150 return xstrdup (pathspec);
5151 #else
5152 char buf[LT_PATHMAX];
5153 struct stat s;
5154 char *tmp_pathspec = xstrdup (pathspec);
5155 char *p;
5156 int has_symlinks = 0;
5157 while (strlen (tmp_pathspec) && !has_symlinks)
5158 {
5159 lt_debugprintf (__FILE__, __LINE__,
5160 "checking path component for symlinks: %s\n",
5161 tmp_pathspec);
5162 if (lstat (tmp_pathspec, &s) == 0)
5163 {
5164 if (S_ISLNK (s.st_mode) != 0)
5165 {
5166 has_symlinks = 1;
5167 break;
5168 }
5169
5170 /* search backwards for last DIR_SEPARATOR */
5171 p = tmp_pathspec + strlen (tmp_pathspec) - 1;
5172 while ((p > tmp_pathspec) && (!IS_DIR_SEPARATOR (*p)))
5173 p--;
5174 if ((p == tmp_pathspec) && (!IS_DIR_SEPARATOR (*p)))
5175 {
5176 /* no more DIR_SEPARATORS left */
5177 break;
5178 }
5179 *p = '\0';
5180 }
5181 else
5182 {
5183 lt_fatal (__FILE__, __LINE__,
5184 "error accessing file \"%s\": %s",
5185 tmp_pathspec, nonnull (strerror (errno)));
5186 }
5187 }
5188 XFREE (tmp_pathspec);
5189
5190 if (!has_symlinks)
5191 {
5192 return xstrdup (pathspec);
5193 }
5194
5195 tmp_pathspec = realpath (pathspec, buf);
5196 if (tmp_pathspec == 0)
5197 {
5198 lt_fatal (__FILE__, __LINE__,
5199 "could not follow symlinks for %s", pathspec);
5200 }
5201 return xstrdup (tmp_pathspec);
5202 #endif
5203 }
5204
5205 char *
5206 strendzap (char *str, const char *pat)
5207 {
5208 size_t len, patlen;
5209
5210 assert (str != NULL);
5211 assert (pat != NULL);
5212
5213 len = strlen (str);
5214 patlen = strlen (pat);
5215
5216 if (patlen <= len)
5217 {
5218 str += len - patlen;
5219 if (strcmp (str, pat) == 0)
5220 *str = '\0';
5221 }
5222 return str;
5223 }
5224
5225 void
5226 lt_debugprintf (const char *file, int line, const char *fmt, ...)
5227 {
5228 va_list args;
5229 if (lt_debug)
5230 {
5231 (void) fprintf (stderr, "%s:%s:%d: ", program_name, file, line);
5232 va_start (args, fmt);
5233 (void) vfprintf (stderr, fmt, args);
5234 va_end (args);
5235 }
5236 }
5237
5238 static void
5239 lt_error_core (int exit_status, const char *file,
5240 int line, const char *mode,
5241 const char *message, va_list ap)
5242 {
5243 fprintf (stderr, "%s:%s:%d: %s: ", program_name, file, line, mode);
5244 vfprintf (stderr, message, ap);
5245 fprintf (stderr, ".\n");
5246
5247 if (exit_status >= 0)
5248 exit (exit_status);
5249 }
5250
5251 void
5252 lt_fatal (const char *file, int line, const char *message, ...)
5253 {
5254 va_list ap;
5255 va_start (ap, message);
5256 lt_error_core (EXIT_FAILURE, file, line, "FATAL", message, ap);
5257 va_end (ap);
5258 }
5259
5260 static const char *
5261 nonnull (const char *s)
5262 {
5263 return s ? s : "(null)";
5264 }
5265
5266 static const char *
5267 nonempty (const char *s)
5268 {
5269 return (s && !*s) ? "(empty)" : nonnull (s);
5270 }
5271
5272 void
5273 lt_setenv (const char *name, const char *value)
5274 {
5275 lt_debugprintf (__FILE__, __LINE__,
5276 "(lt_setenv) setting '%s' to '%s'\n",
5277 nonnull (name), nonnull (value));
5278 {
5279 #ifdef HAVE_SETENV
5280 /* always make a copy, for consistency with !HAVE_SETENV */
5281 char *str = xstrdup (value);
5282 setenv (name, str, 1);
5283 #else
5284 int len = strlen (name) + 1 + strlen (value) + 1;
5285 char *str = XMALLOC (char, len);
5286 sprintf (str, "%s=%s", name, value);
5287 if (putenv (str) != EXIT_SUCCESS)
5288 {
5289 XFREE (str);
5290 }
5291 #endif
5292 }
5293 }
5294
5295 char *
5296 lt_extend_str (const char *orig_value, const char *add, int to_end)
5297 {
5298 char *new_value;
5299 if (orig_value && *orig_value)
5300 {
5301 int orig_value_len = strlen (orig_value);
5302 int add_len = strlen (add);
5303 new_value = XMALLOC (char, add_len + orig_value_len + 1);
5304 if (to_end)
5305 {
5306 strcpy (new_value, orig_value);
5307 strcpy (new_value + orig_value_len, add);
5308 }
5309 else
5310 {
5311 strcpy (new_value, add);
5312 strcpy (new_value + add_len, orig_value);
5313 }
5314 }
5315 else
5316 {
5317 new_value = xstrdup (add);
5318 }
5319 return new_value;
5320 }
5321
5322 void
5323 lt_update_exe_path (const char *name, const char *value)
5324 {
5325 lt_debugprintf (__FILE__, __LINE__,
5326 "(lt_update_exe_path) modifying '%s' by prepending '%s'\n",
5327 nonnull (name), nonnull (value));
5328
5329 if (name && *name && value && *value)
5330 {
5331 char *new_value = lt_extend_str (getenv (name), value, 0);
5332 /* some systems can't cope with a ':'-terminated path #' */
5333 int len = strlen (new_value);
5334 while (((len = strlen (new_value)) > 0) && IS_PATH_SEPARATOR (new_value[len-1]))
5335 {
5336 new_value[len-1] = '\0';
5337 }
5338 lt_setenv (name, new_value);
5339 XFREE (new_value);
5340 }
5341 }
5342
5343 void
5344 lt_update_lib_path (const char *name, const char *value)
5345 {
5346 lt_debugprintf (__FILE__, __LINE__,
5347 "(lt_update_lib_path) modifying '%s' by prepending '%s'\n",
5348 nonnull (name), nonnull (value));
5349
5350 if (name && *name && value && *value)
5351 {
5352 char *new_value = lt_extend_str (getenv (name), value, 0);
5353 lt_setenv (name, new_value);
5354 XFREE (new_value);
5355 }
5356 }
5357
5358 EOF
5359 case $host_os in
5360 mingw*)
5361 cat <<"EOF"
5362
5363 /* Prepares an argument vector before calling spawn().
5364 Note that spawn() does not by itself call the command interpreter
5365 (getenv ("COMSPEC") != NULL ? getenv ("COMSPEC") :
5366 ({ OSVERSIONINFO v; v.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
5367 GetVersionEx(&v);
5368 v.dwPlatformId == VER_PLATFORM_WIN32_NT;
5369 }) ? "cmd.exe" : "command.com").
5370 Instead it simply concatenates the arguments, separated by ' ', and calls
5371 CreateProcess(). We must quote the arguments since Win32 CreateProcess()
5372 interprets characters like ' ', '\t', '\\', '"' (but not '<' and '>') in a
5373 special way:
5374 - Space and tab are interpreted as delimiters. They are not treated as
5375 delimiters if they are surrounded by double quotes: "...".
5376 - Unescaped double quotes are removed from the input. Their only effect is
5377 that within double quotes, space and tab are treated like normal
5378 characters.
5379 - Backslashes not followed by double quotes are not special.
5380 - But 2*n+1 backslashes followed by a double quote become
5381 n backslashes followed by a double quote (n >= 0):
5382 \" -> "
5383 \\\" -> \"
5384 \\\\\" -> \\"
5385 */
5386 #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"
5387 #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"
5388 char **
5389 prepare_spawn (char **argv)
5390 {
5391 size_t argc;
5392 char **new_argv;
5393 size_t i;
5394
5395 /* Count number of arguments. */
5396 for (argc = 0; argv[argc] != NULL; argc++)
5397 ;
5398
5399 /* Allocate new argument vector. */
5400 new_argv = XMALLOC (char *, argc + 1);
5401
5402 /* Put quoted arguments into the new argument vector. */
5403 for (i = 0; i < argc; i++)
5404 {
5405 const char *string = argv[i];
5406
5407 if (string[0] == '\0')
5408 new_argv[i] = xstrdup ("\"\"");
5409 else if (strpbrk (string, SHELL_SPECIAL_CHARS) != NULL)
5410 {
5411 int quote_around = (strpbrk (string, SHELL_SPACE_CHARS) != NULL);
5412 size_t length;
5413 unsigned int backslashes;
5414 const char *s;
5415 char *quoted_string;
5416 char *p;
5417
5418 length = 0;
5419 backslashes = 0;
5420 if (quote_around)
5421 length++;
5422 for (s = string; *s != '\0'; s++)
5423 {
5424 char c = *s;
5425 if (c == '"')
5426 length += backslashes + 1;
5427 length++;
5428 if (c == '\\')
5429 backslashes++;
5430 else
5431 backslashes = 0;
5432 }
5433 if (quote_around)
5434 length += backslashes + 1;
5435
5436 quoted_string = XMALLOC (char, length + 1);
5437
5438 p = quoted_string;
5439 backslashes = 0;
5440 if (quote_around)
5441 *p++ = '"';
5442 for (s = string; *s != '\0'; s++)
5443 {
5444 char c = *s;
5445 if (c == '"')
5446 {
5447 unsigned int j;
5448 for (j = backslashes + 1; j > 0; j--)
5449 *p++ = '\\';
5450 }
5451 *p++ = c;
5452 if (c == '\\')
5453 backslashes++;
5454 else
5455 backslashes = 0;
5456 }
5457 if (quote_around)
5458 {
5459 unsigned int j;
5460 for (j = backslashes; j > 0; j--)
5461 *p++ = '\\';
5462 *p++ = '"';
5463 }
5464 *p = '\0';
5465
5466 new_argv[i] = quoted_string;
5467 }
5468 else
5469 new_argv[i] = (char *) string;
5470 }
5471 new_argv[argc] = NULL;
5472
5473 return new_argv;
5474 }
5475 EOF
5476 ;;
5477 esac
5478
5479 cat <<"EOF"
5480 void lt_dump_script (FILE* f)
5481 {
5482 EOF
5483 func_emit_wrapper yes |
5484 $SED -n -e '
5485 s/^\(.\{79\}\)\(..*\)/\1\
5486 \2/
5487 h
5488 s/\([\\"]\)/\\\1/g
5489 s/$/\\n/
5490 s/\([^\n]*\).*/ fputs ("\1", f);/p
5491 g
5492 D'
5493 cat <<"EOF"
5494 }
5495 EOF
5496 }
5497 # end: func_emit_cwrapperexe_src
5498
5499 # func_win32_import_lib_p ARG
5500 # True if ARG is an import lib, as indicated by $file_magic_cmd
5501 func_win32_import_lib_p ()
5502 {
5503 $opt_debug
5504 case `eval $file_magic_cmd \"\$1\" 2>/dev/null | $SED -e 10q` in
5505 *import*) : ;;
5506 *) false ;;
5507 esac
5508 }
5509
5510 # func_mode_link arg...
5511 func_mode_link ()
5512 {
5513 $opt_debug
5514 case $host in
5515 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*)
5516 # It is impossible to link a dll without this setting, and
5517 # we shouldn't force the makefile maintainer to figure out
5518 # which system we are compiling for in order to pass an extra
5519 # flag for every libtool invocation.
5520 # allow_undefined=no
5521
5522 # FIXME: Unfortunately, there are problems with the above when trying
5523 # to make a dll which has undefined symbols, in which case not
5524 # even a static library is built. For now, we need to specify
5525 # -no-undefined on the libtool link line when we can be certain
5526 # that all symbols are satisfied, otherwise we get a static library.
5527 allow_undefined=yes
5528 ;;
5529 *)
5530 allow_undefined=yes
5531 ;;
5532 esac
5533 libtool_args=$nonopt
5534 base_compile="$nonopt $@"
5535 compile_command=$nonopt
5536 finalize_command=$nonopt
5537
5538 compile_rpath=
5539 finalize_rpath=
5540 compile_shlibpath=
5541 finalize_shlibpath=
5542 convenience=
5543 old_convenience=
5544 deplibs=
5545 old_deplibs=
5546 compiler_flags=
5547 linker_flags=
5548 dllsearchpath=
5549 lib_search_path=`pwd`
5550 inst_prefix_dir=
5551 new_inherited_linker_flags=
5552
5553 avoid_version=no
5554 bindir=
5555 dlfiles=
5556 dlprefiles=
5557 dlself=no
5558 export_dynamic=no
5559 export_symbols=
5560 export_symbols_regex=
5561 generated=
5562 libobjs=
5563 ltlibs=
5564 module=no
5565 no_install=no
5566 objs=
5567 non_pic_objects=
5568 precious_files_regex=
5569 prefer_static_libs=no
5570 preload=no
5571 prev=
5572 prevarg=
5573 release=
5574 rpath=
5575 xrpath=
5576 perm_rpath=
5577 temp_rpath=
5578 thread_safe=no
5579 vinfo=
5580 vinfo_number=no
5581 weak_libs=
5582 single_module="${wl}-single_module"
5583 func_infer_tag $base_compile
5584
5585 # We need to know -static, to get the right output filenames.
5586 for arg
5587 do
5588 case $arg in
5589 -shared)
5590 test "$build_libtool_libs" != yes && \
5591 func_fatal_configuration "can not build a shared library"
5592 build_old_libs=no
5593 break
5594 ;;
5595 -all-static | -static | -static-libtool-libs)
5596 case $arg in
5597 -all-static)
5598 if test "$build_libtool_libs" = yes && test -z "$link_static_flag"; then
5599 func_warning "complete static linking is impossible in this configuration"
5600 fi
5601 if test -n "$link_static_flag"; then
5602 dlopen_self=$dlopen_self_static
5603 fi
5604 prefer_static_libs=yes
5605 ;;
5606 -static)
5607 if test -z "$pic_flag" && test -n "$link_static_flag"; then
5608 dlopen_self=$dlopen_self_static
5609 fi
5610 prefer_static_libs=built
5611 ;;
5612 -static-libtool-libs)
5613 if test -z "$pic_flag" && test -n "$link_static_flag"; then
5614 dlopen_self=$dlopen_self_static
5615 fi
5616 prefer_static_libs=yes
5617 ;;
5618 esac
5619 build_libtool_libs=no
5620 build_old_libs=yes
5621 break
5622 ;;
5623 esac
5624 done
5625
5626 # See if our shared archives depend on static archives.
5627 test -n "$old_archive_from_new_cmds" && build_old_libs=yes
5628
5629 # Go through the arguments, transforming them on the way.
5630 while test "$#" -gt 0; do
5631 arg="$1"
5632 shift
5633 func_quote_for_eval "$arg"
5634 qarg=$func_quote_for_eval_unquoted_result
5635 libtool_args+=" $func_quote_for_eval_result"
5636
5637 # If the previous option needs an argument, assign it.
5638 if test -n "$prev"; then
5639 case $prev in
5640 output)
5641 compile_command+=" @OUTPUT@"
5642 finalize_command+=" @OUTPUT@"
5643 ;;
5644 esac
5645
5646 case $prev in
5647 bindir)
5648 bindir="$arg"
5649 prev=
5650 continue
5651 ;;
5652 dlfiles|dlprefiles)
5653 if test "$preload" = no; then
5654 # Add the symbol object into the linking commands.
5655 compile_command+=" @SYMFILE@"
5656 finalize_command+=" @SYMFILE@"
5657 preload=yes
5658 fi
5659 case $arg in
5660 *.la | *.lo) ;; # We handle these cases below.
5661 force)
5662 if test "$dlself" = no; then
5663 dlself=needless
5664 export_dynamic=yes
5665 fi
5666 prev=
5667 continue
5668 ;;
5669 self)
5670 if test "$prev" = dlprefiles; then
5671 dlself=yes
5672 elif test "$prev" = dlfiles && test "$dlopen_self" != yes; then
5673 dlself=yes
5674 else
5675 dlself=needless
5676 export_dynamic=yes
5677 fi
5678 prev=
5679 continue
5680 ;;
5681 *)
5682 if test "$prev" = dlfiles; then
5683 dlfiles+=" $arg"
5684 else
5685 dlprefiles+=" $arg"
5686 fi
5687 prev=
5688 continue
5689 ;;
5690 esac
5691 ;;
5692 expsyms)
5693 export_symbols="$arg"
5694 test -f "$arg" \
5695 || func_fatal_error "symbol file \`$arg' does not exist"
5696 prev=
5697 continue
5698 ;;
5699 expsyms_regex)
5700 export_symbols_regex="$arg"
5701 prev=
5702 continue
5703 ;;
5704 framework)
5705 case $host in
5706 *-*-darwin*)
5707 case "$deplibs " in
5708 *" $qarg.ltframework "*) ;;
5709 *) deplibs+=" $qarg.ltframework" # this is fixed later
5710 ;;
5711 esac
5712 ;;
5713 esac
5714 prev=
5715 continue
5716 ;;
5717 inst_prefix)
5718 inst_prefix_dir="$arg"
5719 prev=
5720 continue
5721 ;;
5722 objectlist)
5723 if test -f "$arg"; then
5724 save_arg=$arg
5725 moreargs=
5726 for fil in `cat "$save_arg"`
5727 do
5728 # moreargs+=" $fil"
5729 arg=$fil
5730 # A libtool-controlled object.
5731
5732 # Check to see that this really is a libtool object.
5733 if func_lalib_unsafe_p "$arg"; then
5734 pic_object=
5735 non_pic_object=
5736
5737 # Read the .lo file
5738 func_source "$arg"
5739
5740 if test -z "$pic_object" ||
5741 test -z "$non_pic_object" ||
5742 test "$pic_object" = none &&
5743 test "$non_pic_object" = none; then
5744 func_fatal_error "cannot find name of object for \`$arg'"
5745 fi
5746
5747 # Extract subdirectory from the argument.
5748 func_dirname "$arg" "/" ""
5749 xdir="$func_dirname_result"
5750
5751 if test "$pic_object" != none; then
5752 # Prepend the subdirectory the object is found in.
5753 pic_object="$xdir$pic_object"
5754
5755 if test "$prev" = dlfiles; then
5756 if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then
5757 dlfiles+=" $pic_object"
5758 prev=
5759 continue
5760 else
5761 # If libtool objects are unsupported, then we need to preload.
5762 prev=dlprefiles
5763 fi
5764 fi
5765
5766 # CHECK ME: I think I busted this. -Ossama
5767 if test "$prev" = dlprefiles; then
5768 # Preload the old-style object.
5769 dlprefiles+=" $pic_object"
5770 prev=
5771 fi
5772
5773 # A PIC object.
5774 libobjs+=" $pic_object"
5775 arg="$pic_object"
5776 fi
5777
5778 # Non-PIC object.
5779 if test "$non_pic_object" != none; then
5780 # Prepend the subdirectory the object is found in.
5781 non_pic_object="$xdir$non_pic_object"
5782
5783 # A standard non-PIC object
5784 non_pic_objects+=" $non_pic_object"
5785 if test -z "$pic_object" || test "$pic_object" = none ; then
5786 arg="$non_pic_object"
5787 fi
5788 else
5789 # If the PIC object exists, use it instead.
5790 # $xdir was prepended to $pic_object above.
5791 non_pic_object="$pic_object"
5792 non_pic_objects+=" $non_pic_object"
5793 fi
5794 else
5795 # Only an error if not doing a dry-run.
5796 if $opt_dry_run; then
5797 # Extract subdirectory from the argument.
5798 func_dirname "$arg" "/" ""
5799 xdir="$func_dirname_result"
5800
5801 func_lo2o "$arg"
5802 pic_object=$xdir$objdir/$func_lo2o_result
5803 non_pic_object=$xdir$func_lo2o_result
5804 libobjs+=" $pic_object"
5805 non_pic_objects+=" $non_pic_object"
5806 else
5807 func_fatal_error "\`$arg' is not a valid libtool object"
5808 fi
5809 fi
5810 done
5811 else
5812 func_fatal_error "link input file \`$arg' does not exist"
5813 fi
5814 arg=$save_arg
5815 prev=
5816 continue
5817 ;;
5818 precious_regex)
5819 precious_files_regex="$arg"
5820 prev=
5821 continue
5822 ;;
5823 release)
5824 release="-$arg"
5825 prev=
5826 continue
5827 ;;
5828 rpath | xrpath)
5829 # We need an absolute path.
5830 case $arg in
5831 [\\/]* | [A-Za-z]:[\\/]*) ;;
5832 *)
5833 func_fatal_error "only absolute run-paths are allowed"
5834 ;;
5835 esac
5836 if test "$prev" = rpath; then
5837 case "$rpath " in
5838 *" $arg "*) ;;
5839 *) rpath+=" $arg" ;;
5840 esac
5841 else
5842 case "$xrpath " in
5843 *" $arg "*) ;;
5844 *) xrpath+=" $arg" ;;
5845 esac
5846 fi
5847 prev=
5848 continue
5849 ;;
5850 shrext)
5851 shrext_cmds="$arg"
5852 prev=
5853 continue
5854 ;;
5855 weak)
5856 weak_libs+=" $arg"
5857 prev=
5858 continue
5859 ;;
5860 xcclinker)
5861 linker_flags+=" $qarg"
5862 compiler_flags+=" $qarg"
5863 prev=
5864 compile_command+=" $qarg"
5865 finalize_command+=" $qarg"
5866 continue
5867 ;;
5868 xcompiler)
5869 compiler_flags+=" $qarg"
5870 prev=
5871 compile_command+=" $qarg"
5872 finalize_command+=" $qarg"
5873 continue
5874 ;;
5875 xlinker)
5876 linker_flags+=" $qarg"
5877 compiler_flags+=" $wl$qarg"
5878 prev=
5879 compile_command+=" $wl$qarg"
5880 finalize_command+=" $wl$qarg"
5881 continue
5882 ;;
5883 *)
5884 eval "$prev=\"\$arg\""
5885 prev=
5886 continue
5887 ;;
5888 esac
5889 fi # test -n "$prev"
5890
5891 prevarg="$arg"
5892
5893 case $arg in
5894 -all-static)
5895 if test -n "$link_static_flag"; then
5896 # See comment for -static flag below, for more details.
5897 compile_command+=" $link_static_flag"
5898 finalize_command+=" $link_static_flag"
5899 fi
5900 continue
5901 ;;
5902
5903 -allow-undefined)
5904 # FIXME: remove this flag sometime in the future.
5905 func_fatal_error "\`-allow-undefined' must not be used because it is the default"
5906 ;;
5907
5908 -avoid-version)
5909 avoid_version=yes
5910 continue
5911 ;;
5912
5913 -bindir)
5914 prev=bindir
5915 continue
5916 ;;
5917
5918 -dlopen)
5919 prev=dlfiles
5920 continue
5921 ;;
5922
5923 -dlpreopen)
5924 prev=dlprefiles
5925 continue
5926 ;;
5927
5928 -export-dynamic)
5929 export_dynamic=yes
5930 continue
5931 ;;
5932
5933 -export-symbols | -export-symbols-regex)
5934 if test -n "$export_symbols" || test -n "$export_symbols_regex"; then
5935 func_fatal_error "more than one -exported-symbols argument is not allowed"
5936 fi
5937 if test "X$arg" = "X-export-symbols"; then
5938 prev=expsyms
5939 else
5940 prev=expsyms_regex
5941 fi
5942 continue
5943 ;;
5944
5945 -framework)
5946 prev=framework
5947 continue
5948 ;;
5949
5950 -inst-prefix-dir)
5951 prev=inst_prefix
5952 continue
5953 ;;
5954
5955 # The native IRIX linker understands -LANG:*, -LIST:* and -LNO:*
5956 # so, if we see these flags be careful not to treat them like -L
5957 -L[A-Z][A-Z]*:*)
5958 case $with_gcc/$host in
5959 no/*-*-irix* | /*-*-irix*)
5960 compile_command+=" $arg"
5961 finalize_command+=" $arg"
5962 ;;
5963 esac
5964 continue
5965 ;;
5966
5967 -L*)
5968 func_stripname "-L" '' "$arg"
5969 if test -z "$func_stripname_result"; then
5970 if test "$#" -gt 0; then
5971 func_fatal_error "require no space between \`-L' and \`$1'"
5972 else
5973 func_fatal_error "need path for \`-L' option"
5974 fi
5975 fi
5976 func_resolve_sysroot "$func_stripname_result"
5977 dir=$func_resolve_sysroot_result
5978 # We need an absolute path.
5979 case $dir in
5980 [\\/]* | [A-Za-z]:[\\/]*) ;;
5981 *)
5982 absdir=`cd "$dir" && pwd`
5983 test -z "$absdir" && \
5984 func_fatal_error "cannot determine absolute directory name of \`$dir'"
5985 dir="$absdir"
5986 ;;
5987 esac
5988 case "$deplibs " in
5989 *" -L$dir "* | *" $arg "*)
5990 # Will only happen for absolute or sysroot arguments
5991 ;;
5992 *)
5993 # Preserve sysroot, but never include relative directories
5994 case $dir in
5995 [\\/]* | [A-Za-z]:[\\/]* | =*) deplibs+=" $arg" ;;
5996 *) deplibs+=" -L$dir" ;;
5997 esac
5998 lib_search_path+=" $dir"
5999 ;;
6000 esac
6001 case $host in
6002 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*)
6003 testbindir=`$ECHO "$dir" | $SED 's*/lib$*/bin*'`
6004 case :$dllsearchpath: in
6005 *":$dir:"*) ;;
6006 ::) dllsearchpath=$dir;;
6007 *) dllsearchpath+=":$dir";;
6008 esac
6009 case :$dllsearchpath: in
6010 *":$testbindir:"*) ;;
6011 ::) dllsearchpath=$testbindir;;
6012 *) dllsearchpath+=":$testbindir";;
6013 esac
6014 ;;
6015 esac
6016 continue
6017 ;;
6018
6019 -l*)
6020 if test "X$arg" = "X-lc" || test "X$arg" = "X-lm"; then
6021 case $host in
6022 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-beos* | *-cegcc* | *-*-haiku*)
6023 # These systems don't actually have a C or math library (as such)
6024 continue
6025 ;;
6026 *-*-os2*)
6027 # These systems don't actually have a C library (as such)
6028 test "X$arg" = "X-lc" && continue
6029 ;;
6030 *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
6031 # Do not include libc due to us having libc/libc_r.
6032 test "X$arg" = "X-lc" && continue
6033 ;;
6034 *-*-rhapsody* | *-*-darwin1.[012])
6035 # Rhapsody C and math libraries are in the System framework
6036 deplibs+=" System.ltframework"
6037 continue
6038 ;;
6039 *-*-sco3.2v5* | *-*-sco5v6*)
6040 # Causes problems with __ctype
6041 test "X$arg" = "X-lc" && continue
6042 ;;
6043 *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*)
6044 # Compiler inserts libc in the correct place for threads to work
6045 test "X$arg" = "X-lc" && continue
6046 ;;
6047 esac
6048 elif test "X$arg" = "X-lc_r"; then
6049 case $host in
6050 *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
6051 # Do not include libc_r directly, use -pthread flag.
6052 continue
6053 ;;
6054 esac
6055 fi
6056 deplibs+=" $arg"
6057 continue
6058 ;;
6059
6060 -module)
6061 module=yes
6062 continue
6063 ;;
6064
6065 # Tru64 UNIX uses -model [arg] to determine the layout of C++
6066 # classes, name mangling, and exception handling.
6067 # Darwin uses the -arch flag to determine output architecture.
6068 -model|-arch|-isysroot|--sysroot)
6069 compiler_flags+=" $arg"
6070 compile_command+=" $arg"
6071 finalize_command+=" $arg"
6072 prev=xcompiler
6073 continue
6074 ;;
6075
6076 -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe \
6077 |-threads|-fopenmp|-openmp|-mp|-xopenmp|-omp|-qsmp=*)
6078 compiler_flags+=" $arg"
6079 compile_command+=" $arg"
6080 finalize_command+=" $arg"
6081 case "$new_inherited_linker_flags " in
6082 *" $arg "*) ;;
6083 * ) new_inherited_linker_flags+=" $arg" ;;
6084 esac
6085 continue
6086 ;;
6087
6088 -multi_module)
6089 single_module="${wl}-multi_module"
6090 continue
6091 ;;
6092
6093 -no-fast-install)
6094 fast_install=no
6095 continue
6096 ;;
6097
6098 -no-install)
6099 case $host in
6100 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-darwin* | *-cegcc*)
6101 # The PATH hackery in wrapper scripts is required on Windows
6102 # and Darwin in order for the loader to find any dlls it needs.
6103 func_warning "\`-no-install' is ignored for $host"
6104 func_warning "assuming \`-no-fast-install' instead"
6105 fast_install=no
6106 ;;
6107 *) no_install=yes ;;
6108 esac
6109 continue
6110 ;;
6111
6112 -no-undefined)
6113 allow_undefined=no
6114 continue
6115 ;;
6116
6117 -objectlist)
6118 prev=objectlist
6119 continue
6120 ;;
6121
6122 -o) prev=output ;;
6123
6124 -precious-files-regex)
6125 prev=precious_regex
6126 continue
6127 ;;
6128
6129 -release)
6130 prev=release
6131 continue
6132 ;;
6133
6134 -rpath)
6135 prev=rpath
6136 continue
6137 ;;
6138
6139 -R)
6140 prev=xrpath
6141 continue
6142 ;;
6143
6144 -R*)
6145 func_stripname '-R' '' "$arg"
6146 dir=$func_stripname_result
6147 # We need an absolute path.
6148 case $dir in
6149 [\\/]* | [A-Za-z]:[\\/]*) ;;
6150 =*)
6151 func_stripname '=' '' "$dir"
6152 dir=$lt_sysroot$func_stripname_result
6153 ;;
6154 *)
6155 func_fatal_error "only absolute run-paths are allowed"
6156 ;;
6157 esac
6158 case "$xrpath " in
6159 *" $dir "*) ;;
6160 *) xrpath+=" $dir" ;;
6161 esac
6162 continue
6163 ;;
6164
6165 -shared)
6166 # The effects of -shared are defined in a previous loop.
6167 continue
6168 ;;
6169
6170 -shrext)
6171 prev=shrext
6172 continue
6173 ;;
6174
6175 -static | -static-libtool-libs)
6176 # The effects of -static are defined in a previous loop.
6177 # We used to do the same as -all-static on platforms that
6178 # didn't have a PIC flag, but the assumption that the effects
6179 # would be equivalent was wrong. It would break on at least
6180 # Digital Unix and AIX.
6181 continue
6182 ;;
6183
6184 -thread-safe)
6185 thread_safe=yes
6186 continue
6187 ;;
6188
6189 -version-info)
6190 prev=vinfo
6191 continue
6192 ;;
6193
6194 -version-number)
6195 prev=vinfo
6196 vinfo_number=yes
6197 continue
6198 ;;
6199
6200 -weak)
6201 prev=weak
6202 continue
6203 ;;
6204
6205 -Wc,*)
6206 func_stripname '-Wc,' '' "$arg"
6207 args=$func_stripname_result
6208 arg=
6209 save_ifs="$IFS"; IFS=','
6210 for flag in $args; do
6211 IFS="$save_ifs"
6212 func_quote_for_eval "$flag"
6213 arg+=" $func_quote_for_eval_result"
6214 compiler_flags+=" $func_quote_for_eval_result"
6215 done
6216 IFS="$save_ifs"
6217 func_stripname ' ' '' "$arg"
6218 arg=$func_stripname_result
6219 ;;
6220
6221 -Wl,*)
6222 func_stripname '-Wl,' '' "$arg"
6223 args=$func_stripname_result
6224 arg=
6225 save_ifs="$IFS"; IFS=','
6226 for flag in $args; do
6227 IFS="$save_ifs"
6228 func_quote_for_eval "$flag"
6229 arg+=" $wl$func_quote_for_eval_result"
6230 compiler_flags+=" $wl$func_quote_for_eval_result"
6231 linker_flags+=" $func_quote_for_eval_result"
6232 done
6233 IFS="$save_ifs"
6234 func_stripname ' ' '' "$arg"
6235 arg=$func_stripname_result
6236 ;;
6237
6238 -Xcompiler)
6239 prev=xcompiler
6240 continue
6241 ;;
6242
6243 -Xlinker)
6244 prev=xlinker
6245 continue
6246 ;;
6247
6248 -XCClinker)
6249 prev=xcclinker
6250 continue
6251 ;;
6252
6253 # -msg_* for osf cc
6254 -msg_*)
6255 func_quote_for_eval "$arg"
6256 arg="$func_quote_for_eval_result"
6257 ;;
6258
6259 # Flags to be passed through unchanged, with rationale:
6260 # -64, -mips[0-9] enable 64-bit mode for the SGI compiler
6261 # -r[0-9][0-9]* specify processor for the SGI compiler
6262 # -xarch=*, -xtarget=* enable 64-bit mode for the Sun compiler
6263 # +DA*, +DD* enable 64-bit mode for the HP compiler
6264 # -q* compiler args for the IBM compiler
6265 # -m*, -t[45]*, -txscale* architecture-specific flags for GCC
6266 # -F/path path to uninstalled frameworks, gcc on darwin
6267 # -p, -pg, --coverage, -fprofile-* profiling flags for GCC
6268 # @file GCC response files
6269 # -tp=* Portland pgcc target processor selection
6270 # --sysroot=* for sysroot support
6271 # -O*, -flto*, -fwhopr*, -fuse-linker-plugin GCC link-time optimization
6272 -64|-mips[0-9]|-r[0-9][0-9]*|-xarch=*|-xtarget=*|+DA*|+DD*|-q*|-m*| \
6273 -t[45]*|-txscale*|-p|-pg|--coverage|-fprofile-*|-F*|@*|-tp=*|--sysroot=*| \
6274 -O*|-flto*|-fwhopr*|-fuse-linker-plugin)
6275 func_quote_for_eval "$arg"
6276 arg="$func_quote_for_eval_result"
6277 compile_command+=" $arg"
6278 finalize_command+=" $arg"
6279 compiler_flags+=" $arg"
6280 continue
6281 ;;
6282
6283 # Some other compiler flag.
6284 -* | +*)
6285 func_quote_for_eval "$arg"
6286 arg="$func_quote_for_eval_result"
6287 ;;
6288
6289 *.$objext)
6290 # A standard object.
6291 objs+=" $arg"
6292 ;;
6293
6294 *.lo)
6295 # A libtool-controlled object.
6296
6297 # Check to see that this really is a libtool object.
6298 if func_lalib_unsafe_p "$arg"; then
6299 pic_object=
6300 non_pic_object=
6301
6302 # Read the .lo file
6303 func_source "$arg"
6304
6305 if test -z "$pic_object" ||
6306 test -z "$non_pic_object" ||
6307 test "$pic_object" = none &&
6308 test "$non_pic_object" = none; then
6309 func_fatal_error "cannot find name of object for \`$arg'"
6310 fi
6311
6312 # Extract subdirectory from the argument.
6313 func_dirname "$arg" "/" ""
6314 xdir="$func_dirname_result"
6315
6316 if test "$pic_object" != none; then
6317 # Prepend the subdirectory the object is found in.
6318 pic_object="$xdir$pic_object"
6319
6320 if test "$prev" = dlfiles; then
6321 if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then
6322 dlfiles+=" $pic_object"
6323 prev=
6324 continue
6325 else
6326 # If libtool objects are unsupported, then we need to preload.
6327 prev=dlprefiles
6328 fi
6329 fi
6330
6331 # CHECK ME: I think I busted this. -Ossama
6332 if test "$prev" = dlprefiles; then
6333 # Preload the old-style object.
6334 dlprefiles+=" $pic_object"
6335 prev=
6336 fi
6337
6338 # A PIC object.
6339 libobjs+=" $pic_object"
6340 arg="$pic_object"
6341 fi
6342
6343 # Non-PIC object.
6344 if test "$non_pic_object" != none; then
6345 # Prepend the subdirectory the object is found in.
6346 non_pic_object="$xdir$non_pic_object"
6347
6348 # A standard non-PIC object
6349 non_pic_objects+=" $non_pic_object"
6350 if test -z "$pic_object" || test "$pic_object" = none ; then
6351 arg="$non_pic_object"
6352 fi
6353 else
6354 # If the PIC object exists, use it instead.
6355 # $xdir was prepended to $pic_object above.
6356 non_pic_object="$pic_object"
6357 non_pic_objects+=" $non_pic_object"
6358 fi
6359 else
6360 # Only an error if not doing a dry-run.
6361 if $opt_dry_run; then
6362 # Extract subdirectory from the argument.
6363 func_dirname "$arg" "/" ""
6364 xdir="$func_dirname_result"
6365
6366 func_lo2o "$arg"
6367 pic_object=$xdir$objdir/$func_lo2o_result
6368 non_pic_object=$xdir$func_lo2o_result
6369 libobjs+=" $pic_object"
6370 non_pic_objects+=" $non_pic_object"
6371 else
6372 func_fatal_error "\`$arg' is not a valid libtool object"
6373 fi
6374 fi
6375 ;;
6376
6377 *.$libext)
6378 # An archive.
6379 deplibs+=" $arg"
6380 old_deplibs+=" $arg"
6381 continue
6382 ;;
6383
6384 *.la)
6385 # A libtool-controlled library.
6386
6387 func_resolve_sysroot "$arg"
6388 if test "$prev" = dlfiles; then
6389 # This library was specified with -dlopen.
6390 dlfiles+=" $func_resolve_sysroot_result"
6391 prev=
6392 elif test "$prev" = dlprefiles; then
6393 # The library was specified with -dlpreopen.
6394 dlprefiles+=" $func_resolve_sysroot_result"
6395 prev=
6396 else
6397 deplibs+=" $func_resolve_sysroot_result"
6398 fi
6399 continue
6400 ;;
6401
6402 # Some other compiler argument.
6403 *)
6404 # Unknown arguments in both finalize_command and compile_command need
6405 # to be aesthetically quoted because they are evaled later.
6406 func_quote_for_eval "$arg"
6407 arg="$func_quote_for_eval_result"
6408 ;;
6409 esac # arg
6410
6411 # Now actually substitute the argument into the commands.
6412 if test -n "$arg"; then
6413 compile_command+=" $arg"
6414 finalize_command+=" $arg"
6415 fi
6416 done # argument parsing loop
6417
6418 test -n "$prev" && \
6419 func_fatal_help "the \`$prevarg' option requires an argument"
6420
6421 if test "$export_dynamic" = yes && test -n "$export_dynamic_flag_spec"; then
6422 eval arg=\"$export_dynamic_flag_spec\"
6423 compile_command+=" $arg"
6424 finalize_command+=" $arg"
6425 fi
6426
6427 oldlibs=
6428 # calculate the name of the file, without its directory
6429 func_basename "$output"
6430 outputname="$func_basename_result"
6431 libobjs_save="$libobjs"
6432
6433 if test -n "$shlibpath_var"; then
6434 # get the directories listed in $shlibpath_var
6435 eval shlib_search_path=\`\$ECHO \"\${$shlibpath_var}\" \| \$SED \'s/:/ /g\'\`
6436 else
6437 shlib_search_path=
6438 fi
6439 eval sys_lib_search_path=\"$sys_lib_search_path_spec\"
6440 eval sys_lib_dlsearch_path=\"$sys_lib_dlsearch_path_spec\"
6441
6442 func_dirname "$output" "/" ""
6443 output_objdir="$func_dirname_result$objdir"
6444 func_to_tool_file "$output_objdir/"
6445 tool_output_objdir=$func_to_tool_file_result
6446 # Create the object directory.
6447 func_mkdir_p "$output_objdir"
6448
6449 # Determine the type of output
6450 case $output in
6451 "")
6452 func_fatal_help "you must specify an output file"
6453 ;;
6454 *.$libext) linkmode=oldlib ;;
6455 *.lo | *.$objext) linkmode=obj ;;
6456 *.la) linkmode=lib ;;
6457 *) linkmode=prog ;; # Anything else should be a program.
6458 esac
6459
6460 specialdeplibs=
6461
6462 libs=
6463 # Find all interdependent deplibs by searching for libraries
6464 # that are linked more than once (e.g. -la -lb -la)
6465 for deplib in $deplibs; do
6466 if $opt_preserve_dup_deps ; then
6467 case "$libs " in
6468 *" $deplib "*) specialdeplibs+=" $deplib" ;;
6469 esac
6470 fi
6471 libs+=" $deplib"
6472 done
6473
6474 if test "$linkmode" = lib; then
6475 libs="$predeps $libs $compiler_lib_search_path $postdeps"
6476
6477 # Compute libraries that are listed more than once in $predeps
6478 # $postdeps and mark them as special (i.e., whose duplicates are
6479 # not to be eliminated).
6480 pre_post_deps=
6481 if $opt_duplicate_compiler_generated_deps; then
6482 for pre_post_dep in $predeps $postdeps; do
6483 case "$pre_post_deps " in
6484 *" $pre_post_dep "*) specialdeplibs+=" $pre_post_deps" ;;
6485 esac
6486 pre_post_deps+=" $pre_post_dep"
6487 done
6488 fi
6489 pre_post_deps=
6490 fi
6491
6492 deplibs=
6493 newdependency_libs=
6494 newlib_search_path=
6495 need_relink=no # whether we're linking any uninstalled libtool libraries
6496 notinst_deplibs= # not-installed libtool libraries
6497 notinst_path= # paths that contain not-installed libtool libraries
6498
6499 case $linkmode in
6500 lib)
6501 passes="conv dlpreopen link"
6502 for file in $dlfiles $dlprefiles; do
6503 case $file in
6504 *.la) ;;
6505 *)
6506 func_fatal_help "libraries can \`-dlopen' only libtool libraries: $file"
6507 ;;
6508 esac
6509 done
6510 ;;
6511 prog)
6512 compile_deplibs=
6513 finalize_deplibs=
6514 alldeplibs=no
6515 newdlfiles=
6516 newdlprefiles=
6517 passes="conv scan dlopen dlpreopen link"
6518 ;;
6519 *) passes="conv"
6520 ;;
6521 esac
6522
6523 for pass in $passes; do
6524 # The preopen pass in lib mode reverses $deplibs; put it back here
6525 # so that -L comes before libs that need it for instance...
6526 if test "$linkmode,$pass" = "lib,link"; then
6527 ## FIXME: Find the place where the list is rebuilt in the wrong
6528 ## order, and fix it there properly
6529 tmp_deplibs=
6530 for deplib in $deplibs; do
6531 tmp_deplibs="$deplib $tmp_deplibs"
6532 done
6533 deplibs="$tmp_deplibs"
6534 fi
6535
6536 if test "$linkmode,$pass" = "lib,link" ||
6537 test "$linkmode,$pass" = "prog,scan"; then
6538 libs="$deplibs"
6539 deplibs=
6540 fi
6541 if test "$linkmode" = prog; then
6542 case $pass in
6543 dlopen) libs="$dlfiles" ;;
6544 dlpreopen) libs="$dlprefiles" ;;
6545 link) libs="$deplibs %DEPLIBS% $dependency_libs" ;;
6546 esac
6547 fi
6548 if test "$linkmode,$pass" = "lib,dlpreopen"; then
6549 # Collect and forward deplibs of preopened libtool libs
6550 for lib in $dlprefiles; do
6551 # Ignore non-libtool-libs
6552 dependency_libs=
6553 func_resolve_sysroot "$lib"
6554 case $lib in
6555 *.la) func_source "$func_resolve_sysroot_result" ;;
6556 esac
6557
6558 # Collect preopened libtool deplibs, except any this library
6559 # has declared as weak libs
6560 for deplib in $dependency_libs; do
6561 func_basename "$deplib"
6562 deplib_base=$func_basename_result
6563 case " $weak_libs " in
6564 *" $deplib_base "*) ;;
6565 *) deplibs+=" $deplib" ;;
6566 esac
6567 done
6568 done
6569 libs="$dlprefiles"
6570 fi
6571 if test "$pass" = dlopen; then
6572 # Collect dlpreopened libraries
6573 save_deplibs="$deplibs"
6574 deplibs=
6575 fi
6576
6577 for deplib in $libs; do
6578 lib=
6579 found=no
6580 case $deplib in
6581 -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe \
6582 |-threads|-fopenmp|-openmp|-mp|-xopenmp|-omp|-qsmp=*)
6583 if test "$linkmode,$pass" = "prog,link"; then
6584 compile_deplibs="$deplib $compile_deplibs"
6585 finalize_deplibs="$deplib $finalize_deplibs"
6586 else
6587 compiler_flags+=" $deplib"
6588 if test "$linkmode" = lib ; then
6589 case "$new_inherited_linker_flags " in
6590 *" $deplib "*) ;;
6591 * ) new_inherited_linker_flags+=" $deplib" ;;
6592 esac
6593 fi
6594 fi
6595 continue
6596 ;;
6597 -l*)
6598 if test "$linkmode" != lib && test "$linkmode" != prog; then
6599 func_warning "\`-l' is ignored for archives/objects"
6600 continue
6601 fi
6602 func_stripname '-l' '' "$deplib"
6603 name=$func_stripname_result
6604 if test "$linkmode" = lib; then
6605 searchdirs="$newlib_search_path $lib_search_path $compiler_lib_search_dirs $sys_lib_search_path $shlib_search_path"
6606 else
6607 searchdirs="$newlib_search_path $lib_search_path $sys_lib_search_path $shlib_search_path"
6608 fi
6609 for searchdir in $searchdirs; do
6610 for search_ext in .la $std_shrext .so .a; do
6611 # Search the libtool library
6612 lib="$searchdir/lib${name}${search_ext}"
6613 if test -f "$lib"; then
6614 if test "$search_ext" = ".la"; then
6615 found=yes
6616 else
6617 found=no
6618 fi
6619 break 2
6620 fi
6621 done
6622 done
6623 if test "$found" != yes; then
6624 # deplib doesn't seem to be a libtool library
6625 if test "$linkmode,$pass" = "prog,link"; then
6626 compile_deplibs="$deplib $compile_deplibs"
6627 finalize_deplibs="$deplib $finalize_deplibs"
6628 else
6629 deplibs="$deplib $deplibs"
6630 test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs"
6631 fi
6632 continue
6633 else # deplib is a libtool library
6634 # If $allow_libtool_libs_with_static_runtimes && $deplib is a stdlib,
6635 # We need to do some special things here, and not later.
6636 if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
6637 case " $predeps $postdeps " in
6638 *" $deplib "*)
6639 if func_lalib_p "$lib"; then
6640 library_names=
6641 old_library=
6642 func_source "$lib"
6643 for l in $old_library $library_names; do
6644 ll="$l"
6645 done
6646 if test "X$ll" = "X$old_library" ; then # only static version available
6647 found=no
6648 func_dirname "$lib" "" "."
6649 ladir="$func_dirname_result"
6650 lib=$ladir/$old_library
6651 if test "$linkmode,$pass" = "prog,link"; then
6652 compile_deplibs="$deplib $compile_deplibs"
6653 finalize_deplibs="$deplib $finalize_deplibs"
6654 else
6655 deplibs="$deplib $deplibs"
6656 test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs"
6657 fi
6658 continue
6659 fi
6660 fi
6661 ;;
6662 *) ;;
6663 esac
6664 fi
6665 fi
6666 ;; # -l
6667 *.ltframework)
6668 if test "$linkmode,$pass" = "prog,link"; then
6669 compile_deplibs="$deplib $compile_deplibs"
6670 finalize_deplibs="$deplib $finalize_deplibs"
6671 else
6672 deplibs="$deplib $deplibs"
6673 if test "$linkmode" = lib ; then
6674 case "$new_inherited_linker_flags " in
6675 *" $deplib "*) ;;
6676 * ) new_inherited_linker_flags+=" $deplib" ;;
6677 esac
6678 fi
6679 fi
6680 continue
6681 ;;
6682 -L*)
6683 case $linkmode in
6684 lib)
6685 deplibs="$deplib $deplibs"
6686 test "$pass" = conv && continue
6687 newdependency_libs="$deplib $newdependency_libs"
6688 func_stripname '-L' '' "$deplib"
6689 func_resolve_sysroot "$func_stripname_result"
6690 newlib_search_path+=" $func_resolve_sysroot_result"
6691 ;;
6692 prog)
6693 if test "$pass" = conv; then
6694 deplibs="$deplib $deplibs"
6695 continue
6696 fi
6697 if test "$pass" = scan; then
6698 deplibs="$deplib $deplibs"
6699 else
6700 compile_deplibs="$deplib $compile_deplibs"
6701 finalize_deplibs="$deplib $finalize_deplibs"
6702 fi
6703 func_stripname '-L' '' "$deplib"
6704 func_resolve_sysroot "$func_stripname_result"
6705 newlib_search_path+=" $func_resolve_sysroot_result"
6706 ;;
6707 *)
6708 func_warning "\`-L' is ignored for archives/objects"
6709 ;;
6710 esac # linkmode
6711 continue
6712 ;; # -L
6713 -R*)
6714 if test "$pass" = link; then
6715 func_stripname '-R' '' "$deplib"
6716 func_resolve_sysroot "$func_stripname_result"
6717 dir=$func_resolve_sysroot_result
6718 # Make sure the xrpath contains only unique directories.
6719 case "$xrpath " in
6720 *" $dir "*) ;;
6721 *) xrpath+=" $dir" ;;
6722 esac
6723 fi
6724 deplibs="$deplib $deplibs"
6725 continue
6726 ;;
6727 *.la)
6728 func_resolve_sysroot "$deplib"
6729 lib=$func_resolve_sysroot_result
6730 ;;
6731 *.$libext)
6732 if test "$pass" = conv; then
6733 deplibs="$deplib $deplibs"
6734 continue
6735 fi
6736 case $linkmode in
6737 lib)
6738 # Linking convenience modules into shared libraries is allowed,
6739 # but linking other static libraries is non-portable.
6740 case " $dlpreconveniencelibs " in
6741 *" $deplib "*) ;;
6742 *)
6743 valid_a_lib=no
6744 case $deplibs_check_method in
6745 match_pattern*)
6746 set dummy $deplibs_check_method; shift
6747 match_pattern_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"`
6748 if eval "\$ECHO \"$deplib\"" 2>/dev/null | $SED 10q \
6749 | $EGREP "$match_pattern_regex" > /dev/null; then
6750 valid_a_lib=yes
6751 fi
6752 ;;
6753 pass_all)
6754 valid_a_lib=yes
6755 ;;
6756 esac
6757 if test "$valid_a_lib" != yes; then
6758 echo
6759 $ECHO "*** Warning: Trying to link with static lib archive $deplib."
6760 echo "*** I have the capability to make that library automatically link in when"
6761 echo "*** you link to this library. But I can only do this if you have a"
6762 echo "*** shared version of the library, which you do not appear to have"
6763 echo "*** because the file extensions .$libext of this argument makes me believe"
6764 echo "*** that it is just a static archive that I should not use here."
6765 else
6766 echo
6767 $ECHO "*** Warning: Linking the shared library $output against the"
6768 $ECHO "*** static library $deplib is not portable!"
6769 deplibs="$deplib $deplibs"
6770 fi
6771 ;;
6772 esac
6773 continue
6774 ;;
6775 prog)
6776 if test "$pass" != link; then
6777 deplibs="$deplib $deplibs"
6778 else
6779 compile_deplibs="$deplib $compile_deplibs"
6780 finalize_deplibs="$deplib $finalize_deplibs"
6781 fi
6782 continue
6783 ;;
6784 esac # linkmode
6785 ;; # *.$libext
6786 *.lo | *.$objext)
6787 if test "$pass" = conv; then
6788 deplibs="$deplib $deplibs"
6789 elif test "$linkmode" = prog; then
6790 if test "$pass" = dlpreopen || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then
6791 # If there is no dlopen support or we're linking statically,
6792 # we need to preload.
6793 newdlprefiles+=" $deplib"
6794 compile_deplibs="$deplib $compile_deplibs"
6795 finalize_deplibs="$deplib $finalize_deplibs"
6796 else
6797 newdlfiles+=" $deplib"
6798 fi
6799 fi
6800 continue
6801 ;;
6802 %DEPLIBS%)
6803 alldeplibs=yes
6804 continue
6805 ;;
6806 esac # case $deplib
6807
6808 if test "$found" = yes || test -f "$lib"; then :
6809 else
6810 func_fatal_error "cannot find the library \`$lib' or unhandled argument \`$deplib'"
6811 fi
6812
6813 # Check to see that this really is a libtool archive.
6814 func_lalib_unsafe_p "$lib" \
6815 || func_fatal_error "\`$lib' is not a valid libtool archive"
6816
6817 func_dirname "$lib" "" "."
6818 ladir="$func_dirname_result"
6819
6820 dlname=
6821 dlopen=
6822 dlpreopen=
6823 libdir=
6824 library_names=
6825 old_library=
6826 inherited_linker_flags=
6827 # If the library was installed with an old release of libtool,
6828 # it will not redefine variables installed, or shouldnotlink
6829 installed=yes
6830 shouldnotlink=no
6831 avoidtemprpath=
6832
6833
6834 # Read the .la file
6835 func_source "$lib"
6836
6837 # Convert "-framework foo" to "foo.ltframework"
6838 if test -n "$inherited_linker_flags"; then
6839 tmp_inherited_linker_flags=`$ECHO "$inherited_linker_flags" | $SED 's/-framework \([^ $]*\)/\1.ltframework/g'`
6840 for tmp_inherited_linker_flag in $tmp_inherited_linker_flags; do
6841 case " $new_inherited_linker_flags " in
6842 *" $tmp_inherited_linker_flag "*) ;;
6843 *) new_inherited_linker_flags+=" $tmp_inherited_linker_flag";;
6844 esac
6845 done
6846 fi
6847 dependency_libs=`$ECHO " $dependency_libs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
6848 if test "$linkmode,$pass" = "lib,link" ||
6849 test "$linkmode,$pass" = "prog,scan" ||
6850 { test "$linkmode" != prog && test "$linkmode" != lib; }; then
6851 test -n "$dlopen" && dlfiles+=" $dlopen"
6852 test -n "$dlpreopen" && dlprefiles+=" $dlpreopen"
6853 fi
6854
6855 if test "$pass" = conv; then
6856 # Only check for convenience libraries
6857 deplibs="$lib $deplibs"
6858 if test -z "$libdir"; then
6859 if test -z "$old_library"; then
6860 func_fatal_error "cannot find name of link library for \`$lib'"
6861 fi
6862 # It is a libtool convenience library, so add in its objects.
6863 convenience+=" $ladir/$objdir/$old_library"
6864 old_convenience+=" $ladir/$objdir/$old_library"
6865 elif test "$linkmode" != prog && test "$linkmode" != lib; then
6866 func_fatal_error "\`$lib' is not a convenience library"
6867 fi
6868 tmp_libs=
6869 for deplib in $dependency_libs; do
6870 deplibs="$deplib $deplibs"
6871 if $opt_preserve_dup_deps ; then
6872 case "$tmp_libs " in
6873 *" $deplib "*) specialdeplibs+=" $deplib" ;;
6874 esac
6875 fi
6876 tmp_libs+=" $deplib"
6877 done
6878 continue
6879 fi # $pass = conv
6880
6881
6882 # Get the name of the library we link against.
6883 linklib=
6884 if test -n "$old_library" &&
6885 { test "$prefer_static_libs" = yes ||
6886 test "$prefer_static_libs,$installed" = "built,no"; }; then
6887 linklib=$old_library
6888 else
6889 for l in $old_library $library_names; do
6890 linklib="$l"
6891 done
6892 fi
6893 if test -z "$linklib"; then
6894 func_fatal_error "cannot find name of link library for \`$lib'"
6895 fi
6896
6897 # This library was specified with -dlopen.
6898 if test "$pass" = dlopen; then
6899 if test -z "$libdir"; then
6900 func_fatal_error "cannot -dlopen a convenience library: \`$lib'"
6901 fi
6902 if test -z "$dlname" ||
6903 test "$dlopen_support" != yes ||
6904 test "$build_libtool_libs" = no; then
6905 # If there is no dlname, no dlopen support or we're linking
6906 # statically, we need to preload. We also need to preload any
6907 # dependent libraries so libltdl's deplib preloader doesn't
6908 # bomb out in the load deplibs phase.
6909 dlprefiles+=" $lib $dependency_libs"
6910 else
6911 newdlfiles+=" $lib"
6912 fi
6913 continue
6914 fi # $pass = dlopen
6915
6916 # We need an absolute path.
6917 case $ladir in
6918 [\\/]* | [A-Za-z]:[\\/]*) abs_ladir="$ladir" ;;
6919 *)
6920 abs_ladir=`cd "$ladir" && pwd`
6921 if test -z "$abs_ladir"; then
6922 func_warning "cannot determine absolute directory name of \`$ladir'"
6923 func_warning "passing it literally to the linker, although it might fail"
6924 abs_ladir="$ladir"
6925 fi
6926 ;;
6927 esac
6928 func_basename "$lib"
6929 laname="$func_basename_result"
6930
6931 # Find the relevant object directory and library name.
6932 if test "X$installed" = Xyes; then
6933 if test ! -f "$lt_sysroot$libdir/$linklib" && test -f "$abs_ladir/$linklib"; then
6934 func_warning "library \`$lib' was moved."
6935 dir="$ladir"
6936 absdir="$abs_ladir"
6937 libdir="$abs_ladir"
6938 else
6939 dir="$lt_sysroot$libdir"
6940 absdir="$lt_sysroot$libdir"
6941 fi
6942 test "X$hardcode_automatic" = Xyes && avoidtemprpath=yes
6943 else
6944 if test ! -f "$ladir/$objdir/$linklib" && test -f "$abs_ladir/$linklib"; then
6945 dir="$ladir"
6946 absdir="$abs_ladir"
6947 # Remove this search path later
6948 notinst_path+=" $abs_ladir"
6949 else
6950 dir="$ladir/$objdir"
6951 absdir="$abs_ladir/$objdir"
6952 # Remove this search path later
6953 notinst_path+=" $abs_ladir"
6954 fi
6955 fi # $installed = yes
6956 func_stripname 'lib' '.la' "$laname"
6957 name=$func_stripname_result
6958
6959 # This library was specified with -dlpreopen.
6960 if test "$pass" = dlpreopen; then
6961 if test -z "$libdir" && test "$linkmode" = prog; then
6962 func_fatal_error "only libraries may -dlpreopen a convenience library: \`$lib'"
6963 fi
6964 case "$host" in
6965 # special handling for platforms with PE-DLLs.
6966 *cygwin* | *mingw* | *cegcc* )
6967 # Linker will automatically link against shared library if both
6968 # static and shared are present. Therefore, ensure we extract
6969 # symbols from the import library if a shared library is present
6970 # (otherwise, the dlopen module name will be incorrect). We do
6971 # this by putting the import library name into $newdlprefiles.
6972 # We recover the dlopen module name by 'saving' the la file
6973 # name in a special purpose variable, and (later) extracting the
6974 # dlname from the la file.
6975 if test -n "$dlname"; then
6976 func_tr_sh "$dir/$linklib"
6977 eval "libfile_$func_tr_sh_result=\$abs_ladir/\$laname"
6978 newdlprefiles+=" $dir/$linklib"
6979 else
6980 newdlprefiles+=" $dir/$old_library"
6981 # Keep a list of preopened convenience libraries to check
6982 # that they are being used correctly in the link pass.
6983 test -z "$libdir" && \
6984 dlpreconveniencelibs+=" $dir/$old_library"
6985 fi
6986 ;;
6987 * )
6988 # Prefer using a static library (so that no silly _DYNAMIC symbols
6989 # are required to link).
6990 if test -n "$old_library"; then
6991 newdlprefiles+=" $dir/$old_library"
6992 # Keep a list of preopened convenience libraries to check
6993 # that they are being used correctly in the link pass.
6994 test -z "$libdir" && \
6995 dlpreconveniencelibs+=" $dir/$old_library"
6996 # Otherwise, use the dlname, so that lt_dlopen finds it.
6997 elif test -n "$dlname"; then
6998 newdlprefiles+=" $dir/$dlname"
6999 else
7000 newdlprefiles+=" $dir/$linklib"
7001 fi
7002 ;;
7003 esac
7004 fi # $pass = dlpreopen
7005
7006 if test -z "$libdir"; then
7007 # Link the convenience library
7008 if test "$linkmode" = lib; then
7009 deplibs="$dir/$old_library $deplibs"
7010 elif test "$linkmode,$pass" = "prog,link"; then
7011 compile_deplibs="$dir/$old_library $compile_deplibs"
7012 finalize_deplibs="$dir/$old_library $finalize_deplibs"
7013 else
7014 deplibs="$lib $deplibs" # used for prog,scan pass
7015 fi
7016 continue
7017 fi
7018
7019
7020 if test "$linkmode" = prog && test "$pass" != link; then
7021 newlib_search_path+=" $ladir"
7022 deplibs="$lib $deplibs"
7023
7024 linkalldeplibs=no
7025 if test "$link_all_deplibs" != no || test -z "$library_names" ||
7026 test "$build_libtool_libs" = no; then
7027 linkalldeplibs=yes
7028 fi
7029
7030 tmp_libs=
7031 for deplib in $dependency_libs; do
7032 case $deplib in
7033 -L*) func_stripname '-L' '' "$deplib"
7034 func_resolve_sysroot "$func_stripname_result"
7035 newlib_search_path+=" $func_resolve_sysroot_result"
7036 ;;
7037 esac
7038 # Need to link against all dependency_libs?
7039 if test "$linkalldeplibs" = yes; then
7040 deplibs="$deplib $deplibs"
7041 else
7042 # Need to hardcode shared library paths
7043 # or/and link against static libraries
7044 newdependency_libs="$deplib $newdependency_libs"
7045 fi
7046 if $opt_preserve_dup_deps ; then
7047 case "$tmp_libs " in
7048 *" $deplib "*) specialdeplibs+=" $deplib" ;;
7049 esac
7050 fi
7051 tmp_libs+=" $deplib"
7052 done # for deplib
7053 continue
7054 fi # $linkmode = prog...
7055
7056 if test "$linkmode,$pass" = "prog,link"; then
7057 if test -n "$library_names" &&
7058 { { test "$prefer_static_libs" = no ||
7059 test "$prefer_static_libs,$installed" = "built,yes"; } ||
7060 test -z "$old_library"; }; then
7061 # We need to hardcode the library path
7062 if test -n "$shlibpath_var" && test -z "$avoidtemprpath" ; then
7063 # Make sure the rpath contains only unique directories.
7064 case "$temp_rpath:" in
7065 *"$absdir:"*) ;;
7066 *) temp_rpath+="$absdir:" ;;
7067 esac
7068 fi
7069
7070 # Hardcode the library path.
7071 # Skip directories that are in the system default run-time
7072 # search path.
7073 case " $sys_lib_dlsearch_path " in
7074 *" $absdir "*) ;;
7075 *)
7076 case "$compile_rpath " in
7077 *" $absdir "*) ;;
7078 *) compile_rpath+=" $absdir" ;;
7079 esac
7080 ;;
7081 esac
7082 case " $sys_lib_dlsearch_path " in
7083 *" $libdir "*) ;;
7084 *)
7085 case "$finalize_rpath " in
7086 *" $libdir "*) ;;
7087 *) finalize_rpath+=" $libdir" ;;
7088 esac
7089 ;;
7090 esac
7091 fi # $linkmode,$pass = prog,link...
7092
7093 if test "$alldeplibs" = yes &&
7094 { test "$deplibs_check_method" = pass_all ||
7095 { test "$build_libtool_libs" = yes &&
7096 test -n "$library_names"; }; }; then
7097 # We only need to search for static libraries
7098 continue
7099 fi
7100 fi
7101
7102 link_static=no # Whether the deplib will be linked statically
7103 use_static_libs=$prefer_static_libs
7104 if test "$use_static_libs" = built && test "$installed" = yes; then
7105 use_static_libs=no
7106 fi
7107 if test -n "$library_names" &&
7108 { test "$use_static_libs" = no || test -z "$old_library"; }; then
7109 case $host in
7110 *cygwin* | *mingw* | *cegcc*)
7111 # No point in relinking DLLs because paths are not encoded
7112 notinst_deplibs+=" $lib"
7113 need_relink=no
7114 ;;
7115 *)
7116 if test "$installed" = no; then
7117 notinst_deplibs+=" $lib"
7118 need_relink=yes
7119 fi
7120 ;;
7121 esac
7122 # This is a shared library
7123
7124 # Warn about portability, can't link against -module's on some
7125 # systems (darwin). Don't bleat about dlopened modules though!
7126 dlopenmodule=""
7127 for dlpremoduletest in $dlprefiles; do
7128 if test "X$dlpremoduletest" = "X$lib"; then
7129 dlopenmodule="$dlpremoduletest"
7130 break
7131 fi
7132 done
7133 if test -z "$dlopenmodule" && test "$shouldnotlink" = yes && test "$pass" = link; then
7134 echo
7135 if test "$linkmode" = prog; then
7136 $ECHO "*** Warning: Linking the executable $output against the loadable module"
7137 else
7138 $ECHO "*** Warning: Linking the shared library $output against the loadable module"
7139 fi
7140 $ECHO "*** $linklib is not portable!"
7141 fi
7142 if test "$linkmode" = lib &&
7143 test "$hardcode_into_libs" = yes; then
7144 # Hardcode the library path.
7145 # Skip directories that are in the system default run-time
7146 # search path.
7147 case " $sys_lib_dlsearch_path " in
7148 *" $absdir "*) ;;
7149 *)
7150 case "$compile_rpath " in
7151 *" $absdir "*) ;;
7152 *) compile_rpath+=" $absdir" ;;
7153 esac
7154 ;;
7155 esac
7156 case " $sys_lib_dlsearch_path " in
7157 *" $libdir "*) ;;
7158 *)
7159 case "$finalize_rpath " in
7160 *" $libdir "*) ;;
7161 *) finalize_rpath+=" $libdir" ;;
7162 esac
7163 ;;
7164 esac
7165 fi
7166
7167 if test -n "$old_archive_from_expsyms_cmds"; then
7168 # figure out the soname
7169 set dummy $library_names
7170 shift
7171 realname="$1"
7172 shift
7173 libname=`eval "\\$ECHO \"$libname_spec\""`
7174 # use dlname if we got it. it's perfectly good, no?
7175 if test -n "$dlname"; then
7176 soname="$dlname"
7177 elif test -n "$soname_spec"; then
7178 # bleh windows
7179 case $host in
7180 *cygwin* | mingw* | *cegcc*)
7181 func_arith $current - $age
7182 major=$func_arith_result
7183 versuffix="-$major"
7184 ;;
7185 esac
7186 eval soname=\"$soname_spec\"
7187 else
7188 soname="$realname"
7189 fi
7190
7191 # Make a new name for the extract_expsyms_cmds to use
7192 soroot="$soname"
7193 func_basename "$soroot"
7194 soname="$func_basename_result"
7195 func_stripname 'lib' '.dll' "$soname"
7196 newlib=libimp-$func_stripname_result.a
7197
7198 # If the library has no export list, then create one now
7199 if test -f "$output_objdir/$soname-def"; then :
7200 else
7201 func_verbose "extracting exported symbol list from \`$soname'"
7202 func_execute_cmds "$extract_expsyms_cmds" 'exit $?'
7203 fi
7204
7205 # Create $newlib
7206 if test -f "$output_objdir/$newlib"; then :; else
7207 func_verbose "generating import library for \`$soname'"
7208 func_execute_cmds "$old_archive_from_expsyms_cmds" 'exit $?'
7209 fi
7210 # make sure the library variables are pointing to the new library
7211 dir=$output_objdir
7212 linklib=$newlib
7213 fi # test -n "$old_archive_from_expsyms_cmds"
7214
7215 if test "$linkmode" = prog || test "$opt_mode" != relink; then
7216 add_shlibpath=
7217 add_dir=
7218 add=
7219 lib_linked=yes
7220 case $hardcode_action in
7221 immediate | unsupported)
7222 if test "$hardcode_direct" = no; then
7223 add="$dir/$linklib"
7224 case $host in
7225 *-*-sco3.2v5.0.[024]*) add_dir="-L$dir" ;;
7226 *-*-sysv4*uw2*) add_dir="-L$dir" ;;
7227 *-*-sysv5OpenUNIX* | *-*-sysv5UnixWare7.[01].[10]* | \
7228 *-*-unixware7*) add_dir="-L$dir" ;;
7229 *-*-darwin* )
7230 # if the lib is a (non-dlopened) module then we can not
7231 # link against it, someone is ignoring the earlier warnings
7232 if /usr/bin/file -L $add 2> /dev/null |
7233 $GREP ": [^:]* bundle" >/dev/null ; then
7234 if test "X$dlopenmodule" != "X$lib"; then
7235 $ECHO "*** Warning: lib $linklib is a module, not a shared library"
7236 if test -z "$old_library" ; then
7237 echo
7238 echo "*** And there doesn't seem to be a static archive available"
7239 echo "*** The link will probably fail, sorry"
7240 else
7241 add="$dir/$old_library"
7242 fi
7243 elif test -n "$old_library"; then
7244 add="$dir/$old_library"
7245 fi
7246 fi
7247 esac
7248 elif test "$hardcode_minus_L" = no; then
7249 case $host in
7250 *-*-sunos*) add_shlibpath="$dir" ;;
7251 esac
7252 add_dir="-L$dir"
7253 add="-l$name"
7254 elif test "$hardcode_shlibpath_var" = no; then
7255 add_shlibpath="$dir"
7256 add="-l$name"
7257 else
7258 lib_linked=no
7259 fi
7260 ;;
7261 relink)
7262 if test "$hardcode_direct" = yes &&
7263 test "$hardcode_direct_absolute" = no; then
7264 add="$dir/$linklib"
7265 elif test "$hardcode_minus_L" = yes; then
7266 add_dir="-L$absdir"
7267 # Try looking first in the location we're being installed to.
7268 if test -n "$inst_prefix_dir"; then
7269 case $libdir in
7270 [\\/]*)
7271 add_dir+=" -L$inst_prefix_dir$libdir"
7272 ;;
7273 esac
7274 fi
7275 add="-l$name"
7276 elif test "$hardcode_shlibpath_var" = yes; then
7277 add_shlibpath="$dir"
7278 add="-l$name"
7279 else
7280 lib_linked=no
7281 fi
7282 ;;
7283 *) lib_linked=no ;;
7284 esac
7285
7286 if test "$lib_linked" != yes; then
7287 func_fatal_configuration "unsupported hardcode properties"
7288 fi
7289
7290 if test -n "$add_shlibpath"; then
7291 case :$compile_shlibpath: in
7292 *":$add_shlibpath:"*) ;;
7293 *) compile_shlibpath+="$add_shlibpath:" ;;
7294 esac
7295 fi
7296 if test "$linkmode" = prog; then
7297 test -n "$add_dir" && compile_deplibs="$add_dir $compile_deplibs"
7298 test -n "$add" && compile_deplibs="$add $compile_deplibs"
7299 else
7300 test -n "$add_dir" && deplibs="$add_dir $deplibs"
7301 test -n "$add" && deplibs="$add $deplibs"
7302 if test "$hardcode_direct" != yes &&
7303 test "$hardcode_minus_L" != yes &&
7304 test "$hardcode_shlibpath_var" = yes; then
7305 case :$finalize_shlibpath: in
7306 *":$libdir:"*) ;;
7307 *) finalize_shlibpath+="$libdir:" ;;
7308 esac
7309 fi
7310 fi
7311 fi
7312
7313 if test "$linkmode" = prog || test "$opt_mode" = relink; then
7314 add_shlibpath=
7315 add_dir=
7316 add=
7317 # Finalize command for both is simple: just hardcode it.
7318 if test "$hardcode_direct" = yes &&
7319 test "$hardcode_direct_absolute" = no; then
7320 add="$libdir/$linklib"
7321 elif test "$hardcode_minus_L" = yes; then
7322 add_dir="-L$libdir"
7323 add="-l$name"
7324 elif test "$hardcode_shlibpath_var" = yes; then
7325 case :$finalize_shlibpath: in
7326 *":$libdir:"*) ;;
7327 *) finalize_shlibpath+="$libdir:" ;;
7328 esac
7329 add="-l$name"
7330 elif test "$hardcode_automatic" = yes; then
7331 if test -n "$inst_prefix_dir" &&
7332 test -f "$inst_prefix_dir$libdir/$linklib" ; then
7333 add="$inst_prefix_dir$libdir/$linklib"
7334 else
7335 add="$libdir/$linklib"
7336 fi
7337 else
7338 # We cannot seem to hardcode it, guess we'll fake it.
7339 add_dir="-L$libdir"
7340 # Try looking first in the location we're being installed to.
7341 if test -n "$inst_prefix_dir"; then
7342 case $libdir in
7343 [\\/]*)
7344 add_dir+=" -L$inst_prefix_dir$libdir"
7345 ;;
7346 esac
7347 fi
7348 add="-l$name"
7349 fi
7350
7351 if test "$linkmode" = prog; then
7352 test -n "$add_dir" && finalize_deplibs="$add_dir $finalize_deplibs"
7353 test -n "$add" && finalize_deplibs="$add $finalize_deplibs"
7354 else
7355 test -n "$add_dir" && deplibs="$add_dir $deplibs"
7356 test -n "$add" && deplibs="$add $deplibs"
7357 fi
7358 fi
7359 elif test "$linkmode" = prog; then
7360 # Here we assume that one of hardcode_direct or hardcode_minus_L
7361 # is not unsupported. This is valid on all known static and
7362 # shared platforms.
7363 if test "$hardcode_direct" != unsupported; then
7364 test -n "$old_library" && linklib="$old_library"
7365 compile_deplibs="$dir/$linklib $compile_deplibs"
7366 finalize_deplibs="$dir/$linklib $finalize_deplibs"
7367 else
7368 compile_deplibs="-l$name -L$dir $compile_deplibs"
7369 finalize_deplibs="-l$name -L$dir $finalize_deplibs"
7370 fi
7371 elif test "$build_libtool_libs" = yes; then
7372 # Not a shared library
7373 if test "$deplibs_check_method" != pass_all; then
7374 # We're trying link a shared library against a static one
7375 # but the system doesn't support it.
7376
7377 # Just print a warning and add the library to dependency_libs so
7378 # that the program can be linked against the static library.
7379 echo
7380 $ECHO "*** Warning: This system can not link to static lib archive $lib."
7381 echo "*** I have the capability to make that library automatically link in when"
7382 echo "*** you link to this library. But I can only do this if you have a"
7383 echo "*** shared version of the library, which you do not appear to have."
7384 if test "$module" = yes; then
7385 echo "*** But as you try to build a module library, libtool will still create "
7386 echo "*** a static module, that should work as long as the dlopening application"
7387 echo "*** is linked with the -dlopen flag to resolve symbols at runtime."
7388 if test -z "$global_symbol_pipe"; then
7389 echo
7390 echo "*** However, this would only work if libtool was able to extract symbol"
7391 echo "*** lists from a program, using \`nm' or equivalent, but libtool could"
7392 echo "*** not find such a program. So, this module is probably useless."
7393 echo "*** \`nm' from GNU binutils and a full rebuild may help."
7394 fi
7395 if test "$build_old_libs" = no; then
7396 build_libtool_libs=module
7397 build_old_libs=yes
7398 else
7399 build_libtool_libs=no
7400 fi
7401 fi
7402 else
7403 deplibs="$dir/$old_library $deplibs"
7404 link_static=yes
7405 fi
7406 fi # link shared/static library?
7407
7408 if test "$linkmode" = lib; then
7409 if test -n "$dependency_libs" &&
7410 { test "$hardcode_into_libs" != yes ||
7411 test "$build_old_libs" = yes ||
7412 test "$link_static" = yes; }; then
7413 # Extract -R from dependency_libs
7414 temp_deplibs=
7415 for libdir in $dependency_libs; do
7416 case $libdir in
7417 -R*) func_stripname '-R' '' "$libdir"
7418 temp_xrpath=$func_stripname_result
7419 case " $xrpath " in
7420 *" $temp_xrpath "*) ;;
7421 *) xrpath+=" $temp_xrpath";;
7422 esac;;
7423 *) temp_deplibs+=" $libdir";;
7424 esac
7425 done
7426 dependency_libs="$temp_deplibs"
7427 fi
7428
7429 newlib_search_path+=" $absdir"
7430 # Link against this library
7431 test "$link_static" = no && newdependency_libs="$abs_ladir/$laname $newdependency_libs"
7432 # ... and its dependency_libs
7433 tmp_libs=
7434 for deplib in $dependency_libs; do
7435 newdependency_libs="$deplib $newdependency_libs"
7436 case $deplib in
7437 -L*) func_stripname '-L' '' "$deplib"
7438 func_resolve_sysroot "$func_stripname_result";;
7439 *) func_resolve_sysroot "$deplib" ;;
7440 esac
7441 if $opt_preserve_dup_deps ; then
7442 case "$tmp_libs " in
7443 *" $func_resolve_sysroot_result "*)
7444 specialdeplibs+=" $func_resolve_sysroot_result" ;;
7445 esac
7446 fi
7447 tmp_libs+=" $func_resolve_sysroot_result"
7448 done
7449
7450 if test "$link_all_deplibs" != no; then
7451 # Add the search paths of all dependency libraries
7452 for deplib in $dependency_libs; do
7453 path=
7454 case $deplib in
7455 -L*) path="$deplib" ;;
7456 *.la)
7457 func_resolve_sysroot "$deplib"
7458 deplib=$func_resolve_sysroot_result
7459 func_dirname "$deplib" "" "."
7460 dir=$func_dirname_result
7461 # We need an absolute path.
7462 case $dir in
7463 [\\/]* | [A-Za-z]:[\\/]*) absdir="$dir" ;;
7464 *)
7465 absdir=`cd "$dir" && pwd`
7466 if test -z "$absdir"; then
7467 func_warning "cannot determine absolute directory name of \`$dir'"
7468 absdir="$dir"
7469 fi
7470 ;;
7471 esac
7472 if $GREP "^installed=no" $deplib > /dev/null; then
7473 case $host in
7474 *-*-darwin*)
7475 depdepl=
7476 eval deplibrary_names=`${SED} -n -e 's/^library_names=\(.*\)$/\1/p' $deplib`
7477 if test -n "$deplibrary_names" ; then
7478 for tmp in $deplibrary_names ; do
7479 depdepl=$tmp
7480 done
7481 if test -f "$absdir/$objdir/$depdepl" ; then
7482 depdepl="$absdir/$objdir/$depdepl"
7483 darwin_install_name=`${OTOOL} -L $depdepl | awk '{if (NR == 2) {print $1;exit}}'`
7484 if test -z "$darwin_install_name"; then
7485 darwin_install_name=`${OTOOL64} -L $depdepl | awk '{if (NR == 2) {print $1;exit}}'`
7486 fi
7487 compiler_flags+=" ${wl}-dylib_file ${wl}${darwin_install_name}:${depdepl}"
7488 linker_flags+=" -dylib_file ${darwin_install_name}:${depdepl}"
7489 path=
7490 fi
7491 fi
7492 ;;
7493 *)
7494 path="-L$absdir/$objdir"
7495 ;;
7496 esac
7497 else
7498 eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
7499 test -z "$libdir" && \
7500 func_fatal_error "\`$deplib' is not a valid libtool archive"
7501 test "$absdir" != "$libdir" && \
7502 func_warning "\`$deplib' seems to be moved"
7503
7504 path="-L$absdir"
7505 fi
7506 ;;
7507 esac
7508 case " $deplibs " in
7509 *" $path "*) ;;
7510 *) deplibs="$path $deplibs" ;;
7511 esac
7512 done
7513 fi # link_all_deplibs != no
7514 fi # linkmode = lib
7515 done # for deplib in $libs
7516 if test "$pass" = link; then
7517 if test "$linkmode" = "prog"; then
7518 compile_deplibs="$new_inherited_linker_flags $compile_deplibs"
7519 finalize_deplibs="$new_inherited_linker_flags $finalize_deplibs"
7520 else
7521 compiler_flags="$compiler_flags "`$ECHO " $new_inherited_linker_flags" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
7522 fi
7523 fi
7524 dependency_libs="$newdependency_libs"
7525 if test "$pass" = dlpreopen; then
7526 # Link the dlpreopened libraries before other libraries
7527 for deplib in $save_deplibs; do
7528 deplibs="$deplib $deplibs"
7529 done
7530 fi
7531 if test "$pass" != dlopen; then
7532 if test "$pass" != conv; then
7533 # Make sure lib_search_path contains only unique directories.
7534 lib_search_path=
7535 for dir in $newlib_search_path; do
7536 case "$lib_search_path " in
7537 *" $dir "*) ;;
7538 *) lib_search_path+=" $dir" ;;
7539 esac
7540 done
7541 newlib_search_path=
7542 fi
7543
7544 if test "$linkmode,$pass" != "prog,link"; then
7545 vars="deplibs"
7546 else
7547 vars="compile_deplibs finalize_deplibs"
7548 fi
7549 for var in $vars dependency_libs; do
7550 # Add libraries to $var in reverse order
7551 eval tmp_libs=\"\$$var\"
7552 new_libs=
7553 for deplib in $tmp_libs; do
7554 # FIXME: Pedantically, this is the right thing to do, so
7555 # that some nasty dependency loop isn't accidentally
7556 # broken:
7557 #new_libs="$deplib $new_libs"
7558 # Pragmatically, this seems to cause very few problems in
7559 # practice:
7560 case $deplib in
7561 -L*) new_libs="$deplib $new_libs" ;;
7562 -R*) ;;
7563 *)
7564 # And here is the reason: when a library appears more
7565 # than once as an explicit dependence of a library, or
7566 # is implicitly linked in more than once by the
7567 # compiler, it is considered special, and multiple
7568 # occurrences thereof are not removed. Compare this
7569 # with having the same library being listed as a
7570 # dependency of multiple other libraries: in this case,
7571 # we know (pedantically, we assume) the library does not
7572 # need to be listed more than once, so we keep only the
7573 # last copy. This is not always right, but it is rare
7574 # enough that we require users that really mean to play
7575 # such unportable linking tricks to link the library
7576 # using -Wl,-lname, so that libtool does not consider it
7577 # for duplicate removal.
7578 case " $specialdeplibs " in
7579 *" $deplib "*) new_libs="$deplib $new_libs" ;;
7580 *)
7581 case " $new_libs " in
7582 *" $deplib "*) ;;
7583 *) new_libs="$deplib $new_libs" ;;
7584 esac
7585 ;;
7586 esac
7587 ;;
7588 esac
7589 done
7590 tmp_libs=
7591 for deplib in $new_libs; do
7592 case $deplib in
7593 -L*)
7594 case " $tmp_libs " in
7595 *" $deplib "*) ;;
7596 *) tmp_libs+=" $deplib" ;;
7597 esac
7598 ;;
7599 *) tmp_libs+=" $deplib" ;;
7600 esac
7601 done
7602 eval $var=\"$tmp_libs\"
7603 done # for var
7604 fi
7605 # Last step: remove runtime libs from dependency_libs
7606 # (they stay in deplibs)
7607 tmp_libs=
7608 for i in $dependency_libs ; do
7609 case " $predeps $postdeps $compiler_lib_search_path " in
7610 *" $i "*)
7611 i=""
7612 ;;
7613 esac
7614 if test -n "$i" ; then
7615 tmp_libs+=" $i"
7616 fi
7617 done
7618 dependency_libs=$tmp_libs
7619 done # for pass
7620 if test "$linkmode" = prog; then
7621 dlfiles="$newdlfiles"
7622 fi
7623 if test "$linkmode" = prog || test "$linkmode" = lib; then
7624 dlprefiles="$newdlprefiles"
7625 fi
7626
7627 case $linkmode in
7628 oldlib)
7629 if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
7630 func_warning "\`-dlopen' is ignored for archives"
7631 fi
7632
7633 case " $deplibs" in
7634 *\ -l* | *\ -L*)
7635 func_warning "\`-l' and \`-L' are ignored for archives" ;;
7636 esac
7637
7638 test -n "$rpath" && \
7639 func_warning "\`-rpath' is ignored for archives"
7640
7641 test -n "$xrpath" && \
7642 func_warning "\`-R' is ignored for archives"
7643
7644 test -n "$vinfo" && \
7645 func_warning "\`-version-info/-version-number' is ignored for archives"
7646
7647 test -n "$release" && \
7648 func_warning "\`-release' is ignored for archives"
7649
7650 test -n "$export_symbols$export_symbols_regex" && \
7651 func_warning "\`-export-symbols' is ignored for archives"
7652
7653 # Now set the variables for building old libraries.
7654 build_libtool_libs=no
7655 oldlibs="$output"
7656 objs+="$old_deplibs"
7657 ;;
7658
7659 lib)
7660 # Make sure we only generate libraries of the form `libNAME.la'.
7661 case $outputname in
7662 lib*)
7663 func_stripname 'lib' '.la' "$outputname"
7664 name=$func_stripname_result
7665 eval shared_ext=\"$shrext_cmds\"
7666 eval libname=\"$libname_spec\"
7667 ;;
7668 *)
7669 test "$module" = no && \
7670 func_fatal_help "libtool library \`$output' must begin with \`lib'"
7671
7672 if test "$need_lib_prefix" != no; then
7673 # Add the "lib" prefix for modules if required
7674 func_stripname '' '.la' "$outputname"
7675 name=$func_stripname_result
7676 eval shared_ext=\"$shrext_cmds\"
7677 eval libname=\"$libname_spec\"
7678 else
7679 func_stripname '' '.la' "$outputname"
7680 libname=$func_stripname_result
7681 fi
7682 ;;
7683 esac
7684
7685 if test -n "$objs"; then
7686 if test "$deplibs_check_method" != pass_all; then
7687 func_fatal_error "cannot build libtool library \`$output' from non-libtool objects on this host:$objs"
7688 else
7689 echo
7690 $ECHO "*** Warning: Linking the shared library $output against the non-libtool"
7691 $ECHO "*** objects $objs is not portable!"
7692 libobjs+=" $objs"
7693 fi
7694 fi
7695
7696 test "$dlself" != no && \
7697 func_warning "\`-dlopen self' is ignored for libtool libraries"
7698
7699 set dummy $rpath
7700 shift
7701 test "$#" -gt 1 && \
7702 func_warning "ignoring multiple \`-rpath's for a libtool library"
7703
7704 install_libdir="$1"
7705
7706 oldlibs=
7707 if test -z "$rpath"; then
7708 if test "$build_libtool_libs" = yes; then
7709 # Building a libtool convenience library.
7710 # Some compilers have problems with a `.al' extension so
7711 # convenience libraries should have the same extension an
7712 # archive normally would.
7713 oldlibs="$output_objdir/$libname.$libext $oldlibs"
7714 build_libtool_libs=convenience
7715 build_old_libs=yes
7716 fi
7717
7718 test -n "$vinfo" && \
7719 func_warning "\`-version-info/-version-number' is ignored for convenience libraries"
7720
7721 test -n "$release" && \
7722 func_warning "\`-release' is ignored for convenience libraries"
7723 else
7724
7725 # Parse the version information argument.
7726 save_ifs="$IFS"; IFS=':'
7727 set dummy $vinfo 0 0 0
7728 shift
7729 IFS="$save_ifs"
7730
7731 test -n "$7" && \
7732 func_fatal_help "too many parameters to \`-version-info'"
7733
7734 # convert absolute version numbers to libtool ages
7735 # this retains compatibility with .la files and attempts
7736 # to make the code below a bit more comprehensible
7737
7738 case $vinfo_number in
7739 yes)
7740 number_major="$1"
7741 number_minor="$2"
7742 number_revision="$3"
7743 #
7744 # There are really only two kinds -- those that
7745 # use the current revision as the major version
7746 # and those that subtract age and use age as
7747 # a minor version. But, then there is irix
7748 # which has an extra 1 added just for fun
7749 #
7750 case $version_type in
7751 # correct linux to gnu/linux during the next big refactor
7752 darwin|linux|osf|windows|none)
7753 func_arith $number_major + $number_minor
7754 current=$func_arith_result
7755 age="$number_minor"
7756 revision="$number_revision"
7757 ;;
7758 freebsd-aout|freebsd-elf|qnx|sunos)
7759 current="$number_major"
7760 revision="$number_minor"
7761 age="0"
7762 ;;
7763 irix|nonstopux)
7764 func_arith $number_major + $number_minor
7765 current=$func_arith_result
7766 age="$number_minor"
7767 revision="$number_minor"
7768 lt_irix_increment=no
7769 ;;
7770 esac
7771 ;;
7772 no)
7773 current="$1"
7774 revision="$2"
7775 age="$3"
7776 ;;
7777 esac
7778
7779 # Check that each of the things are valid numbers.
7780 case $current in
7781 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]) ;;
7782 *)
7783 func_error "CURRENT \`$current' must be a nonnegative integer"
7784 func_fatal_error "\`$vinfo' is not valid version information"
7785 ;;
7786 esac
7787
7788 case $revision in
7789 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]) ;;
7790 *)
7791 func_error "REVISION \`$revision' must be a nonnegative integer"
7792 func_fatal_error "\`$vinfo' is not valid version information"
7793 ;;
7794 esac
7795
7796 case $age in
7797 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]) ;;
7798 *)
7799 func_error "AGE \`$age' must be a nonnegative integer"
7800 func_fatal_error "\`$vinfo' is not valid version information"
7801 ;;
7802 esac
7803
7804 if test "$age" -gt "$current"; then
7805 func_error "AGE \`$age' is greater than the current interface number \`$current'"
7806 func_fatal_error "\`$vinfo' is not valid version information"
7807 fi
7808
7809 # Calculate the version variables.
7810 major=
7811 versuffix=
7812 verstring=
7813 case $version_type in
7814 none) ;;
7815
7816 darwin)
7817 # Like Linux, but with the current version available in
7818 # verstring for coding it into the library header
7819 func_arith $current - $age
7820 major=.$func_arith_result
7821 versuffix="$major.$age.$revision"
7822 # Darwin ld doesn't like 0 for these options...
7823 func_arith $current + 1
7824 minor_current=$func_arith_result
7825 xlcverstring="${wl}-compatibility_version ${wl}$minor_current ${wl}-current_version ${wl}$minor_current.$revision"
7826 verstring="-compatibility_version $minor_current -current_version $minor_current.$revision"
7827 ;;
7828
7829 freebsd-aout)
7830 major=".$current"
7831 versuffix=".$current.$revision";
7832 ;;
7833
7834 freebsd-elf)
7835 major=".$current"
7836 versuffix=".$current"
7837 ;;
7838
7839 irix | nonstopux)
7840 if test "X$lt_irix_increment" = "Xno"; then
7841 func_arith $current - $age
7842 else
7843 func_arith $current - $age + 1
7844 fi
7845 major=$func_arith_result
7846
7847 case $version_type in
7848 nonstopux) verstring_prefix=nonstopux ;;
7849 *) verstring_prefix=sgi ;;
7850 esac
7851 verstring="$verstring_prefix$major.$revision"
7852
7853 # Add in all the interfaces that we are compatible with.
7854 loop=$revision
7855 while test "$loop" -ne 0; do
7856 func_arith $revision - $loop
7857 iface=$func_arith_result
7858 func_arith $loop - 1
7859 loop=$func_arith_result
7860 verstring="$verstring_prefix$major.$iface:$verstring"
7861 done
7862
7863 # Before this point, $major must not contain `.'.
7864 major=.$major
7865 versuffix="$major.$revision"
7866 ;;
7867
7868 linux) # correct to gnu/linux during the next big refactor
7869 func_arith $current - $age
7870 major=.$func_arith_result
7871 versuffix="$major.$age.$revision"
7872 ;;
7873
7874 osf)
7875 func_arith $current - $age
7876 major=.$func_arith_result
7877 versuffix=".$current.$age.$revision"
7878 verstring="$current.$age.$revision"
7879
7880 # Add in all the interfaces that we are compatible with.
7881 loop=$age
7882 while test "$loop" -ne 0; do
7883 func_arith $current - $loop
7884 iface=$func_arith_result
7885 func_arith $loop - 1
7886 loop=$func_arith_result
7887 verstring="$verstring:${iface}.0"
7888 done
7889
7890 # Make executables depend on our current version.
7891 verstring+=":${current}.0"
7892 ;;
7893
7894 qnx)
7895 major=".$current"
7896 versuffix=".$current"
7897 ;;
7898
7899 sunos)
7900 major=".$current"
7901 versuffix=".$current.$revision"
7902 ;;
7903
7904 windows)
7905 # Use '-' rather than '.', since we only want one
7906 # extension on DOS 8.3 filesystems.
7907 func_arith $current - $age
7908 major=$func_arith_result
7909 versuffix="-$major"
7910 ;;
7911
7912 *)
7913 func_fatal_configuration "unknown library version type \`$version_type'"
7914 ;;
7915 esac
7916
7917 # Clear the version info if we defaulted, and they specified a release.
7918 if test -z "$vinfo" && test -n "$release"; then
7919 major=
7920 case $version_type in
7921 darwin)
7922 # we can't check for "0.0" in archive_cmds due to quoting
7923 # problems, so we reset it completely
7924 verstring=
7925 ;;
7926 *)
7927 verstring="0.0"
7928 ;;
7929 esac
7930 if test "$need_version" = no; then
7931 versuffix=
7932 else
7933 versuffix=".0.0"
7934 fi
7935 fi
7936
7937 # Remove version info from name if versioning should be avoided
7938 if test "$avoid_version" = yes && test "$need_version" = no; then
7939 major=
7940 versuffix=
7941 verstring=""
7942 fi
7943
7944 # Check to see if the archive will have undefined symbols.
7945 if test "$allow_undefined" = yes; then
7946 if test "$allow_undefined_flag" = unsupported; then
7947 func_warning "undefined symbols not allowed in $host shared libraries"
7948 build_libtool_libs=no
7949 build_old_libs=yes
7950 fi
7951 else
7952 # Don't allow undefined symbols.
7953 allow_undefined_flag="$no_undefined_flag"
7954 fi
7955
7956 fi
7957
7958 func_generate_dlsyms "$libname" "$libname" "yes"
7959 libobjs+=" $symfileobj"
7960 test "X$libobjs" = "X " && libobjs=
7961
7962 if test "$opt_mode" != relink; then
7963 # Remove our outputs, but don't remove object files since they
7964 # may have been created when compiling PIC objects.
7965 removelist=
7966 tempremovelist=`$ECHO "$output_objdir/*"`
7967 for p in $tempremovelist; do
7968 case $p in
7969 *.$objext | *.gcno)
7970 ;;
7971 $output_objdir/$outputname | $output_objdir/$libname.* | $output_objdir/${libname}${release}.*)
7972 if test "X$precious_files_regex" != "X"; then
7973 if $ECHO "$p" | $EGREP -e "$precious_files_regex" >/dev/null 2>&1
7974 then
7975 continue
7976 fi
7977 fi
7978 removelist+=" $p"
7979 ;;
7980 *) ;;
7981 esac
7982 done
7983 test -n "$removelist" && \
7984 func_show_eval "${RM}r \$removelist"
7985 fi
7986
7987 # Now set the variables for building old libraries.
7988 if test "$build_old_libs" = yes && test "$build_libtool_libs" != convenience ; then
7989 oldlibs+=" $output_objdir/$libname.$libext"
7990
7991 # Transform .lo files to .o files.
7992 oldobjs="$objs "`$ECHO "$libobjs" | $SP2NL | $SED "/\.${libext}$/d; $lo2o" | $NL2SP`
7993 fi
7994
7995 # Eliminate all temporary directories.
7996 #for path in $notinst_path; do
7997 # lib_search_path=`$ECHO "$lib_search_path " | $SED "s% $path % %g"`
7998 # deplibs=`$ECHO "$deplibs " | $SED "s% -L$path % %g"`
7999 # dependency_libs=`$ECHO "$dependency_libs " | $SED "s% -L$path % %g"`
8000 #done
8001
8002 if test -n "$xrpath"; then
8003 # If the user specified any rpath flags, then add them.
8004 temp_xrpath=
8005 for libdir in $xrpath; do
8006 func_replace_sysroot "$libdir"
8007 temp_xrpath+=" -R$func_replace_sysroot_result"
8008 case "$finalize_rpath " in
8009 *" $libdir "*) ;;
8010 *) finalize_rpath+=" $libdir" ;;
8011 esac
8012 done
8013 if test "$hardcode_into_libs" != yes || test "$build_old_libs" = yes; then
8014 dependency_libs="$temp_xrpath $dependency_libs"
8015 fi
8016 fi
8017
8018 # Make sure dlfiles contains only unique files that won't be dlpreopened
8019 old_dlfiles="$dlfiles"
8020 dlfiles=
8021 for lib in $old_dlfiles; do
8022 case " $dlprefiles $dlfiles " in
8023 *" $lib "*) ;;
8024 *) dlfiles+=" $lib" ;;
8025 esac
8026 done
8027
8028 # Make sure dlprefiles contains only unique files
8029 old_dlprefiles="$dlprefiles"
8030 dlprefiles=
8031 for lib in $old_dlprefiles; do
8032 case "$dlprefiles " in
8033 *" $lib "*) ;;
8034 *) dlprefiles+=" $lib" ;;
8035 esac
8036 done
8037
8038 if test "$build_libtool_libs" = yes; then
8039 if test -n "$rpath"; then
8040 case $host in
8041 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-beos* | *-cegcc* | *-*-haiku*)
8042 # these systems don't actually have a c library (as such)!
8043 ;;
8044 *-*-rhapsody* | *-*-darwin1.[012])
8045 # Rhapsody C library is in the System framework
8046 deplibs+=" System.ltframework"
8047 ;;
8048 *-*-netbsd*)
8049 # Don't link with libc until the a.out ld.so is fixed.
8050 ;;
8051 *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
8052 # Do not include libc due to us having libc/libc_r.
8053 ;;
8054 *-*-sco3.2v5* | *-*-sco5v6*)
8055 # Causes problems with __ctype
8056 ;;
8057 *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*)
8058 # Compiler inserts libc in the correct place for threads to work
8059 ;;
8060 *)
8061 # Add libc to deplibs on all other systems if necessary.
8062 if test "$build_libtool_need_lc" = "yes"; then
8063 deplibs+=" -lc"
8064 fi
8065 ;;
8066 esac
8067 fi
8068
8069 # Transform deplibs into only deplibs that can be linked in shared.
8070 name_save=$name
8071 libname_save=$libname
8072 release_save=$release
8073 versuffix_save=$versuffix
8074 major_save=$major
8075 # I'm not sure if I'm treating the release correctly. I think
8076 # release should show up in the -l (ie -lgmp5) so we don't want to
8077 # add it in twice. Is that correct?
8078 release=""
8079 versuffix=""
8080 major=""
8081 newdeplibs=
8082 droppeddeps=no
8083 case $deplibs_check_method in
8084 pass_all)
8085 # Don't check for shared/static. Everything works.
8086 # This might be a little naive. We might want to check
8087 # whether the library exists or not. But this is on
8088 # osf3 & osf4 and I'm not really sure... Just
8089 # implementing what was already the behavior.
8090 newdeplibs=$deplibs
8091 ;;
8092 test_compile)
8093 # This code stresses the "libraries are programs" paradigm to its
8094 # limits. Maybe even breaks it. We compile a program, linking it
8095 # against the deplibs as a proxy for the library. Then we can check
8096 # whether they linked in statically or dynamically with ldd.
8097 $opt_dry_run || $RM conftest.c
8098 cat > conftest.c <<EOF
8099 int main() { return 0; }
8100 EOF
8101 $opt_dry_run || $RM conftest
8102 if $LTCC $LTCFLAGS -o conftest conftest.c $deplibs; then
8103 ldd_output=`ldd conftest`
8104 for i in $deplibs; do
8105 case $i in
8106 -l*)
8107 func_stripname -l '' "$i"
8108 name=$func_stripname_result
8109 if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
8110 case " $predeps $postdeps " in
8111 *" $i "*)
8112 newdeplibs+=" $i"
8113 i=""
8114 ;;
8115 esac
8116 fi
8117 if test -n "$i" ; then
8118 libname=`eval "\\$ECHO \"$libname_spec\""`
8119 deplib_matches=`eval "\\$ECHO \"$library_names_spec\""`
8120 set dummy $deplib_matches; shift
8121 deplib_match=$1
8122 if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then
8123 newdeplibs+=" $i"
8124 else
8125 droppeddeps=yes
8126 echo
8127 $ECHO "*** Warning: dynamic linker does not accept needed library $i."
8128 echo "*** I have the capability to make that library automatically link in when"
8129 echo "*** you link to this library. But I can only do this if you have a"
8130 echo "*** shared version of the library, which I believe you do not have"
8131 echo "*** because a test_compile did reveal that the linker did not use it for"
8132 echo "*** its dynamic dependency list that programs get resolved with at runtime."
8133 fi
8134 fi
8135 ;;
8136 *)
8137 newdeplibs+=" $i"
8138 ;;
8139 esac
8140 done
8141 else
8142 # Error occurred in the first compile. Let's try to salvage
8143 # the situation: Compile a separate program for each library.
8144 for i in $deplibs; do
8145 case $i in
8146 -l*)
8147 func_stripname -l '' "$i"
8148 name=$func_stripname_result
8149 $opt_dry_run || $RM conftest
8150 if $LTCC $LTCFLAGS -o conftest conftest.c $i; then
8151 ldd_output=`ldd conftest`
8152 if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
8153 case " $predeps $postdeps " in
8154 *" $i "*)
8155 newdeplibs+=" $i"
8156 i=""
8157 ;;
8158 esac
8159 fi
8160 if test -n "$i" ; then
8161 libname=`eval "\\$ECHO \"$libname_spec\""`
8162 deplib_matches=`eval "\\$ECHO \"$library_names_spec\""`
8163 set dummy $deplib_matches; shift
8164 deplib_match=$1
8165 if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then
8166 newdeplibs+=" $i"
8167 else
8168 droppeddeps=yes
8169 echo
8170 $ECHO "*** Warning: dynamic linker does not accept needed library $i."
8171 echo "*** I have the capability to make that library automatically link in when"
8172 echo "*** you link to this library. But I can only do this if you have a"
8173 echo "*** shared version of the library, which you do not appear to have"
8174 echo "*** because a test_compile did reveal that the linker did not use this one"
8175 echo "*** as a dynamic dependency that programs can get resolved with at runtime."
8176 fi
8177 fi
8178 else
8179 droppeddeps=yes
8180 echo
8181 $ECHO "*** Warning! Library $i is needed by this library but I was not able to"
8182 echo "*** make it link in! You will probably need to install it or some"
8183 echo "*** library that it depends on before this library will be fully"
8184 echo "*** functional. Installing it before continuing would be even better."
8185 fi
8186 ;;
8187 *)
8188 newdeplibs+=" $i"
8189 ;;
8190 esac
8191 done
8192 fi
8193 ;;
8194 file_magic*)
8195 set dummy $deplibs_check_method; shift
8196 file_magic_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"`
8197 for a_deplib in $deplibs; do
8198 case $a_deplib in
8199 -l*)
8200 func_stripname -l '' "$a_deplib"
8201 name=$func_stripname_result
8202 if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
8203 case " $predeps $postdeps " in
8204 *" $a_deplib "*)
8205 newdeplibs+=" $a_deplib"
8206 a_deplib=""
8207 ;;
8208 esac
8209 fi
8210 if test -n "$a_deplib" ; then
8211 libname=`eval "\\$ECHO \"$libname_spec\""`
8212 if test -n "$file_magic_glob"; then
8213 libnameglob=`func_echo_all "$libname" | $SED -e $file_magic_glob`
8214 else
8215 libnameglob=$libname
8216 fi
8217 test "$want_nocaseglob" = yes && nocaseglob=`shopt -p nocaseglob`
8218 for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
8219 if test "$want_nocaseglob" = yes; then
8220 shopt -s nocaseglob
8221 potential_libs=`ls $i/$libnameglob[.-]* 2>/dev/null`
8222 $nocaseglob
8223 else
8224 potential_libs=`ls $i/$libnameglob[.-]* 2>/dev/null`
8225 fi
8226 for potent_lib in $potential_libs; do
8227 # Follow soft links.
8228 if ls -lLd "$potent_lib" 2>/dev/null |
8229 $GREP " -> " >/dev/null; then
8230 continue
8231 fi
8232 # The statement above tries to avoid entering an
8233 # endless loop below, in case of cyclic links.
8234 # We might still enter an endless loop, since a link
8235 # loop can be closed while we follow links,
8236 # but so what?
8237 potlib="$potent_lib"
8238 while test -h "$potlib" 2>/dev/null; do
8239 potliblink=`ls -ld $potlib | ${SED} 's/.* -> //'`
8240 case $potliblink in
8241 [\\/]* | [A-Za-z]:[\\/]*) potlib="$potliblink";;
8242 *) potlib=`$ECHO "$potlib" | $SED 's,[^/]*$,,'`"$potliblink";;
8243 esac
8244 done
8245 if eval $file_magic_cmd \"\$potlib\" 2>/dev/null |
8246 $SED -e 10q |
8247 $EGREP "$file_magic_regex" > /dev/null; then
8248 newdeplibs+=" $a_deplib"
8249 a_deplib=""
8250 break 2
8251 fi
8252 done
8253 done
8254 fi
8255 if test -n "$a_deplib" ; then
8256 droppeddeps=yes
8257 echo
8258 $ECHO "*** Warning: linker path does not have real file for library $a_deplib."
8259 echo "*** I have the capability to make that library automatically link in when"
8260 echo "*** you link to this library. But I can only do this if you have a"
8261 echo "*** shared version of the library, which you do not appear to have"
8262 echo "*** because I did check the linker path looking for a file starting"
8263 if test -z "$potlib" ; then
8264 $ECHO "*** with $libname but no candidates were found. (...for file magic test)"
8265 else
8266 $ECHO "*** with $libname and none of the candidates passed a file format test"
8267 $ECHO "*** using a file magic. Last file checked: $potlib"
8268 fi
8269 fi
8270 ;;
8271 *)
8272 # Add a -L argument.
8273 newdeplibs+=" $a_deplib"
8274 ;;
8275 esac
8276 done # Gone through all deplibs.
8277 ;;
8278 match_pattern*)
8279 set dummy $deplibs_check_method; shift
8280 match_pattern_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"`
8281 for a_deplib in $deplibs; do
8282 case $a_deplib in
8283 -l*)
8284 func_stripname -l '' "$a_deplib"
8285 name=$func_stripname_result
8286 if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
8287 case " $predeps $postdeps " in
8288 *" $a_deplib "*)
8289 newdeplibs+=" $a_deplib"
8290 a_deplib=""
8291 ;;
8292 esac
8293 fi
8294 if test -n "$a_deplib" ; then
8295 libname=`eval "\\$ECHO \"$libname_spec\""`
8296 for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
8297 potential_libs=`ls $i/$libname[.-]* 2>/dev/null`
8298 for potent_lib in $potential_libs; do
8299 potlib="$potent_lib" # see symlink-check above in file_magic test
8300 if eval "\$ECHO \"$potent_lib\"" 2>/dev/null | $SED 10q | \
8301 $EGREP "$match_pattern_regex" > /dev/null; then
8302 newdeplibs+=" $a_deplib"
8303 a_deplib=""
8304 break 2
8305 fi
8306 done
8307 done
8308 fi
8309 if test -n "$a_deplib" ; then
8310 droppeddeps=yes
8311 echo
8312 $ECHO "*** Warning: linker path does not have real file for library $a_deplib."
8313 echo "*** I have the capability to make that library automatically link in when"
8314 echo "*** you link to this library. But I can only do this if you have a"
8315 echo "*** shared version of the library, which you do not appear to have"
8316 echo "*** because I did check the linker path looking for a file starting"
8317 if test -z "$potlib" ; then
8318 $ECHO "*** with $libname but no candidates were found. (...for regex pattern test)"
8319 else
8320 $ECHO "*** with $libname and none of the candidates passed a file format test"
8321 $ECHO "*** using a regex pattern. Last file checked: $potlib"
8322 fi
8323 fi
8324 ;;
8325 *)
8326 # Add a -L argument.
8327 newdeplibs+=" $a_deplib"
8328 ;;
8329 esac
8330 done # Gone through all deplibs.
8331 ;;
8332 none | unknown | *)
8333 newdeplibs=""
8334 tmp_deplibs=`$ECHO " $deplibs" | $SED 's/ -lc$//; s/ -[LR][^ ]*//g'`
8335 if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
8336 for i in $predeps $postdeps ; do
8337 # can't use Xsed below, because $i might contain '/'
8338 tmp_deplibs=`$ECHO " $tmp_deplibs" | $SED "s,$i,,"`
8339 done
8340 fi
8341 case $tmp_deplibs in
8342 *[!\ \ ]*)
8343 echo
8344 if test "X$deplibs_check_method" = "Xnone"; then
8345 echo "*** Warning: inter-library dependencies are not supported in this platform."
8346 else
8347 echo "*** Warning: inter-library dependencies are not known to be supported."
8348 fi
8349 echo "*** All declared inter-library dependencies are being dropped."
8350 droppeddeps=yes
8351 ;;
8352 esac
8353 ;;
8354 esac
8355 versuffix=$versuffix_save
8356 major=$major_save
8357 release=$release_save
8358 libname=$libname_save
8359 name=$name_save
8360
8361 case $host in
8362 *-*-rhapsody* | *-*-darwin1.[012])
8363 # On Rhapsody replace the C library with the System framework
8364 newdeplibs=`$ECHO " $newdeplibs" | $SED 's/ -lc / System.ltframework /'`
8365 ;;
8366 esac
8367
8368 if test "$droppeddeps" = yes; then
8369 if test "$module" = yes; then
8370 echo
8371 echo "*** Warning: libtool could not satisfy all declared inter-library"
8372 $ECHO "*** dependencies of module $libname. Therefore, libtool will create"
8373 echo "*** a static module, that should work as long as the dlopening"
8374 echo "*** application is linked with the -dlopen flag."
8375 if test -z "$global_symbol_pipe"; then
8376 echo
8377 echo "*** However, this would only work if libtool was able to extract symbol"
8378 echo "*** lists from a program, using \`nm' or equivalent, but libtool could"
8379 echo "*** not find such a program. So, this module is probably useless."
8380 echo "*** \`nm' from GNU binutils and a full rebuild may help."
8381 fi
8382 if test "$build_old_libs" = no; then
8383 oldlibs="$output_objdir/$libname.$libext"
8384 build_libtool_libs=module
8385 build_old_libs=yes
8386 else
8387 build_libtool_libs=no
8388 fi
8389 else
8390 echo "*** The inter-library dependencies that have been dropped here will be"
8391 echo "*** automatically added whenever a program is linked with this library"
8392 echo "*** or is declared to -dlopen it."
8393
8394 if test "$allow_undefined" = no; then
8395 echo
8396 echo "*** Since this library must not contain undefined symbols,"
8397 echo "*** because either the platform does not support them or"
8398 echo "*** it was explicitly requested with -no-undefined,"
8399 echo "*** libtool will only create a static version of it."
8400 if test "$build_old_libs" = no; then
8401 oldlibs="$output_objdir/$libname.$libext"
8402 build_libtool_libs=module
8403 build_old_libs=yes
8404 else
8405 build_libtool_libs=no
8406 fi
8407 fi
8408 fi
8409 fi
8410 # Done checking deplibs!
8411 deplibs=$newdeplibs
8412 fi
8413 # Time to change all our "foo.ltframework" stuff back to "-framework foo"
8414 case $host in
8415 *-*-darwin*)
8416 newdeplibs=`$ECHO " $newdeplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
8417 new_inherited_linker_flags=`$ECHO " $new_inherited_linker_flags" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
8418 deplibs=`$ECHO " $deplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
8419 ;;
8420 esac
8421
8422 # move library search paths that coincide with paths to not yet
8423 # installed libraries to the beginning of the library search list
8424 new_libs=
8425 for path in $notinst_path; do
8426 case " $new_libs " in
8427 *" -L$path/$objdir "*) ;;
8428 *)
8429 case " $deplibs " in
8430 *" -L$path/$objdir "*)
8431 new_libs+=" -L$path/$objdir" ;;
8432 esac
8433 ;;
8434 esac
8435 done
8436 for deplib in $deplibs; do
8437 case $deplib in
8438 -L*)
8439 case " $new_libs " in
8440 *" $deplib "*) ;;
8441 *) new_libs+=" $deplib" ;;
8442 esac
8443 ;;
8444 *) new_libs+=" $deplib" ;;
8445 esac
8446 done
8447 deplibs="$new_libs"
8448
8449 # All the library-specific variables (install_libdir is set above).
8450 library_names=
8451 old_library=
8452 dlname=
8453
8454 # Test again, we may have decided not to build it any more
8455 if test "$build_libtool_libs" = yes; then
8456 # Remove ${wl} instances when linking with ld.
8457 # FIXME: should test the right _cmds variable.
8458 case $archive_cmds in
8459 *\$LD\ *) wl= ;;
8460 esac
8461 if test "$hardcode_into_libs" = yes; then
8462 # Hardcode the library paths
8463 hardcode_libdirs=
8464 dep_rpath=
8465 rpath="$finalize_rpath"
8466 test "$opt_mode" != relink && rpath="$compile_rpath$rpath"
8467 for libdir in $rpath; do
8468 if test -n "$hardcode_libdir_flag_spec"; then
8469 if test -n "$hardcode_libdir_separator"; then
8470 func_replace_sysroot "$libdir"
8471 libdir=$func_replace_sysroot_result
8472 if test -z "$hardcode_libdirs"; then
8473 hardcode_libdirs="$libdir"
8474 else
8475 # Just accumulate the unique libdirs.
8476 case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
8477 *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
8478 ;;
8479 *)
8480 hardcode_libdirs+="$hardcode_libdir_separator$libdir"
8481 ;;
8482 esac
8483 fi
8484 else
8485 eval flag=\"$hardcode_libdir_flag_spec\"
8486 dep_rpath+=" $flag"
8487 fi
8488 elif test -n "$runpath_var"; then
8489 case "$perm_rpath " in
8490 *" $libdir "*) ;;
8491 *) perm_rpath+=" $libdir" ;;
8492 esac
8493 fi
8494 done
8495 # Substitute the hardcoded libdirs into the rpath.
8496 if test -n "$hardcode_libdir_separator" &&
8497 test -n "$hardcode_libdirs"; then
8498 libdir="$hardcode_libdirs"
8499 eval "dep_rpath=\"$hardcode_libdir_flag_spec\""
8500 fi
8501 if test -n "$runpath_var" && test -n "$perm_rpath"; then
8502 # We should set the runpath_var.
8503 rpath=
8504 for dir in $perm_rpath; do
8505 rpath+="$dir:"
8506 done
8507 eval "$runpath_var='$rpath\$$runpath_var'; export $runpath_var"
8508 fi
8509 test -n "$dep_rpath" && deplibs="$dep_rpath $deplibs"
8510 fi
8511
8512 shlibpath="$finalize_shlibpath"
8513 test "$opt_mode" != relink && shlibpath="$compile_shlibpath$shlibpath"
8514 if test -n "$shlibpath"; then
8515 eval "$shlibpath_var='$shlibpath\$$shlibpath_var'; export $shlibpath_var"
8516 fi
8517
8518 # Get the real and link names of the library.
8519 eval shared_ext=\"$shrext_cmds\"
8520 eval library_names=\"$library_names_spec\"
8521 set dummy $library_names
8522 shift
8523 realname="$1"
8524 shift
8525
8526 if test -n "$soname_spec"; then
8527 eval soname=\"$soname_spec\"
8528 else
8529 soname="$realname"
8530 fi
8531 if test -z "$dlname"; then
8532 dlname=$soname
8533 fi
8534
8535 lib="$output_objdir/$realname"
8536 linknames=
8537 for link
8538 do
8539 linknames+=" $link"
8540 done
8541
8542 # Use standard objects if they are pic
8543 test -z "$pic_flag" && libobjs=`$ECHO "$libobjs" | $SP2NL | $SED "$lo2o" | $NL2SP`
8544 test "X$libobjs" = "X " && libobjs=
8545
8546 delfiles=
8547 if test -n "$export_symbols" && test -n "$include_expsyms"; then
8548 $opt_dry_run || cp "$export_symbols" "$output_objdir/$libname.uexp"
8549 export_symbols="$output_objdir/$libname.uexp"
8550 delfiles+=" $export_symbols"
8551 fi
8552
8553 orig_export_symbols=
8554 case $host_os in
8555 cygwin* | mingw* | cegcc*)
8556 if test -n "$export_symbols" && test -z "$export_symbols_regex"; then
8557 # exporting using user supplied symfile
8558 if test "x`$SED 1q $export_symbols`" != xEXPORTS; then
8559 # and it's NOT already a .def file. Must figure out
8560 # which of the given symbols are data symbols and tag
8561 # them as such. So, trigger use of export_symbols_cmds.
8562 # export_symbols gets reassigned inside the "prepare
8563 # the list of exported symbols" if statement, so the
8564 # include_expsyms logic still works.
8565 orig_export_symbols="$export_symbols"
8566 export_symbols=
8567 always_export_symbols=yes
8568 fi
8569 fi
8570 ;;
8571 esac
8572
8573 # Prepare the list of exported symbols
8574 if test -z "$export_symbols"; then
8575 if test "$always_export_symbols" = yes || test -n "$export_symbols_regex"; then
8576 func_verbose "generating symbol list for \`$libname.la'"
8577 export_symbols="$output_objdir/$libname.exp"
8578 $opt_dry_run || $RM $export_symbols
8579 cmds=$export_symbols_cmds
8580 save_ifs="$IFS"; IFS='~'
8581 for cmd1 in $cmds; do
8582 IFS="$save_ifs"
8583 # Take the normal branch if the nm_file_list_spec branch
8584 # doesn't work or if tool conversion is not needed.
8585 case $nm_file_list_spec~$to_tool_file_cmd in
8586 *~func_convert_file_noop | *~func_convert_file_msys_to_w32 | ~*)
8587 try_normal_branch=yes
8588 eval cmd=\"$cmd1\"
8589 func_len " $cmd"
8590 len=$func_len_result
8591 ;;
8592 *)
8593 try_normal_branch=no
8594 ;;
8595 esac
8596 if test "$try_normal_branch" = yes \
8597 && { test "$len" -lt "$max_cmd_len" \
8598 || test "$max_cmd_len" -le -1; }
8599 then
8600 func_show_eval "$cmd" 'exit $?'
8601 skipped_export=false
8602 elif test -n "$nm_file_list_spec"; then
8603 func_basename "$output"
8604 output_la=$func_basename_result
8605 save_libobjs=$libobjs
8606 save_output=$output
8607 output=${output_objdir}/${output_la}.nm
8608 func_to_tool_file "$output"
8609 libobjs=$nm_file_list_spec$func_to_tool_file_result
8610 delfiles+=" $output"
8611 func_verbose "creating $NM input file list: $output"
8612 for obj in $save_libobjs; do
8613 func_to_tool_file "$obj"
8614 $ECHO "$func_to_tool_file_result"
8615 done > "$output"
8616 eval cmd=\"$cmd1\"
8617 func_show_eval "$cmd" 'exit $?'
8618 output=$save_output
8619 libobjs=$save_libobjs
8620 skipped_export=false
8621 else
8622 # The command line is too long to execute in one step.
8623 func_verbose "using reloadable object file for export list..."
8624 skipped_export=:
8625 # Break out early, otherwise skipped_export may be
8626 # set to false by a later but shorter cmd.
8627 break
8628 fi
8629 done
8630 IFS="$save_ifs"
8631 if test -n "$export_symbols_regex" && test "X$skipped_export" != "X:"; then
8632 func_show_eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"'
8633 func_show_eval '$MV "${export_symbols}T" "$export_symbols"'
8634 fi
8635 fi
8636 fi
8637
8638 if test -n "$export_symbols" && test -n "$include_expsyms"; then
8639 tmp_export_symbols="$export_symbols"
8640 test -n "$orig_export_symbols" && tmp_export_symbols="$orig_export_symbols"
8641 $opt_dry_run || eval '$ECHO "$include_expsyms" | $SP2NL >> "$tmp_export_symbols"'
8642 fi
8643
8644 if test "X$skipped_export" != "X:" && test -n "$orig_export_symbols"; then
8645 # The given exports_symbols file has to be filtered, so filter it.
8646 func_verbose "filter symbol list for \`$libname.la' to tag DATA exports"
8647 # FIXME: $output_objdir/$libname.filter potentially contains lots of
8648 # 's' commands which not all seds can handle. GNU sed should be fine
8649 # though. Also, the filter scales superlinearly with the number of
8650 # global variables. join(1) would be nice here, but unfortunately
8651 # isn't a blessed tool.
8652 $opt_dry_run || $SED -e '/[ ,]DATA/!d;s,\(.*\)\([ \,].*\),s|^\1$|\1\2|,' < $export_symbols > $output_objdir/$libname.filter
8653 delfiles+=" $export_symbols $output_objdir/$libname.filter"
8654 export_symbols=$output_objdir/$libname.def
8655 $opt_dry_run || $SED -f $output_objdir/$libname.filter < $orig_export_symbols > $export_symbols
8656 fi
8657
8658 tmp_deplibs=
8659 for test_deplib in $deplibs; do
8660 case " $convenience " in
8661 *" $test_deplib "*) ;;
8662 *)
8663 tmp_deplibs+=" $test_deplib"
8664 ;;
8665 esac
8666 done
8667 deplibs="$tmp_deplibs"
8668
8669 if test -n "$convenience"; then
8670 if test -n "$whole_archive_flag_spec" &&
8671 test "$compiler_needs_object" = yes &&
8672 test -z "$libobjs"; then
8673 # extract the archives, so we have objects to list.
8674 # TODO: could optimize this to just extract one archive.
8675 whole_archive_flag_spec=
8676 fi
8677 if test -n "$whole_archive_flag_spec"; then
8678 save_libobjs=$libobjs
8679 eval libobjs=\"\$libobjs $whole_archive_flag_spec\"
8680 test "X$libobjs" = "X " && libobjs=
8681 else
8682 gentop="$output_objdir/${outputname}x"
8683 generated+=" $gentop"
8684
8685 func_extract_archives $gentop $convenience
8686 libobjs+=" $func_extract_archives_result"
8687 test "X$libobjs" = "X " && libobjs=
8688 fi
8689 fi
8690
8691 if test "$thread_safe" = yes && test -n "$thread_safe_flag_spec"; then
8692 eval flag=\"$thread_safe_flag_spec\"
8693 linker_flags+=" $flag"
8694 fi
8695
8696 # Make a backup of the uninstalled library when relinking
8697 if test "$opt_mode" = relink; then
8698 $opt_dry_run || eval '(cd $output_objdir && $RM ${realname}U && $MV $realname ${realname}U)' || exit $?
8699 fi
8700
8701 # Do each of the archive commands.
8702 if test "$module" = yes && test -n "$module_cmds" ; then
8703 if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then
8704 eval test_cmds=\"$module_expsym_cmds\"
8705 cmds=$module_expsym_cmds
8706 else
8707 eval test_cmds=\"$module_cmds\"
8708 cmds=$module_cmds
8709 fi
8710 else
8711 if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
8712 eval test_cmds=\"$archive_expsym_cmds\"
8713 cmds=$archive_expsym_cmds
8714 else
8715 eval test_cmds=\"$archive_cmds\"
8716 cmds=$archive_cmds
8717 fi
8718 fi
8719
8720 if test "X$skipped_export" != "X:" &&
8721 func_len " $test_cmds" &&
8722 len=$func_len_result &&
8723 test "$len" -lt "$max_cmd_len" || test "$max_cmd_len" -le -1; then
8724 :
8725 else
8726 # The command line is too long to link in one step, link piecewise
8727 # or, if using GNU ld and skipped_export is not :, use a linker
8728 # script.
8729
8730 # Save the value of $output and $libobjs because we want to
8731 # use them later. If we have whole_archive_flag_spec, we
8732 # want to use save_libobjs as it was before
8733 # whole_archive_flag_spec was expanded, because we can't
8734 # assume the linker understands whole_archive_flag_spec.
8735 # This may have to be revisited, in case too many
8736 # convenience libraries get linked in and end up exceeding
8737 # the spec.
8738 if test -z "$convenience" || test -z "$whole_archive_flag_spec"; then
8739 save_libobjs=$libobjs
8740 fi
8741 save_output=$output
8742 func_basename "$output"
8743 output_la=$func_basename_result
8744
8745 # Clear the reloadable object creation command queue and
8746 # initialize k to one.
8747 test_cmds=
8748 concat_cmds=
8749 objlist=
8750 last_robj=
8751 k=1
8752
8753 if test -n "$save_libobjs" && test "X$skipped_export" != "X:" && test "$with_gnu_ld" = yes; then
8754 output=${output_objdir}/${output_la}.lnkscript
8755 func_verbose "creating GNU ld script: $output"
8756 echo 'INPUT (' > $output
8757 for obj in $save_libobjs
8758 do
8759 func_to_tool_file "$obj"
8760 $ECHO "$func_to_tool_file_result" >> $output
8761 done
8762 echo ')' >> $output
8763 delfiles+=" $output"
8764 func_to_tool_file "$output"
8765 output=$func_to_tool_file_result
8766 elif test -n "$save_libobjs" && test "X$skipped_export" != "X:" && test "X$file_list_spec" != X; then
8767 output=${output_objdir}/${output_la}.lnk
8768 func_verbose "creating linker input file list: $output"
8769 : > $output
8770 set x $save_libobjs
8771 shift
8772 firstobj=
8773 if test "$compiler_needs_object" = yes; then
8774 firstobj="$1 "
8775 shift
8776 fi
8777 for obj
8778 do
8779 func_to_tool_file "$obj"
8780 $ECHO "$func_to_tool_file_result" >> $output
8781 done
8782 delfiles+=" $output"
8783 func_to_tool_file "$output"
8784 output=$firstobj\"$file_list_spec$func_to_tool_file_result\"
8785 else
8786 if test -n "$save_libobjs"; then
8787 func_verbose "creating reloadable object files..."
8788 output=$output_objdir/$output_la-${k}.$objext
8789 eval test_cmds=\"$reload_cmds\"
8790 func_len " $test_cmds"
8791 len0=$func_len_result
8792 len=$len0
8793
8794 # Loop over the list of objects to be linked.
8795 for obj in $save_libobjs
8796 do
8797 func_len " $obj"
8798 func_arith $len + $func_len_result
8799 len=$func_arith_result
8800 if test "X$objlist" = X ||
8801 test "$len" -lt "$max_cmd_len"; then
8802 objlist+=" $obj"
8803 else
8804 # The command $test_cmds is almost too long, add a
8805 # command to the queue.
8806 if test "$k" -eq 1 ; then
8807 # The first file doesn't have a previous command to add.
8808 reload_objs=$objlist
8809 eval concat_cmds=\"$reload_cmds\"
8810 else
8811 # All subsequent reloadable object files will link in
8812 # the last one created.
8813 reload_objs="$objlist $last_robj"
8814 eval concat_cmds=\"\$concat_cmds~$reload_cmds~\$RM $last_robj\"
8815 fi
8816 last_robj=$output_objdir/$output_la-${k}.$objext
8817 func_arith $k + 1
8818 k=$func_arith_result
8819 output=$output_objdir/$output_la-${k}.$objext
8820 objlist=" $obj"
8821 func_len " $last_robj"
8822 func_arith $len0 + $func_len_result
8823 len=$func_arith_result
8824 fi
8825 done
8826 # Handle the remaining objects by creating one last
8827 # reloadable object file. All subsequent reloadable object
8828 # files will link in the last one created.
8829 test -z "$concat_cmds" || concat_cmds=$concat_cmds~
8830 reload_objs="$objlist $last_robj"
8831 eval concat_cmds=\"\${concat_cmds}$reload_cmds\"
8832 if test -n "$last_robj"; then
8833 eval concat_cmds=\"\${concat_cmds}~\$RM $last_robj\"
8834 fi
8835 delfiles+=" $output"
8836
8837 else
8838 output=
8839 fi
8840
8841 if ${skipped_export-false}; then
8842 func_verbose "generating symbol list for \`$libname.la'"
8843 export_symbols="$output_objdir/$libname.exp"
8844 $opt_dry_run || $RM $export_symbols
8845 libobjs=$output
8846 # Append the command to create the export file.
8847 test -z "$concat_cmds" || concat_cmds=$concat_cmds~
8848 eval concat_cmds=\"\$concat_cmds$export_symbols_cmds\"
8849 if test -n "$last_robj"; then
8850 eval concat_cmds=\"\$concat_cmds~\$RM $last_robj\"
8851 fi
8852 fi
8853
8854 test -n "$save_libobjs" &&
8855 func_verbose "creating a temporary reloadable object file: $output"
8856
8857 # Loop through the commands generated above and execute them.
8858 save_ifs="$IFS"; IFS='~'
8859 for cmd in $concat_cmds; do
8860 IFS="$save_ifs"
8861 $opt_silent || {
8862 func_quote_for_expand "$cmd"
8863 eval "func_echo $func_quote_for_expand_result"
8864 }
8865 $opt_dry_run || eval "$cmd" || {
8866 lt_exit=$?
8867
8868 # Restore the uninstalled library and exit
8869 if test "$opt_mode" = relink; then
8870 ( cd "$output_objdir" && \
8871 $RM "${realname}T" && \
8872 $MV "${realname}U" "$realname" )
8873 fi
8874
8875 exit $lt_exit
8876 }
8877 done
8878 IFS="$save_ifs"
8879
8880 if test -n "$export_symbols_regex" && ${skipped_export-false}; then
8881 func_show_eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"'
8882 func_show_eval '$MV "${export_symbols}T" "$export_symbols"'
8883 fi
8884 fi
8885
8886 if ${skipped_export-false}; then
8887 if test -n "$export_symbols" && test -n "$include_expsyms"; then
8888 tmp_export_symbols="$export_symbols"
8889 test -n "$orig_export_symbols" && tmp_export_symbols="$orig_export_symbols"
8890 $opt_dry_run || eval '$ECHO "$include_expsyms" | $SP2NL >> "$tmp_export_symbols"'
8891 fi
8892
8893 if test -n "$orig_export_symbols"; then
8894 # The given exports_symbols file has to be filtered, so filter it.
8895 func_verbose "filter symbol list for \`$libname.la' to tag DATA exports"
8896 # FIXME: $output_objdir/$libname.filter potentially contains lots of
8897 # 's' commands which not all seds can handle. GNU sed should be fine
8898 # though. Also, the filter scales superlinearly with the number of
8899 # global variables. join(1) would be nice here, but unfortunately
8900 # isn't a blessed tool.
8901 $opt_dry_run || $SED -e '/[ ,]DATA/!d;s,\(.*\)\([ \,].*\),s|^\1$|\1\2|,' < $export_symbols > $output_objdir/$libname.filter
8902 delfiles+=" $export_symbols $output_objdir/$libname.filter"
8903 export_symbols=$output_objdir/$libname.def
8904 $opt_dry_run || $SED -f $output_objdir/$libname.filter < $orig_export_symbols > $export_symbols
8905 fi
8906 fi
8907
8908 libobjs=$output
8909 # Restore the value of output.
8910 output=$save_output
8911
8912 if test -n "$convenience" && test -n "$whole_archive_flag_spec"; then
8913 eval libobjs=\"\$libobjs $whole_archive_flag_spec\"
8914 test "X$libobjs" = "X " && libobjs=
8915 fi
8916 # Expand the library linking commands again to reset the
8917 # value of $libobjs for piecewise linking.
8918
8919 # Do each of the archive commands.
8920 if test "$module" = yes && test -n "$module_cmds" ; then
8921 if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then
8922 cmds=$module_expsym_cmds
8923 else
8924 cmds=$module_cmds
8925 fi
8926 else
8927 if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
8928 cmds=$archive_expsym_cmds
8929 else
8930 cmds=$archive_cmds
8931 fi
8932 fi
8933 fi
8934
8935 if test -n "$delfiles"; then
8936 # Append the command to remove temporary files to $cmds.
8937 eval cmds=\"\$cmds~\$RM $delfiles\"
8938 fi
8939
8940 # Add any objects from preloaded convenience libraries
8941 if test -n "$dlprefiles"; then
8942 gentop="$output_objdir/${outputname}x"
8943 generated+=" $gentop"
8944
8945 func_extract_archives $gentop $dlprefiles
8946 libobjs+=" $func_extract_archives_result"
8947 test "X$libobjs" = "X " && libobjs=
8948 fi
8949
8950 save_ifs="$IFS"; IFS='~'
8951 for cmd in $cmds; do
8952 IFS="$save_ifs"
8953 eval cmd=\"$cmd\"
8954 $opt_silent || {
8955 func_quote_for_expand "$cmd"
8956 eval "func_echo $func_quote_for_expand_result"
8957 }
8958 $opt_dry_run || eval "$cmd" || {
8959 lt_exit=$?
8960
8961 # Restore the uninstalled library and exit
8962 if test "$opt_mode" = relink; then
8963 ( cd "$output_objdir" && \
8964 $RM "${realname}T" && \
8965 $MV "${realname}U" "$realname" )
8966 fi
8967
8968 exit $lt_exit
8969 }
8970 done
8971 IFS="$save_ifs"
8972
8973 # Restore the uninstalled library and exit
8974 if test "$opt_mode" = relink; then
8975 $opt_dry_run || eval '(cd $output_objdir && $RM ${realname}T && $MV $realname ${realname}T && $MV ${realname}U $realname)' || exit $?
8976
8977 if test -n "$convenience"; then
8978 if test -z "$whole_archive_flag_spec"; then
8979 func_show_eval '${RM}r "$gentop"'
8980 fi
8981 fi
8982
8983 exit $EXIT_SUCCESS
8984 fi
8985
8986 # Create links to the real library.
8987 for linkname in $linknames; do
8988 if test "$realname" != "$linkname"; then
8989 func_show_eval '(cd "$output_objdir" && $RM "$linkname" && $LN_S "$realname" "$linkname")' 'exit $?'
8990 fi
8991 done
8992
8993 # If -module or -export-dynamic was specified, set the dlname.
8994 if test "$module" = yes || test "$export_dynamic" = yes; then
8995 # On all known operating systems, these are identical.
8996 dlname="$soname"
8997 fi
8998 fi
8999 ;;
9000
9001 obj)
9002 if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
9003 func_warning "\`-dlopen' is ignored for objects"
9004 fi
9005
9006 case " $deplibs" in
9007 *\ -l* | *\ -L*)
9008 func_warning "\`-l' and \`-L' are ignored for objects" ;;
9009 esac
9010
9011 test -n "$rpath" && \
9012 func_warning "\`-rpath' is ignored for objects"
9013
9014 test -n "$xrpath" && \
9015 func_warning "\`-R' is ignored for objects"
9016
9017 test -n "$vinfo" && \
9018 func_warning "\`-version-info' is ignored for objects"
9019
9020 test -n "$release" && \
9021 func_warning "\`-release' is ignored for objects"
9022
9023 case $output in
9024 *.lo)
9025 test -n "$objs$old_deplibs" && \
9026 func_fatal_error "cannot build library object \`$output' from non-libtool objects"
9027
9028 libobj=$output
9029 func_lo2o "$libobj"
9030 obj=$func_lo2o_result
9031 ;;
9032 *)
9033 libobj=
9034 obj="$output"
9035 ;;
9036 esac
9037
9038 # Delete the old objects.
9039 $opt_dry_run || $RM $obj $libobj
9040
9041 # Objects from convenience libraries. This assumes
9042 # single-version convenience libraries. Whenever we create
9043 # different ones for PIC/non-PIC, this we'll have to duplicate
9044 # the extraction.
9045 reload_conv_objs=
9046 gentop=
9047 # reload_cmds runs $LD directly, so let us get rid of
9048 # -Wl from whole_archive_flag_spec and hope we can get by with
9049 # turning comma into space..
9050 wl=
9051
9052 if test -n "$convenience"; then
9053 if test -n "$whole_archive_flag_spec"; then
9054 eval tmp_whole_archive_flags=\"$whole_archive_flag_spec\"
9055 reload_conv_objs=$reload_objs\ `$ECHO "$tmp_whole_archive_flags" | $SED 's|,| |g'`
9056 else
9057 gentop="$output_objdir/${obj}x"
9058 generated+=" $gentop"
9059
9060 func_extract_archives $gentop $convenience
9061 reload_conv_objs="$reload_objs $func_extract_archives_result"
9062 fi
9063 fi
9064
9065 # If we're not building shared, we need to use non_pic_objs
9066 test "$build_libtool_libs" != yes && libobjs="$non_pic_objects"
9067
9068 # Create the old-style object.
9069 reload_objs="$objs$old_deplibs "`$ECHO "$libobjs" | $SP2NL | $SED "/\.${libext}$/d; /\.lib$/d; $lo2o" | $NL2SP`" $reload_conv_objs" ### testsuite: skip nested quoting test
9070
9071 output="$obj"
9072 func_execute_cmds "$reload_cmds" 'exit $?'
9073
9074 # Exit if we aren't doing a library object file.
9075 if test -z "$libobj"; then
9076 if test -n "$gentop"; then
9077 func_show_eval '${RM}r "$gentop"'
9078 fi
9079
9080 exit $EXIT_SUCCESS
9081 fi
9082
9083 if test "$build_libtool_libs" != yes; then
9084 if test -n "$gentop"; then
9085 func_show_eval '${RM}r "$gentop"'
9086 fi
9087
9088 # Create an invalid libtool object if no PIC, so that we don't
9089 # accidentally link it into a program.
9090 # $show "echo timestamp > $libobj"
9091 # $opt_dry_run || eval "echo timestamp > $libobj" || exit $?
9092 exit $EXIT_SUCCESS
9093 fi
9094
9095 if test -n "$pic_flag" || test "$pic_mode" != default; then
9096 # Only do commands if we really have different PIC objects.
9097 reload_objs="$libobjs $reload_conv_objs"
9098 output="$libobj"
9099 func_execute_cmds "$reload_cmds" 'exit $?'
9100 fi
9101
9102 if test -n "$gentop"; then
9103 func_show_eval '${RM}r "$gentop"'
9104 fi
9105
9106 exit $EXIT_SUCCESS
9107 ;;
9108
9109 prog)
9110 case $host in
9111 *cygwin*) func_stripname '' '.exe' "$output"
9112 output=$func_stripname_result.exe;;
9113 esac
9114 test -n "$vinfo" && \
9115 func_warning "\`-version-info' is ignored for programs"
9116
9117 test -n "$release" && \
9118 func_warning "\`-release' is ignored for programs"
9119
9120 test "$preload" = yes \
9121 && test "$dlopen_support" = unknown \
9122 && test "$dlopen_self" = unknown \
9123 && test "$dlopen_self_static" = unknown && \
9124 func_warning "\`LT_INIT([dlopen])' not used. Assuming no dlopen support."
9125
9126 case $host in
9127 *-*-rhapsody* | *-*-darwin1.[012])
9128 # On Rhapsody replace the C library is the System framework
9129 compile_deplibs=`$ECHO " $compile_deplibs" | $SED 's/ -lc / System.ltframework /'`
9130 finalize_deplibs=`$ECHO " $finalize_deplibs" | $SED 's/ -lc / System.ltframework /'`
9131 ;;
9132 esac
9133
9134 case $host in
9135 *-*-darwin*)
9136 # Don't allow lazy linking, it breaks C++ global constructors
9137 # But is supposedly fixed on 10.4 or later (yay!).
9138 if test "$tagname" = CXX ; then
9139 case ${MACOSX_DEPLOYMENT_TARGET-10.0} in
9140 10.[0123])
9141 compile_command+=" ${wl}-bind_at_load"
9142 finalize_command+=" ${wl}-bind_at_load"
9143 ;;
9144 esac
9145 fi
9146 # Time to change all our "foo.ltframework" stuff back to "-framework foo"
9147 compile_deplibs=`$ECHO " $compile_deplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
9148 finalize_deplibs=`$ECHO " $finalize_deplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
9149 ;;
9150 esac
9151
9152
9153 # move library search paths that coincide with paths to not yet
9154 # installed libraries to the beginning of the library search list
9155 new_libs=
9156 for path in $notinst_path; do
9157 case " $new_libs " in
9158 *" -L$path/$objdir "*) ;;
9159 *)
9160 case " $compile_deplibs " in
9161 *" -L$path/$objdir "*)
9162 new_libs+=" -L$path/$objdir" ;;
9163 esac
9164 ;;
9165 esac
9166 done
9167 for deplib in $compile_deplibs; do
9168 case $deplib in
9169 -L*)
9170 case " $new_libs " in
9171 *" $deplib "*) ;;
9172 *) new_libs+=" $deplib" ;;
9173 esac
9174 ;;
9175 *) new_libs+=" $deplib" ;;
9176 esac
9177 done
9178 compile_deplibs="$new_libs"
9179
9180
9181 compile_command+=" $compile_deplibs"
9182 finalize_command+=" $finalize_deplibs"
9183
9184 if test -n "$rpath$xrpath"; then
9185 # If the user specified any rpath flags, then add them.
9186 for libdir in $rpath $xrpath; do
9187 # This is the magic to use -rpath.
9188 case "$finalize_rpath " in
9189 *" $libdir "*) ;;
9190 *) finalize_rpath+=" $libdir" ;;
9191 esac
9192 done
9193 fi
9194
9195 # Now hardcode the library paths
9196 rpath=
9197 hardcode_libdirs=
9198 for libdir in $compile_rpath $finalize_rpath; do
9199 if test -n "$hardcode_libdir_flag_spec"; then
9200 if test -n "$hardcode_libdir_separator"; then
9201 if test -z "$hardcode_libdirs"; then
9202 hardcode_libdirs="$libdir"
9203 else
9204 # Just accumulate the unique libdirs.
9205 case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
9206 *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
9207 ;;
9208 *)
9209 hardcode_libdirs+="$hardcode_libdir_separator$libdir"
9210 ;;
9211 esac
9212 fi
9213 else
9214 eval flag=\"$hardcode_libdir_flag_spec\"
9215 rpath+=" $flag"
9216 fi
9217 elif test -n "$runpath_var"; then
9218 case "$perm_rpath " in
9219 *" $libdir "*) ;;
9220 *) perm_rpath+=" $libdir" ;;
9221 esac
9222 fi
9223 case $host in
9224 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*)
9225 testbindir=`${ECHO} "$libdir" | ${SED} -e 's*/lib$*/bin*'`
9226 case :$dllsearchpath: in
9227 *":$libdir:"*) ;;
9228 ::) dllsearchpath=$libdir;;
9229 *) dllsearchpath+=":$libdir";;
9230 esac
9231 case :$dllsearchpath: in
9232 *":$testbindir:"*) ;;
9233 ::) dllsearchpath=$testbindir;;
9234 *) dllsearchpath+=":$testbindir";;
9235 esac
9236 ;;
9237 esac
9238 done
9239 # Substitute the hardcoded libdirs into the rpath.
9240 if test -n "$hardcode_libdir_separator" &&
9241 test -n "$hardcode_libdirs"; then
9242 libdir="$hardcode_libdirs"
9243 eval rpath=\" $hardcode_libdir_flag_spec\"
9244 fi
9245 compile_rpath="$rpath"
9246
9247 rpath=
9248 hardcode_libdirs=
9249 for libdir in $finalize_rpath; do
9250 if test -n "$hardcode_libdir_flag_spec"; then
9251 if test -n "$hardcode_libdir_separator"; then
9252 if test -z "$hardcode_libdirs"; then
9253 hardcode_libdirs="$libdir"
9254 else
9255 # Just accumulate the unique libdirs.
9256 case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
9257 *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
9258 ;;
9259 *)
9260 hardcode_libdirs+="$hardcode_libdir_separator$libdir"
9261 ;;
9262 esac
9263 fi
9264 else
9265 eval flag=\"$hardcode_libdir_flag_spec\"
9266 rpath+=" $flag"
9267 fi
9268 elif test -n "$runpath_var"; then
9269 case "$finalize_perm_rpath " in
9270 *" $libdir "*) ;;
9271 *) finalize_perm_rpath+=" $libdir" ;;
9272 esac
9273 fi
9274 done
9275 # Substitute the hardcoded libdirs into the rpath.
9276 if test -n "$hardcode_libdir_separator" &&
9277 test -n "$hardcode_libdirs"; then
9278 libdir="$hardcode_libdirs"
9279 eval rpath=\" $hardcode_libdir_flag_spec\"
9280 fi
9281 finalize_rpath="$rpath"
9282
9283 if test -n "$libobjs" && test "$build_old_libs" = yes; then
9284 # Transform all the library objects into standard objects.
9285 compile_command=`$ECHO "$compile_command" | $SP2NL | $SED "$lo2o" | $NL2SP`
9286 finalize_command=`$ECHO "$finalize_command" | $SP2NL | $SED "$lo2o" | $NL2SP`
9287 fi
9288
9289 func_generate_dlsyms "$outputname" "@PROGRAM@" "no"
9290
9291 # template prelinking step
9292 if test -n "$prelink_cmds"; then
9293 func_execute_cmds "$prelink_cmds" 'exit $?'
9294 fi
9295
9296 wrappers_required=yes
9297 case $host in
9298 *cegcc* | *mingw32ce*)
9299 # Disable wrappers for cegcc and mingw32ce hosts, we are cross compiling anyway.
9300 wrappers_required=no
9301 ;;
9302 *cygwin* | *mingw* )
9303 if test "$build_libtool_libs" != yes; then
9304 wrappers_required=no
9305 fi
9306 ;;
9307 *)
9308 if test "$need_relink" = no || test "$build_libtool_libs" != yes; then
9309 wrappers_required=no
9310 fi
9311 ;;
9312 esac
9313 if test "$wrappers_required" = no; then
9314 # Replace the output file specification.
9315 compile_command=`$ECHO "$compile_command" | $SED 's%@OUTPUT@%'"$output"'%g'`
9316 link_command="$compile_command$compile_rpath"
9317
9318 # We have no uninstalled library dependencies, so finalize right now.
9319 exit_status=0
9320 func_show_eval "$link_command" 'exit_status=$?'
9321
9322 if test -n "$postlink_cmds"; then
9323 func_to_tool_file "$output"
9324 postlink_cmds=`func_echo_all "$postlink_cmds" | $SED -e 's%@OUTPUT@%'"$output"'%g' -e 's%@TOOL_OUTPUT@%'"$func_to_tool_file_result"'%g'`
9325 func_execute_cmds "$postlink_cmds" 'exit $?'
9326 fi
9327
9328 # Delete the generated files.
9329 if test -f "$output_objdir/${outputname}S.${objext}"; then
9330 func_show_eval '$RM "$output_objdir/${outputname}S.${objext}"'
9331 fi
9332
9333 exit $exit_status
9334 fi
9335
9336 if test -n "$compile_shlibpath$finalize_shlibpath"; then
9337 compile_command="$shlibpath_var=\"$compile_shlibpath$finalize_shlibpath\$$shlibpath_var\" $compile_command"
9338 fi
9339 if test -n "$finalize_shlibpath"; then
9340 finalize_command="$shlibpath_var=\"$finalize_shlibpath\$$shlibpath_var\" $finalize_command"
9341 fi
9342
9343 compile_var=
9344 finalize_var=
9345 if test -n "$runpath_var"; then
9346 if test -n "$perm_rpath"; then
9347 # We should set the runpath_var.
9348 rpath=
9349 for dir in $perm_rpath; do
9350 rpath+="$dir:"
9351 done
9352 compile_var="$runpath_var=\"$rpath\$$runpath_var\" "
9353 fi
9354 if test -n "$finalize_perm_rpath"; then
9355 # We should set the runpath_var.
9356 rpath=
9357 for dir in $finalize_perm_rpath; do
9358 rpath+="$dir:"
9359 done
9360 finalize_var="$runpath_var=\"$rpath\$$runpath_var\" "
9361 fi
9362 fi
9363
9364 if test "$no_install" = yes; then
9365 # We don't need to create a wrapper script.
9366 link_command="$compile_var$compile_command$compile_rpath"
9367 # Replace the output file specification.
9368 link_command=`$ECHO "$link_command" | $SED 's%@OUTPUT@%'"$output"'%g'`
9369 # Delete the old output file.
9370 $opt_dry_run || $RM $output
9371 # Link the executable and exit
9372 func_show_eval "$link_command" 'exit $?'
9373
9374 if test -n "$postlink_cmds"; then
9375 func_to_tool_file "$output"
9376 postlink_cmds=`func_echo_all "$postlink_cmds" | $SED -e 's%@OUTPUT@%'"$output"'%g' -e 's%@TOOL_OUTPUT@%'"$func_to_tool_file_result"'%g'`
9377 func_execute_cmds "$postlink_cmds" 'exit $?'
9378 fi
9379
9380 exit $EXIT_SUCCESS
9381 fi
9382
9383 if test "$hardcode_action" = relink; then
9384 # Fast installation is not supported
9385 link_command="$compile_var$compile_command$compile_rpath"
9386 relink_command="$finalize_var$finalize_command$finalize_rpath"
9387
9388 func_warning "this platform does not like uninstalled shared libraries"
9389 func_warning "\`$output' will be relinked during installation"
9390 else
9391 if test "$fast_install" != no; then
9392 link_command="$finalize_var$compile_command$finalize_rpath"
9393 if test "$fast_install" = yes; then
9394 relink_command=`$ECHO "$compile_var$compile_command$compile_rpath" | $SED 's%@OUTPUT@%\$progdir/\$file%g'`
9395 else
9396 # fast_install is set to needless
9397 relink_command=
9398 fi
9399 else
9400 link_command="$compile_var$compile_command$compile_rpath"
9401 relink_command="$finalize_var$finalize_command$finalize_rpath"
9402 fi
9403 fi
9404
9405 # Replace the output file specification.
9406 link_command=`$ECHO "$link_command" | $SED 's%@OUTPUT@%'"$output_objdir/$outputname"'%g'`
9407
9408 # Delete the old output files.
9409 $opt_dry_run || $RM $output $output_objdir/$outputname $output_objdir/lt-$outputname
9410
9411 func_show_eval "$link_command" 'exit $?'
9412
9413 if test -n "$postlink_cmds"; then
9414 func_to_tool_file "$output_objdir/$outputname"
9415 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'`
9416 func_execute_cmds "$postlink_cmds" 'exit $?'
9417 fi
9418
9419 # Now create the wrapper script.
9420 func_verbose "creating $output"
9421
9422 # Quote the relink command for shipping.
9423 if test -n "$relink_command"; then
9424 # Preserve any variables that may affect compiler behavior
9425 for var in $variables_saved_for_relink; do
9426 if eval test -z \"\${$var+set}\"; then
9427 relink_command="{ test -z \"\${$var+set}\" || $lt_unset $var || { $var=; export $var; }; }; $relink_command"
9428 elif eval var_value=\$$var; test -z "$var_value"; then
9429 relink_command="$var=; export $var; $relink_command"
9430 else
9431 func_quote_for_eval "$var_value"
9432 relink_command="$var=$func_quote_for_eval_result; export $var; $relink_command"
9433 fi
9434 done
9435 relink_command="(cd `pwd`; $relink_command)"
9436 relink_command=`$ECHO "$relink_command" | $SED "$sed_quote_subst"`
9437 fi
9438
9439 # Only actually do things if not in dry run mode.
9440 $opt_dry_run || {
9441 # win32 will think the script is a binary if it has
9442 # a .exe suffix, so we strip it off here.
9443 case $output in
9444 *.exe) func_stripname '' '.exe' "$output"
9445 output=$func_stripname_result ;;
9446 esac
9447 # test for cygwin because mv fails w/o .exe extensions
9448 case $host in
9449 *cygwin*)
9450 exeext=.exe
9451 func_stripname '' '.exe' "$outputname"
9452 outputname=$func_stripname_result ;;
9453 *) exeext= ;;
9454 esac
9455 case $host in
9456 *cygwin* | *mingw* )
9457 func_dirname_and_basename "$output" "" "."
9458 output_name=$func_basename_result
9459 output_path=$func_dirname_result
9460 cwrappersource="$output_path/$objdir/lt-$output_name.c"
9461 cwrapper="$output_path/$output_name.exe"
9462 $RM $cwrappersource $cwrapper
9463 trap "$RM $cwrappersource $cwrapper; exit $EXIT_FAILURE" 1 2 15
9464
9465 func_emit_cwrapperexe_src > $cwrappersource
9466
9467 # The wrapper executable is built using the $host compiler,
9468 # because it contains $host paths and files. If cross-
9469 # compiling, it, like the target executable, must be
9470 # executed on the $host or under an emulation environment.
9471 $opt_dry_run || {
9472 $LTCC $LTCFLAGS -o $cwrapper $cwrappersource
9473 $STRIP $cwrapper
9474 }
9475
9476 # Now, create the wrapper script for func_source use:
9477 func_ltwrapper_scriptname $cwrapper
9478 $RM $func_ltwrapper_scriptname_result
9479 trap "$RM $func_ltwrapper_scriptname_result; exit $EXIT_FAILURE" 1 2 15
9480 $opt_dry_run || {
9481 # note: this script will not be executed, so do not chmod.
9482 if test "x$build" = "x$host" ; then
9483 $cwrapper --lt-dump-script > $func_ltwrapper_scriptname_result
9484 else
9485 func_emit_wrapper no > $func_ltwrapper_scriptname_result
9486 fi
9487 }
9488 ;;
9489 * )
9490 $RM $output
9491 trap "$RM $output; exit $EXIT_FAILURE" 1 2 15
9492
9493 func_emit_wrapper no > $output
9494 chmod +x $output
9495 ;;
9496 esac
9497 }
9498 exit $EXIT_SUCCESS
9499 ;;
9500 esac
9501
9502 # See if we need to build an old-fashioned archive.
9503 for oldlib in $oldlibs; do
9504
9505 if test "$build_libtool_libs" = convenience; then
9506 oldobjs="$libobjs_save $symfileobj"
9507 addlibs="$convenience"
9508 build_libtool_libs=no
9509 else
9510 if test "$build_libtool_libs" = module; then
9511 oldobjs="$libobjs_save"
9512 build_libtool_libs=no
9513 else
9514 oldobjs="$old_deplibs $non_pic_objects"
9515 if test "$preload" = yes && test -f "$symfileobj"; then
9516 oldobjs+=" $symfileobj"
9517 fi
9518 fi
9519 addlibs="$old_convenience"
9520 fi
9521
9522 if test -n "$addlibs"; then
9523 gentop="$output_objdir/${outputname}x"
9524 generated+=" $gentop"
9525
9526 func_extract_archives $gentop $addlibs
9527 oldobjs+=" $func_extract_archives_result"
9528 fi
9529
9530 # Do each command in the archive commands.
9531 if test -n "$old_archive_from_new_cmds" && test "$build_libtool_libs" = yes; then
9532 cmds=$old_archive_from_new_cmds
9533 else
9534
9535 # Add any objects from preloaded convenience libraries
9536 if test -n "$dlprefiles"; then
9537 gentop="$output_objdir/${outputname}x"
9538 generated+=" $gentop"
9539
9540 func_extract_archives $gentop $dlprefiles
9541 oldobjs+=" $func_extract_archives_result"
9542 fi
9543
9544 # POSIX demands no paths to be encoded in archives. We have
9545 # to avoid creating archives with duplicate basenames if we
9546 # might have to extract them afterwards, e.g., when creating a
9547 # static archive out of a convenience library, or when linking
9548 # the entirety of a libtool archive into another (currently
9549 # not supported by libtool).
9550 if (for obj in $oldobjs
9551 do
9552 func_basename "$obj"
9553 $ECHO "$func_basename_result"
9554 done | sort | sort -uc >/dev/null 2>&1); then
9555 :
9556 else
9557 echo "copying selected object files to avoid basename conflicts..."
9558 gentop="$output_objdir/${outputname}x"
9559 generated+=" $gentop"
9560 func_mkdir_p "$gentop"
9561 save_oldobjs=$oldobjs
9562 oldobjs=
9563 counter=1
9564 for obj in $save_oldobjs
9565 do
9566 func_basename "$obj"
9567 objbase="$func_basename_result"
9568 case " $oldobjs " in
9569 " ") oldobjs=$obj ;;
9570 *[\ /]"$objbase "*)
9571 while :; do
9572 # Make sure we don't pick an alternate name that also
9573 # overlaps.
9574 newobj=lt$counter-$objbase
9575 func_arith $counter + 1
9576 counter=$func_arith_result
9577 case " $oldobjs " in
9578 *[\ /]"$newobj "*) ;;
9579 *) if test ! -f "$gentop/$newobj"; then break; fi ;;
9580 esac
9581 done
9582 func_show_eval "ln $obj $gentop/$newobj || cp $obj $gentop/$newobj"
9583 oldobjs+=" $gentop/$newobj"
9584 ;;
9585 *) oldobjs+=" $obj" ;;
9586 esac
9587 done
9588 fi
9589 func_to_tool_file "$oldlib" func_convert_file_msys_to_w32
9590 tool_oldlib=$func_to_tool_file_result
9591 eval cmds=\"$old_archive_cmds\"
9592
9593 func_len " $cmds"
9594 len=$func_len_result
9595 if test "$len" -lt "$max_cmd_len" || test "$max_cmd_len" -le -1; then
9596 cmds=$old_archive_cmds
9597 elif test -n "$archiver_list_spec"; then
9598 func_verbose "using command file archive linking..."
9599 for obj in $oldobjs
9600 do
9601 func_to_tool_file "$obj"
9602 $ECHO "$func_to_tool_file_result"
9603 done > $output_objdir/$libname.libcmd
9604 func_to_tool_file "$output_objdir/$libname.libcmd"
9605 oldobjs=" $archiver_list_spec$func_to_tool_file_result"
9606 cmds=$old_archive_cmds
9607 else
9608 # the command line is too long to link in one step, link in parts
9609 func_verbose "using piecewise archive linking..."
9610 save_RANLIB=$RANLIB
9611 RANLIB=:
9612 objlist=
9613 concat_cmds=
9614 save_oldobjs=$oldobjs
9615 oldobjs=
9616 # Is there a better way of finding the last object in the list?
9617 for obj in $save_oldobjs
9618 do
9619 last_oldobj=$obj
9620 done
9621 eval test_cmds=\"$old_archive_cmds\"
9622 func_len " $test_cmds"
9623 len0=$func_len_result
9624 len=$len0
9625 for obj in $save_oldobjs
9626 do
9627 func_len " $obj"
9628 func_arith $len + $func_len_result
9629 len=$func_arith_result
9630 objlist+=" $obj"
9631 if test "$len" -lt "$max_cmd_len"; then
9632 :
9633 else
9634 # the above command should be used before it gets too long
9635 oldobjs=$objlist
9636 if test "$obj" = "$last_oldobj" ; then
9637 RANLIB=$save_RANLIB
9638 fi
9639 test -z "$concat_cmds" || concat_cmds=$concat_cmds~
9640 eval concat_cmds=\"\${concat_cmds}$old_archive_cmds\"
9641 objlist=
9642 len=$len0
9643 fi
9644 done
9645 RANLIB=$save_RANLIB
9646 oldobjs=$objlist
9647 if test "X$oldobjs" = "X" ; then
9648 eval cmds=\"\$concat_cmds\"
9649 else
9650 eval cmds=\"\$concat_cmds~\$old_archive_cmds\"
9651 fi
9652 fi
9653 fi
9654 func_execute_cmds "$cmds" 'exit $?'
9655 done
9656
9657 test -n "$generated" && \
9658 func_show_eval "${RM}r$generated"
9659
9660 # Now create the libtool archive.
9661 case $output in
9662 *.la)
9663 old_library=
9664 test "$build_old_libs" = yes && old_library="$libname.$libext"
9665 func_verbose "creating $output"
9666
9667 # Preserve any variables that may affect compiler behavior
9668 for var in $variables_saved_for_relink; do
9669 if eval test -z \"\${$var+set}\"; then
9670 relink_command="{ test -z \"\${$var+set}\" || $lt_unset $var || { $var=; export $var; }; }; $relink_command"
9671 elif eval var_value=\$$var; test -z "$var_value"; then
9672 relink_command="$var=; export $var; $relink_command"
9673 else
9674 func_quote_for_eval "$var_value"
9675 relink_command="$var=$func_quote_for_eval_result; export $var; $relink_command"
9676 fi
9677 done
9678 # Quote the link command for shipping.
9679 relink_command="(cd `pwd`; $SHELL $progpath $preserve_args --mode=relink $libtool_args @inst_prefix_dir@)"
9680 relink_command=`$ECHO "$relink_command" | $SED "$sed_quote_subst"`
9681 if test "$hardcode_automatic" = yes ; then
9682 relink_command=
9683 fi
9684
9685 # Only create the output if not a dry run.
9686 $opt_dry_run || {
9687 for installed in no yes; do
9688 if test "$installed" = yes; then
9689 if test -z "$install_libdir"; then
9690 break
9691 fi
9692 output="$output_objdir/$outputname"i
9693 # Replace all uninstalled libtool libraries with the installed ones
9694 newdependency_libs=
9695 for deplib in $dependency_libs; do
9696 case $deplib in
9697 *.la)
9698 func_basename "$deplib"
9699 name="$func_basename_result"
9700 func_resolve_sysroot "$deplib"
9701 eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $func_resolve_sysroot_result`
9702 test -z "$libdir" && \
9703 func_fatal_error "\`$deplib' is not a valid libtool archive"
9704 newdependency_libs+=" ${lt_sysroot:+=}$libdir/$name"
9705 ;;
9706 -L*)
9707 func_stripname -L '' "$deplib"
9708 func_replace_sysroot "$func_stripname_result"
9709 newdependency_libs+=" -L$func_replace_sysroot_result"
9710 ;;
9711 -R*)
9712 func_stripname -R '' "$deplib"
9713 func_replace_sysroot "$func_stripname_result"
9714 newdependency_libs+=" -R$func_replace_sysroot_result"
9715 ;;
9716 *) newdependency_libs+=" $deplib" ;;
9717 esac
9718 done
9719 dependency_libs="$newdependency_libs"
9720 newdlfiles=
9721
9722 for lib in $dlfiles; do
9723 case $lib in
9724 *.la)
9725 func_basename "$lib"
9726 name="$func_basename_result"
9727 eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
9728 test -z "$libdir" && \
9729 func_fatal_error "\`$lib' is not a valid libtool archive"
9730 newdlfiles+=" ${lt_sysroot:+=}$libdir/$name"
9731 ;;
9732 *) newdlfiles+=" $lib" ;;
9733 esac
9734 done
9735 dlfiles="$newdlfiles"
9736 newdlprefiles=
9737 for lib in $dlprefiles; do
9738 case $lib in
9739 *.la)
9740 # Only pass preopened files to the pseudo-archive (for
9741 # eventual linking with the app. that links it) if we
9742 # didn't already link the preopened objects directly into
9743 # the library:
9744 func_basename "$lib"
9745 name="$func_basename_result"
9746 eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
9747 test -z "$libdir" && \
9748 func_fatal_error "\`$lib' is not a valid libtool archive"
9749 newdlprefiles+=" ${lt_sysroot:+=}$libdir/$name"
9750 ;;
9751 esac
9752 done
9753 dlprefiles="$newdlprefiles"
9754 else
9755 newdlfiles=
9756 for lib in $dlfiles; do
9757 case $lib in
9758 [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;;
9759 *) abs=`pwd`"/$lib" ;;
9760 esac
9761 newdlfiles+=" $abs"
9762 done
9763 dlfiles="$newdlfiles"
9764 newdlprefiles=
9765 for lib in $dlprefiles; do
9766 case $lib in
9767 [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;;
9768 *) abs=`pwd`"/$lib" ;;
9769 esac
9770 newdlprefiles+=" $abs"
9771 done
9772 dlprefiles="$newdlprefiles"
9773 fi
9774 $RM $output
9775 # place dlname in correct position for cygwin
9776 # In fact, it would be nice if we could use this code for all target
9777 # systems that can't hard-code library paths into their executables
9778 # and that have no shared library path variable independent of PATH,
9779 # but it turns out we can't easily determine that from inspecting
9780 # libtool variables, so we have to hard-code the OSs to which it
9781 # applies here; at the moment, that means platforms that use the PE
9782 # object format with DLL files. See the long comment at the top of
9783 # tests/bindir.at for full details.
9784 tdlname=$dlname
9785 case $host,$output,$installed,$module,$dlname in
9786 *cygwin*,*lai,yes,no,*.dll | *mingw*,*lai,yes,no,*.dll | *cegcc*,*lai,yes,no,*.dll)
9787 # If a -bindir argument was supplied, place the dll there.
9788 if test "x$bindir" != x ;
9789 then
9790 func_relative_path "$install_libdir" "$bindir"
9791 tdlname=$func_relative_path_result$dlname
9792 else
9793 # Otherwise fall back on heuristic.
9794 tdlname=../bin/$dlname
9795 fi
9796 ;;
9797 esac
9798 $ECHO > $output "\
9799 # $outputname - a libtool library file
9800 # Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION
9801 #
9802 # Please DO NOT delete this file!
9803 # It is necessary for linking the library.
9804
9805 # The name that we can dlopen(3).
9806 dlname='$tdlname'
9807
9808 # Names of this library.
9809 library_names='$library_names'
9810
9811 # The name of the static archive.
9812 old_library='$old_library'
9813
9814 # Linker flags that can not go in dependency_libs.
9815 inherited_linker_flags='$new_inherited_linker_flags'
9816
9817 # Libraries that this one depends upon.
9818 dependency_libs='$dependency_libs'
9819
9820 # Names of additional weak libraries provided by this library
9821 weak_library_names='$weak_libs'
9822
9823 # Version information for $libname.
9824 current=$current
9825 age=$age
9826 revision=$revision
9827
9828 # Is this an already installed library?
9829 installed=$installed
9830
9831 # Should we warn about portability when linking against -modules?
9832 shouldnotlink=$module
9833
9834 # Files to dlopen/dlpreopen
9835 dlopen='$dlfiles'
9836 dlpreopen='$dlprefiles'
9837
9838 # Directory that this library needs to be installed in:
9839 libdir='$install_libdir'"
9840 if test "$installed" = no && test "$need_relink" = yes; then
9841 $ECHO >> $output "\
9842 relink_command=\"$relink_command\""
9843 fi
9844 done
9845 }
9846
9847 # Do a symbolic link so that the libtool archive can be found in
9848 # LD_LIBRARY_PATH before the program is installed.
9849 func_show_eval '( cd "$output_objdir" && $RM "$outputname" && $LN_S "../$outputname" "$outputname" )' 'exit $?'
9850 ;;
9851 esac
9852 exit $EXIT_SUCCESS
9853 }
9854
9855 { test "$opt_mode" = link || test "$opt_mode" = relink; } &&
9856 func_mode_link ${1+"$@"}
9857
9858
9859 # func_mode_uninstall arg...
9860 func_mode_uninstall ()
9861 {
9862 $opt_debug
9863 RM="$nonopt"
9864 files=
9865 rmforce=
9866 exit_status=0
9867
9868 # This variable tells wrapper scripts just to set variables rather
9869 # than running their programs.
9870 libtool_install_magic="$magic"
9871
9872 for arg
9873 do
9874 case $arg in
9875 -f) RM+=" $arg"; rmforce=yes ;;
9876 -*) RM+=" $arg" ;;
9877 *) files+=" $arg" ;;
9878 esac
9879 done
9880
9881 test -z "$RM" && \
9882 func_fatal_help "you must specify an RM program"
9883
9884 rmdirs=
9885
9886 for file in $files; do
9887 func_dirname "$file" "" "."
9888 dir="$func_dirname_result"
9889 if test "X$dir" = X.; then
9890 odir="$objdir"
9891 else
9892 odir="$dir/$objdir"
9893 fi
9894 func_basename "$file"
9895 name="$func_basename_result"
9896 test "$opt_mode" = uninstall && odir="$dir"
9897
9898 # Remember odir for removal later, being careful to avoid duplicates
9899 if test "$opt_mode" = clean; then
9900 case " $rmdirs " in
9901 *" $odir "*) ;;
9902 *) rmdirs+=" $odir" ;;
9903 esac
9904 fi
9905
9906 # Don't error if the file doesn't exist and rm -f was used.
9907 if { test -L "$file"; } >/dev/null 2>&1 ||
9908 { test -h "$file"; } >/dev/null 2>&1 ||
9909 test -f "$file"; then
9910 :
9911 elif test -d "$file"; then
9912 exit_status=1
9913 continue
9914 elif test "$rmforce" = yes; then
9915 continue
9916 fi
9917
9918 rmfiles="$file"
9919
9920 case $name in
9921 *.la)
9922 # Possibly a libtool archive, so verify it.
9923 if func_lalib_p "$file"; then
9924 func_source $dir/$name
9925
9926 # Delete the libtool libraries and symlinks.
9927 for n in $library_names; do
9928 rmfiles+=" $odir/$n"
9929 done
9930 test -n "$old_library" && rmfiles+=" $odir/$old_library"
9931
9932 case "$opt_mode" in
9933 clean)
9934 case " $library_names " in
9935 *" $dlname "*) ;;
9936 *) test -n "$dlname" && rmfiles+=" $odir/$dlname" ;;
9937 esac
9938 test -n "$libdir" && rmfiles+=" $odir/$name $odir/${name}i"
9939 ;;
9940 uninstall)
9941 if test -n "$library_names"; then
9942 # Do each command in the postuninstall commands.
9943 func_execute_cmds "$postuninstall_cmds" 'test "$rmforce" = yes || exit_status=1'
9944 fi
9945
9946 if test -n "$old_library"; then
9947 # Do each command in the old_postuninstall commands.
9948 func_execute_cmds "$old_postuninstall_cmds" 'test "$rmforce" = yes || exit_status=1'
9949 fi
9950 # FIXME: should reinstall the best remaining shared library.
9951 ;;
9952 esac
9953 fi
9954 ;;
9955
9956 *.lo)
9957 # Possibly a libtool object, so verify it.
9958 if func_lalib_p "$file"; then
9959
9960 # Read the .lo file
9961 func_source $dir/$name
9962
9963 # Add PIC object to the list of files to remove.
9964 if test -n "$pic_object" &&
9965 test "$pic_object" != none; then
9966 rmfiles+=" $dir/$pic_object"
9967 fi
9968
9969 # Add non-PIC object to the list of files to remove.
9970 if test -n "$non_pic_object" &&
9971 test "$non_pic_object" != none; then
9972 rmfiles+=" $dir/$non_pic_object"
9973 fi
9974 fi
9975 ;;
9976
9977 *)
9978 if test "$opt_mode" = clean ; then
9979 noexename=$name
9980 case $file in
9981 *.exe)
9982 func_stripname '' '.exe' "$file"
9983 file=$func_stripname_result
9984 func_stripname '' '.exe' "$name"
9985 noexename=$func_stripname_result
9986 # $file with .exe has already been added to rmfiles,
9987 # add $file without .exe
9988 rmfiles+=" $file"
9989 ;;
9990 esac
9991 # Do a test to see if this is a libtool program.
9992 if func_ltwrapper_p "$file"; then
9993 if func_ltwrapper_executable_p "$file"; then
9994 func_ltwrapper_scriptname "$file"
9995 relink_command=
9996 func_source $func_ltwrapper_scriptname_result
9997 rmfiles+=" $func_ltwrapper_scriptname_result"
9998 else
9999 relink_command=
10000 func_source $dir/$noexename
10001 fi
10002
10003 # note $name still contains .exe if it was in $file originally
10004 # as does the version of $file that was added into $rmfiles
10005 rmfiles+=" $odir/$name $odir/${name}S.${objext}"
10006 if test "$fast_install" = yes && test -n "$relink_command"; then
10007 rmfiles+=" $odir/lt-$name"
10008 fi
10009 if test "X$noexename" != "X$name" ; then
10010 rmfiles+=" $odir/lt-${noexename}.c"
10011 fi
10012 fi
10013 fi
10014 ;;
10015 esac
10016 func_show_eval "$RM $rmfiles" 'exit_status=1'
10017 done
10018
10019 # Try to remove the ${objdir}s in the directories where we deleted files
10020 for dir in $rmdirs; do
10021 if test -d "$dir"; then
10022 func_show_eval "rmdir $dir >/dev/null 2>&1"
10023 fi
10024 done
10025
10026 exit $exit_status
10027 }
10028
10029 { test "$opt_mode" = uninstall || test "$opt_mode" = clean; } &&
10030 func_mode_uninstall ${1+"$@"}
10031
10032 test -z "$opt_mode" && {
10033 help="$generic_help"
10034 func_fatal_help "you must specify a MODE"
10035 }
10036
10037 test -z "$exec_cmd" && \
10038 func_fatal_help "invalid operation mode \`$opt_mode'"
10039
10040 if test -n "$exec_cmd"; then
10041 eval exec "$exec_cmd"
10042 exit $EXIT_FAILURE
10043 fi
10044
10045 exit $exit_status
10046
10047
10048 # The TAGs below are defined such that we never get into a situation
10049 # in which we disable both kinds of libraries. Given conflicting
10050 # choices, we go for a static library, that is the most portable,
10051 # since we can't tell whether shared libraries were disabled because
10052 # the user asked for that or because the platform doesn't support
10053 # them. This is particularly important on AIX, because we don't
10054 # support having both static and shared libraries enabled at the same
10055 # time on that platform, so we default to a shared-only configuration.
10056 # If a disable-shared tag is given, we'll fallback to a static-only
10057 # configuration. But we'll never go from static-only to shared-only.
10058
10059 # ### BEGIN LIBTOOL TAG CONFIG: disable-shared
10060 build_libtool_libs=no
10061 build_old_libs=yes
10062 # ### END LIBTOOL TAG CONFIG: disable-shared
10063
10064 # ### BEGIN LIBTOOL TAG CONFIG: disable-static
10065 build_old_libs=`case $build_libtool_libs in yes) echo no;; *) echo yes;; esac`
10066 # ### END LIBTOOL TAG CONFIG: disable-static
10067
10068 # Local Variables:
10069 # mode:shell-script
10070 # sh-indentation:2
10071 # End:
10072 # vi:sw=2
10073
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*|ppc*-*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 ppc64-*linux*|powerpc64-*linux*)
1329 LD="${LD-ld} -m elf32ppclinux"
1330 ;;
1331 s390x-*linux*)
1332 LD="${LD-ld} -m elf_s390"
1333 ;;
1334 sparc64-*linux*)
1335 LD="${LD-ld} -m elf32_sparc"
1336 ;;
1337 esac
1338 ;;
1339 *64-bit*)
1340 case $host in
1341 x86_64-*kfreebsd*-gnu)
1342 LD="${LD-ld} -m elf_x86_64_fbsd"
1343 ;;
1344 x86_64-*linux*)
1345 LD="${LD-ld} -m elf_x86_64"
1346 ;;
1347 ppc*-*linux*|powerpc*-*linux*)
1348 LD="${LD-ld} -m elf64ppc"
1349 ;;
1350 s390*-*linux*|s390*-*tpf*)
1351 LD="${LD-ld} -m elf64_s390"
1352 ;;
1353 sparc*-*linux*)
1354 LD="${LD-ld} -m elf64_sparc"
1355 ;;
1356 esac
1357 ;;
1358 esac
1359 fi
1360 rm -rf conftest*
1361 ;;
1362
1363 *-*-sco3.2v5*)
1364 # On SCO OpenServer 5, we need -belf to get full-featured binaries.
1365 SAVE_CFLAGS="$CFLAGS"
1366 CFLAGS="$CFLAGS -belf"
1367 AC_CACHE_CHECK([whether the C compiler needs -belf], lt_cv_cc_needs_belf,
1368 [AC_LANG_PUSH(C)
1369 AC_LINK_IFELSE([AC_LANG_PROGRAM([[]],[[]])],[lt_cv_cc_needs_belf=yes],[lt_cv_cc_needs_belf=no])
1370 AC_LANG_POP])
1371 if test x"$lt_cv_cc_needs_belf" != x"yes"; then
1372 # this is probably gcc 2.8.0, egcs 1.0 or newer; no need for -belf
1373 CFLAGS="$SAVE_CFLAGS"
1374 fi
1375 ;;
1376 *-*solaris*)
1377 # Find out which ABI we are using.
1378 echo 'int i;' > conftest.$ac_ext
1379 if AC_TRY_EVAL(ac_compile); then
1380 case `/usr/bin/file conftest.o` in
1381 *64-bit*)
1382 case $lt_cv_prog_gnu_ld in
1383 yes*)
1384 case $host in
1385 i?86-*-solaris*)
1386 LD="${LD-ld} -m elf_x86_64"
1387 ;;
1388 sparc*-*-solaris*)
1389 LD="${LD-ld} -m elf64_sparc"
1390 ;;
1391 esac
1392 # GNU ld 2.21 introduced _sol2 emulations. Use them if available.
1393 if ${LD-ld} -V | grep _sol2 >/dev/null 2>&1; then
1394 LD="${LD-ld}_sol2"
1395 fi
1396 ;;
1397 *)
1398 if ${LD-ld} -64 -r -o conftest2.o conftest.o >/dev/null 2>&1; then
1399 LD="${LD-ld} -64"
1400 fi
1401 ;;
1402 esac
1403 ;;
1404 esac
1405 fi
1406 rm -rf conftest*
1407 ;;
1408 esac
1409
1410 need_locks="$enable_libtool_lock"
1411 ])# _LT_ENABLE_LOCK
1412
1413
1414 # _LT_PROG_AR
1415 # -----------
1416 m4_defun([_LT_PROG_AR],
1417 [AC_CHECK_TOOLS(AR, [ar], false)
1418 : ${AR=ar}
1419 : ${AR_FLAGS=cru}
1420 _LT_DECL([], [AR], [1], [The archiver])
1421 _LT_DECL([], [AR_FLAGS], [1], [Flags to create an archive])
1422
1423 AC_CACHE_CHECK([for archiver @FILE support], [lt_cv_ar_at_file],
1424 [lt_cv_ar_at_file=no
1425 AC_COMPILE_IFELSE([AC_LANG_PROGRAM],
1426 [echo conftest.$ac_objext > conftest.lst
1427 lt_ar_try='$AR $AR_FLAGS libconftest.a @conftest.lst >&AS_MESSAGE_LOG_FD'
1428 AC_TRY_EVAL([lt_ar_try])
1429 if test "$ac_status" -eq 0; then
1430 # Ensure the archiver fails upon bogus file names.
1431 rm -f conftest.$ac_objext libconftest.a
1432 AC_TRY_EVAL([lt_ar_try])
1433 if test "$ac_status" -ne 0; then
1434 lt_cv_ar_at_file=@
1435 fi
1436 fi
1437 rm -f conftest.* libconftest.a
1438 ])
1439 ])
1440
1441 if test "x$lt_cv_ar_at_file" = xno; then
1442 archiver_list_spec=
1443 else
1444 archiver_list_spec=$lt_cv_ar_at_file
1445 fi
1446 _LT_DECL([], [archiver_list_spec], [1],
1447 [How to feed a file listing to the archiver])
1448 ])# _LT_PROG_AR
1449
1450
1451 # _LT_CMD_OLD_ARCHIVE
1452 # -------------------
1453 m4_defun([_LT_CMD_OLD_ARCHIVE],
1454 [_LT_PROG_AR
1455
1456 AC_CHECK_TOOL(STRIP, strip, :)
1457 test -z "$STRIP" && STRIP=:
1458 _LT_DECL([], [STRIP], [1], [A symbol stripping program])
1459
1460 AC_CHECK_TOOL(RANLIB, ranlib, :)
1461 test -z "$RANLIB" && RANLIB=:
1462 _LT_DECL([], [RANLIB], [1],
1463 [Commands used to install an old-style archive])
1464
1465 # Determine commands to create old-style static archives.
1466 old_archive_cmds='$AR $AR_FLAGS $oldlib$oldobjs'
1467 old_postinstall_cmds='chmod 644 $oldlib'
1468 old_postuninstall_cmds=
1469
1470 if test -n "$RANLIB"; then
1471 case $host_os in
1472 openbsd*)
1473 old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB -t \$tool_oldlib"
1474 ;;
1475 *)
1476 old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB \$tool_oldlib"
1477 ;;
1478 esac
1479 old_archive_cmds="$old_archive_cmds~\$RANLIB \$tool_oldlib"
1480 fi
1481
1482 case $host_os in
1483 darwin*)
1484 lock_old_archive_extraction=yes ;;
1485 *)
1486 lock_old_archive_extraction=no ;;
1487 esac
1488 _LT_DECL([], [old_postinstall_cmds], [2])
1489 _LT_DECL([], [old_postuninstall_cmds], [2])
1490 _LT_TAGDECL([], [old_archive_cmds], [2],
1491 [Commands used to build an old-style archive])
1492 _LT_DECL([], [lock_old_archive_extraction], [0],
1493 [Whether to use a lock for old archive extraction])
1494 ])# _LT_CMD_OLD_ARCHIVE
1495
1496
1497 # _LT_COMPILER_OPTION(MESSAGE, VARIABLE-NAME, FLAGS,
1498 # [OUTPUT-FILE], [ACTION-SUCCESS], [ACTION-FAILURE])
1499 # ----------------------------------------------------------------
1500 # Check whether the given compiler option works
1501 AC_DEFUN([_LT_COMPILER_OPTION],
1502 [m4_require([_LT_FILEUTILS_DEFAULTS])dnl
1503 m4_require([_LT_DECL_SED])dnl
1504 AC_CACHE_CHECK([$1], [$2],
1505 [$2=no
1506 m4_if([$4], , [ac_outfile=conftest.$ac_objext], [ac_outfile=$4])
1507 echo "$lt_simple_compile_test_code" > conftest.$ac_ext
1508 lt_compiler_flag="$3"
1509 # Insert the option either (1) after the last *FLAGS variable, or
1510 # (2) before a word containing "conftest.", or (3) at the end.
1511 # Note that $ac_compile itself does not contain backslashes and begins
1512 # with a dollar sign (not a hyphen), so the echo should work correctly.
1513 # The option is referenced via a variable to avoid confusing sed.
1514 lt_compile=`echo "$ac_compile" | $SED \
1515 -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
1516 -e 's: [[^ ]]*conftest\.: $lt_compiler_flag&:; t' \
1517 -e 's:$: $lt_compiler_flag:'`
1518 (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&AS_MESSAGE_LOG_FD)
1519 (eval "$lt_compile" 2>conftest.err)
1520 ac_status=$?
1521 cat conftest.err >&AS_MESSAGE_LOG_FD
1522 echo "$as_me:$LINENO: \$? = $ac_status" >&AS_MESSAGE_LOG_FD
1523 if (exit $ac_status) && test -s "$ac_outfile"; then
1524 # The compiler can only warn and ignore the option if not recognized
1525 # So say no if there are warnings other than the usual output.
1526 $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' >conftest.exp
1527 $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2
1528 if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then
1529 $2=yes
1530 fi
1531 fi
1532 $RM conftest*
1533 ])
1534
1535 if test x"[$]$2" = xyes; then
1536 m4_if([$5], , :, [$5])
1537 else
1538 m4_if([$6], , :, [$6])
1539 fi
1540 ])# _LT_COMPILER_OPTION
1541
1542 # Old name:
1543 AU_ALIAS([AC_LIBTOOL_COMPILER_OPTION], [_LT_COMPILER_OPTION])
1544 dnl aclocal-1.4 backwards compatibility:
1545 dnl AC_DEFUN([AC_LIBTOOL_COMPILER_OPTION], [])
1546
1547
1548 # _LT_LINKER_OPTION(MESSAGE, VARIABLE-NAME, FLAGS,
1549 # [ACTION-SUCCESS], [ACTION-FAILURE])
1550 # ----------------------------------------------------
1551 # Check whether the given linker option works
1552 AC_DEFUN([_LT_LINKER_OPTION],
1553 [m4_require([_LT_FILEUTILS_DEFAULTS])dnl
1554 m4_require([_LT_DECL_SED])dnl
1555 AC_CACHE_CHECK([$1], [$2],
1556 [$2=no
1557 save_LDFLAGS="$LDFLAGS"
1558 LDFLAGS="$LDFLAGS $3"
1559 echo "$lt_simple_link_test_code" > conftest.$ac_ext
1560 if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then
1561 # The linker can only warn and ignore the option if not recognized
1562 # So say no if there are warnings
1563 if test -s conftest.err; then
1564 # Append any errors to the config.log.
1565 cat conftest.err 1>&AS_MESSAGE_LOG_FD
1566 $ECHO "$_lt_linker_boilerplate" | $SED '/^$/d' > conftest.exp
1567 $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2
1568 if diff conftest.exp conftest.er2 >/dev/null; then
1569 $2=yes
1570 fi
1571 else
1572 $2=yes
1573 fi
1574 fi
1575 $RM -r conftest*
1576 LDFLAGS="$save_LDFLAGS"
1577 ])
1578
1579 if test x"[$]$2" = xyes; then
1580 m4_if([$4], , :, [$4])
1581 else
1582 m4_if([$5], , :, [$5])
1583 fi
1584 ])# _LT_LINKER_OPTION
1585
1586 # Old name:
1587 AU_ALIAS([AC_LIBTOOL_LINKER_OPTION], [_LT_LINKER_OPTION])
1588 dnl aclocal-1.4 backwards compatibility:
1589 dnl AC_DEFUN([AC_LIBTOOL_LINKER_OPTION], [])
1590
1591
1592 # LT_CMD_MAX_LEN
1593 #---------------
1594 AC_DEFUN([LT_CMD_MAX_LEN],
1595 [AC_REQUIRE([AC_CANONICAL_HOST])dnl
1596 # find the maximum length of command line arguments
1597 AC_MSG_CHECKING([the maximum length of command line arguments])
1598 AC_CACHE_VAL([lt_cv_sys_max_cmd_len], [dnl
1599 i=0
1600 teststring="ABCD"
1601
1602 case $build_os in
1603 msdosdjgpp*)
1604 # On DJGPP, this test can blow up pretty badly due to problems in libc
1605 # (any single argument exceeding 2000 bytes causes a buffer overrun
1606 # during glob expansion). Even if it were fixed, the result of this
1607 # check would be larger than it should be.
1608 lt_cv_sys_max_cmd_len=12288; # 12K is about right
1609 ;;
1610
1611 gnu*)
1612 # Under GNU Hurd, this test is not required because there is
1613 # no limit to the length of command line arguments.
1614 # Libtool will interpret -1 as no limit whatsoever
1615 lt_cv_sys_max_cmd_len=-1;
1616 ;;
1617
1618 cygwin* | mingw* | cegcc*)
1619 # On Win9x/ME, this test blows up -- it succeeds, but takes
1620 # about 5 minutes as the teststring grows exponentially.
1621 # Worse, since 9x/ME are not pre-emptively multitasking,
1622 # you end up with a "frozen" computer, even though with patience
1623 # the test eventually succeeds (with a max line length of 256k).
1624 # Instead, let's just punt: use the minimum linelength reported by
1625 # all of the supported platforms: 8192 (on NT/2K/XP).
1626 lt_cv_sys_max_cmd_len=8192;
1627 ;;
1628
1629 mint*)
1630 # On MiNT this can take a long time and run out of memory.
1631 lt_cv_sys_max_cmd_len=8192;
1632 ;;
1633
1634 amigaos*)
1635 # On AmigaOS with pdksh, this test takes hours, literally.
1636 # So we just punt and use a minimum line length of 8192.
1637 lt_cv_sys_max_cmd_len=8192;
1638 ;;
1639
1640 netbsd* | freebsd* | openbsd* | darwin* | dragonfly*)
1641 # This has been around since 386BSD, at least. Likely further.
1642 if test -x /sbin/sysctl; then
1643 lt_cv_sys_max_cmd_len=`/sbin/sysctl -n kern.argmax`
1644 elif test -x /usr/sbin/sysctl; then
1645 lt_cv_sys_max_cmd_len=`/usr/sbin/sysctl -n kern.argmax`
1646 else
1647 lt_cv_sys_max_cmd_len=65536 # usable default for all BSDs
1648 fi
1649 # And add a safety zone
1650 lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4`
1651 lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3`
1652 ;;
1653
1654 interix*)
1655 # We know the value 262144 and hardcode it with a safety zone (like BSD)
1656 lt_cv_sys_max_cmd_len=196608
1657 ;;
1658
1659 os2*)
1660 # The test takes a long time on OS/2.
1661 lt_cv_sys_max_cmd_len=8192
1662 ;;
1663
1664 osf*)
1665 # Dr. Hans Ekkehard Plesser reports seeing a kernel panic running configure
1666 # due to this test when exec_disable_arg_limit is 1 on Tru64. It is not
1667 # nice to cause kernel panics so lets avoid the loop below.
1668 # First set a reasonable default.
1669 lt_cv_sys_max_cmd_len=16384
1670 #
1671 if test -x /sbin/sysconfig; then
1672 case `/sbin/sysconfig -q proc exec_disable_arg_limit` in
1673 *1*) lt_cv_sys_max_cmd_len=-1 ;;
1674 esac
1675 fi
1676 ;;
1677 sco3.2v5*)
1678 lt_cv_sys_max_cmd_len=102400
1679 ;;
1680 sysv5* | sco5v6* | sysv4.2uw2*)
1681 kargmax=`grep ARG_MAX /etc/conf/cf.d/stune 2>/dev/null`
1682 if test -n "$kargmax"; then
1683 lt_cv_sys_max_cmd_len=`echo $kargmax | sed 's/.*[[ ]]//'`
1684 else
1685 lt_cv_sys_max_cmd_len=32768
1686 fi
1687 ;;
1688 *)
1689 lt_cv_sys_max_cmd_len=`(getconf ARG_MAX) 2> /dev/null`
1690 if test -n "$lt_cv_sys_max_cmd_len"; then
1691 lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4`
1692 lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3`
1693 else
1694 # Make teststring a little bigger before we do anything with it.
1695 # a 1K string should be a reasonable start.
1696 for i in 1 2 3 4 5 6 7 8 ; do
1697 teststring=$teststring$teststring
1698 done
1699 SHELL=${SHELL-${CONFIG_SHELL-/bin/sh}}
1700 # If test is not a shell built-in, we'll probably end up computing a
1701 # maximum length that is only half of the actual maximum length, but
1702 # we can't tell.
1703 while { test "X"`env echo "$teststring$teststring" 2>/dev/null` \
1704 = "X$teststring$teststring"; } >/dev/null 2>&1 &&
1705 test $i != 17 # 1/2 MB should be enough
1706 do
1707 i=`expr $i + 1`
1708 teststring=$teststring$teststring
1709 done
1710 # Only check the string length outside the loop.
1711 lt_cv_sys_max_cmd_len=`expr "X$teststring" : ".*" 2>&1`
1712 teststring=
1713 # Add a significant safety factor because C++ compilers can tack on
1714 # massive amounts of additional arguments before passing them to the
1715 # linker. It appears as though 1/2 is a usable value.
1716 lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 2`
1717 fi
1718 ;;
1719 esac
1720 ])
1721 if test -n $lt_cv_sys_max_cmd_len ; then
1722 AC_MSG_RESULT($lt_cv_sys_max_cmd_len)
1723 else
1724 AC_MSG_RESULT(none)
1725 fi
1726 max_cmd_len=$lt_cv_sys_max_cmd_len
1727 _LT_DECL([], [max_cmd_len], [0],
1728 [What is the maximum length of a command?])
1729 ])# LT_CMD_MAX_LEN
1730
1731 # Old name:
1732 AU_ALIAS([AC_LIBTOOL_SYS_MAX_CMD_LEN], [LT_CMD_MAX_LEN])
1733 dnl aclocal-1.4 backwards compatibility:
1734 dnl AC_DEFUN([AC_LIBTOOL_SYS_MAX_CMD_LEN], [])
1735
1736
1737 # _LT_HEADER_DLFCN
1738 # ----------------
1739 m4_defun([_LT_HEADER_DLFCN],
1740 [AC_CHECK_HEADERS([dlfcn.h], [], [], [AC_INCLUDES_DEFAULT])dnl
1741 ])# _LT_HEADER_DLFCN
1742
1743
1744 # _LT_TRY_DLOPEN_SELF (ACTION-IF-TRUE, ACTION-IF-TRUE-W-USCORE,
1745 # ACTION-IF-FALSE, ACTION-IF-CROSS-COMPILING)
1746 # ----------------------------------------------------------------
1747 m4_defun([_LT_TRY_DLOPEN_SELF],
1748 [m4_require([_LT_HEADER_DLFCN])dnl
1749 if test "$cross_compiling" = yes; then :
1750 [$4]
1751 else
1752 lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
1753 lt_status=$lt_dlunknown
1754 cat > conftest.$ac_ext <<_LT_EOF
1755 [#line $LINENO "configure"
1756 #include "confdefs.h"
1757
1758 #if HAVE_DLFCN_H
1759 #include <dlfcn.h>
1760 #endif
1761
1762 #include <stdio.h>
1763
1764 #ifdef RTLD_GLOBAL
1765 # define LT_DLGLOBAL RTLD_GLOBAL
1766 #else
1767 # ifdef DL_GLOBAL
1768 # define LT_DLGLOBAL DL_GLOBAL
1769 # else
1770 # define LT_DLGLOBAL 0
1771 # endif
1772 #endif
1773
1774 /* We may have to define LT_DLLAZY_OR_NOW in the command line if we
1775 find out it does not work in some platform. */
1776 #ifndef LT_DLLAZY_OR_NOW
1777 # ifdef RTLD_LAZY
1778 # define LT_DLLAZY_OR_NOW RTLD_LAZY
1779 # else
1780 # ifdef DL_LAZY
1781 # define LT_DLLAZY_OR_NOW DL_LAZY
1782 # else
1783 # ifdef RTLD_NOW
1784 # define LT_DLLAZY_OR_NOW RTLD_NOW
1785 # else
1786 # ifdef DL_NOW
1787 # define LT_DLLAZY_OR_NOW DL_NOW
1788 # else
1789 # define LT_DLLAZY_OR_NOW 0
1790 # endif
1791 # endif
1792 # endif
1793 # endif
1794 #endif
1795
1796 /* When -fvisbility=hidden is used, assume the code has been annotated
1797 correspondingly for the symbols needed. */
1798 #if defined(__GNUC__) && (((__GNUC__ == 3) && (__GNUC_MINOR__ >= 3)) || (__GNUC__ > 3))
1799 int fnord () __attribute__((visibility("default")));
1800 #endif
1801
1802 int fnord () { return 42; }
1803 int main ()
1804 {
1805 void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW);
1806 int status = $lt_dlunknown;
1807
1808 if (self)
1809 {
1810 if (dlsym (self,"fnord")) status = $lt_dlno_uscore;
1811 else
1812 {
1813 if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore;
1814 else puts (dlerror ());
1815 }
1816 /* dlclose (self); */
1817 }
1818 else
1819 puts (dlerror ());
1820
1821 return status;
1822 }]
1823 _LT_EOF
1824 if AC_TRY_EVAL(ac_link) && test -s conftest${ac_exeext} 2>/dev/null; then
1825 (./conftest; exit; ) >&AS_MESSAGE_LOG_FD 2>/dev/null
1826 lt_status=$?
1827 case x$lt_status in
1828 x$lt_dlno_uscore) $1 ;;
1829 x$lt_dlneed_uscore) $2 ;;
1830 x$lt_dlunknown|x*) $3 ;;
1831 esac
1832 else :
1833 # compilation failed
1834 $3
1835 fi
1836 fi
1837 rm -fr conftest*
1838 ])# _LT_TRY_DLOPEN_SELF
1839
1840
1841 # LT_SYS_DLOPEN_SELF
1842 # ------------------
1843 AC_DEFUN([LT_SYS_DLOPEN_SELF],
1844 [m4_require([_LT_HEADER_DLFCN])dnl
1845 if test "x$enable_dlopen" != xyes; then
1846 enable_dlopen=unknown
1847 enable_dlopen_self=unknown
1848 enable_dlopen_self_static=unknown
1849 else
1850 lt_cv_dlopen=no
1851 lt_cv_dlopen_libs=
1852
1853 case $host_os in
1854 beos*)
1855 lt_cv_dlopen="load_add_on"
1856 lt_cv_dlopen_libs=
1857 lt_cv_dlopen_self=yes
1858 ;;
1859
1860 mingw* | pw32* | cegcc*)
1861 lt_cv_dlopen="LoadLibrary"
1862 lt_cv_dlopen_libs=
1863 ;;
1864
1865 cygwin*)
1866 lt_cv_dlopen="dlopen"
1867 lt_cv_dlopen_libs=
1868 ;;
1869
1870 darwin*)
1871 # if libdl is installed we need to link against it
1872 AC_CHECK_LIB([dl], [dlopen],
1873 [lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl"],[
1874 lt_cv_dlopen="dyld"
1875 lt_cv_dlopen_libs=
1876 lt_cv_dlopen_self=yes
1877 ])
1878 ;;
1879
1880 *)
1881 AC_CHECK_FUNC([shl_load],
1882 [lt_cv_dlopen="shl_load"],
1883 [AC_CHECK_LIB([dld], [shl_load],
1884 [lt_cv_dlopen="shl_load" lt_cv_dlopen_libs="-ldld"],
1885 [AC_CHECK_FUNC([dlopen],
1886 [lt_cv_dlopen="dlopen"],
1887 [AC_CHECK_LIB([dl], [dlopen],
1888 [lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl"],
1889 [AC_CHECK_LIB([svld], [dlopen],
1890 [lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-lsvld"],
1891 [AC_CHECK_LIB([dld], [dld_link],
1892 [lt_cv_dlopen="dld_link" lt_cv_dlopen_libs="-ldld"])
1893 ])
1894 ])
1895 ])
1896 ])
1897 ])
1898 ;;
1899 esac
1900
1901 if test "x$lt_cv_dlopen" != xno; then
1902 enable_dlopen=yes
1903 else
1904 enable_dlopen=no
1905 fi
1906
1907 case $lt_cv_dlopen in
1908 dlopen)
1909 save_CPPFLAGS="$CPPFLAGS"
1910 test "x$ac_cv_header_dlfcn_h" = xyes && CPPFLAGS="$CPPFLAGS -DHAVE_DLFCN_H"
1911
1912 save_LDFLAGS="$LDFLAGS"
1913 wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $export_dynamic_flag_spec\"
1914
1915 save_LIBS="$LIBS"
1916 LIBS="$lt_cv_dlopen_libs $LIBS"
1917
1918 AC_CACHE_CHECK([whether a program can dlopen itself],
1919 lt_cv_dlopen_self, [dnl
1920 _LT_TRY_DLOPEN_SELF(
1921 lt_cv_dlopen_self=yes, lt_cv_dlopen_self=yes,
1922 lt_cv_dlopen_self=no, lt_cv_dlopen_self=cross)
1923 ])
1924
1925 if test "x$lt_cv_dlopen_self" = xyes; then
1926 wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $lt_prog_compiler_static\"
1927 AC_CACHE_CHECK([whether a statically linked program can dlopen itself],
1928 lt_cv_dlopen_self_static, [dnl
1929 _LT_TRY_DLOPEN_SELF(
1930 lt_cv_dlopen_self_static=yes, lt_cv_dlopen_self_static=yes,
1931 lt_cv_dlopen_self_static=no, lt_cv_dlopen_self_static=cross)
1932 ])
1933 fi
1934
1935 CPPFLAGS="$save_CPPFLAGS"
1936 LDFLAGS="$save_LDFLAGS"
1937 LIBS="$save_LIBS"
1938 ;;
1939 esac
1940
1941 case $lt_cv_dlopen_self in
1942 yes|no) enable_dlopen_self=$lt_cv_dlopen_self ;;
1943 *) enable_dlopen_self=unknown ;;
1944 esac
1945
1946 case $lt_cv_dlopen_self_static in
1947 yes|no) enable_dlopen_self_static=$lt_cv_dlopen_self_static ;;
1948 *) enable_dlopen_self_static=unknown ;;
1949 esac
1950 fi
1951 _LT_DECL([dlopen_support], [enable_dlopen], [0],
1952 [Whether dlopen is supported])
1953 _LT_DECL([dlopen_self], [enable_dlopen_self], [0],
1954 [Whether dlopen of programs is supported])
1955 _LT_DECL([dlopen_self_static], [enable_dlopen_self_static], [0],
1956 [Whether dlopen of statically linked programs is supported])
1957 ])# LT_SYS_DLOPEN_SELF
1958
1959 # Old name:
1960 AU_ALIAS([AC_LIBTOOL_DLOPEN_SELF], [LT_SYS_DLOPEN_SELF])
1961 dnl aclocal-1.4 backwards compatibility:
1962 dnl AC_DEFUN([AC_LIBTOOL_DLOPEN_SELF], [])
1963
1964
1965 # _LT_COMPILER_C_O([TAGNAME])
1966 # ---------------------------
1967 # Check to see if options -c and -o are simultaneously supported by compiler.
1968 # This macro does not hard code the compiler like AC_PROG_CC_C_O.
1969 m4_defun([_LT_COMPILER_C_O],
1970 [m4_require([_LT_DECL_SED])dnl
1971 m4_require([_LT_FILEUTILS_DEFAULTS])dnl
1972 m4_require([_LT_TAG_COMPILER])dnl
1973 AC_CACHE_CHECK([if $compiler supports -c -o file.$ac_objext],
1974 [_LT_TAGVAR(lt_cv_prog_compiler_c_o, $1)],
1975 [_LT_TAGVAR(lt_cv_prog_compiler_c_o, $1)=no
1976 $RM -r conftest 2>/dev/null
1977 mkdir conftest
1978 cd conftest
1979 mkdir out
1980 echo "$lt_simple_compile_test_code" > conftest.$ac_ext
1981
1982 lt_compiler_flag="-o out/conftest2.$ac_objext"
1983 # Insert the option either (1) after the last *FLAGS variable, or
1984 # (2) before a word containing "conftest.", or (3) at the end.
1985 # Note that $ac_compile itself does not contain backslashes and begins
1986 # with a dollar sign (not a hyphen), so the echo should work correctly.
1987 lt_compile=`echo "$ac_compile" | $SED \
1988 -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
1989 -e 's: [[^ ]]*conftest\.: $lt_compiler_flag&:; t' \
1990 -e 's:$: $lt_compiler_flag:'`
1991 (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&AS_MESSAGE_LOG_FD)
1992 (eval "$lt_compile" 2>out/conftest.err)
1993 ac_status=$?
1994 cat out/conftest.err >&AS_MESSAGE_LOG_FD
1995 echo "$as_me:$LINENO: \$? = $ac_status" >&AS_MESSAGE_LOG_FD
1996 if (exit $ac_status) && test -s out/conftest2.$ac_objext
1997 then
1998 # The compiler can only warn and ignore the option if not recognized
1999 # So say no if there are warnings
2000 $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' > out/conftest.exp
2001 $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2
2002 if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then
2003 _LT_TAGVAR(lt_cv_prog_compiler_c_o, $1)=yes
2004 fi
2005 fi
2006 chmod u+w . 2>&AS_MESSAGE_LOG_FD
2007 $RM conftest*
2008 # SGI C++ compiler will create directory out/ii_files/ for
2009 # template instantiation
2010 test -d out/ii_files && $RM out/ii_files/* && rmdir out/ii_files
2011 $RM out/* && rmdir out
2012 cd ..
2013 $RM -r conftest
2014 $RM conftest*
2015 ])
2016 _LT_TAGDECL([compiler_c_o], [lt_cv_prog_compiler_c_o], [1],
2017 [Does compiler simultaneously support -c and -o options?])
2018 ])# _LT_COMPILER_C_O
2019
2020
2021 # _LT_COMPILER_FILE_LOCKS([TAGNAME])
2022 # ----------------------------------
2023 # Check to see if we can do hard links to lock some files if needed
2024 m4_defun([_LT_COMPILER_FILE_LOCKS],
2025 [m4_require([_LT_ENABLE_LOCK])dnl
2026 m4_require([_LT_FILEUTILS_DEFAULTS])dnl
2027 _LT_COMPILER_C_O([$1])
2028
2029 hard_links="nottested"
2030 if test "$_LT_TAGVAR(lt_cv_prog_compiler_c_o, $1)" = no && test "$need_locks" != no; then
2031 # do not overwrite the value of need_locks provided by the user
2032 AC_MSG_CHECKING([if we can lock with hard links])
2033 hard_links=yes
2034 $RM conftest*
2035 ln conftest.a conftest.b 2>/dev/null && hard_links=no
2036 touch conftest.a
2037 ln conftest.a conftest.b 2>&5 || hard_links=no
2038 ln conftest.a conftest.b 2>/dev/null && hard_links=no
2039 AC_MSG_RESULT([$hard_links])
2040 if test "$hard_links" = no; then
2041 AC_MSG_WARN([`$CC' does not support `-c -o', so `make -j' may be unsafe])
2042 need_locks=warn
2043 fi
2044 else
2045 need_locks=no
2046 fi
2047 _LT_DECL([], [need_locks], [1], [Must we lock files when doing compilation?])
2048 ])# _LT_COMPILER_FILE_LOCKS
2049
2050
2051 # _LT_CHECK_OBJDIR
2052 # ----------------
2053 m4_defun([_LT_CHECK_OBJDIR],
2054 [AC_CACHE_CHECK([for objdir], [lt_cv_objdir],
2055 [rm -f .libs 2>/dev/null
2056 mkdir .libs 2>/dev/null
2057 if test -d .libs; then
2058 lt_cv_objdir=.libs
2059 else
2060 # MS-DOS does not allow filenames that begin with a dot.
2061 lt_cv_objdir=_libs
2062 fi
2063 rmdir .libs 2>/dev/null])
2064 objdir=$lt_cv_objdir
2065 _LT_DECL([], [objdir], [0],
2066 [The name of the directory that contains temporary libtool files])dnl
2067 m4_pattern_allow([LT_OBJDIR])dnl
2068 AC_DEFINE_UNQUOTED(LT_OBJDIR, "$lt_cv_objdir/",
2069 [Define to the sub-directory in which libtool stores uninstalled libraries.])
2070 ])# _LT_CHECK_OBJDIR
2071
2072
2073 # _LT_LINKER_HARDCODE_LIBPATH([TAGNAME])
2074 # --------------------------------------
2075 # Check hardcoding attributes.
2076 m4_defun([_LT_LINKER_HARDCODE_LIBPATH],
2077 [AC_MSG_CHECKING([how to hardcode library paths into programs])
2078 _LT_TAGVAR(hardcode_action, $1)=
2079 if test -n "$_LT_TAGVAR(hardcode_libdir_flag_spec, $1)" ||
2080 test -n "$_LT_TAGVAR(runpath_var, $1)" ||
2081 test "X$_LT_TAGVAR(hardcode_automatic, $1)" = "Xyes" ; then
2082
2083 # We can hardcode non-existent directories.
2084 if test "$_LT_TAGVAR(hardcode_direct, $1)" != no &&
2085 # If the only mechanism to avoid hardcoding is shlibpath_var, we
2086 # have to relink, otherwise we might link with an installed library
2087 # when we should be linking with a yet-to-be-installed one
2088 ## test "$_LT_TAGVAR(hardcode_shlibpath_var, $1)" != no &&
2089 test "$_LT_TAGVAR(hardcode_minus_L, $1)" != no; then
2090 # Linking always hardcodes the temporary library directory.
2091 _LT_TAGVAR(hardcode_action, $1)=relink
2092 else
2093 # We can link without hardcoding, and we can hardcode nonexisting dirs.
2094 _LT_TAGVAR(hardcode_action, $1)=immediate
2095 fi
2096 else
2097 # We cannot hardcode anything, or else we can only hardcode existing
2098 # directories.
2099 _LT_TAGVAR(hardcode_action, $1)=unsupported
2100 fi
2101 AC_MSG_RESULT([$_LT_TAGVAR(hardcode_action, $1)])
2102
2103 if test "$_LT_TAGVAR(hardcode_action, $1)" = relink ||
2104 test "$_LT_TAGVAR(inherit_rpath, $1)" = yes; then
2105 # Fast installation is not supported
2106 enable_fast_install=no
2107 elif test "$shlibpath_overrides_runpath" = yes ||
2108 test "$enable_shared" = no; then
2109 # Fast installation is not necessary
2110 enable_fast_install=needless
2111 fi
2112 _LT_TAGDECL([], [hardcode_action], [0],
2113 [How to hardcode a shared library path into an executable])
2114 ])# _LT_LINKER_HARDCODE_LIBPATH
2115
2116
2117 # _LT_CMD_STRIPLIB
2118 # ----------------
2119 m4_defun([_LT_CMD_STRIPLIB],
2120 [m4_require([_LT_DECL_EGREP])
2121 striplib=
2122 old_striplib=
2123 AC_MSG_CHECKING([whether stripping libraries is possible])
2124 if test -n "$STRIP" && $STRIP -V 2>&1 | $GREP "GNU strip" >/dev/null; then
2125 test -z "$old_striplib" && old_striplib="$STRIP --strip-debug"
2126 test -z "$striplib" && striplib="$STRIP --strip-unneeded"
2127 AC_MSG_RESULT([yes])
2128 else
2129 # FIXME - insert some real tests, host_os isn't really good enough
2130 case $host_os in
2131 darwin*)
2132 if test -n "$STRIP" ; then
2133 striplib="$STRIP -x"
2134 old_striplib="$STRIP -S"
2135 AC_MSG_RESULT([yes])
2136 else
2137 AC_MSG_RESULT([no])
2138 fi
2139 ;;
2140 *)
2141 AC_MSG_RESULT([no])
2142 ;;
2143 esac
2144 fi
2145 _LT_DECL([], [old_striplib], [1], [Commands to strip libraries])
2146 _LT_DECL([], [striplib], [1])
2147 ])# _LT_CMD_STRIPLIB
2148
2149
2150 # _LT_SYS_DYNAMIC_LINKER([TAG])
2151 # -----------------------------
2152 # PORTME Fill in your ld.so characteristics
2153 m4_defun([_LT_SYS_DYNAMIC_LINKER],
2154 [AC_REQUIRE([AC_CANONICAL_HOST])dnl
2155 m4_require([_LT_DECL_EGREP])dnl
2156 m4_require([_LT_FILEUTILS_DEFAULTS])dnl
2157 m4_require([_LT_DECL_OBJDUMP])dnl
2158 m4_require([_LT_DECL_SED])dnl
2159 m4_require([_LT_CHECK_SHELL_FEATURES])dnl
2160 AC_MSG_CHECKING([dynamic linker characteristics])
2161 m4_if([$1],
2162 [], [
2163 if test "$GCC" = yes; then
2164 case $host_os in
2165 darwin*) lt_awk_arg="/^libraries:/,/LR/" ;;
2166 *) lt_awk_arg="/^libraries:/" ;;
2167 esac
2168 case $host_os in
2169 mingw* | cegcc*) lt_sed_strip_eq="s,=\([[A-Za-z]]:\),\1,g" ;;
2170 *) lt_sed_strip_eq="s,=/,/,g" ;;
2171 esac
2172 lt_search_path_spec=`$CC -print-search-dirs | awk $lt_awk_arg | $SED -e "s/^libraries://" -e $lt_sed_strip_eq`
2173 case $lt_search_path_spec in
2174 *\;*)
2175 # if the path contains ";" then we assume it to be the separator
2176 # otherwise default to the standard path separator (i.e. ":") - it is
2177 # assumed that no part of a normal pathname contains ";" but that should
2178 # okay in the real world where ";" in dirpaths is itself problematic.
2179 lt_search_path_spec=`$ECHO "$lt_search_path_spec" | $SED 's/;/ /g'`
2180 ;;
2181 *)
2182 lt_search_path_spec=`$ECHO "$lt_search_path_spec" | $SED "s/$PATH_SEPARATOR/ /g"`
2183 ;;
2184 esac
2185 # Ok, now we have the path, separated by spaces, we can step through it
2186 # and add multilib dir if necessary.
2187 lt_tmp_lt_search_path_spec=
2188 lt_multi_os_dir=`$CC $CPPFLAGS $CFLAGS $LDFLAGS -print-multi-os-directory 2>/dev/null`
2189 for lt_sys_path in $lt_search_path_spec; do
2190 if test -d "$lt_sys_path/$lt_multi_os_dir"; then
2191 lt_tmp_lt_search_path_spec="$lt_tmp_lt_search_path_spec $lt_sys_path/$lt_multi_os_dir"
2192 else
2193 test -d "$lt_sys_path" && \
2194 lt_tmp_lt_search_path_spec="$lt_tmp_lt_search_path_spec $lt_sys_path"
2195 fi
2196 done
2197 lt_search_path_spec=`$ECHO "$lt_tmp_lt_search_path_spec" | awk '
2198 BEGIN {RS=" "; FS="/|\n";} {
2199 lt_foo="";
2200 lt_count=0;
2201 for (lt_i = NF; lt_i > 0; lt_i--) {
2202 if ($lt_i != "" && $lt_i != ".") {
2203 if ($lt_i == "..") {
2204 lt_count++;
2205 } else {
2206 if (lt_count == 0) {
2207 lt_foo="/" $lt_i lt_foo;
2208 } else {
2209 lt_count--;
2210 }
2211 }
2212 }
2213 }
2214 if (lt_foo != "") { lt_freq[[lt_foo]]++; }
2215 if (lt_freq[[lt_foo]] == 1) { print lt_foo; }
2216 }'`
2217 # AWK program above erroneously prepends '/' to C:/dos/paths
2218 # for these hosts.
2219 case $host_os in
2220 mingw* | cegcc*) lt_search_path_spec=`$ECHO "$lt_search_path_spec" |\
2221 $SED 's,/\([[A-Za-z]]:\),\1,g'` ;;
2222 esac
2223 sys_lib_search_path_spec=`$ECHO "$lt_search_path_spec" | $lt_NL2SP`
2224 else
2225 sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib"
2226 fi])
2227 library_names_spec=
2228 libname_spec='lib$name'
2229 soname_spec=
2230 shrext_cmds=".so"
2231 postinstall_cmds=
2232 postuninstall_cmds=
2233 finish_cmds=
2234 finish_eval=
2235 shlibpath_var=
2236 shlibpath_overrides_runpath=unknown
2237 version_type=none
2238 dynamic_linker="$host_os ld.so"
2239 sys_lib_dlsearch_path_spec="/lib /usr/lib"
2240 need_lib_prefix=unknown
2241 hardcode_into_libs=no
2242
2243 # when you set need_version to no, make sure it does not cause -set_version
2244 # flags to be left without arguments
2245 need_version=unknown
2246
2247 case $host_os in
2248 aix3*)
2249 version_type=linux # correct to gnu/linux during the next big refactor
2250 library_names_spec='${libname}${release}${shared_ext}$versuffix $libname.a'
2251 shlibpath_var=LIBPATH
2252
2253 # AIX 3 has no versioning support, so we append a major version to the name.
2254 soname_spec='${libname}${release}${shared_ext}$major'
2255 ;;
2256
2257 aix[[4-9]]*)
2258 version_type=linux # correct to gnu/linux during the next big refactor
2259 need_lib_prefix=no
2260 need_version=no
2261 hardcode_into_libs=yes
2262 if test "$host_cpu" = ia64; then
2263 # AIX 5 supports IA64
2264 library_names_spec='${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext}$versuffix $libname${shared_ext}'
2265 shlibpath_var=LD_LIBRARY_PATH
2266 else
2267 # With GCC up to 2.95.x, collect2 would create an import file
2268 # for dependence libraries. The import file would start with
2269 # the line `#! .'. This would cause the generated library to
2270 # depend on `.', always an invalid library. This was fixed in
2271 # development snapshots of GCC prior to 3.0.
2272 case $host_os in
2273 aix4 | aix4.[[01]] | aix4.[[01]].*)
2274 if { echo '#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 97)'
2275 echo ' yes '
2276 echo '#endif'; } | ${CC} -E - | $GREP yes > /dev/null; then
2277 :
2278 else
2279 can_build_shared=no
2280 fi
2281 ;;
2282 esac
2283 # AIX (on Power*) has no versioning support, so currently we can not hardcode correct
2284 # soname into executable. Probably we can add versioning support to
2285 # collect2, so additional links can be useful in future.
2286 if test "$aix_use_runtimelinking" = yes; then
2287 # If using run time linking (on AIX 4.2 or later) use lib<name>.so
2288 # instead of lib<name>.a to let people know that these are not
2289 # typical AIX shared libraries.
2290 library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
2291 else
2292 # We preserve .a as extension for shared libraries through AIX4.2
2293 # and later when we are not doing run time linking.
2294 library_names_spec='${libname}${release}.a $libname.a'
2295 soname_spec='${libname}${release}${shared_ext}$major'
2296 fi
2297 shlibpath_var=LIBPATH
2298 fi
2299 ;;
2300
2301 amigaos*)
2302 case $host_cpu in
2303 powerpc)
2304 # Since July 2007 AmigaOS4 officially supports .so libraries.
2305 # When compiling the executable, add -use-dynld -Lsobjs: to the compileline.
2306 library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
2307 ;;
2308 m68k)
2309 library_names_spec='$libname.ixlibrary $libname.a'
2310 # Create ${libname}_ixlibrary.a entries in /sys/libs.
2311 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'
2312 ;;
2313 esac
2314 ;;
2315
2316 beos*)
2317 library_names_spec='${libname}${shared_ext}'
2318 dynamic_linker="$host_os ld.so"
2319 shlibpath_var=LIBRARY_PATH
2320 ;;
2321
2322 bsdi[[45]]*)
2323 version_type=linux # correct to gnu/linux during the next big refactor
2324 need_version=no
2325 library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
2326 soname_spec='${libname}${release}${shared_ext}$major'
2327 finish_cmds='PATH="\$PATH:/sbin" ldconfig $libdir'
2328 shlibpath_var=LD_LIBRARY_PATH
2329 sys_lib_search_path_spec="/shlib /usr/lib /usr/X11/lib /usr/contrib/lib /lib /usr/local/lib"
2330 sys_lib_dlsearch_path_spec="/shlib /usr/lib /usr/local/lib"
2331 # the default ld.so.conf also contains /usr/contrib/lib and
2332 # /usr/X11R6/lib (/usr/X11 is a link to /usr/X11R6), but let us allow
2333 # libtool to hard-code these into programs
2334 ;;
2335
2336 cygwin* | mingw* | pw32* | cegcc*)
2337 version_type=windows
2338 shrext_cmds=".dll"
2339 need_version=no
2340 need_lib_prefix=no
2341
2342 case $GCC,$cc_basename in
2343 yes,*)
2344 # gcc
2345 library_names_spec='$libname.dll.a'
2346 # DLL is installed to $(libdir)/../bin by postinstall_cmds
2347 postinstall_cmds='base_file=`basename \${file}`~
2348 dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~
2349 dldir=$destdir/`dirname \$dlpath`~
2350 test -d \$dldir || mkdir -p \$dldir~
2351 $install_prog $dir/$dlname \$dldir/$dlname~
2352 chmod a+x \$dldir/$dlname~
2353 if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then
2354 eval '\''$striplib \$dldir/$dlname'\'' || exit \$?;
2355 fi'
2356 postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~
2357 dlpath=$dir/\$dldll~
2358 $RM \$dlpath'
2359 shlibpath_overrides_runpath=yes
2360
2361 case $host_os in
2362 cygwin*)
2363 # Cygwin DLLs use 'cyg' prefix rather than 'lib'
2364 soname_spec='`echo ${libname} | sed -e 's/^lib/cyg/'``echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext}'
2365 m4_if([$1], [],[
2366 sys_lib_search_path_spec="$sys_lib_search_path_spec /usr/lib/w32api"])
2367 ;;
2368 mingw* | cegcc*)
2369 # MinGW DLLs use traditional 'lib' prefix
2370 soname_spec='${libname}`echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext}'
2371 ;;
2372 pw32*)
2373 # pw32 DLLs use 'pw' prefix rather than 'lib'
2374 library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext}'
2375 ;;
2376 esac
2377 dynamic_linker='Win32 ld.exe'
2378 ;;
2379
2380 *,cl*)
2381 # Native MSVC
2382 libname_spec='$name'
2383 soname_spec='${libname}`echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext}'
2384 library_names_spec='${libname}.dll.lib'
2385
2386 case $build_os in
2387 mingw*)
2388 sys_lib_search_path_spec=
2389 lt_save_ifs=$IFS
2390 IFS=';'
2391 for lt_path in $LIB
2392 do
2393 IFS=$lt_save_ifs
2394 # Let DOS variable expansion print the short 8.3 style file name.
2395 lt_path=`cd "$lt_path" 2>/dev/null && cmd //C "for %i in (".") do @echo %~si"`
2396 sys_lib_search_path_spec="$sys_lib_search_path_spec $lt_path"
2397 done
2398 IFS=$lt_save_ifs
2399 # Convert to MSYS style.
2400 sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | sed -e 's|\\\\|/|g' -e 's| \\([[a-zA-Z]]\\):| /\\1|g' -e 's|^ ||'`
2401 ;;
2402 cygwin*)
2403 # Convert to unix form, then to dos form, then back to unix form
2404 # but this time dos style (no spaces!) so that the unix form looks
2405 # like /cygdrive/c/PROGRA~1:/cygdr...
2406 sys_lib_search_path_spec=`cygpath --path --unix "$LIB"`
2407 sys_lib_search_path_spec=`cygpath --path --dos "$sys_lib_search_path_spec" 2>/dev/null`
2408 sys_lib_search_path_spec=`cygpath --path --unix "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"`
2409 ;;
2410 *)
2411 sys_lib_search_path_spec="$LIB"
2412 if $ECHO "$sys_lib_search_path_spec" | [$GREP ';[c-zC-Z]:/' >/dev/null]; then
2413 # It is most probably a Windows format PATH.
2414 sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'`
2415 else
2416 sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"`
2417 fi
2418 # FIXME: find the short name or the path components, as spaces are
2419 # common. (e.g. "Program Files" -> "PROGRA~1")
2420 ;;
2421 esac
2422
2423 # DLL is installed to $(libdir)/../bin by postinstall_cmds
2424 postinstall_cmds='base_file=`basename \${file}`~
2425 dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~
2426 dldir=$destdir/`dirname \$dlpath`~
2427 test -d \$dldir || mkdir -p \$dldir~
2428 $install_prog $dir/$dlname \$dldir/$dlname'
2429 postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~
2430 dlpath=$dir/\$dldll~
2431 $RM \$dlpath'
2432 shlibpath_overrides_runpath=yes
2433 dynamic_linker='Win32 link.exe'
2434 ;;
2435
2436 *)
2437 # Assume MSVC wrapper
2438 library_names_spec='${libname}`echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext} $libname.lib'
2439 dynamic_linker='Win32 ld.exe'
2440 ;;
2441 esac
2442 # FIXME: first we should search . and the directory the executable is in
2443 shlibpath_var=PATH
2444 ;;
2445
2446 darwin* | rhapsody*)
2447 dynamic_linker="$host_os dyld"
2448 version_type=darwin
2449 need_lib_prefix=no
2450 need_version=no
2451 library_names_spec='${libname}${release}${major}$shared_ext ${libname}$shared_ext'
2452 soname_spec='${libname}${release}${major}$shared_ext'
2453 shlibpath_overrides_runpath=yes
2454 shlibpath_var=DYLD_LIBRARY_PATH
2455 shrext_cmds='`test .$module = .yes && echo .so || echo .dylib`'
2456 m4_if([$1], [],[
2457 sys_lib_search_path_spec="$sys_lib_search_path_spec /usr/local/lib"])
2458 sys_lib_dlsearch_path_spec='/usr/local/lib /lib /usr/lib'
2459 ;;
2460
2461 dgux*)
2462 version_type=linux # correct to gnu/linux during the next big refactor
2463 need_lib_prefix=no
2464 need_version=no
2465 library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname$shared_ext'
2466 soname_spec='${libname}${release}${shared_ext}$major'
2467 shlibpath_var=LD_LIBRARY_PATH
2468 ;;
2469
2470 freebsd* | dragonfly*)
2471 # DragonFly does not have aout. When/if they implement a new
2472 # versioning mechanism, adjust this.
2473 if test -x /usr/bin/objformat; then
2474 objformat=`/usr/bin/objformat`
2475 else
2476 case $host_os in
2477 freebsd[[23]].*) objformat=aout ;;
2478 *) objformat=elf ;;
2479 esac
2480 fi
2481 version_type=freebsd-$objformat
2482 case $version_type in
2483 freebsd-elf*)
2484 library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}'
2485 need_version=no
2486 need_lib_prefix=no
2487 ;;
2488 freebsd-*)
2489 library_names_spec='${libname}${release}${shared_ext}$versuffix $libname${shared_ext}$versuffix'
2490 need_version=yes
2491 ;;
2492 esac
2493 shlibpath_var=LD_LIBRARY_PATH
2494 case $host_os in
2495 freebsd2.*)
2496 shlibpath_overrides_runpath=yes
2497 ;;
2498 freebsd3.[[01]]* | freebsdelf3.[[01]]*)
2499 shlibpath_overrides_runpath=yes
2500 hardcode_into_libs=yes
2501 ;;
2502 freebsd3.[[2-9]]* | freebsdelf3.[[2-9]]* | \
2503 freebsd4.[[0-5]] | freebsdelf4.[[0-5]] | freebsd4.1.1 | freebsdelf4.1.1)
2504 shlibpath_overrides_runpath=no
2505 hardcode_into_libs=yes
2506 ;;
2507 *) # from 4.6 on, and DragonFly
2508 shlibpath_overrides_runpath=yes
2509 hardcode_into_libs=yes
2510 ;;
2511 esac
2512 ;;
2513
2514 gnu*)
2515 version_type=linux # correct to gnu/linux during the next big refactor
2516 need_lib_prefix=no
2517 need_version=no
2518 library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}'
2519 soname_spec='${libname}${release}${shared_ext}$major'
2520 shlibpath_var=LD_LIBRARY_PATH
2521 shlibpath_overrides_runpath=no
2522 hardcode_into_libs=yes
2523 ;;
2524
2525 haiku*)
2526 version_type=linux # correct to gnu/linux during the next big refactor
2527 need_lib_prefix=no
2528 need_version=no
2529 dynamic_linker="$host_os runtime_loader"
2530 library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}'
2531 soname_spec='${libname}${release}${shared_ext}$major'
2532 shlibpath_var=LIBRARY_PATH
2533 shlibpath_overrides_runpath=yes
2534 sys_lib_dlsearch_path_spec='/boot/home/config/lib /boot/common/lib /boot/system/lib'
2535 hardcode_into_libs=yes
2536 ;;
2537
2538 hpux9* | hpux10* | hpux11*)
2539 # Give a soname corresponding to the major version so that dld.sl refuses to
2540 # link against other versions.
2541 version_type=sunos
2542 need_lib_prefix=no
2543 need_version=no
2544 case $host_cpu in
2545 ia64*)
2546 shrext_cmds='.so'
2547 hardcode_into_libs=yes
2548 dynamic_linker="$host_os dld.so"
2549 shlibpath_var=LD_LIBRARY_PATH
2550 shlibpath_overrides_runpath=yes # Unless +noenvvar is specified.
2551 library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
2552 soname_spec='${libname}${release}${shared_ext}$major'
2553 if test "X$HPUX_IA64_MODE" = X32; then
2554 sys_lib_search_path_spec="/usr/lib/hpux32 /usr/local/lib/hpux32 /usr/local/lib"
2555 else
2556 sys_lib_search_path_spec="/usr/lib/hpux64 /usr/local/lib/hpux64"
2557 fi
2558 sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec
2559 ;;
2560 hppa*64*)
2561 shrext_cmds='.sl'
2562 hardcode_into_libs=yes
2563 dynamic_linker="$host_os dld.sl"
2564 shlibpath_var=LD_LIBRARY_PATH # How should we handle SHLIB_PATH
2565 shlibpath_overrides_runpath=yes # Unless +noenvvar is specified.
2566 library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
2567 soname_spec='${libname}${release}${shared_ext}$major'
2568 sys_lib_search_path_spec="/usr/lib/pa20_64 /usr/ccs/lib/pa20_64"
2569 sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec
2570 ;;
2571 *)
2572 shrext_cmds='.sl'
2573 dynamic_linker="$host_os dld.sl"
2574 shlibpath_var=SHLIB_PATH
2575 shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH
2576 library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
2577 soname_spec='${libname}${release}${shared_ext}$major'
2578 ;;
2579 esac
2580 # HP-UX runs *really* slowly unless shared libraries are mode 555, ...
2581 postinstall_cmds='chmod 555 $lib'
2582 # or fails outright, so override atomically:
2583 install_override_mode=555
2584 ;;
2585
2586 interix[[3-9]]*)
2587 version_type=linux # correct to gnu/linux during the next big refactor
2588 need_lib_prefix=no
2589 need_version=no
2590 library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}'
2591 soname_spec='${libname}${release}${shared_ext}$major'
2592 dynamic_linker='Interix 3.x ld.so.1 (PE, like ELF)'
2593 shlibpath_var=LD_LIBRARY_PATH
2594 shlibpath_overrides_runpath=no
2595 hardcode_into_libs=yes
2596 ;;
2597
2598 irix5* | irix6* | nonstopux*)
2599 case $host_os in
2600 nonstopux*) version_type=nonstopux ;;
2601 *)
2602 if test "$lt_cv_prog_gnu_ld" = yes; then
2603 version_type=linux # correct to gnu/linux during the next big refactor
2604 else
2605 version_type=irix
2606 fi ;;
2607 esac
2608 need_lib_prefix=no
2609 need_version=no
2610 soname_spec='${libname}${release}${shared_ext}$major'
2611 library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext} $libname${shared_ext}'
2612 case $host_os in
2613 irix5* | nonstopux*)
2614 libsuff= shlibsuff=
2615 ;;
2616 *)
2617 case $LD in # libtool.m4 will add one of these switches to LD
2618 *-32|*"-32 "|*-melf32bsmip|*"-melf32bsmip ")
2619 libsuff= shlibsuff= libmagic=32-bit;;
2620 *-n32|*"-n32 "|*-melf32bmipn32|*"-melf32bmipn32 ")
2621 libsuff=32 shlibsuff=N32 libmagic=N32;;
2622 *-64|*"-64 "|*-melf64bmip|*"-melf64bmip ")
2623 libsuff=64 shlibsuff=64 libmagic=64-bit;;
2624 *) libsuff= shlibsuff= libmagic=never-match;;
2625 esac
2626 ;;
2627 esac
2628 shlibpath_var=LD_LIBRARY${shlibsuff}_PATH
2629 shlibpath_overrides_runpath=no
2630 sys_lib_search_path_spec="/usr/lib${libsuff} /lib${libsuff} /usr/local/lib${libsuff}"
2631 sys_lib_dlsearch_path_spec="/usr/lib${libsuff} /lib${libsuff}"
2632 hardcode_into_libs=yes
2633 ;;
2634
2635 # No shared lib support for Linux oldld, aout, or coff.
2636 linux*oldld* | linux*aout* | linux*coff*)
2637 dynamic_linker=no
2638 ;;
2639
2640 # This must be glibc/ELF.
2641 linux* | k*bsd*-gnu | kopensolaris*-gnu)
2642 version_type=linux # correct to gnu/linux during the next big refactor
2643 need_lib_prefix=no
2644 need_version=no
2645 library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
2646 soname_spec='${libname}${release}${shared_ext}$major'
2647 finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir'
2648 shlibpath_var=LD_LIBRARY_PATH
2649 shlibpath_overrides_runpath=no
2650
2651 # Some binutils ld are patched to set DT_RUNPATH
2652 AC_CACHE_VAL([lt_cv_shlibpath_overrides_runpath],
2653 [lt_cv_shlibpath_overrides_runpath=no
2654 save_LDFLAGS=$LDFLAGS
2655 save_libdir=$libdir
2656 eval "libdir=/foo; wl=\"$_LT_TAGVAR(lt_prog_compiler_wl, $1)\"; \
2657 LDFLAGS=\"\$LDFLAGS $_LT_TAGVAR(hardcode_libdir_flag_spec, $1)\""
2658 AC_LINK_IFELSE([AC_LANG_PROGRAM([],[])],
2659 [AS_IF([ ($OBJDUMP -p conftest$ac_exeext) 2>/dev/null | grep "RUNPATH.*$libdir" >/dev/null],
2660 [lt_cv_shlibpath_overrides_runpath=yes])])
2661 LDFLAGS=$save_LDFLAGS
2662 libdir=$save_libdir
2663 ])
2664 shlibpath_overrides_runpath=$lt_cv_shlibpath_overrides_runpath
2665
2666 # This implies no fast_install, which is unacceptable.
2667 # Some rework will be needed to allow for fast_install
2668 # before this can be enabled.
2669 hardcode_into_libs=yes
2670
2671 # Add ABI-specific directories to the system library path.
2672 sys_lib_dlsearch_path_spec="/lib64 /usr/lib64 /lib /usr/lib"
2673
2674 # Append ld.so.conf contents to the search path
2675 if test -f /etc/ld.so.conf; then
2676 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' ' '`
2677 sys_lib_dlsearch_path_spec="$sys_lib_dlsearch_path_spec $lt_ld_extra"
2678
2679 fi
2680
2681 # We used to test for /lib/ld.so.1 and disable shared libraries on
2682 # powerpc, because MkLinux only supported shared libraries with the
2683 # GNU dynamic linker. Since this was broken with cross compilers,
2684 # most powerpc-linux boxes support dynamic linking these days and
2685 # people can always --disable-shared, the test was removed, and we
2686 # assume the GNU/Linux dynamic linker is in use.
2687 dynamic_linker='GNU/Linux ld.so'
2688 ;;
2689
2690 netbsd*)
2691 version_type=sunos
2692 need_lib_prefix=no
2693 need_version=no
2694 if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then
2695 library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix'
2696 finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir'
2697 dynamic_linker='NetBSD (a.out) ld.so'
2698 else
2699 library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}'
2700 soname_spec='${libname}${release}${shared_ext}$major'
2701 dynamic_linker='NetBSD ld.elf_so'
2702 fi
2703 shlibpath_var=LD_LIBRARY_PATH
2704 shlibpath_overrides_runpath=yes
2705 hardcode_into_libs=yes
2706 ;;
2707
2708 newsos6)
2709 version_type=linux # correct to gnu/linux during the next big refactor
2710 library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
2711 shlibpath_var=LD_LIBRARY_PATH
2712 shlibpath_overrides_runpath=yes
2713 ;;
2714
2715 *nto* | *qnx*)
2716 version_type=qnx
2717 need_lib_prefix=no
2718 need_version=no
2719 library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
2720 soname_spec='${libname}${release}${shared_ext}$major'
2721 shlibpath_var=LD_LIBRARY_PATH
2722 shlibpath_overrides_runpath=no
2723 hardcode_into_libs=yes
2724 dynamic_linker='ldqnx.so'
2725 ;;
2726
2727 openbsd*)
2728 version_type=sunos
2729 sys_lib_dlsearch_path_spec="/usr/lib"
2730 need_lib_prefix=no
2731 # Some older versions of OpenBSD (3.3 at least) *do* need versioned libs.
2732 case $host_os in
2733 openbsd3.3 | openbsd3.3.*) need_version=yes ;;
2734 *) need_version=no ;;
2735 esac
2736 library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix'
2737 finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir'
2738 shlibpath_var=LD_LIBRARY_PATH
2739 if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then
2740 case $host_os in
2741 openbsd2.[[89]] | openbsd2.[[89]].*)
2742 shlibpath_overrides_runpath=no
2743 ;;
2744 *)
2745 shlibpath_overrides_runpath=yes
2746 ;;
2747 esac
2748 else
2749 shlibpath_overrides_runpath=yes
2750 fi
2751 ;;
2752
2753 os2*)
2754 libname_spec='$name'
2755 shrext_cmds=".dll"
2756 need_lib_prefix=no
2757 library_names_spec='$libname${shared_ext} $libname.a'
2758 dynamic_linker='OS/2 ld.exe'
2759 shlibpath_var=LIBPATH
2760 ;;
2761
2762 osf3* | osf4* | osf5*)
2763 version_type=osf
2764 need_lib_prefix=no
2765 need_version=no
2766 soname_spec='${libname}${release}${shared_ext}$major'
2767 library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
2768 shlibpath_var=LD_LIBRARY_PATH
2769 sys_lib_search_path_spec="/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /usr/local/lib /var/shlib"
2770 sys_lib_dlsearch_path_spec="$sys_lib_search_path_spec"
2771 ;;
2772
2773 rdos*)
2774 dynamic_linker=no
2775 ;;
2776
2777 solaris*)
2778 version_type=linux # correct to gnu/linux during the next big refactor
2779 need_lib_prefix=no
2780 need_version=no
2781 library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
2782 soname_spec='${libname}${release}${shared_ext}$major'
2783 shlibpath_var=LD_LIBRARY_PATH
2784 shlibpath_overrides_runpath=yes
2785 hardcode_into_libs=yes
2786 # ldd complains unless libraries are executable
2787 postinstall_cmds='chmod +x $lib'
2788 ;;
2789
2790 sunos4*)
2791 version_type=sunos
2792 library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix'
2793 finish_cmds='PATH="\$PATH:/usr/etc" ldconfig $libdir'
2794 shlibpath_var=LD_LIBRARY_PATH
2795 shlibpath_overrides_runpath=yes
2796 if test "$with_gnu_ld" = yes; then
2797 need_lib_prefix=no
2798 fi
2799 need_version=yes
2800 ;;
2801
2802 sysv4 | sysv4.3*)
2803 version_type=linux # correct to gnu/linux during the next big refactor
2804 library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
2805 soname_spec='${libname}${release}${shared_ext}$major'
2806 shlibpath_var=LD_LIBRARY_PATH
2807 case $host_vendor in
2808 sni)
2809 shlibpath_overrides_runpath=no
2810 need_lib_prefix=no
2811 runpath_var=LD_RUN_PATH
2812 ;;
2813 siemens)
2814 need_lib_prefix=no
2815 ;;
2816 motorola)
2817 need_lib_prefix=no
2818 need_version=no
2819 shlibpath_overrides_runpath=no
2820 sys_lib_search_path_spec='/lib /usr/lib /usr/ccs/lib'
2821 ;;
2822 esac
2823 ;;
2824
2825 sysv4*MP*)
2826 if test -d /usr/nec ;then
2827 version_type=linux # correct to gnu/linux during the next big refactor
2828 library_names_spec='$libname${shared_ext}.$versuffix $libname${shared_ext}.$major $libname${shared_ext}'
2829 soname_spec='$libname${shared_ext}.$major'
2830 shlibpath_var=LD_LIBRARY_PATH
2831 fi
2832 ;;
2833
2834 sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*)
2835 version_type=freebsd-elf
2836 need_lib_prefix=no
2837 need_version=no
2838 library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}'
2839 soname_spec='${libname}${release}${shared_ext}$major'
2840 shlibpath_var=LD_LIBRARY_PATH
2841 shlibpath_overrides_runpath=yes
2842 hardcode_into_libs=yes
2843 if test "$with_gnu_ld" = yes; then
2844 sys_lib_search_path_spec='/usr/local/lib /usr/gnu/lib /usr/ccs/lib /usr/lib /lib'
2845 else
2846 sys_lib_search_path_spec='/usr/ccs/lib /usr/lib'
2847 case $host_os in
2848 sco3.2v5*)
2849 sys_lib_search_path_spec="$sys_lib_search_path_spec /lib"
2850 ;;
2851 esac
2852 fi
2853 sys_lib_dlsearch_path_spec='/usr/lib'
2854 ;;
2855
2856 tpf*)
2857 # TPF is a cross-target only. Preferred cross-host = GNU/Linux.
2858 version_type=linux # correct to gnu/linux during the next big refactor
2859 need_lib_prefix=no
2860 need_version=no
2861 library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
2862 shlibpath_var=LD_LIBRARY_PATH
2863 shlibpath_overrides_runpath=no
2864 hardcode_into_libs=yes
2865 ;;
2866
2867 uts4*)
2868 version_type=linux # correct to gnu/linux during the next big refactor
2869 library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
2870 soname_spec='${libname}${release}${shared_ext}$major'
2871 shlibpath_var=LD_LIBRARY_PATH
2872 ;;
2873
2874 *)
2875 dynamic_linker=no
2876 ;;
2877 esac
2878 AC_MSG_RESULT([$dynamic_linker])
2879 test "$dynamic_linker" = no && can_build_shared=no
2880
2881 variables_saved_for_relink="PATH $shlibpath_var $runpath_var"
2882 if test "$GCC" = yes; then
2883 variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH"
2884 fi
2885
2886 if test "${lt_cv_sys_lib_search_path_spec+set}" = set; then
2887 sys_lib_search_path_spec="$lt_cv_sys_lib_search_path_spec"
2888 fi
2889 if test "${lt_cv_sys_lib_dlsearch_path_spec+set}" = set; then
2890 sys_lib_dlsearch_path_spec="$lt_cv_sys_lib_dlsearch_path_spec"
2891 fi
2892
2893 _LT_DECL([], [variables_saved_for_relink], [1],
2894 [Variables whose values should be saved in libtool wrapper scripts and
2895 restored at link time])
2896 _LT_DECL([], [need_lib_prefix], [0],
2897 [Do we need the "lib" prefix for modules?])
2898 _LT_DECL([], [need_version], [0], [Do we need a version for libraries?])
2899 _LT_DECL([], [version_type], [0], [Library versioning type])
2900 _LT_DECL([], [runpath_var], [0], [Shared library runtime path variable])
2901 _LT_DECL([], [shlibpath_var], [0],[Shared library path variable])
2902 _LT_DECL([], [shlibpath_overrides_runpath], [0],
2903 [Is shlibpath searched before the hard-coded library search path?])
2904 _LT_DECL([], [libname_spec], [1], [Format of library name prefix])
2905 _LT_DECL([], [library_names_spec], [1],
2906 [[List of archive names. First name is the real one, the rest are links.
2907 The last name is the one that the linker finds with -lNAME]])
2908 _LT_DECL([], [soname_spec], [1],
2909 [[The coded name of the library, if different from the real name]])
2910 _LT_DECL([], [install_override_mode], [1],
2911 [Permission mode override for installation of shared libraries])
2912 _LT_DECL([], [postinstall_cmds], [2],
2913 [Command to use after installation of a shared archive])
2914 _LT_DECL([], [postuninstall_cmds], [2],
2915 [Command to use after uninstallation of a shared archive])
2916 _LT_DECL([], [finish_cmds], [2],
2917 [Commands used to finish a libtool library installation in a directory])
2918 _LT_DECL([], [finish_eval], [1],
2919 [[As "finish_cmds", except a single script fragment to be evaled but
2920 not shown]])
2921 _LT_DECL([], [hardcode_into_libs], [0],
2922 [Whether we should hardcode library paths into libraries])
2923 _LT_DECL([], [sys_lib_search_path_spec], [2],
2924 [Compile-time system search path for libraries])
2925 _LT_DECL([], [sys_lib_dlsearch_path_spec], [2],
2926 [Run-time system search path for libraries])
2927 ])# _LT_SYS_DYNAMIC_LINKER
2928
2929
2930 # _LT_PATH_TOOL_PREFIX(TOOL)
2931 # --------------------------
2932 # find a file program which can recognize shared library
2933 AC_DEFUN([_LT_PATH_TOOL_PREFIX],
2934 [m4_require([_LT_DECL_EGREP])dnl
2935 AC_MSG_CHECKING([for $1])
2936 AC_CACHE_VAL(lt_cv_path_MAGIC_CMD,
2937 [case $MAGIC_CMD in
2938 [[\\/*] | ?:[\\/]*])
2939 lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a path.
2940 ;;
2941 *)
2942 lt_save_MAGIC_CMD="$MAGIC_CMD"
2943 lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR
2944 dnl $ac_dummy forces splitting on constant user-supplied paths.
2945 dnl POSIX.2 word splitting is done only on the output of word expansions,
2946 dnl not every word. This closes a longstanding sh security hole.
2947 ac_dummy="m4_if([$2], , $PATH, [$2])"
2948 for ac_dir in $ac_dummy; do
2949 IFS="$lt_save_ifs"
2950 test -z "$ac_dir" && ac_dir=.
2951 if test -f $ac_dir/$1; then
2952 lt_cv_path_MAGIC_CMD="$ac_dir/$1"
2953 if test -n "$file_magic_test_file"; then
2954 case $deplibs_check_method in
2955 "file_magic "*)
2956 file_magic_regex=`expr "$deplibs_check_method" : "file_magic \(.*\)"`
2957 MAGIC_CMD="$lt_cv_path_MAGIC_CMD"
2958 if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null |
2959 $EGREP "$file_magic_regex" > /dev/null; then
2960 :
2961 else
2962 cat <<_LT_EOF 1>&2
2963
2964 *** Warning: the command libtool uses to detect shared libraries,
2965 *** $file_magic_cmd, produces output that libtool cannot recognize.
2966 *** The result is that libtool may fail to recognize shared libraries
2967 *** as such. This will affect the creation of libtool libraries that
2968 *** depend on shared libraries, but programs linked with such libtool
2969 *** libraries will work regardless of this problem. Nevertheless, you
2970 *** may want to report the problem to your system manager and/or to
2971 *** bug-libtool@gnu.org
2972
2973 _LT_EOF
2974 fi ;;
2975 esac
2976 fi
2977 break
2978 fi
2979 done
2980 IFS="$lt_save_ifs"
2981 MAGIC_CMD="$lt_save_MAGIC_CMD"
2982 ;;
2983 esac])
2984 MAGIC_CMD="$lt_cv_path_MAGIC_CMD"
2985 if test -n "$MAGIC_CMD"; then
2986 AC_MSG_RESULT($MAGIC_CMD)
2987 else
2988 AC_MSG_RESULT(no)
2989 fi
2990 _LT_DECL([], [MAGIC_CMD], [0],
2991 [Used to examine libraries when file_magic_cmd begins with "file"])dnl
2992 ])# _LT_PATH_TOOL_PREFIX
2993
2994 # Old name:
2995 AU_ALIAS([AC_PATH_TOOL_PREFIX], [_LT_PATH_TOOL_PREFIX])
2996 dnl aclocal-1.4 backwards compatibility:
2997 dnl AC_DEFUN([AC_PATH_TOOL_PREFIX], [])
2998
2999
3000 # _LT_PATH_MAGIC
3001 # --------------
3002 # find a file program which can recognize a shared library
3003 m4_defun([_LT_PATH_MAGIC],
3004 [_LT_PATH_TOOL_PREFIX(${ac_tool_prefix}file, /usr/bin$PATH_SEPARATOR$PATH)
3005 if test -z "$lt_cv_path_MAGIC_CMD"; then
3006 if test -n "$ac_tool_prefix"; then
3007 _LT_PATH_TOOL_PREFIX(file, /usr/bin$PATH_SEPARATOR$PATH)
3008 else
3009 MAGIC_CMD=:
3010 fi
3011 fi
3012 ])# _LT_PATH_MAGIC
3013
3014
3015 # LT_PATH_LD
3016 # ----------
3017 # find the pathname to the GNU or non-GNU linker
3018 AC_DEFUN([LT_PATH_LD],
3019 [AC_REQUIRE([AC_PROG_CC])dnl
3020 AC_REQUIRE([AC_CANONICAL_HOST])dnl
3021 AC_REQUIRE([AC_CANONICAL_BUILD])dnl
3022 m4_require([_LT_DECL_SED])dnl
3023 m4_require([_LT_DECL_EGREP])dnl
3024 m4_require([_LT_PROG_ECHO_BACKSLASH])dnl
3025
3026 AC_ARG_WITH([gnu-ld],
3027 [AS_HELP_STRING([--with-gnu-ld],
3028 [assume the C compiler uses GNU ld @<:@default=no@:>@])],
3029 [test "$withval" = no || with_gnu_ld=yes],
3030 [with_gnu_ld=no])dnl
3031
3032 ac_prog=ld
3033 if test "$GCC" = yes; then
3034 # Check if gcc -print-prog-name=ld gives a path.
3035 AC_MSG_CHECKING([for ld used by $CC])
3036 case $host in
3037 *-*-mingw*)
3038 # gcc leaves a trailing carriage return which upsets mingw
3039 ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;;
3040 *)
3041 ac_prog=`($CC -print-prog-name=ld) 2>&5` ;;
3042 esac
3043 case $ac_prog in
3044 # Accept absolute paths.
3045 [[\\/]]* | ?:[[\\/]]*)
3046 re_direlt='/[[^/]][[^/]]*/\.\./'
3047 # Canonicalize the pathname of ld
3048 ac_prog=`$ECHO "$ac_prog"| $SED 's%\\\\%/%g'`
3049 while $ECHO "$ac_prog" | $GREP "$re_direlt" > /dev/null 2>&1; do
3050 ac_prog=`$ECHO $ac_prog| $SED "s%$re_direlt%/%"`
3051 done
3052 test -z "$LD" && LD="$ac_prog"
3053 ;;
3054 "")
3055 # If it fails, then pretend we aren't using GCC.
3056 ac_prog=ld
3057 ;;
3058 *)
3059 # If it is relative, then search for the first ld in PATH.
3060 with_gnu_ld=unknown
3061 ;;
3062 esac
3063 elif test "$with_gnu_ld" = yes; then
3064 AC_MSG_CHECKING([for GNU ld])
3065 else
3066 AC_MSG_CHECKING([for non-GNU ld])
3067 fi
3068 AC_CACHE_VAL(lt_cv_path_LD,
3069 [if test -z "$LD"; then
3070 lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR
3071 for ac_dir in $PATH; do
3072 IFS="$lt_save_ifs"
3073 test -z "$ac_dir" && ac_dir=.
3074 if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then
3075 lt_cv_path_LD="$ac_dir/$ac_prog"
3076 # Check to see if the program is GNU ld. I'd rather use --version,
3077 # but apparently some variants of GNU ld only accept -v.
3078 # Break only if it was the GNU/non-GNU ld that we prefer.
3079 case `"$lt_cv_path_LD" -v 2>&1 </dev/null` in
3080 *GNU* | *'with BFD'*)
3081 test "$with_gnu_ld" != no && break
3082 ;;
3083 *)
3084 test "$with_gnu_ld" != yes && break
3085 ;;
3086 esac
3087 fi
3088 done
3089 IFS="$lt_save_ifs"
3090 else
3091 lt_cv_path_LD="$LD" # Let the user override the test with a path.
3092 fi])
3093 LD="$lt_cv_path_LD"
3094 if test -n "$LD"; then
3095 AC_MSG_RESULT($LD)
3096 else
3097 AC_MSG_RESULT(no)
3098 fi
3099 test -z "$LD" && AC_MSG_ERROR([no acceptable ld found in \$PATH])
3100 _LT_PATH_LD_GNU
3101 AC_SUBST([LD])
3102
3103 _LT_TAGDECL([], [LD], [1], [The linker used to build libraries])
3104 ])# LT_PATH_LD
3105
3106 # Old names:
3107 AU_ALIAS([AM_PROG_LD], [LT_PATH_LD])
3108 AU_ALIAS([AC_PROG_LD], [LT_PATH_LD])
3109 dnl aclocal-1.4 backwards compatibility:
3110 dnl AC_DEFUN([AM_PROG_LD], [])
3111 dnl AC_DEFUN([AC_PROG_LD], [])
3112
3113
3114 # _LT_PATH_LD_GNU
3115 #- --------------
3116 m4_defun([_LT_PATH_LD_GNU],
3117 [AC_CACHE_CHECK([if the linker ($LD) is GNU ld], lt_cv_prog_gnu_ld,
3118 [# I'd rather use --version here, but apparently some GNU lds only accept -v.
3119 case `$LD -v 2>&1 </dev/null` in
3120 *GNU* | *'with BFD'*)
3121 lt_cv_prog_gnu_ld=yes
3122 ;;
3123 *)
3124 lt_cv_prog_gnu_ld=no
3125 ;;
3126 esac])
3127 with_gnu_ld=$lt_cv_prog_gnu_ld
3128 ])# _LT_PATH_LD_GNU
3129
3130
3131 # _LT_CMD_RELOAD
3132 # --------------
3133 # find reload flag for linker
3134 # -- PORTME Some linkers may need a different reload flag.
3135 m4_defun([_LT_CMD_RELOAD],
3136 [AC_CACHE_CHECK([for $LD option to reload object files],
3137 lt_cv_ld_reload_flag,
3138 [lt_cv_ld_reload_flag='-r'])
3139 reload_flag=$lt_cv_ld_reload_flag
3140 case $reload_flag in
3141 "" | " "*) ;;
3142 *) reload_flag=" $reload_flag" ;;
3143 esac
3144 reload_cmds='$LD$reload_flag -o $output$reload_objs'
3145 case $host_os in
3146 cygwin* | mingw* | pw32* | cegcc*)
3147 if test "$GCC" != yes; then
3148 reload_cmds=false
3149 fi
3150 ;;
3151 darwin*)
3152 if test "$GCC" = yes; then
3153 reload_cmds='$LTCC $LTCFLAGS -nostdlib ${wl}-r -o $output$reload_objs'
3154 else
3155 reload_cmds='$LD$reload_flag -o $output$reload_objs'
3156 fi
3157 ;;
3158 esac
3159 _LT_TAGDECL([], [reload_flag], [1], [How to create reloadable object files])dnl
3160 _LT_TAGDECL([], [reload_cmds], [2])dnl
3161 ])# _LT_CMD_RELOAD
3162
3163
3164 # _LT_CHECK_MAGIC_METHOD
3165 # ----------------------
3166 # how to check for library dependencies
3167 # -- PORTME fill in with the dynamic library characteristics
3168 m4_defun([_LT_CHECK_MAGIC_METHOD],
3169 [m4_require([_LT_DECL_EGREP])
3170 m4_require([_LT_DECL_OBJDUMP])
3171 AC_CACHE_CHECK([how to recognize dependent libraries],
3172 lt_cv_deplibs_check_method,
3173 [lt_cv_file_magic_cmd='$MAGIC_CMD'
3174 lt_cv_file_magic_test_file=
3175 lt_cv_deplibs_check_method='unknown'
3176 # Need to set the preceding variable on all platforms that support
3177 # interlibrary dependencies.
3178 # 'none' -- dependencies not supported.
3179 # `unknown' -- same as none, but documents that we really don't know.
3180 # 'pass_all' -- all dependencies passed with no checks.
3181 # 'test_compile' -- check by making test program.
3182 # 'file_magic [[regex]]' -- check by looking for files in library path
3183 # which responds to the $file_magic_cmd with a given extended regex.
3184 # If you have `file' or equivalent on your system and you're not sure
3185 # whether `pass_all' will *always* work, you probably want this one.
3186
3187 case $host_os in
3188 aix[[4-9]]*)
3189 lt_cv_deplibs_check_method=pass_all
3190 ;;
3191
3192 beos*)
3193 lt_cv_deplibs_check_method=pass_all
3194 ;;
3195
3196 bsdi[[45]]*)
3197 lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[ML]]SB (shared object|dynamic lib)'
3198 lt_cv_file_magic_cmd='/usr/bin/file -L'
3199 lt_cv_file_magic_test_file=/shlib/libc.so
3200 ;;
3201
3202 cygwin*)
3203 # func_win32_libid is a shell function defined in ltmain.sh
3204 lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL'
3205 lt_cv_file_magic_cmd='func_win32_libid'
3206 ;;
3207
3208 mingw* | pw32*)
3209 # Base MSYS/MinGW do not provide the 'file' command needed by
3210 # func_win32_libid shell function, so use a weaker test based on 'objdump',
3211 # unless we find 'file', for example because we are cross-compiling.
3212 # func_win32_libid assumes BSD nm, so disallow it if using MS dumpbin.
3213 if ( test "$lt_cv_nm_interface" = "BSD nm" && file / ) >/dev/null 2>&1; then
3214 lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL'
3215 lt_cv_file_magic_cmd='func_win32_libid'
3216 else
3217 # Keep this pattern in sync with the one in func_win32_libid.
3218 lt_cv_deplibs_check_method='file_magic file format (pei*-i386(.*architecture: i386)?|pe-arm-wince|pe-x86-64)'
3219 lt_cv_file_magic_cmd='$OBJDUMP -f'
3220 fi
3221 ;;
3222
3223 cegcc*)
3224 # use the weaker test based on 'objdump'. See mingw*.
3225 lt_cv_deplibs_check_method='file_magic file format pe-arm-.*little(.*architecture: arm)?'
3226 lt_cv_file_magic_cmd='$OBJDUMP -f'
3227 ;;
3228
3229 darwin* | rhapsody*)
3230 lt_cv_deplibs_check_method=pass_all
3231 ;;
3232
3233 freebsd* | dragonfly*)
3234 if echo __ELF__ | $CC -E - | $GREP __ELF__ > /dev/null; then
3235 case $host_cpu in
3236 i*86 )
3237 # Not sure whether the presence of OpenBSD here was a mistake.
3238 # Let's accept both of them until this is cleared up.
3239 lt_cv_deplibs_check_method='file_magic (FreeBSD|OpenBSD|DragonFly)/i[[3-9]]86 (compact )?demand paged shared library'
3240 lt_cv_file_magic_cmd=/usr/bin/file
3241 lt_cv_file_magic_test_file=`echo /usr/lib/libc.so.*`
3242 ;;
3243 esac
3244 else
3245 lt_cv_deplibs_check_method=pass_all
3246 fi
3247 ;;
3248
3249 gnu*)
3250 lt_cv_deplibs_check_method=pass_all
3251 ;;
3252
3253 haiku*)
3254 lt_cv_deplibs_check_method=pass_all
3255 ;;
3256
3257 hpux10.20* | hpux11*)
3258 lt_cv_file_magic_cmd=/usr/bin/file
3259 case $host_cpu in
3260 ia64*)
3261 lt_cv_deplibs_check_method='file_magic (s[[0-9]][[0-9]][[0-9]]|ELF-[[0-9]][[0-9]]) shared object file - IA64'
3262 lt_cv_file_magic_test_file=/usr/lib/hpux32/libc.so
3263 ;;
3264 hppa*64*)
3265 [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]']
3266 lt_cv_file_magic_test_file=/usr/lib/pa20_64/libc.sl
3267 ;;
3268 *)
3269 lt_cv_deplibs_check_method='file_magic (s[[0-9]][[0-9]][[0-9]]|PA-RISC[[0-9]]\.[[0-9]]) shared library'
3270 lt_cv_file_magic_test_file=/usr/lib/libc.sl
3271 ;;
3272 esac
3273 ;;
3274
3275 interix[[3-9]]*)
3276 # PIC code is broken on Interix 3.x, that's why |\.a not |_pic\.a here
3277 lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so|\.a)$'
3278 ;;
3279
3280 irix5* | irix6* | nonstopux*)
3281 case $LD in
3282 *-32|*"-32 ") libmagic=32-bit;;
3283 *-n32|*"-n32 ") libmagic=N32;;
3284 *-64|*"-64 ") libmagic=64-bit;;
3285 *) libmagic=never-match;;
3286 esac
3287 lt_cv_deplibs_check_method=pass_all
3288 ;;
3289
3290 # This must be glibc/ELF.
3291 linux* | k*bsd*-gnu | kopensolaris*-gnu)
3292 lt_cv_deplibs_check_method=pass_all
3293 ;;
3294
3295 netbsd*)
3296 if echo __ELF__ | $CC -E - | $GREP __ELF__ > /dev/null; then
3297 lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so\.[[0-9]]+\.[[0-9]]+|_pic\.a)$'
3298 else
3299 lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so|_pic\.a)$'
3300 fi
3301 ;;
3302
3303 newos6*)
3304 lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[ML]]SB (executable|dynamic lib)'
3305 lt_cv_file_magic_cmd=/usr/bin/file
3306 lt_cv_file_magic_test_file=/usr/lib/libnls.so
3307 ;;
3308
3309 *nto* | *qnx*)
3310 lt_cv_deplibs_check_method=pass_all
3311 ;;
3312
3313 openbsd*)
3314 if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then
3315 lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so\.[[0-9]]+\.[[0-9]]+|\.so|_pic\.a)$'
3316 else
3317 lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so\.[[0-9]]+\.[[0-9]]+|_pic\.a)$'
3318 fi
3319 ;;
3320
3321 osf3* | osf4* | osf5*)
3322 lt_cv_deplibs_check_method=pass_all
3323 ;;
3324
3325 rdos*)
3326 lt_cv_deplibs_check_method=pass_all
3327 ;;
3328
3329 solaris*)
3330 lt_cv_deplibs_check_method=pass_all
3331 ;;
3332
3333 sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*)
3334 lt_cv_deplibs_check_method=pass_all
3335 ;;
3336
3337 sysv4 | sysv4.3*)
3338 case $host_vendor in
3339 motorola)
3340 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]]'
3341 lt_cv_file_magic_test_file=`echo /usr/lib/libc.so*`
3342 ;;
3343 ncr)
3344 lt_cv_deplibs_check_method=pass_all
3345 ;;
3346 sequent)
3347 lt_cv_file_magic_cmd='/bin/file'
3348 lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[LM]]SB (shared object|dynamic lib )'
3349 ;;
3350 sni)
3351 lt_cv_file_magic_cmd='/bin/file'
3352 lt_cv_deplibs_check_method="file_magic ELF [[0-9]][[0-9]]*-bit [[LM]]SB dynamic lib"
3353 lt_cv_file_magic_test_file=/lib/libc.so
3354 ;;
3355 siemens)
3356 lt_cv_deplibs_check_method=pass_all
3357 ;;
3358 pc)
3359 lt_cv_deplibs_check_method=pass_all
3360 ;;
3361 esac
3362 ;;
3363
3364 tpf*)
3365 lt_cv_deplibs_check_method=pass_all
3366 ;;
3367 esac
3368 ])
3369
3370 file_magic_glob=
3371 want_nocaseglob=no
3372 if test "$build" = "$host"; then
3373 case $host_os in
3374 mingw* | pw32*)
3375 if ( shopt | grep nocaseglob ) >/dev/null 2>&1; then
3376 want_nocaseglob=yes
3377 else
3378 file_magic_glob=`echo aAbBcCdDeEfFgGhHiIjJkKlLmMnNoOpPqQrRsStTuUvVwWxXyYzZ | $SED -e "s/\(..\)/s\/[[\1]]\/[[\1]]\/g;/g"`
3379 fi
3380 ;;
3381 esac
3382 fi
3383
3384 file_magic_cmd=$lt_cv_file_magic_cmd
3385 deplibs_check_method=$lt_cv_deplibs_check_method
3386 test -z "$deplibs_check_method" && deplibs_check_method=unknown
3387
3388 _LT_DECL([], [deplibs_check_method], [1],
3389 [Method to check whether dependent libraries are shared objects])
3390 _LT_DECL([], [file_magic_cmd], [1],
3391 [Command to use when deplibs_check_method = "file_magic"])
3392 _LT_DECL([], [file_magic_glob], [1],
3393 [How to find potential files when deplibs_check_method = "file_magic"])
3394 _LT_DECL([], [want_nocaseglob], [1],
3395 [Find potential files using nocaseglob when deplibs_check_method = "file_magic"])
3396 ])# _LT_CHECK_MAGIC_METHOD
3397
3398
3399 # LT_PATH_NM
3400 # ----------
3401 # find the pathname to a BSD- or MS-compatible name lister
3402 AC_DEFUN([LT_PATH_NM],
3403 [AC_REQUIRE([AC_PROG_CC])dnl
3404 AC_CACHE_CHECK([for BSD- or MS-compatible name lister (nm)], lt_cv_path_NM,
3405 [if test -n "$NM"; then
3406 # Let the user override the test.
3407 lt_cv_path_NM="$NM"
3408 else
3409 lt_nm_to_check="${ac_tool_prefix}nm"
3410 if test -n "$ac_tool_prefix" && test "$build" = "$host"; then
3411 lt_nm_to_check="$lt_nm_to_check nm"
3412 fi
3413 for lt_tmp_nm in $lt_nm_to_check; do
3414 lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR
3415 for ac_dir in $PATH /usr/ccs/bin/elf /usr/ccs/bin /usr/ucb /bin; do
3416 IFS="$lt_save_ifs"
3417 test -z "$ac_dir" && ac_dir=.
3418 tmp_nm="$ac_dir/$lt_tmp_nm"
3419 if test -f "$tmp_nm" || test -f "$tmp_nm$ac_exeext" ; then
3420 # Check to see if the nm accepts a BSD-compat flag.
3421 # Adding the `sed 1q' prevents false positives on HP-UX, which says:
3422 # nm: unknown option "B" ignored
3423 # Tru64's nm complains that /dev/null is an invalid object file
3424 case `"$tmp_nm" -B /dev/null 2>&1 | sed '1q'` in
3425 */dev/null* | *'Invalid file or object type'*)
3426 lt_cv_path_NM="$tmp_nm -B"
3427 break
3428 ;;
3429 *)
3430 case `"$tmp_nm" -p /dev/null 2>&1 | sed '1q'` in
3431 */dev/null*)
3432 lt_cv_path_NM="$tmp_nm -p"
3433 break
3434 ;;
3435 *)
3436 lt_cv_path_NM=${lt_cv_path_NM="$tmp_nm"} # keep the first match, but
3437 continue # so that we can try to find one that supports BSD flags
3438 ;;
3439 esac
3440 ;;
3441 esac
3442 fi
3443 done
3444 IFS="$lt_save_ifs"
3445 done
3446 : ${lt_cv_path_NM=no}
3447 fi])
3448 if test "$lt_cv_path_NM" != "no"; then
3449 NM="$lt_cv_path_NM"
3450 else
3451 # Didn't find any BSD compatible name lister, look for dumpbin.
3452 if test -n "$DUMPBIN"; then :
3453 # Let the user override the test.
3454 else
3455 AC_CHECK_TOOLS(DUMPBIN, [dumpbin "link -dump"], :)
3456 case `$DUMPBIN -symbols /dev/null 2>&1 | sed '1q'` in
3457 *COFF*)
3458 DUMPBIN="$DUMPBIN -symbols"
3459 ;;
3460 *)
3461 DUMPBIN=:
3462 ;;
3463 esac
3464 fi
3465 AC_SUBST([DUMPBIN])
3466 if test "$DUMPBIN" != ":"; then
3467 NM="$DUMPBIN"
3468 fi
3469 fi
3470 test -z "$NM" && NM=nm
3471 AC_SUBST([NM])
3472 _LT_DECL([], [NM], [1], [A BSD- or MS-compatible name lister])dnl
3473
3474 AC_CACHE_CHECK([the name lister ($NM) interface], [lt_cv_nm_interface],
3475 [lt_cv_nm_interface="BSD nm"
3476 echo "int some_variable = 0;" > conftest.$ac_ext
3477 (eval echo "\"\$as_me:$LINENO: $ac_compile\"" >&AS_MESSAGE_LOG_FD)
3478 (eval "$ac_compile" 2>conftest.err)
3479 cat conftest.err >&AS_MESSAGE_LOG_FD
3480 (eval echo "\"\$as_me:$LINENO: $NM \\\"conftest.$ac_objext\\\"\"" >&AS_MESSAGE_LOG_FD)
3481 (eval "$NM \"conftest.$ac_objext\"" 2>conftest.err > conftest.out)
3482 cat conftest.err >&AS_MESSAGE_LOG_FD
3483 (eval echo "\"\$as_me:$LINENO: output\"" >&AS_MESSAGE_LOG_FD)
3484 cat conftest.out >&AS_MESSAGE_LOG_FD
3485 if $GREP 'External.*some_variable' conftest.out > /dev/null; then
3486 lt_cv_nm_interface="MS dumpbin"
3487 fi
3488 rm -f conftest*])
3489 ])# LT_PATH_NM
3490
3491 # Old names:
3492 AU_ALIAS([AM_PROG_NM], [LT_PATH_NM])
3493 AU_ALIAS([AC_PROG_NM], [LT_PATH_NM])
3494 dnl aclocal-1.4 backwards compatibility:
3495 dnl AC_DEFUN([AM_PROG_NM], [])
3496 dnl AC_DEFUN([AC_PROG_NM], [])
3497
3498 # _LT_CHECK_SHAREDLIB_FROM_LINKLIB
3499 # --------------------------------
3500 # how to determine the name of the shared library
3501 # associated with a specific link library.
3502 # -- PORTME fill in with the dynamic library characteristics
3503 m4_defun([_LT_CHECK_SHAREDLIB_FROM_LINKLIB],
3504 [m4_require([_LT_DECL_EGREP])
3505 m4_require([_LT_DECL_OBJDUMP])
3506 m4_require([_LT_DECL_DLLTOOL])
3507 AC_CACHE_CHECK([how to associate runtime and link libraries],
3508 lt_cv_sharedlib_from_linklib_cmd,
3509 [lt_cv_sharedlib_from_linklib_cmd='unknown'
3510
3511 case $host_os in
3512 cygwin* | mingw* | pw32* | cegcc*)
3513 # two different shell functions defined in ltmain.sh
3514 # decide which to use based on capabilities of $DLLTOOL
3515 case `$DLLTOOL --help 2>&1` in
3516 *--identify-strict*)
3517 lt_cv_sharedlib_from_linklib_cmd=func_cygming_dll_for_implib
3518 ;;
3519 *)
3520 lt_cv_sharedlib_from_linklib_cmd=func_cygming_dll_for_implib_fallback
3521 ;;
3522 esac
3523 ;;
3524 *)
3525 # fallback: assume linklib IS sharedlib
3526 lt_cv_sharedlib_from_linklib_cmd="$ECHO"
3527 ;;
3528 esac
3529 ])
3530 sharedlib_from_linklib_cmd=$lt_cv_sharedlib_from_linklib_cmd
3531 test -z "$sharedlib_from_linklib_cmd" && sharedlib_from_linklib_cmd=$ECHO
3532
3533 _LT_DECL([], [sharedlib_from_linklib_cmd], [1],
3534 [Command to associate shared and link libraries])
3535 ])# _LT_CHECK_SHAREDLIB_FROM_LINKLIB
3536
3537
3538 # _LT_PATH_MANIFEST_TOOL
3539 # ----------------------
3540 # locate the manifest tool
3541 m4_defun([_LT_PATH_MANIFEST_TOOL],
3542 [AC_CHECK_TOOL(MANIFEST_TOOL, mt, :)
3543 test -z "$MANIFEST_TOOL" && MANIFEST_TOOL=mt
3544 AC_CACHE_CHECK([if $MANIFEST_TOOL is a manifest tool], [lt_cv_path_mainfest_tool],
3545 [lt_cv_path_mainfest_tool=no
3546 echo "$as_me:$LINENO: $MANIFEST_TOOL '-?'" >&AS_MESSAGE_LOG_FD
3547 $MANIFEST_TOOL '-?' 2>conftest.err > conftest.out
3548 cat conftest.err >&AS_MESSAGE_LOG_FD
3549 if $GREP 'Manifest Tool' conftest.out > /dev/null; then
3550 lt_cv_path_mainfest_tool=yes
3551 fi
3552 rm -f conftest*])
3553 if test "x$lt_cv_path_mainfest_tool" != xyes; then
3554 MANIFEST_TOOL=:
3555 fi
3556 _LT_DECL([], [MANIFEST_TOOL], [1], [Manifest tool])dnl
3557 ])# _LT_PATH_MANIFEST_TOOL
3558
3559
3560 # LT_LIB_M
3561 # --------
3562 # check for math library
3563 AC_DEFUN([LT_LIB_M],
3564 [AC_REQUIRE([AC_CANONICAL_HOST])dnl
3565 LIBM=
3566 case $host in
3567 *-*-beos* | *-*-cegcc* | *-*-cygwin* | *-*-haiku* | *-*-pw32* | *-*-darwin*)
3568 # These system don't have libm, or don't need it
3569 ;;
3570 *-ncr-sysv4.3*)
3571 AC_CHECK_LIB(mw, _mwvalidcheckl, LIBM="-lmw")
3572 AC_CHECK_LIB(m, cos, LIBM="$LIBM -lm")
3573 ;;
3574 *)
3575 AC_CHECK_LIB(m, cos, LIBM="-lm")
3576 ;;
3577 esac
3578 AC_SUBST([LIBM])
3579 ])# LT_LIB_M
3580
3581 # Old name:
3582 AU_ALIAS([AC_CHECK_LIBM], [LT_LIB_M])
3583 dnl aclocal-1.4 backwards compatibility:
3584 dnl AC_DEFUN([AC_CHECK_LIBM], [])
3585
3586
3587 # _LT_COMPILER_NO_RTTI([TAGNAME])
3588 # -------------------------------
3589 m4_defun([_LT_COMPILER_NO_RTTI],
3590 [m4_require([_LT_TAG_COMPILER])dnl
3591
3592 _LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=
3593
3594 if test "$GCC" = yes; then
3595 case $cc_basename in
3596 nvcc*)
3597 _LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=' -Xcompiler -fno-builtin' ;;
3598 *)
3599 _LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=' -fno-builtin' ;;
3600 esac
3601
3602 _LT_COMPILER_OPTION([if $compiler supports -fno-rtti -fno-exceptions],
3603 lt_cv_prog_compiler_rtti_exceptions,
3604 [-fno-rtti -fno-exceptions], [],
3605 [_LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)="$_LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1) -fno-rtti -fno-exceptions"])
3606 fi
3607 _LT_TAGDECL([no_builtin_flag], [lt_prog_compiler_no_builtin_flag], [1],
3608 [Compiler flag to turn off builtin functions])
3609 ])# _LT_COMPILER_NO_RTTI
3610
3611
3612 # _LT_CMD_GLOBAL_SYMBOLS
3613 # ----------------------
3614 m4_defun([_LT_CMD_GLOBAL_SYMBOLS],
3615 [AC_REQUIRE([AC_CANONICAL_HOST])dnl
3616 AC_REQUIRE([AC_PROG_CC])dnl
3617 AC_REQUIRE([AC_PROG_AWK])dnl
3618 AC_REQUIRE([LT_PATH_NM])dnl
3619 AC_REQUIRE([LT_PATH_LD])dnl
3620 m4_require([_LT_DECL_SED])dnl
3621 m4_require([_LT_DECL_EGREP])dnl
3622 m4_require([_LT_TAG_COMPILER])dnl
3623
3624 # Check for command to grab the raw symbol name followed by C symbol from nm.
3625 AC_MSG_CHECKING([command to parse $NM output from $compiler object])
3626 AC_CACHE_VAL([lt_cv_sys_global_symbol_pipe],
3627 [
3628 # These are sane defaults that work on at least a few old systems.
3629 # [They come from Ultrix. What could be older than Ultrix?!! ;)]
3630
3631 # Character class describing NM global symbol codes.
3632 symcode='[[BCDEGRST]]'
3633
3634 # Regexp to match symbols that can be accessed directly from C.
3635 sympat='\([[_A-Za-z]][[_A-Za-z0-9]]*\)'
3636
3637 # Define system-specific variables.
3638 case $host_os in
3639 aix*)
3640 symcode='[[BCDT]]'
3641 ;;
3642 cygwin* | mingw* | pw32* | cegcc*)
3643 symcode='[[ABCDGISTW]]'
3644 ;;
3645 hpux*)
3646 if test "$host_cpu" = ia64; then
3647 symcode='[[ABCDEGRST]]'
3648 fi
3649 ;;
3650 irix* | nonstopux*)
3651 symcode='[[BCDEGRST]]'
3652 ;;
3653 osf*)
3654 symcode='[[BCDEGQRST]]'
3655 ;;
3656 solaris*)
3657 symcode='[[BDRT]]'
3658 ;;
3659 sco3.2v5*)
3660 symcode='[[DT]]'
3661 ;;
3662 sysv4.2uw2*)
3663 symcode='[[DT]]'
3664 ;;
3665 sysv5* | sco5v6* | unixware* | OpenUNIX*)
3666 symcode='[[ABDT]]'
3667 ;;
3668 sysv4)
3669 symcode='[[DFNSTU]]'
3670 ;;
3671 esac
3672
3673 # If we're using GNU nm, then use its standard symbol codes.
3674 case `$NM -V 2>&1` in
3675 *GNU* | *'with BFD'*)
3676 symcode='[[ABCDGIRSTW]]' ;;
3677 esac
3678
3679 # Transform an extracted symbol line into a proper C declaration.
3680 # Some systems (esp. on ia64) link data and code symbols differently,
3681 # so use this general approach.
3682 lt_cv_sys_global_symbol_to_cdecl="sed -n -e 's/^T .* \(.*\)$/extern int \1();/p' -e 's/^$symcode* .* \(.*\)$/extern char \1;/p'"
3683
3684 # Transform an extracted symbol line into symbol name and symbol address
3685 lt_cv_sys_global_symbol_to_c_name_address="sed -n -e 's/^: \([[^ ]]*\)[[ ]]*$/ {\\\"\1\\\", (void *) 0},/p' -e 's/^$symcode* \([[^ ]]*\) \([[^ ]]*\)$/ {\"\2\", (void *) \&\2},/p'"
3686 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'"
3687
3688 # Handle CRLF in mingw tool chain
3689 opt_cr=
3690 case $build_os in
3691 mingw*)
3692 opt_cr=`$ECHO 'x\{0,1\}' | tr x '\015'` # option cr in regexp
3693 ;;
3694 esac
3695
3696 # Try without a prefix underscore, then with it.
3697 for ac_symprfx in "" "_"; do
3698
3699 # Transform symcode, sympat, and symprfx into a raw symbol and a C symbol.
3700 symxfrm="\\1 $ac_symprfx\\2 \\2"
3701
3702 # Write the raw and C identifiers.
3703 if test "$lt_cv_nm_interface" = "MS dumpbin"; then
3704 # Fake it for dumpbin and say T for any non-static function
3705 # and D for any global variable.
3706 # Also find C++ and __fastcall symbols from MSVC++,
3707 # which start with @ or ?.
3708 lt_cv_sys_global_symbol_pipe="$AWK ['"\
3709 " {last_section=section; section=\$ 3};"\
3710 " /^COFF SYMBOL TABLE/{for(i in hide) delete hide[i]};"\
3711 " /Section length .*#relocs.*(pick any)/{hide[last_section]=1};"\
3712 " \$ 0!~/External *\|/{next};"\
3713 " / 0+ UNDEF /{next}; / UNDEF \([^|]\)*()/{next};"\
3714 " {if(hide[section]) next};"\
3715 " {f=0}; \$ 0~/\(\).*\|/{f=1}; {printf f ? \"T \" : \"D \"};"\
3716 " {split(\$ 0, a, /\||\r/); split(a[2], s)};"\
3717 " s[1]~/^[@?]/{print s[1], s[1]; next};"\
3718 " s[1]~prfx {split(s[1],t,\"@\"); print t[1], substr(t[1],length(prfx))}"\
3719 " ' prfx=^$ac_symprfx]"
3720 else
3721 lt_cv_sys_global_symbol_pipe="sed -n -e 's/^.*[[ ]]\($symcode$symcode*\)[[ ]][[ ]]*$ac_symprfx$sympat$opt_cr$/$symxfrm/p'"
3722 fi
3723 lt_cv_sys_global_symbol_pipe="$lt_cv_sys_global_symbol_pipe | sed '/ __gnu_lto/d'"
3724
3725 # Check to see that the pipe works correctly.
3726 pipe_works=no
3727
3728 rm -f conftest*
3729 cat > conftest.$ac_ext <<_LT_EOF
3730 #ifdef __cplusplus
3731 extern "C" {
3732 #endif
3733 char nm_test_var;
3734 void nm_test_func(void);
3735 void nm_test_func(void){}
3736 #ifdef __cplusplus
3737 }
3738 #endif
3739 int main(){nm_test_var='a';nm_test_func();return(0);}
3740 _LT_EOF
3741
3742 if AC_TRY_EVAL(ac_compile); then
3743 # Now try to grab the symbols.
3744 nlist=conftest.nm
3745 if AC_TRY_EVAL(NM conftest.$ac_objext \| "$lt_cv_sys_global_symbol_pipe" \> $nlist) && test -s "$nlist"; then
3746 # Try sorting and uniquifying the output.
3747 if sort "$nlist" | uniq > "$nlist"T; then
3748 mv -f "$nlist"T "$nlist"
3749 else
3750 rm -f "$nlist"T
3751 fi
3752
3753 # Make sure that we snagged all the symbols we need.
3754 if $GREP ' nm_test_var$' "$nlist" >/dev/null; then
3755 if $GREP ' nm_test_func$' "$nlist" >/dev/null; then
3756 cat <<_LT_EOF > conftest.$ac_ext
3757 /* Keep this code in sync between libtool.m4, ltmain, lt_system.h, and tests. */
3758 #if defined(_WIN32) || defined(__CYGWIN__) || defined(_WIN32_WCE)
3759 /* DATA imports from DLLs on WIN32 con't be const, because runtime
3760 relocations are performed -- see ld's documentation on pseudo-relocs. */
3761 # define LT@&t@_DLSYM_CONST
3762 #elif defined(__osf__)
3763 /* This system does not cope well with relocations in const data. */
3764 # define LT@&t@_DLSYM_CONST
3765 #else
3766 # define LT@&t@_DLSYM_CONST const
3767 #endif
3768
3769 #ifdef __cplusplus
3770 extern "C" {
3771 #endif
3772
3773 _LT_EOF
3774 # Now generate the symbol file.
3775 eval "$lt_cv_sys_global_symbol_to_cdecl"' < "$nlist" | $GREP -v main >> conftest.$ac_ext'
3776
3777 cat <<_LT_EOF >> conftest.$ac_ext
3778
3779 /* The mapping between symbol names and symbols. */
3780 LT@&t@_DLSYM_CONST struct {
3781 const char *name;
3782 void *address;
3783 }
3784 lt__PROGRAM__LTX_preloaded_symbols[[]] =
3785 {
3786 { "@PROGRAM@", (void *) 0 },
3787 _LT_EOF
3788 $SED "s/^$symcode$symcode* \(.*\) \(.*\)$/ {\"\2\", (void *) \&\2},/" < "$nlist" | $GREP -v main >> conftest.$ac_ext
3789 cat <<\_LT_EOF >> conftest.$ac_ext
3790 {0, (void *) 0}
3791 };
3792
3793 /* This works around a problem in FreeBSD linker */
3794 #ifdef FREEBSD_WORKAROUND
3795 static const void *lt_preloaded_setup() {
3796 return lt__PROGRAM__LTX_preloaded_symbols;
3797 }
3798 #endif
3799
3800 #ifdef __cplusplus
3801 }
3802 #endif
3803 _LT_EOF
3804 # Now try linking the two files.
3805 mv conftest.$ac_objext conftstm.$ac_objext
3806 lt_globsym_save_LIBS=$LIBS
3807 lt_globsym_save_CFLAGS=$CFLAGS
3808 LIBS="conftstm.$ac_objext"
3809 CFLAGS="$CFLAGS$_LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)"
3810 if AC_TRY_EVAL(ac_link) && test -s conftest${ac_exeext}; then
3811 pipe_works=yes
3812 fi
3813 LIBS=$lt_globsym_save_LIBS
3814 CFLAGS=$lt_globsym_save_CFLAGS
3815 else
3816 echo "cannot find nm_test_func in $nlist" >&AS_MESSAGE_LOG_FD
3817 fi
3818 else
3819 echo "cannot find nm_test_var in $nlist" >&AS_MESSAGE_LOG_FD
3820 fi
3821 else
3822 echo "cannot run $lt_cv_sys_global_symbol_pipe" >&AS_MESSAGE_LOG_FD
3823 fi
3824 else
3825 echo "$progname: failed program was:" >&AS_MESSAGE_LOG_FD
3826 cat conftest.$ac_ext >&5
3827 fi
3828 rm -rf conftest* conftst*
3829
3830 # Do not use the global_symbol_pipe unless it works.
3831 if test "$pipe_works" = yes; then
3832 break
3833 else
3834 lt_cv_sys_global_symbol_pipe=
3835 fi
3836 done
3837 ])
3838 if test -z "$lt_cv_sys_global_symbol_pipe"; then
3839 lt_cv_sys_global_symbol_to_cdecl=
3840 fi
3841 if test -z "$lt_cv_sys_global_symbol_pipe$lt_cv_sys_global_symbol_to_cdecl"; then
3842 AC_MSG_RESULT(failed)
3843 else
3844 AC_MSG_RESULT(ok)
3845 fi
3846
3847 # Response file support.
3848 if test "$lt_cv_nm_interface" = "MS dumpbin"; then
3849 nm_file_list_spec='@'
3850 elif $NM --help 2>/dev/null | grep '[[@]]FILE' >/dev/null; then
3851 nm_file_list_spec='@'
3852 fi
3853
3854 _LT_DECL([global_symbol_pipe], [lt_cv_sys_global_symbol_pipe], [1],
3855 [Take the output of nm and produce a listing of raw symbols and C names])
3856 _LT_DECL([global_symbol_to_cdecl], [lt_cv_sys_global_symbol_to_cdecl], [1],
3857 [Transform the output of nm in a proper C declaration])
3858 _LT_DECL([global_symbol_to_c_name_address],
3859 [lt_cv_sys_global_symbol_to_c_name_address], [1],
3860 [Transform the output of nm in a C name address pair])
3861 _LT_DECL([global_symbol_to_c_name_address_lib_prefix],
3862 [lt_cv_sys_global_symbol_to_c_name_address_lib_prefix], [1],
3863 [Transform the output of nm in a C name address pair when lib prefix is needed])
3864 _LT_DECL([], [nm_file_list_spec], [1],
3865 [Specify filename containing input files for $NM])
3866 ]) # _LT_CMD_GLOBAL_SYMBOLS
3867
3868
3869 # _LT_COMPILER_PIC([TAGNAME])
3870 # ---------------------------
3871 m4_defun([_LT_COMPILER_PIC],
3872 [m4_require([_LT_TAG_COMPILER])dnl
3873 _LT_TAGVAR(lt_prog_compiler_wl, $1)=
3874 _LT_TAGVAR(lt_prog_compiler_pic, $1)=
3875 _LT_TAGVAR(lt_prog_compiler_static, $1)=
3876
3877 m4_if([$1], [CXX], [
3878 # C++ specific cases for pic, static, wl, etc.
3879 if test "$GXX" = yes; then
3880 _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
3881 _LT_TAGVAR(lt_prog_compiler_static, $1)='-static'
3882
3883 case $host_os in
3884 aix*)
3885 # All AIX code is PIC.
3886 if test "$host_cpu" = ia64; then
3887 # AIX 5 now supports IA64 processor
3888 _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
3889 fi
3890 ;;
3891
3892 amigaos*)
3893 case $host_cpu in
3894 powerpc)
3895 # see comment about AmigaOS4 .so support
3896 _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC'
3897 ;;
3898 m68k)
3899 # FIXME: we need at least 68020 code to build shared libraries, but
3900 # adding the `-m68020' flag to GCC prevents building anything better,
3901 # like `-m68040'.
3902 _LT_TAGVAR(lt_prog_compiler_pic, $1)='-m68020 -resident32 -malways-restore-a4'
3903 ;;
3904 esac
3905 ;;
3906
3907 beos* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*)
3908 # PIC is the default for these OSes.
3909 ;;
3910 mingw* | cygwin* | os2* | pw32* | cegcc*)
3911 # This hack is so that the source file can tell whether it is being
3912 # built for inclusion in a dll (and should export symbols for example).
3913 # Although the cygwin gcc ignores -fPIC, still need this for old-style
3914 # (--disable-auto-import) libraries
3915 m4_if([$1], [GCJ], [],
3916 [_LT_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT'])
3917 ;;
3918 darwin* | rhapsody*)
3919 # PIC is the default on this platform
3920 # Common symbols not allowed in MH_DYLIB files
3921 _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fno-common'
3922 ;;
3923 *djgpp*)
3924 # DJGPP does not support shared libraries at all
3925 _LT_TAGVAR(lt_prog_compiler_pic, $1)=
3926 ;;
3927 haiku*)
3928 # PIC is the default for Haiku.
3929 # The "-static" flag exists, but is broken.
3930 _LT_TAGVAR(lt_prog_compiler_static, $1)=
3931 ;;
3932 interix[[3-9]]*)
3933 # Interix 3.x gcc -fpic/-fPIC options generate broken code.
3934 # Instead, we relocate shared libraries at runtime.
3935 ;;
3936 sysv4*MP*)
3937 if test -d /usr/nec; then
3938 _LT_TAGVAR(lt_prog_compiler_pic, $1)=-Kconform_pic
3939 fi
3940 ;;
3941 hpux*)
3942 # PIC is the default for 64-bit PA HP-UX, but not for 32-bit
3943 # PA HP-UX. On IA64 HP-UX, PIC is the default but the pic flag
3944 # sets the default TLS model and affects inlining.
3945 case $host_cpu in
3946 hppa*64*)
3947 ;;
3948 *)
3949 _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC'
3950 ;;
3951 esac
3952 ;;
3953 *qnx* | *nto*)
3954 # QNX uses GNU C++, but need to define -shared option too, otherwise
3955 # it will coredump.
3956 _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC -shared'
3957 ;;
3958 *)
3959 _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC'
3960 ;;
3961 esac
3962 else
3963 case $host_os in
3964 aix[[4-9]]*)
3965 # All AIX code is PIC.
3966 if test "$host_cpu" = ia64; then
3967 # AIX 5 now supports IA64 processor
3968 _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
3969 else
3970 _LT_TAGVAR(lt_prog_compiler_static, $1)='-bnso -bI:/lib/syscalls.exp'
3971 fi
3972 ;;
3973 chorus*)
3974 case $cc_basename in
3975 cxch68*)
3976 # Green Hills C++ Compiler
3977 # _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"
3978 ;;
3979 esac
3980 ;;
3981 mingw* | cygwin* | os2* | pw32* | cegcc*)
3982 # This hack is so that the source file can tell whether it is being
3983 # built for inclusion in a dll (and should export symbols for example).
3984 m4_if([$1], [GCJ], [],
3985 [_LT_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT'])
3986 ;;
3987 dgux*)
3988 case $cc_basename in
3989 ec++*)
3990 _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
3991 ;;
3992 ghcx*)
3993 # Green Hills C++ Compiler
3994 _LT_TAGVAR(lt_prog_compiler_pic, $1)='-pic'
3995 ;;
3996 *)
3997 ;;
3998 esac
3999 ;;
4000 freebsd* | dragonfly*)
4001 # FreeBSD uses GNU C++
4002 ;;
4003 hpux9* | hpux10* | hpux11*)
4004 case $cc_basename in
4005 CC*)
4006 _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
4007 _LT_TAGVAR(lt_prog_compiler_static, $1)='${wl}-a ${wl}archive'
4008 if test "$host_cpu" != ia64; then
4009 _LT_TAGVAR(lt_prog_compiler_pic, $1)='+Z'
4010 fi
4011 ;;
4012 aCC*)
4013 _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
4014 _LT_TAGVAR(lt_prog_compiler_static, $1)='${wl}-a ${wl}archive'
4015 case $host_cpu in
4016 hppa*64*|ia64*)
4017 # +Z the default
4018 ;;
4019 *)
4020 _LT_TAGVAR(lt_prog_compiler_pic, $1)='+Z'
4021 ;;
4022 esac
4023 ;;
4024 *)
4025 ;;
4026 esac
4027 ;;
4028 interix*)
4029 # This is c89, which is MS Visual C++ (no shared libs)
4030 # Anyone wants to do a port?
4031 ;;
4032 irix5* | irix6* | nonstopux*)
4033 case $cc_basename in
4034 CC*)
4035 _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
4036 _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared'
4037 # CC pic flag -KPIC is the default.
4038 ;;
4039 *)
4040 ;;
4041 esac
4042 ;;
4043 linux* | k*bsd*-gnu | kopensolaris*-gnu)
4044 case $cc_basename in
4045 KCC*)
4046 # KAI C++ Compiler
4047 _LT_TAGVAR(lt_prog_compiler_wl, $1)='--backend -Wl,'
4048 _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC'
4049 ;;
4050 ecpc* )
4051 # old Intel C++ for x86_64 which still supported -KPIC.
4052 _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
4053 _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
4054 _LT_TAGVAR(lt_prog_compiler_static, $1)='-static'
4055 ;;
4056 icpc* )
4057 # Intel C++, used to be incompatible with GCC.
4058 # ICC 10 doesn't accept -KPIC any more.
4059 _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
4060 _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC'
4061 _LT_TAGVAR(lt_prog_compiler_static, $1)='-static'
4062 ;;
4063 pgCC* | pgcpp*)
4064 # Portland Group C++ compiler
4065 _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
4066 _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fpic'
4067 _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
4068 ;;
4069 cxx*)
4070 # Compaq C++
4071 # Make sure the PIC flag is empty. It appears that all Alpha
4072 # Linux and Compaq Tru64 Unix objects are PIC.
4073 _LT_TAGVAR(lt_prog_compiler_pic, $1)=
4074 _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared'
4075 ;;
4076 xlc* | xlC* | bgxl[[cC]]* | mpixl[[cC]]*)
4077 # IBM XL 8.0, 9.0 on PPC and BlueGene
4078 _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
4079 _LT_TAGVAR(lt_prog_compiler_pic, $1)='-qpic'
4080 _LT_TAGVAR(lt_prog_compiler_static, $1)='-qstaticlink'
4081 ;;
4082 *)
4083 case `$CC -V 2>&1 | sed 5q` in
4084 *Sun\ C*)
4085 # Sun C++ 5.9
4086 _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
4087 _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
4088 _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld '
4089 ;;
4090 esac
4091 ;;
4092 esac
4093 ;;
4094 lynxos*)
4095 ;;
4096 m88k*)
4097 ;;
4098 mvs*)
4099 case $cc_basename in
4100 cxx*)
4101 _LT_TAGVAR(lt_prog_compiler_pic, $1)='-W c,exportall'
4102 ;;
4103 *)
4104 ;;
4105 esac
4106 ;;
4107 netbsd*)
4108 ;;
4109 *qnx* | *nto*)
4110 # QNX uses GNU C++, but need to define -shared option too, otherwise
4111 # it will coredump.
4112 _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC -shared'
4113 ;;
4114 osf3* | osf4* | osf5*)
4115 case $cc_basename in
4116 KCC*)
4117 _LT_TAGVAR(lt_prog_compiler_wl, $1)='--backend -Wl,'
4118 ;;
4119 RCC*)
4120 # Rational C++ 2.4.1
4121 _LT_TAGVAR(lt_prog_compiler_pic, $1)='-pic'
4122 ;;
4123 cxx*)
4124 # Digital/Compaq C++
4125 _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
4126 # Make sure the PIC flag is empty. It appears that all Alpha
4127 # Linux and Compaq Tru64 Unix objects are PIC.
4128 _LT_TAGVAR(lt_prog_compiler_pic, $1)=
4129 _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared'
4130 ;;
4131 *)
4132 ;;
4133 esac
4134 ;;
4135 psos*)
4136 ;;
4137 solaris*)
4138 case $cc_basename in
4139 CC* | sunCC*)
4140 # Sun C++ 4.2, 5.x and Centerline C++
4141 _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
4142 _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
4143 _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld '
4144 ;;
4145 gcx*)
4146 # Green Hills C++ Compiler
4147 _LT_TAGVAR(lt_prog_compiler_pic, $1)='-PIC'
4148 ;;
4149 *)
4150 ;;
4151 esac
4152 ;;
4153 sunos4*)
4154 case $cc_basename in
4155 CC*)
4156 # Sun C++ 4.x
4157 _LT_TAGVAR(lt_prog_compiler_pic, $1)='-pic'
4158 _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
4159 ;;
4160 lcc*)
4161 # Lucid
4162 _LT_TAGVAR(lt_prog_compiler_pic, $1)='-pic'
4163 ;;
4164 *)
4165 ;;
4166 esac
4167 ;;
4168 sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*)
4169 case $cc_basename in
4170 CC*)
4171 _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
4172 _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
4173 _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
4174 ;;
4175 esac
4176 ;;
4177 tandem*)
4178 case $cc_basename in
4179 NCC*)
4180 # NonStop-UX NCC 3.20
4181 _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
4182 ;;
4183 *)
4184 ;;
4185 esac
4186 ;;
4187 vxworks*)
4188 ;;
4189 *)
4190 _LT_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no
4191 ;;
4192 esac
4193 fi
4194 ],
4195 [
4196 if test "$GCC" = yes; then
4197 _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
4198 _LT_TAGVAR(lt_prog_compiler_static, $1)='-static'
4199
4200 case $host_os in
4201 aix*)
4202 # All AIX code is PIC.
4203 if test "$host_cpu" = ia64; then
4204 # AIX 5 now supports IA64 processor
4205 _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
4206 fi
4207 ;;
4208
4209 amigaos*)
4210 case $host_cpu in
4211 powerpc)
4212 # see comment about AmigaOS4 .so support
4213 _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC'
4214 ;;
4215 m68k)
4216 # FIXME: we need at least 68020 code to build shared libraries, but
4217 # adding the `-m68020' flag to GCC prevents building anything better,
4218 # like `-m68040'.
4219 _LT_TAGVAR(lt_prog_compiler_pic, $1)='-m68020 -resident32 -malways-restore-a4'
4220 ;;
4221 esac
4222 ;;
4223
4224 beos* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*)
4225 # PIC is the default for these OSes.
4226 ;;
4227
4228 mingw* | cygwin* | pw32* | os2* | cegcc*)
4229 # This hack is so that the source file can tell whether it is being
4230 # built for inclusion in a dll (and should export symbols for example).
4231 # Although the cygwin gcc ignores -fPIC, still need this for old-style
4232 # (--disable-auto-import) libraries
4233 m4_if([$1], [GCJ], [],
4234 [_LT_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT'])
4235 ;;
4236
4237 darwin* | rhapsody*)
4238 # PIC is the default on this platform
4239 # Common symbols not allowed in MH_DYLIB files
4240 _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fno-common'
4241 ;;
4242
4243 haiku*)
4244 # PIC is the default for Haiku.
4245 # The "-static" flag exists, but is broken.
4246 _LT_TAGVAR(lt_prog_compiler_static, $1)=
4247 ;;
4248
4249 hpux*)
4250 # PIC is the default for 64-bit PA HP-UX, but not for 32-bit
4251 # PA HP-UX. On IA64 HP-UX, PIC is the default but the pic flag
4252 # sets the default TLS model and affects inlining.
4253 case $host_cpu in
4254 hppa*64*)
4255 # +Z the default
4256 ;;
4257 *)
4258 _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC'
4259 ;;
4260 esac
4261 ;;
4262
4263 interix[[3-9]]*)
4264 # Interix 3.x gcc -fpic/-fPIC options generate broken code.
4265 # Instead, we relocate shared libraries at runtime.
4266 ;;
4267
4268 msdosdjgpp*)
4269 # Just because we use GCC doesn't mean we suddenly get shared libraries
4270 # on systems that don't support them.
4271 _LT_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no
4272 enable_shared=no
4273 ;;
4274
4275 *nto* | *qnx*)
4276 # QNX uses GNU C++, but need to define -shared option too, otherwise
4277 # it will coredump.
4278 _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC -shared'
4279 ;;
4280
4281 sysv4*MP*)
4282 if test -d /usr/nec; then
4283 _LT_TAGVAR(lt_prog_compiler_pic, $1)=-Kconform_pic
4284 fi
4285 ;;
4286
4287 *)
4288 _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC'
4289 ;;
4290 esac
4291
4292 case $cc_basename in
4293 nvcc*) # Cuda Compiler Driver 2.2
4294 _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Xlinker '
4295 if test -n "$_LT_TAGVAR(lt_prog_compiler_pic, $1)"; then
4296 _LT_TAGVAR(lt_prog_compiler_pic, $1)="-Xcompiler $_LT_TAGVAR(lt_prog_compiler_pic, $1)"
4297 fi
4298 ;;
4299 esac
4300 else
4301 # PORTME Check for flag to pass linker flags through the system compiler.
4302 case $host_os in
4303 aix*)
4304 _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
4305 if test "$host_cpu" = ia64; then
4306 # AIX 5 now supports IA64 processor
4307 _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
4308 else
4309 _LT_TAGVAR(lt_prog_compiler_static, $1)='-bnso -bI:/lib/syscalls.exp'
4310 fi
4311 ;;
4312
4313 mingw* | cygwin* | pw32* | os2* | cegcc*)
4314 # This hack is so that the source file can tell whether it is being
4315 # built for inclusion in a dll (and should export symbols for example).
4316 m4_if([$1], [GCJ], [],
4317 [_LT_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT'])
4318 ;;
4319
4320 hpux9* | hpux10* | hpux11*)
4321 _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
4322 # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but
4323 # not for PA HP-UX.
4324 case $host_cpu in
4325 hppa*64*|ia64*)
4326 # +Z the default
4327 ;;
4328 *)
4329 _LT_TAGVAR(lt_prog_compiler_pic, $1)='+Z'
4330 ;;
4331 esac
4332 # Is there a better lt_prog_compiler_static that works with the bundled CC?
4333 _LT_TAGVAR(lt_prog_compiler_static, $1)='${wl}-a ${wl}archive'
4334 ;;
4335
4336 irix5* | irix6* | nonstopux*)
4337 _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
4338 # PIC (with -KPIC) is the default.
4339 _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared'
4340 ;;
4341
4342 linux* | k*bsd*-gnu | kopensolaris*-gnu)
4343 case $cc_basename in
4344 # old Intel for x86_64 which still supported -KPIC.
4345 ecc*)
4346 _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
4347 _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
4348 _LT_TAGVAR(lt_prog_compiler_static, $1)='-static'
4349 ;;
4350 # icc used to be incompatible with GCC.
4351 # ICC 10 doesn't accept -KPIC any more.
4352 icc* | ifort*)
4353 _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
4354 _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC'
4355 _LT_TAGVAR(lt_prog_compiler_static, $1)='-static'
4356 ;;
4357 # Lahey Fortran 8.1.
4358 lf95*)
4359 _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
4360 _LT_TAGVAR(lt_prog_compiler_pic, $1)='--shared'
4361 _LT_TAGVAR(lt_prog_compiler_static, $1)='--static'
4362 ;;
4363 nagfor*)
4364 # NAG Fortran compiler
4365 _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,-Wl,,'
4366 _LT_TAGVAR(lt_prog_compiler_pic, $1)='-PIC'
4367 _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
4368 ;;
4369 pgcc* | pgf77* | pgf90* | pgf95* | pgfortran*)
4370 # Portland Group compilers (*not* the Pentium gcc compiler,
4371 # which looks to be a dead project)
4372 _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
4373 _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fpic'
4374 _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
4375 ;;
4376 ccc*)
4377 _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
4378 # All Alpha code is PIC.
4379 _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared'
4380 ;;
4381 xl* | bgxl* | bgf* | mpixl*)
4382 # IBM XL C 8.0/Fortran 10.1, 11.1 on PPC and BlueGene
4383 _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
4384 _LT_TAGVAR(lt_prog_compiler_pic, $1)='-qpic'
4385 _LT_TAGVAR(lt_prog_compiler_static, $1)='-qstaticlink'
4386 ;;
4387 *)
4388 case `$CC -V 2>&1 | sed 5q` in
4389 *Sun\ Ceres\ Fortran* | *Sun*Fortran*\ [[1-7]].* | *Sun*Fortran*\ 8.[[0-3]]*)
4390 # Sun Fortran 8.3 passes all unrecognized flags to the linker
4391 _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
4392 _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
4393 _LT_TAGVAR(lt_prog_compiler_wl, $1)=''
4394 ;;
4395 *Sun\ F* | *Sun*Fortran*)
4396 _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
4397 _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
4398 _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld '
4399 ;;
4400 *Sun\ C*)
4401 # Sun C 5.9
4402 _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
4403 _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
4404 _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
4405 ;;
4406 *Intel*\ [[CF]]*Compiler*)
4407 _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
4408 _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC'
4409 _LT_TAGVAR(lt_prog_compiler_static, $1)='-static'
4410 ;;
4411 *Portland\ Group*)
4412 _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
4413 _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fpic'
4414 _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
4415 ;;
4416 esac
4417 ;;
4418 esac
4419 ;;
4420
4421 newsos6)
4422 _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
4423 _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
4424 ;;
4425
4426 *nto* | *qnx*)
4427 # QNX uses GNU C++, but need to define -shared option too, otherwise
4428 # it will coredump.
4429 _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC -shared'
4430 ;;
4431
4432 osf3* | osf4* | osf5*)
4433 _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
4434 # All OSF/1 code is PIC.
4435 _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared'
4436 ;;
4437
4438 rdos*)
4439 _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared'
4440 ;;
4441
4442 solaris*)
4443 _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
4444 _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
4445 case $cc_basename in
4446 f77* | f90* | f95* | sunf77* | sunf90* | sunf95*)
4447 _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld ';;
4448 *)
4449 _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,';;
4450 esac
4451 ;;
4452
4453 sunos4*)
4454 _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld '
4455 _LT_TAGVAR(lt_prog_compiler_pic, $1)='-PIC'
4456 _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
4457 ;;
4458
4459 sysv4 | sysv4.2uw2* | sysv4.3*)
4460 _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
4461 _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
4462 _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
4463 ;;
4464
4465 sysv4*MP*)
4466 if test -d /usr/nec ;then
4467 _LT_TAGVAR(lt_prog_compiler_pic, $1)='-Kconform_pic'
4468 _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
4469 fi
4470 ;;
4471
4472 sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*)
4473 _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
4474 _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
4475 _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
4476 ;;
4477
4478 unicos*)
4479 _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
4480 _LT_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no
4481 ;;
4482
4483 uts4*)
4484 _LT_TAGVAR(lt_prog_compiler_pic, $1)='-pic'
4485 _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
4486 ;;
4487
4488 *)
4489 _LT_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no
4490 ;;
4491 esac
4492 fi
4493 ])
4494 case $host_os in
4495 # For platforms which do not support PIC, -DPIC is meaningless:
4496 *djgpp*)
4497 _LT_TAGVAR(lt_prog_compiler_pic, $1)=
4498 ;;
4499 *)
4500 _LT_TAGVAR(lt_prog_compiler_pic, $1)="$_LT_TAGVAR(lt_prog_compiler_pic, $1)@&t@m4_if([$1],[],[ -DPIC],[m4_if([$1],[CXX],[ -DPIC],[])])"
4501 ;;
4502 esac
4503
4504 AC_CACHE_CHECK([for $compiler option to produce PIC],
4505 [_LT_TAGVAR(lt_cv_prog_compiler_pic, $1)],
4506 [_LT_TAGVAR(lt_cv_prog_compiler_pic, $1)=$_LT_TAGVAR(lt_prog_compiler_pic, $1)])
4507 _LT_TAGVAR(lt_prog_compiler_pic, $1)=$_LT_TAGVAR(lt_cv_prog_compiler_pic, $1)
4508
4509 #
4510 # Check to make sure the PIC flag actually works.
4511 #
4512 if test -n "$_LT_TAGVAR(lt_prog_compiler_pic, $1)"; then
4513 _LT_COMPILER_OPTION([if $compiler PIC flag $_LT_TAGVAR(lt_prog_compiler_pic, $1) works],
4514 [_LT_TAGVAR(lt_cv_prog_compiler_pic_works, $1)],
4515 [$_LT_TAGVAR(lt_prog_compiler_pic, $1)@&t@m4_if([$1],[],[ -DPIC],[m4_if([$1],[CXX],[ -DPIC],[])])], [],
4516 [case $_LT_TAGVAR(lt_prog_compiler_pic, $1) in
4517 "" | " "*) ;;
4518 *) _LT_TAGVAR(lt_prog_compiler_pic, $1)=" $_LT_TAGVAR(lt_prog_compiler_pic, $1)" ;;
4519 esac],
4520 [_LT_TAGVAR(lt_prog_compiler_pic, $1)=
4521 _LT_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no])
4522 fi
4523 _LT_TAGDECL([pic_flag], [lt_prog_compiler_pic], [1],
4524 [Additional compiler flags for building library objects])
4525
4526 _LT_TAGDECL([wl], [lt_prog_compiler_wl], [1],
4527 [How to pass a linker flag through the compiler])
4528 #
4529 # Check to make sure the static flag actually works.
4530 #
4531 wl=$_LT_TAGVAR(lt_prog_compiler_wl, $1) eval lt_tmp_static_flag=\"$_LT_TAGVAR(lt_prog_compiler_static, $1)\"
4532 _LT_LINKER_OPTION([if $compiler static flag $lt_tmp_static_flag works],
4533 _LT_TAGVAR(lt_cv_prog_compiler_static_works, $1),
4534 $lt_tmp_static_flag,
4535 [],
4536 [_LT_TAGVAR(lt_prog_compiler_static, $1)=])
4537 _LT_TAGDECL([link_static_flag], [lt_prog_compiler_static], [1],
4538 [Compiler flag to prevent dynamic linking])
4539 ])# _LT_COMPILER_PIC
4540
4541
4542 # _LT_LINKER_SHLIBS([TAGNAME])
4543 # ----------------------------
4544 # See if the linker supports building shared libraries.
4545 m4_defun([_LT_LINKER_SHLIBS],
4546 [AC_REQUIRE([LT_PATH_LD])dnl
4547 AC_REQUIRE([LT_PATH_NM])dnl
4548 m4_require([_LT_PATH_MANIFEST_TOOL])dnl
4549 m4_require([_LT_FILEUTILS_DEFAULTS])dnl
4550 m4_require([_LT_DECL_EGREP])dnl
4551 m4_require([_LT_DECL_SED])dnl
4552 m4_require([_LT_CMD_GLOBAL_SYMBOLS])dnl
4553 m4_require([_LT_TAG_COMPILER])dnl
4554 AC_MSG_CHECKING([whether the $compiler linker ($LD) supports shared libraries])
4555 m4_if([$1], [CXX], [
4556 _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols'
4557 _LT_TAGVAR(exclude_expsyms, $1)=['_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*']
4558 case $host_os in
4559 aix[[4-9]]*)
4560 # If we're using GNU nm, then we don't want the "-C" option.
4561 # -C means demangle to AIX nm, but means don't demangle with GNU nm
4562 # Also, AIX nm treats weak defined symbols like other global defined
4563 # symbols, whereas GNU nm marks them as "W".
4564 if $NM -V 2>&1 | $GREP 'GNU' > /dev/null; then
4565 _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'
4566 else
4567 _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'
4568 fi
4569 ;;
4570 pw32*)
4571 _LT_TAGVAR(export_symbols_cmds, $1)="$ltdll_cmds"
4572 ;;
4573 cygwin* | mingw* | cegcc*)
4574 case $cc_basename in
4575 cl*)
4576 _LT_TAGVAR(exclude_expsyms, $1)='_NULL_IMPORT_DESCRIPTOR|_IMPORT_DESCRIPTOR_.*'
4577 ;;
4578 *)
4579 _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'
4580 _LT_TAGVAR(exclude_expsyms, $1)=['[_]+GLOBAL_OFFSET_TABLE_|[_]+GLOBAL__[FID]_.*|[_]+head_[A-Za-z0-9_]+_dll|[A-Za-z0-9_]+_dll_iname']
4581 ;;
4582 esac
4583 ;;
4584 *)
4585 _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols'
4586 ;;
4587 esac
4588 ], [
4589 runpath_var=
4590 _LT_TAGVAR(allow_undefined_flag, $1)=
4591 _LT_TAGVAR(always_export_symbols, $1)=no
4592 _LT_TAGVAR(archive_cmds, $1)=
4593 _LT_TAGVAR(archive_expsym_cmds, $1)=
4594 _LT_TAGVAR(compiler_needs_object, $1)=no
4595 _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=no
4596 _LT_TAGVAR(export_dynamic_flag_spec, $1)=
4597 _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols'
4598 _LT_TAGVAR(hardcode_automatic, $1)=no
4599 _LT_TAGVAR(hardcode_direct, $1)=no
4600 _LT_TAGVAR(hardcode_direct_absolute, $1)=no
4601 _LT_TAGVAR(hardcode_libdir_flag_spec, $1)=
4602 _LT_TAGVAR(hardcode_libdir_separator, $1)=
4603 _LT_TAGVAR(hardcode_minus_L, $1)=no
4604 _LT_TAGVAR(hardcode_shlibpath_var, $1)=unsupported
4605 _LT_TAGVAR(inherit_rpath, $1)=no
4606 _LT_TAGVAR(link_all_deplibs, $1)=unknown
4607 _LT_TAGVAR(module_cmds, $1)=
4608 _LT_TAGVAR(module_expsym_cmds, $1)=
4609 _LT_TAGVAR(old_archive_from_new_cmds, $1)=
4610 _LT_TAGVAR(old_archive_from_expsyms_cmds, $1)=
4611 _LT_TAGVAR(thread_safe_flag_spec, $1)=
4612 _LT_TAGVAR(whole_archive_flag_spec, $1)=
4613 # include_expsyms should be a list of space-separated symbols to be *always*
4614 # included in the symbol list
4615 _LT_TAGVAR(include_expsyms, $1)=
4616 # exclude_expsyms can be an extended regexp of symbols to exclude
4617 # it will be wrapped by ` (' and `)$', so one must not match beginning or
4618 # end of line. Example: `a|bc|.*d.*' will exclude the symbols `a' and `bc',
4619 # as well as any symbol that contains `d'.
4620 _LT_TAGVAR(exclude_expsyms, $1)=['_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*']
4621 # Although _GLOBAL_OFFSET_TABLE_ is a valid symbol C name, most a.out
4622 # platforms (ab)use it in PIC code, but their linkers get confused if
4623 # the symbol is explicitly referenced. Since portable code cannot
4624 # rely on this symbol name, it's probably fine to never include it in
4625 # preloaded symbol tables.
4626 # Exclude shared library initialization/finalization symbols.
4627 dnl Note also adjust exclude_expsyms for C++ above.
4628 extract_expsyms_cmds=
4629
4630 case $host_os in
4631 cygwin* | mingw* | pw32* | cegcc*)
4632 # FIXME: the MSVC++ port hasn't been tested in a loooong time
4633 # When not using gcc, we currently assume that we are using
4634 # Microsoft Visual C++.
4635 if test "$GCC" != yes; then
4636 with_gnu_ld=no
4637 fi
4638 ;;
4639 interix*)
4640 # we just hope/assume this is gcc and not c89 (= MSVC++)
4641 with_gnu_ld=yes
4642 ;;
4643 openbsd*)
4644 with_gnu_ld=no
4645 ;;
4646 esac
4647
4648 _LT_TAGVAR(ld_shlibs, $1)=yes
4649
4650 # On some targets, GNU ld is compatible enough with the native linker
4651 # that we're better off using the native interface for both.
4652 lt_use_gnu_ld_interface=no
4653 if test "$with_gnu_ld" = yes; then
4654 case $host_os in
4655 aix*)
4656 # The AIX port of GNU ld has always aspired to compatibility
4657 # with the native linker. However, as the warning in the GNU ld
4658 # block says, versions before 2.19.5* couldn't really create working
4659 # shared libraries, regardless of the interface used.
4660 case `$LD -v 2>&1` in
4661 *\ \(GNU\ Binutils\)\ 2.19.5*) ;;
4662 *\ \(GNU\ Binutils\)\ 2.[[2-9]]*) ;;
4663 *\ \(GNU\ Binutils\)\ [[3-9]]*) ;;
4664 *)
4665 lt_use_gnu_ld_interface=yes
4666 ;;
4667 esac
4668 ;;
4669 *)
4670 lt_use_gnu_ld_interface=yes
4671 ;;
4672 esac
4673 fi
4674
4675 if test "$lt_use_gnu_ld_interface" = yes; then
4676 # If archive_cmds runs LD, not CC, wlarc should be empty
4677 wlarc='${wl}'
4678
4679 # Set some defaults for GNU ld with shared library support. These
4680 # are reset later if shared libraries are not supported. Putting them
4681 # here allows them to be overridden if necessary.
4682 runpath_var=LD_RUN_PATH
4683 _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
4684 _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic'
4685 # ancient GNU ld didn't support --whole-archive et. al.
4686 if $LD --help 2>&1 | $GREP 'no-whole-archive' > /dev/null; then
4687 _LT_TAGVAR(whole_archive_flag_spec, $1)="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive'
4688 else
4689 _LT_TAGVAR(whole_archive_flag_spec, $1)=
4690 fi
4691 supports_anon_versioning=no
4692 case `$LD -v 2>&1` in
4693 *GNU\ gold*) supports_anon_versioning=yes ;;
4694 *\ [[01]].* | *\ 2.[[0-9]].* | *\ 2.10.*) ;; # catch versions < 2.11
4695 *\ 2.11.93.0.2\ *) supports_anon_versioning=yes ;; # RH7.3 ...
4696 *\ 2.11.92.0.12\ *) supports_anon_versioning=yes ;; # Mandrake 8.2 ...
4697 *\ 2.11.*) ;; # other 2.11 versions
4698 *) supports_anon_versioning=yes ;;
4699 esac
4700
4701 # See if GNU ld supports shared libraries.
4702 case $host_os in
4703 aix[[3-9]]*)
4704 # On AIX/PPC, the GNU linker is very broken
4705 if test "$host_cpu" != ia64; then
4706 _LT_TAGVAR(ld_shlibs, $1)=no
4707 cat <<_LT_EOF 1>&2
4708
4709 *** Warning: the GNU linker, at least up to release 2.19, is reported
4710 *** to be unable to reliably create shared libraries on AIX.
4711 *** Therefore, libtool is disabling shared libraries support. If you
4712 *** really care for shared libraries, you may want to install binutils
4713 *** 2.20 or above, or modify your PATH so that a non-GNU linker is found.
4714 *** You will then need to restart the configuration process.
4715
4716 _LT_EOF
4717 fi
4718 ;;
4719
4720 amigaos*)
4721 case $host_cpu in
4722 powerpc)
4723 # see comment about AmigaOS4 .so support
4724 _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
4725 _LT_TAGVAR(archive_expsym_cmds, $1)=''
4726 ;;
4727 m68k)
4728 _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)'
4729 _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
4730 _LT_TAGVAR(hardcode_minus_L, $1)=yes
4731 ;;
4732 esac
4733 ;;
4734
4735 beos*)
4736 if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then
4737 _LT_TAGVAR(allow_undefined_flag, $1)=unsupported
4738 # Joseph Beckenbach <jrb3@best.com> says some releases of gcc
4739 # support --undefined. This deserves some investigation. FIXME
4740 _LT_TAGVAR(archive_cmds, $1)='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
4741 else
4742 _LT_TAGVAR(ld_shlibs, $1)=no
4743 fi
4744 ;;
4745
4746 cygwin* | mingw* | pw32* | cegcc*)
4747 # _LT_TAGVAR(hardcode_libdir_flag_spec, $1) is actually meaningless,
4748 # as there is no search path for DLLs.
4749 _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
4750 _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-all-symbols'
4751 _LT_TAGVAR(allow_undefined_flag, $1)=unsupported
4752 _LT_TAGVAR(always_export_symbols, $1)=no
4753 _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes
4754 _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'
4755 _LT_TAGVAR(exclude_expsyms, $1)=['[_]+GLOBAL_OFFSET_TABLE_|[_]+GLOBAL__[FID]_.*|[_]+head_[A-Za-z0-9_]+_dll|[A-Za-z0-9_]+_dll_iname']
4756
4757 if $LD --help 2>&1 | $GREP 'auto-import' > /dev/null; then
4758 _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'
4759 # If the export-symbols file already is a .def file (1st line
4760 # is EXPORTS), use it as is; otherwise, prepend...
4761 _LT_TAGVAR(archive_expsym_cmds, $1)='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then
4762 cp $export_symbols $output_objdir/$soname.def;
4763 else
4764 echo EXPORTS > $output_objdir/$soname.def;
4765 cat $export_symbols >> $output_objdir/$soname.def;
4766 fi~
4767 $CC -shared $output_objdir/$soname.def $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib'
4768 else
4769 _LT_TAGVAR(ld_shlibs, $1)=no
4770 fi
4771 ;;
4772
4773 haiku*)
4774 _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
4775 _LT_TAGVAR(link_all_deplibs, $1)=yes
4776 ;;
4777
4778 interix[[3-9]]*)
4779 _LT_TAGVAR(hardcode_direct, $1)=no
4780 _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
4781 _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir'
4782 _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E'
4783 # Hack: On Interix 3.x, we cannot compile PIC because of a broken gcc.
4784 # Instead, shared libraries are loaded at an image base (0x10000000 by
4785 # default) and relocated if they conflict, which is a slow very memory
4786 # consuming and fragmenting process. To avoid this, we pick a random,
4787 # 256 KiB-aligned image base between 0x50000000 and 0x6FFC0000 at link
4788 # time. Moving up from 0x10000000 also allows more sbrk(2) space.
4789 _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'
4790 _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'
4791 ;;
4792
4793 gnu* | linux* | tpf* | k*bsd*-gnu | kopensolaris*-gnu)
4794 tmp_diet=no
4795 if test "$host_os" = linux-dietlibc; then
4796 case $cc_basename in
4797 diet\ *) tmp_diet=yes;; # linux-dietlibc with static linking (!diet-dyn)
4798 esac
4799 fi
4800 if $LD --help 2>&1 | $EGREP ': supported targets:.* elf' > /dev/null \
4801 && test "$tmp_diet" = no
4802 then
4803 tmp_addflag=' $pic_flag'
4804 tmp_sharedflag='-shared'
4805 case $cc_basename,$host_cpu in
4806 pgcc*) # Portland Group C compiler
4807 _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'
4808 tmp_addflag=' $pic_flag'
4809 ;;
4810 pgf77* | pgf90* | pgf95* | pgfortran*)
4811 # Portland Group f77 and f90 compilers
4812 _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'
4813 tmp_addflag=' $pic_flag -Mnomain' ;;
4814 ecc*,ia64* | icc*,ia64*) # Intel C compiler on ia64
4815 tmp_addflag=' -i_dynamic' ;;
4816 efc*,ia64* | ifort*,ia64*) # Intel Fortran compiler on ia64
4817 tmp_addflag=' -i_dynamic -nofor_main' ;;
4818 ifc* | ifort*) # Intel Fortran compiler
4819 tmp_addflag=' -nofor_main' ;;
4820 lf95*) # Lahey Fortran 8.1
4821 _LT_TAGVAR(whole_archive_flag_spec, $1)=
4822 tmp_sharedflag='--shared' ;;
4823 xl[[cC]]* | bgxl[[cC]]* | mpixl[[cC]]*) # IBM XL C 8.0 on PPC (deal with xlf below)
4824 tmp_sharedflag='-qmkshrobj'
4825 tmp_addflag= ;;
4826 nvcc*) # Cuda Compiler Driver 2.2
4827 _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'
4828 _LT_TAGVAR(compiler_needs_object, $1)=yes
4829 ;;
4830 esac
4831 case `$CC -V 2>&1 | sed 5q` in
4832 *Sun\ C*) # Sun C 5.9
4833 _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'
4834 _LT_TAGVAR(compiler_needs_object, $1)=yes
4835 tmp_sharedflag='-G' ;;
4836 *Sun\ F*) # Sun Fortran 8.3
4837 tmp_sharedflag='-G' ;;
4838 esac
4839 _LT_TAGVAR(archive_cmds, $1)='$CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
4840
4841 if test "x$supports_anon_versioning" = xyes; then
4842 _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $output_objdir/$libname.ver~
4843 cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~
4844 echo "local: *; };" >> $output_objdir/$libname.ver~
4845 $CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib'
4846 fi
4847
4848 case $cc_basename in
4849 xlf* | bgf* | bgxlf* | mpixlf*)
4850 # IBM XL Fortran 10.1 on PPC cannot create shared libs itself
4851 _LT_TAGVAR(whole_archive_flag_spec, $1)='--whole-archive$convenience --no-whole-archive'
4852 _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
4853 _LT_TAGVAR(archive_cmds, $1)='$LD -shared $libobjs $deplibs $linker_flags -soname $soname -o $lib'
4854 if test "x$supports_anon_versioning" = xyes; then
4855 _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $output_objdir/$libname.ver~
4856 cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~
4857 echo "local: *; };" >> $output_objdir/$libname.ver~
4858 $LD -shared $libobjs $deplibs $linker_flags -soname $soname -version-script $output_objdir/$libname.ver -o $lib'
4859 fi
4860 ;;
4861 esac
4862 else
4863 _LT_TAGVAR(ld_shlibs, $1)=no
4864 fi
4865 ;;
4866
4867 netbsd*)
4868 if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then
4869 _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib'
4870 wlarc=
4871 else
4872 _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
4873 _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'
4874 fi
4875 ;;
4876
4877 solaris*)
4878 if $LD -v 2>&1 | $GREP 'BFD 2\.8' > /dev/null; then
4879 _LT_TAGVAR(ld_shlibs, $1)=no
4880 cat <<_LT_EOF 1>&2
4881
4882 *** Warning: The releases 2.8.* of the GNU linker cannot reliably
4883 *** create shared libraries on Solaris systems. Therefore, libtool
4884 *** is disabling shared libraries support. We urge you to upgrade GNU
4885 *** binutils to release 2.9.1 or newer. Another option is to modify
4886 *** your PATH or compiler configuration so that the native linker is
4887 *** used, and then restart.
4888
4889 _LT_EOF
4890 elif $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then
4891 _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
4892 _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'
4893 else
4894 _LT_TAGVAR(ld_shlibs, $1)=no
4895 fi
4896 ;;
4897
4898 sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX*)
4899 case `$LD -v 2>&1` in
4900 *\ [[01]].* | *\ 2.[[0-9]].* | *\ 2.1[[0-5]].*)
4901 _LT_TAGVAR(ld_shlibs, $1)=no
4902 cat <<_LT_EOF 1>&2
4903
4904 *** Warning: Releases of the GNU linker prior to 2.16.91.0.3 can not
4905 *** reliably create shared libraries on SCO systems. Therefore, libtool
4906 *** is disabling shared libraries support. We urge you to upgrade GNU
4907 *** binutils to release 2.16.91.0.3 or newer. Another option is to modify
4908 *** your PATH or compiler configuration so that the native linker is
4909 *** used, and then restart.
4910
4911 _LT_EOF
4912 ;;
4913 *)
4914 # For security reasons, it is highly recommended that you always
4915 # use absolute paths for naming shared libraries, and exclude the
4916 # DT_RUNPATH tag from executables and libraries. But doing so
4917 # requires that you compile everything twice, which is a pain.
4918 if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then
4919 _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
4920 _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
4921 _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'
4922 else
4923 _LT_TAGVAR(ld_shlibs, $1)=no
4924 fi
4925 ;;
4926 esac
4927 ;;
4928
4929 sunos4*)
4930 _LT_TAGVAR(archive_cmds, $1)='$LD -assert pure-text -Bshareable -o $lib $libobjs $deplibs $linker_flags'
4931 wlarc=
4932 _LT_TAGVAR(hardcode_direct, $1)=yes
4933 _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
4934 ;;
4935
4936 *)
4937 if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then
4938 _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
4939 _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'
4940 else
4941 _LT_TAGVAR(ld_shlibs, $1)=no
4942 fi
4943 ;;
4944 esac
4945
4946 if test "$_LT_TAGVAR(ld_shlibs, $1)" = no; then
4947 runpath_var=
4948 _LT_TAGVAR(hardcode_libdir_flag_spec, $1)=
4949 _LT_TAGVAR(export_dynamic_flag_spec, $1)=
4950 _LT_TAGVAR(whole_archive_flag_spec, $1)=
4951 fi
4952 else
4953 # PORTME fill in a description of your system's linker (not GNU ld)
4954 case $host_os in
4955 aix3*)
4956 _LT_TAGVAR(allow_undefined_flag, $1)=unsupported
4957 _LT_TAGVAR(always_export_symbols, $1)=yes
4958 _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'
4959 # Note: this linker hardcodes the directories in LIBPATH if there
4960 # are no directories specified by -L.
4961 _LT_TAGVAR(hardcode_minus_L, $1)=yes
4962 if test "$GCC" = yes && test -z "$lt_prog_compiler_static"; then
4963 # Neither direct hardcoding nor static linking is supported with a
4964 # broken collect2.
4965 _LT_TAGVAR(hardcode_direct, $1)=unsupported
4966 fi
4967 ;;
4968
4969 aix[[4-9]]*)
4970 if test "$host_cpu" = ia64; then
4971 # On IA64, the linker does run time linking by default, so we don't
4972 # have to do anything special.
4973 aix_use_runtimelinking=no
4974 exp_sym_flag='-Bexport'
4975 no_entry_flag=""
4976 else
4977 # If we're using GNU nm, then we don't want the "-C" option.
4978 # -C means demangle to AIX nm, but means don't demangle with GNU nm
4979 # Also, AIX nm treats weak defined symbols like other global
4980 # defined symbols, whereas GNU nm marks them as "W".
4981 if $NM -V 2>&1 | $GREP 'GNU' > /dev/null; then
4982 _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'
4983 else
4984 _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'
4985 fi
4986 aix_use_runtimelinking=no
4987
4988 # Test if we are trying to use run time linking or normal
4989 # AIX style linking. If -brtl is somewhere in LDFLAGS, we
4990 # need to do runtime linking.
4991 case $host_os in aix4.[[23]]|aix4.[[23]].*|aix[[5-9]]*)
4992 for ld_flag in $LDFLAGS; do
4993 if (test $ld_flag = "-brtl" || test $ld_flag = "-Wl,-brtl"); then
4994 aix_use_runtimelinking=yes
4995 break
4996 fi
4997 done
4998 ;;
4999 esac
5000
5001 exp_sym_flag='-bexport'
5002 no_entry_flag='-bnoentry'
5003 fi
5004
5005 # When large executables or shared objects are built, AIX ld can
5006 # have problems creating the table of contents. If linking a library
5007 # or program results in "error TOC overflow" add -mminimal-toc to
5008 # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not
5009 # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS.
5010
5011 _LT_TAGVAR(archive_cmds, $1)=''
5012 _LT_TAGVAR(hardcode_direct, $1)=yes
5013 _LT_TAGVAR(hardcode_direct_absolute, $1)=yes
5014 _LT_TAGVAR(hardcode_libdir_separator, $1)=':'
5015 _LT_TAGVAR(link_all_deplibs, $1)=yes
5016 _LT_TAGVAR(file_list_spec, $1)='${wl}-f,'
5017
5018 if test "$GCC" = yes; then
5019 case $host_os in aix4.[[012]]|aix4.[[012]].*)
5020 # We only want to do this on AIX 4.2 and lower, the check
5021 # below for broken collect2 doesn't work under 4.3+
5022 collect2name=`${CC} -print-prog-name=collect2`
5023 if test -f "$collect2name" &&
5024 strings "$collect2name" | $GREP resolve_lib_name >/dev/null
5025 then
5026 # We have reworked collect2
5027 :
5028 else
5029 # We have old collect2
5030 _LT_TAGVAR(hardcode_direct, $1)=unsupported
5031 # It fails to find uninstalled libraries when the uninstalled
5032 # path is not listed in the libpath. Setting hardcode_minus_L
5033 # to unsupported forces relinking
5034 _LT_TAGVAR(hardcode_minus_L, $1)=yes
5035 _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
5036 _LT_TAGVAR(hardcode_libdir_separator, $1)=
5037 fi
5038 ;;
5039 esac
5040 shared_flag='-shared'
5041 if test "$aix_use_runtimelinking" = yes; then
5042 shared_flag="$shared_flag "'${wl}-G'
5043 fi
5044 else
5045 # not using gcc
5046 if test "$host_cpu" = ia64; then
5047 # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release
5048 # chokes on -Wl,-G. The following line is correct:
5049 shared_flag='-G'
5050 else
5051 if test "$aix_use_runtimelinking" = yes; then
5052 shared_flag='${wl}-G'
5053 else
5054 shared_flag='${wl}-bM:SRE'
5055 fi
5056 fi
5057 fi
5058
5059 _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-bexpall'
5060 # It seems that -bexpall does not export symbols beginning with
5061 # underscore (_), so it is better to generate a list of symbols to export.
5062 _LT_TAGVAR(always_export_symbols, $1)=yes
5063 if test "$aix_use_runtimelinking" = yes; then
5064 # Warning - without using the other runtime loading flags (-brtl),
5065 # -berok will link without error, but may produce a broken library.
5066 _LT_TAGVAR(allow_undefined_flag, $1)='-berok'
5067 # Determine the default libpath from the value encoded in an
5068 # empty executable.
5069 _LT_SYS_MODULE_PATH_AIX([$1])
5070 _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath"
5071 _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"
5072 else
5073 if test "$host_cpu" = ia64; then
5074 _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R $libdir:/usr/lib:/lib'
5075 _LT_TAGVAR(allow_undefined_flag, $1)="-z nodefs"
5076 _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"
5077 else
5078 # Determine the default libpath from the value encoded in an
5079 # empty executable.
5080 _LT_SYS_MODULE_PATH_AIX([$1])
5081 _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath"
5082 # Warning - without using the other run time loading flags,
5083 # -berok will link without error, but may produce a broken library.
5084 _LT_TAGVAR(no_undefined_flag, $1)=' ${wl}-bernotok'
5085 _LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-berok'
5086 if test "$with_gnu_ld" = yes; then
5087 # We only use this code for GNU lds that support --whole-archive.
5088 _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive$convenience ${wl}--no-whole-archive'
5089 else
5090 # Exported symbols can be pulled into shared objects from archives
5091 _LT_TAGVAR(whole_archive_flag_spec, $1)='$convenience'
5092 fi
5093 _LT_TAGVAR(archive_cmds_need_lc, $1)=yes
5094 # This is similar to how AIX traditionally builds its shared libraries.
5095 _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'
5096 fi
5097 fi
5098 ;;
5099
5100 amigaos*)
5101 case $host_cpu in
5102 powerpc)
5103 # see comment about AmigaOS4 .so support
5104 _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
5105 _LT_TAGVAR(archive_expsym_cmds, $1)=''
5106 ;;
5107 m68k)
5108 _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)'
5109 _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
5110 _LT_TAGVAR(hardcode_minus_L, $1)=yes
5111 ;;
5112 esac
5113 ;;
5114
5115 bsdi[[45]]*)
5116 _LT_TAGVAR(export_dynamic_flag_spec, $1)=-rdynamic
5117 ;;
5118
5119 cygwin* | mingw* | pw32* | cegcc*)
5120 # When not using gcc, we currently assume that we are using
5121 # Microsoft Visual C++.
5122 # hardcode_libdir_flag_spec is actually meaningless, as there is
5123 # no search path for DLLs.
5124 case $cc_basename in
5125 cl*)
5126 # Native MSVC
5127 _LT_TAGVAR(hardcode_libdir_flag_spec, $1)=' '
5128 _LT_TAGVAR(allow_undefined_flag, $1)=unsupported
5129 _LT_TAGVAR(always_export_symbols, $1)=yes
5130 _LT_TAGVAR(file_list_spec, $1)='@'
5131 # Tell ltmain to make .lib files, not .a files.
5132 libext=lib
5133 # Tell ltmain to make .dll files, not .so files.
5134 shrext_cmds=".dll"
5135 # FIXME: Setting linknames here is a bad hack.
5136 _LT_TAGVAR(archive_cmds, $1)='$CC -o $output_objdir/$soname $libobjs $compiler_flags $deplibs -Wl,-dll~linknames='
5137 _LT_TAGVAR(archive_expsym_cmds, $1)='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then
5138 sed -n -e 's/\\\\\\\(.*\\\\\\\)/-link\\\ -EXPORT:\\\\\\\1/' -e '1\\\!p' < $export_symbols > $output_objdir/$soname.exp;
5139 else
5140 sed -e 's/\\\\\\\(.*\\\\\\\)/-link\\\ -EXPORT:\\\\\\\1/' < $export_symbols > $output_objdir/$soname.exp;
5141 fi~
5142 $CC -o $tool_output_objdir$soname $libobjs $compiler_flags $deplibs "@$tool_output_objdir$soname.exp" -Wl,-DLL,-IMPLIB:"$tool_output_objdir$libname.dll.lib"~
5143 linknames='
5144 # The linker will not automatically build a static lib if we build a DLL.
5145 # _LT_TAGVAR(old_archive_from_new_cmds, $1)='true'
5146 _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes
5147 _LT_TAGVAR(exclude_expsyms, $1)='_NULL_IMPORT_DESCRIPTOR|_IMPORT_DESCRIPTOR_.*'
5148 _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'
5149 # Don't use ranlib
5150 _LT_TAGVAR(old_postinstall_cmds, $1)='chmod 644 $oldlib'
5151 _LT_TAGVAR(postlink_cmds, $1)='lt_outputfile="@OUTPUT@"~
5152 lt_tool_outputfile="@TOOL_OUTPUT@"~
5153 case $lt_outputfile in
5154 *.exe|*.EXE) ;;
5155 *)
5156 lt_outputfile="$lt_outputfile.exe"
5157 lt_tool_outputfile="$lt_tool_outputfile.exe"
5158 ;;
5159 esac~
5160 if test "$MANIFEST_TOOL" != ":" && test -f "$lt_outputfile.manifest"; then
5161 $MANIFEST_TOOL -manifest "$lt_tool_outputfile.manifest" -outputresource:"$lt_tool_outputfile" || exit 1;
5162 $RM "$lt_outputfile.manifest";
5163 fi'
5164 ;;
5165 *)
5166 # Assume MSVC wrapper
5167 _LT_TAGVAR(hardcode_libdir_flag_spec, $1)=' '
5168 _LT_TAGVAR(allow_undefined_flag, $1)=unsupported
5169 # Tell ltmain to make .lib files, not .a files.
5170 libext=lib
5171 # Tell ltmain to make .dll files, not .so files.
5172 shrext_cmds=".dll"
5173 # FIXME: Setting linknames here is a bad hack.
5174 _LT_TAGVAR(archive_cmds, $1)='$CC -o $lib $libobjs $compiler_flags `func_echo_all "$deplibs" | $SED '\''s/ -lc$//'\''` -link -dll~linknames='
5175 # The linker will automatically build a .lib file if we build a DLL.
5176 _LT_TAGVAR(old_archive_from_new_cmds, $1)='true'
5177 # FIXME: Should let the user specify the lib program.
5178 _LT_TAGVAR(old_archive_cmds, $1)='lib -OUT:$oldlib$oldobjs$old_deplibs'
5179 _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes
5180 ;;
5181 esac
5182 ;;
5183
5184 darwin* | rhapsody*)
5185 _LT_DARWIN_LINKER_FEATURES($1)
5186 ;;
5187
5188 dgux*)
5189 _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
5190 _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
5191 _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
5192 ;;
5193
5194 # FreeBSD 2.2.[012] allows us to include c++rt0.o to get C++ constructor
5195 # support. Future versions do this automatically, but an explicit c++rt0.o
5196 # does not break anything, and helps significantly (at the cost of a little
5197 # extra space).
5198 freebsd2.2*)
5199 _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags /usr/lib/c++rt0.o'
5200 _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir'
5201 _LT_TAGVAR(hardcode_direct, $1)=yes
5202 _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
5203 ;;
5204
5205 # Unfortunately, older versions of FreeBSD 2 do not have this feature.
5206 freebsd2.*)
5207 _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags'
5208 _LT_TAGVAR(hardcode_direct, $1)=yes
5209 _LT_TAGVAR(hardcode_minus_L, $1)=yes
5210 _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
5211 ;;
5212
5213 # FreeBSD 3 and greater uses gcc -shared to do shared libraries.
5214 freebsd* | dragonfly*)
5215 _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags'
5216 _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir'
5217 _LT_TAGVAR(hardcode_direct, $1)=yes
5218 _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
5219 ;;
5220
5221 hpux9*)
5222 if test "$GCC" = yes; then
5223 _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'
5224 else
5225 _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'
5226 fi
5227 _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir'
5228 _LT_TAGVAR(hardcode_libdir_separator, $1)=:
5229 _LT_TAGVAR(hardcode_direct, $1)=yes
5230
5231 # hardcode_minus_L: Not really in the search PATH,
5232 # but as the default location of the library.
5233 _LT_TAGVAR(hardcode_minus_L, $1)=yes
5234 _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E'
5235 ;;
5236
5237 hpux10*)
5238 if test "$GCC" = yes && test "$with_gnu_ld" = no; then
5239 _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'
5240 else
5241 _LT_TAGVAR(archive_cmds, $1)='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags'
5242 fi
5243 if test "$with_gnu_ld" = no; then
5244 _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir'
5245 _LT_TAGVAR(hardcode_libdir_separator, $1)=:
5246 _LT_TAGVAR(hardcode_direct, $1)=yes
5247 _LT_TAGVAR(hardcode_direct_absolute, $1)=yes
5248 _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E'
5249 # hardcode_minus_L: Not really in the search PATH,
5250 # but as the default location of the library.
5251 _LT_TAGVAR(hardcode_minus_L, $1)=yes
5252 fi
5253 ;;
5254
5255 hpux11*)
5256 if test "$GCC" = yes && test "$with_gnu_ld" = no; then
5257 case $host_cpu in
5258 hppa*64*)
5259 _LT_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags'
5260 ;;
5261 ia64*)
5262 _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags'
5263 ;;
5264 *)
5265 _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'
5266 ;;
5267 esac
5268 else
5269 case $host_cpu in
5270 hppa*64*)
5271 _LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags'
5272 ;;
5273 ia64*)
5274 _LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags'
5275 ;;
5276 *)
5277 m4_if($1, [], [
5278 # Older versions of the 11.00 compiler do not understand -b yet
5279 # (HP92453-01 A.11.01.20 doesn't, HP92453-01 B.11.X.35175-35176.GP does)
5280 _LT_LINKER_OPTION([if $CC understands -b],
5281 _LT_TAGVAR(lt_cv_prog_compiler__b, $1), [-b],
5282 [_LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'],
5283 [_LT_TAGVAR(archive_cmds, $1)='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags'])],
5284 [_LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'])
5285 ;;
5286 esac
5287 fi
5288 if test "$with_gnu_ld" = no; then
5289 _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir'
5290 _LT_TAGVAR(hardcode_libdir_separator, $1)=:
5291
5292 case $host_cpu in
5293 hppa*64*|ia64*)
5294 _LT_TAGVAR(hardcode_direct, $1)=no
5295 _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
5296 ;;
5297 *)
5298 _LT_TAGVAR(hardcode_direct, $1)=yes
5299 _LT_TAGVAR(hardcode_direct_absolute, $1)=yes
5300 _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E'
5301
5302 # hardcode_minus_L: Not really in the search PATH,
5303 # but as the default location of the library.
5304 _LT_TAGVAR(hardcode_minus_L, $1)=yes
5305 ;;
5306 esac
5307 fi
5308 ;;
5309
5310 irix5* | irix6* | nonstopux*)
5311 if test "$GCC" = yes; then
5312 _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'
5313 # Try to use the -exported_symbol ld option, if it does not
5314 # work, assume that -exports_file does not work either and
5315 # implicitly export all symbols.
5316 # This should be the same for all languages, so no per-tag cache variable.
5317 AC_CACHE_CHECK([whether the $host_os linker accepts -exported_symbol],
5318 [lt_cv_irix_exported_symbol],
5319 [save_LDFLAGS="$LDFLAGS"
5320 LDFLAGS="$LDFLAGS -shared ${wl}-exported_symbol ${wl}foo ${wl}-update_registry ${wl}/dev/null"
5321 AC_LINK_IFELSE(
5322 [AC_LANG_SOURCE(
5323 [AC_LANG_CASE([C], [[int foo (void) { return 0; }]],
5324 [C++], [[int foo (void) { return 0; }]],
5325 [Fortran 77], [[
5326 subroutine foo
5327 end]],
5328 [Fortran], [[
5329 subroutine foo
5330 end]])])],
5331 [lt_cv_irix_exported_symbol=yes],
5332 [lt_cv_irix_exported_symbol=no])
5333 LDFLAGS="$save_LDFLAGS"])
5334 if test "$lt_cv_irix_exported_symbol" = yes; then
5335 _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'
5336 fi
5337 else
5338 _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'
5339 _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'
5340 fi
5341 _LT_TAGVAR(archive_cmds_need_lc, $1)='no'
5342 _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
5343 _LT_TAGVAR(hardcode_libdir_separator, $1)=:
5344 _LT_TAGVAR(inherit_rpath, $1)=yes
5345 _LT_TAGVAR(link_all_deplibs, $1)=yes
5346 ;;
5347
5348 netbsd*)
5349 if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then
5350 _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' # a.out
5351 else
5352 _LT_TAGVAR(archive_cmds, $1)='$LD -shared -o $lib $libobjs $deplibs $linker_flags' # ELF
5353 fi
5354 _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir'
5355 _LT_TAGVAR(hardcode_direct, $1)=yes
5356 _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
5357 ;;
5358
5359 newsos6)
5360 _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
5361 _LT_TAGVAR(hardcode_direct, $1)=yes
5362 _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
5363 _LT_TAGVAR(hardcode_libdir_separator, $1)=:
5364 _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
5365 ;;
5366
5367 *nto* | *qnx*)
5368 ;;
5369
5370 openbsd*)
5371 if test -f /usr/libexec/ld.so; then
5372 _LT_TAGVAR(hardcode_direct, $1)=yes
5373 _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
5374 _LT_TAGVAR(hardcode_direct_absolute, $1)=yes
5375 if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then
5376 _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags'
5377 _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-retain-symbols-file,$export_symbols'
5378 _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir'
5379 _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E'
5380 else
5381 case $host_os in
5382 openbsd[[01]].* | openbsd2.[[0-7]] | openbsd2.[[0-7]].*)
5383 _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags'
5384 _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir'
5385 ;;
5386 *)
5387 _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags'
5388 _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir'
5389 ;;
5390 esac
5391 fi
5392 else
5393 _LT_TAGVAR(ld_shlibs, $1)=no
5394 fi
5395 ;;
5396
5397 os2*)
5398 _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
5399 _LT_TAGVAR(hardcode_minus_L, $1)=yes
5400 _LT_TAGVAR(allow_undefined_flag, $1)=unsupported
5401 _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'
5402 _LT_TAGVAR(old_archive_from_new_cmds, $1)='emximp -o $output_objdir/$libname.a $output_objdir/$libname.def'
5403 ;;
5404
5405 osf3*)
5406 if test "$GCC" = yes; then
5407 _LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*'
5408 _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'
5409 else
5410 _LT_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*'
5411 _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'
5412 fi
5413 _LT_TAGVAR(archive_cmds_need_lc, $1)='no'
5414 _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
5415 _LT_TAGVAR(hardcode_libdir_separator, $1)=:
5416 ;;
5417
5418 osf4* | osf5*) # as osf3* with the addition of -msym flag
5419 if test "$GCC" = yes; then
5420 _LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*'
5421 _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'
5422 _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
5423 else
5424 _LT_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*'
5425 _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'
5426 _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~
5427 $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'
5428
5429 # Both c and cxx compiler support -rpath directly
5430 _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir'
5431 fi
5432 _LT_TAGVAR(archive_cmds_need_lc, $1)='no'
5433 _LT_TAGVAR(hardcode_libdir_separator, $1)=:
5434 ;;
5435
5436 solaris*)
5437 _LT_TAGVAR(no_undefined_flag, $1)=' -z defs'
5438 if test "$GCC" = yes; then
5439 wlarc='${wl}'
5440 _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag ${wl}-z ${wl}text ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags'
5441 _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~
5442 $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'
5443 else
5444 case `$CC -V 2>&1` in
5445 *"Compilers 5.0"*)
5446 wlarc=''
5447 _LT_TAGVAR(archive_cmds, $1)='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags'
5448 _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~
5449 $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$RM $lib.exp'
5450 ;;
5451 *)
5452 wlarc='${wl}'
5453 _LT_TAGVAR(archive_cmds, $1)='$CC -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $compiler_flags'
5454 _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~
5455 $CC -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp'
5456 ;;
5457 esac
5458 fi
5459 _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir'
5460 _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
5461 case $host_os in
5462 solaris2.[[0-5]] | solaris2.[[0-5]].*) ;;
5463 *)
5464 # The compiler driver will combine and reorder linker options,
5465 # but understands `-z linker_flag'. GCC discards it without `$wl',
5466 # but is careful enough not to reorder.
5467 # Supported since Solaris 2.6 (maybe 2.5.1?)
5468 if test "$GCC" = yes; then
5469 _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract'
5470 else
5471 _LT_TAGVAR(whole_archive_flag_spec, $1)='-z allextract$convenience -z defaultextract'
5472 fi
5473 ;;
5474 esac
5475 _LT_TAGVAR(link_all_deplibs, $1)=yes
5476 ;;
5477
5478 sunos4*)
5479 if test "x$host_vendor" = xsequent; then
5480 # Use $CC to link under sequent, because it throws in some extra .o
5481 # files that make .init and .fini sections work.
5482 _LT_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h $soname -o $lib $libobjs $deplibs $compiler_flags'
5483 else
5484 _LT_TAGVAR(archive_cmds, $1)='$LD -assert pure-text -Bstatic -o $lib $libobjs $deplibs $linker_flags'
5485 fi
5486 _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
5487 _LT_TAGVAR(hardcode_direct, $1)=yes
5488 _LT_TAGVAR(hardcode_minus_L, $1)=yes
5489 _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
5490 ;;
5491
5492 sysv4)
5493 case $host_vendor in
5494 sni)
5495 _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
5496 _LT_TAGVAR(hardcode_direct, $1)=yes # is this really true???
5497 ;;
5498 siemens)
5499 ## LD is ld it makes a PLAMLIB
5500 ## CC just makes a GrossModule.
5501 _LT_TAGVAR(archive_cmds, $1)='$LD -G -o $lib $libobjs $deplibs $linker_flags'
5502 _LT_TAGVAR(reload_cmds, $1)='$CC -r -o $output$reload_objs'
5503 _LT_TAGVAR(hardcode_direct, $1)=no
5504 ;;
5505 motorola)
5506 _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
5507 _LT_TAGVAR(hardcode_direct, $1)=no #Motorola manual says yes, but my tests say they lie
5508 ;;
5509 esac
5510 runpath_var='LD_RUN_PATH'
5511 _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
5512 ;;
5513
5514 sysv4.3*)
5515 _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
5516 _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
5517 _LT_TAGVAR(export_dynamic_flag_spec, $1)='-Bexport'
5518 ;;
5519
5520 sysv4*MP*)
5521 if test -d /usr/nec; then
5522 _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
5523 _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
5524 runpath_var=LD_RUN_PATH
5525 hardcode_runpath_var=yes
5526 _LT_TAGVAR(ld_shlibs, $1)=yes
5527 fi
5528 ;;
5529
5530 sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[[01]].[[10]]* | unixware7* | sco3.2v5.0.[[024]]*)
5531 _LT_TAGVAR(no_undefined_flag, $1)='${wl}-z,text'
5532 _LT_TAGVAR(archive_cmds_need_lc, $1)=no
5533 _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
5534 runpath_var='LD_RUN_PATH'
5535
5536 if test "$GCC" = yes; then
5537 _LT_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
5538 _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
5539 else
5540 _LT_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
5541 _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
5542 fi
5543 ;;
5544
5545 sysv5* | sco3.2v5* | sco5v6*)
5546 # Note: We can NOT use -z defs as we might desire, because we do not
5547 # link with -lc, and that would cause any symbols used from libc to
5548 # always be unresolved, which means just about no library would
5549 # ever link correctly. If we're not using GNU ld we use -z text
5550 # though, which does catch some bad symbols but isn't as heavy-handed
5551 # as -z defs.
5552 _LT_TAGVAR(no_undefined_flag, $1)='${wl}-z,text'
5553 _LT_TAGVAR(allow_undefined_flag, $1)='${wl}-z,nodefs'
5554 _LT_TAGVAR(archive_cmds_need_lc, $1)=no
5555 _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
5556 _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R,$libdir'
5557 _LT_TAGVAR(hardcode_libdir_separator, $1)=':'
5558 _LT_TAGVAR(link_all_deplibs, $1)=yes
5559 _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-Bexport'
5560 runpath_var='LD_RUN_PATH'
5561
5562 if test "$GCC" = yes; then
5563 _LT_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
5564 _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
5565 else
5566 _LT_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
5567 _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
5568 fi
5569 ;;
5570
5571 uts4*)
5572 _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
5573 _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
5574 _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
5575 ;;
5576
5577 *)
5578 _LT_TAGVAR(ld_shlibs, $1)=no
5579 ;;
5580 esac
5581
5582 if test x$host_vendor = xsni; then
5583 case $host in
5584 sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*)
5585 _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-Blargedynsym'
5586 ;;
5587 esac
5588 fi
5589 fi
5590 ])
5591 AC_MSG_RESULT([$_LT_TAGVAR(ld_shlibs, $1)])
5592 test "$_LT_TAGVAR(ld_shlibs, $1)" = no && can_build_shared=no
5593
5594 _LT_TAGVAR(with_gnu_ld, $1)=$with_gnu_ld
5595
5596 _LT_DECL([], [libext], [0], [Old archive suffix (normally "a")])dnl
5597 _LT_DECL([], [shrext_cmds], [1], [Shared library suffix (normally ".so")])dnl
5598 _LT_DECL([], [extract_expsyms_cmds], [2],
5599 [The commands to extract the exported symbol list from a shared archive])
5600
5601 #
5602 # Do we need to explicitly link libc?
5603 #
5604 case "x$_LT_TAGVAR(archive_cmds_need_lc, $1)" in
5605 x|xyes)
5606 # Assume -lc should be added
5607 _LT_TAGVAR(archive_cmds_need_lc, $1)=yes
5608
5609 if test "$enable_shared" = yes && test "$GCC" = yes; then
5610 case $_LT_TAGVAR(archive_cmds, $1) in
5611 *'~'*)
5612 # FIXME: we may have to deal with multi-command sequences.
5613 ;;
5614 '$CC '*)
5615 # Test whether the compiler implicitly links with -lc since on some
5616 # systems, -lgcc has to come before -lc. If gcc already passes -lc
5617 # to ld, don't add -lc before -lgcc.
5618 AC_CACHE_CHECK([whether -lc should be explicitly linked in],
5619 [lt_cv_]_LT_TAGVAR(archive_cmds_need_lc, $1),
5620 [$RM conftest*
5621 echo "$lt_simple_compile_test_code" > conftest.$ac_ext
5622
5623 if AC_TRY_EVAL(ac_compile) 2>conftest.err; then
5624 soname=conftest
5625 lib=conftest
5626 libobjs=conftest.$ac_objext
5627 deplibs=
5628 wl=$_LT_TAGVAR(lt_prog_compiler_wl, $1)
5629 pic_flag=$_LT_TAGVAR(lt_prog_compiler_pic, $1)
5630 compiler_flags=-v
5631 linker_flags=-v
5632 verstring=
5633 output_objdir=.
5634 libname=conftest
5635 lt_save_allow_undefined_flag=$_LT_TAGVAR(allow_undefined_flag, $1)
5636 _LT_TAGVAR(allow_undefined_flag, $1)=
5637 if AC_TRY_EVAL(_LT_TAGVAR(archive_cmds, $1) 2\>\&1 \| $GREP \" -lc \" \>/dev/null 2\>\&1)
5638 then
5639 lt_cv_[]_LT_TAGVAR(archive_cmds_need_lc, $1)=no
5640 else
5641 lt_cv_[]_LT_TAGVAR(archive_cmds_need_lc, $1)=yes
5642 fi
5643 _LT_TAGVAR(allow_undefined_flag, $1)=$lt_save_allow_undefined_flag
5644 else
5645 cat conftest.err 1>&5
5646 fi
5647 $RM conftest*
5648 ])
5649 _LT_TAGVAR(archive_cmds_need_lc, $1)=$lt_cv_[]_LT_TAGVAR(archive_cmds_need_lc, $1)
5650 ;;
5651 esac
5652 fi
5653 ;;
5654 esac
5655
5656 _LT_TAGDECL([build_libtool_need_lc], [archive_cmds_need_lc], [0],
5657 [Whether or not to add -lc for building shared libraries])
5658 _LT_TAGDECL([allow_libtool_libs_with_static_runtimes],
5659 [enable_shared_with_static_runtimes], [0],
5660 [Whether or not to disallow shared libs when runtime libs are static])
5661 _LT_TAGDECL([], [export_dynamic_flag_spec], [1],
5662 [Compiler flag to allow reflexive dlopens])
5663 _LT_TAGDECL([], [whole_archive_flag_spec], [1],
5664 [Compiler flag to generate shared objects directly from archives])
5665 _LT_TAGDECL([], [compiler_needs_object], [1],
5666 [Whether the compiler copes with passing no objects directly])
5667 _LT_TAGDECL([], [old_archive_from_new_cmds], [2],
5668 [Create an old-style archive from a shared archive])
5669 _LT_TAGDECL([], [old_archive_from_expsyms_cmds], [2],
5670 [Create a temporary old-style archive to link instead of a shared archive])
5671 _LT_TAGDECL([], [archive_cmds], [2], [Commands used to build a shared archive])
5672 _LT_TAGDECL([], [archive_expsym_cmds], [2])
5673 _LT_TAGDECL([], [module_cmds], [2],
5674 [Commands used to build a loadable module if different from building
5675 a shared archive.])
5676 _LT_TAGDECL([], [module_expsym_cmds], [2])
5677 _LT_TAGDECL([], [with_gnu_ld], [1],
5678 [Whether we are building with GNU ld or not])
5679 _LT_TAGDECL([], [allow_undefined_flag], [1],
5680 [Flag that allows shared libraries with undefined symbols to be built])
5681 _LT_TAGDECL([], [no_undefined_flag], [1],
5682 [Flag that enforces no undefined symbols])
5683 _LT_TAGDECL([], [hardcode_libdir_flag_spec], [1],
5684 [Flag to hardcode $libdir into a binary during linking.
5685 This must work even if $libdir does not exist])
5686 _LT_TAGDECL([], [hardcode_libdir_separator], [1],
5687 [Whether we need a single "-rpath" flag with a separated argument])
5688 _LT_TAGDECL([], [hardcode_direct], [0],
5689 [Set to "yes" if using DIR/libNAME${shared_ext} during linking hardcodes
5690 DIR into the resulting binary])
5691 _LT_TAGDECL([], [hardcode_direct_absolute], [0],
5692 [Set to "yes" if using DIR/libNAME${shared_ext} during linking hardcodes
5693 DIR into the resulting binary and the resulting library dependency is
5694 "absolute", i.e impossible to change by setting ${shlibpath_var} if the
5695 library is relocated])
5696 _LT_TAGDECL([], [hardcode_minus_L], [0],
5697 [Set to "yes" if using the -LDIR flag during linking hardcodes DIR
5698 into the resulting binary])
5699 _LT_TAGDECL([], [hardcode_shlibpath_var], [0],
5700 [Set to "yes" if using SHLIBPATH_VAR=DIR during linking hardcodes DIR
5701 into the resulting binary])
5702 _LT_TAGDECL([], [hardcode_automatic], [0],
5703 [Set to "yes" if building a shared library automatically hardcodes DIR
5704 into the library and all subsequent libraries and executables linked
5705 against it])
5706 _LT_TAGDECL([], [inherit_rpath], [0],
5707 [Set to yes if linker adds runtime paths of dependent libraries
5708 to runtime path list])
5709 _LT_TAGDECL([], [link_all_deplibs], [0],
5710 [Whether libtool must link a program against all its dependency libraries])
5711 _LT_TAGDECL([], [always_export_symbols], [0],
5712 [Set to "yes" if exported symbols are required])
5713 _LT_TAGDECL([], [export_symbols_cmds], [2],
5714 [The commands to list exported symbols])
5715 _LT_TAGDECL([], [exclude_expsyms], [1],
5716 [Symbols that should not be listed in the preloaded symbols])
5717 _LT_TAGDECL([], [include_expsyms], [1],
5718 [Symbols that must always be exported])
5719 _LT_TAGDECL([], [prelink_cmds], [2],
5720 [Commands necessary for linking programs (against libraries) with templates])
5721 _LT_TAGDECL([], [postlink_cmds], [2],
5722 [Commands necessary for finishing linking programs])
5723 _LT_TAGDECL([], [file_list_spec], [1],
5724 [Specify filename containing input files])
5725 dnl FIXME: Not yet implemented
5726 dnl _LT_TAGDECL([], [thread_safe_flag_spec], [1],
5727 dnl [Compiler flag to generate thread safe objects])
5728 ])# _LT_LINKER_SHLIBS
5729
5730
5731 # _LT_LANG_C_CONFIG([TAG])
5732 # ------------------------
5733 # Ensure that the configuration variables for a C compiler are suitably
5734 # defined. These variables are subsequently used by _LT_CONFIG to write
5735 # the compiler configuration to `libtool'.
5736 m4_defun([_LT_LANG_C_CONFIG],
5737 [m4_require([_LT_DECL_EGREP])dnl
5738 lt_save_CC="$CC"
5739 AC_LANG_PUSH(C)
5740
5741 # Source file extension for C test sources.
5742 ac_ext=c
5743
5744 # Object file extension for compiled C test sources.
5745 objext=o
5746 _LT_TAGVAR(objext, $1)=$objext
5747
5748 # Code to be used in simple compile tests
5749 lt_simple_compile_test_code="int some_variable = 0;"
5750
5751 # Code to be used in simple link tests
5752 lt_simple_link_test_code='int main(){return(0);}'
5753
5754 _LT_TAG_COMPILER
5755 # Save the default compiler, since it gets overwritten when the other
5756 # tags are being tested, and _LT_TAGVAR(compiler, []) is a NOP.
5757 compiler_DEFAULT=$CC
5758
5759 # save warnings/boilerplate of simple test code
5760 _LT_COMPILER_BOILERPLATE
5761 _LT_LINKER_BOILERPLATE
5762
5763 ## CAVEAT EMPTOR:
5764 ## There is no encapsulation within the following macros, do not change
5765 ## the running order or otherwise move them around unless you know exactly
5766 ## what you are doing...
5767 if test -n "$compiler"; then
5768 _LT_COMPILER_NO_RTTI($1)
5769 _LT_COMPILER_PIC($1)
5770 _LT_COMPILER_C_O($1)
5771 _LT_COMPILER_FILE_LOCKS($1)
5772 _LT_LINKER_SHLIBS($1)
5773 _LT_SYS_DYNAMIC_LINKER($1)
5774 _LT_LINKER_HARDCODE_LIBPATH($1)
5775 LT_SYS_DLOPEN_SELF
5776 _LT_CMD_STRIPLIB
5777
5778 # Report which library types will actually be built
5779 AC_MSG_CHECKING([if libtool supports shared libraries])
5780 AC_MSG_RESULT([$can_build_shared])
5781
5782 AC_MSG_CHECKING([whether to build shared libraries])
5783 test "$can_build_shared" = "no" && enable_shared=no
5784
5785 # On AIX, shared libraries and static libraries use the same namespace, and
5786 # are all built from PIC.
5787 case $host_os in
5788 aix3*)
5789 test "$enable_shared" = yes && enable_static=no
5790 if test -n "$RANLIB"; then
5791 archive_cmds="$archive_cmds~\$RANLIB \$lib"
5792 postinstall_cmds='$RANLIB $lib'
5793 fi
5794 ;;
5795
5796 aix[[4-9]]*)
5797 if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then
5798 test "$enable_shared" = yes && enable_static=no
5799 fi
5800 ;;
5801 esac
5802 AC_MSG_RESULT([$enable_shared])
5803
5804 AC_MSG_CHECKING([whether to build static libraries])
5805 # Make sure either enable_shared or enable_static is yes.
5806 test "$enable_shared" = yes || enable_static=yes
5807 AC_MSG_RESULT([$enable_static])
5808
5809 _LT_CONFIG($1)
5810 fi
5811 AC_LANG_POP
5812 CC="$lt_save_CC"
5813 ])# _LT_LANG_C_CONFIG
5814
5815
5816 # _LT_LANG_CXX_CONFIG([TAG])
5817 # --------------------------
5818 # Ensure that the configuration variables for a C++ compiler are suitably
5819 # defined. These variables are subsequently used by _LT_CONFIG to write
5820 # the compiler configuration to `libtool'.
5821 m4_defun([_LT_LANG_CXX_CONFIG],
5822 [m4_require([_LT_FILEUTILS_DEFAULTS])dnl
5823 m4_require([_LT_DECL_EGREP])dnl
5824 m4_require([_LT_PATH_MANIFEST_TOOL])dnl
5825 if test -n "$CXX" && ( test "X$CXX" != "Xno" &&
5826 ( (test "X$CXX" = "Xg++" && `g++ -v >/dev/null 2>&1` ) ||
5827 (test "X$CXX" != "Xg++"))) ; then
5828 AC_PROG_CXXCPP
5829 else
5830 _lt_caught_CXX_error=yes
5831 fi
5832
5833 AC_LANG_PUSH(C++)
5834 _LT_TAGVAR(archive_cmds_need_lc, $1)=no
5835 _LT_TAGVAR(allow_undefined_flag, $1)=
5836 _LT_TAGVAR(always_export_symbols, $1)=no
5837 _LT_TAGVAR(archive_expsym_cmds, $1)=
5838 _LT_TAGVAR(compiler_needs_object, $1)=no
5839 _LT_TAGVAR(export_dynamic_flag_spec, $1)=
5840 _LT_TAGVAR(hardcode_direct, $1)=no
5841 _LT_TAGVAR(hardcode_direct_absolute, $1)=no
5842 _LT_TAGVAR(hardcode_libdir_flag_spec, $1)=
5843 _LT_TAGVAR(hardcode_libdir_separator, $1)=
5844 _LT_TAGVAR(hardcode_minus_L, $1)=no
5845 _LT_TAGVAR(hardcode_shlibpath_var, $1)=unsupported
5846 _LT_TAGVAR(hardcode_automatic, $1)=no
5847 _LT_TAGVAR(inherit_rpath, $1)=no
5848 _LT_TAGVAR(module_cmds, $1)=
5849 _LT_TAGVAR(module_expsym_cmds, $1)=
5850 _LT_TAGVAR(link_all_deplibs, $1)=unknown
5851 _LT_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds
5852 _LT_TAGVAR(reload_flag, $1)=$reload_flag
5853 _LT_TAGVAR(reload_cmds, $1)=$reload_cmds
5854 _LT_TAGVAR(no_undefined_flag, $1)=
5855 _LT_TAGVAR(whole_archive_flag_spec, $1)=
5856 _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=no
5857
5858 # Source file extension for C++ test sources.
5859 ac_ext=cpp
5860
5861 # Object file extension for compiled C++ test sources.
5862 objext=o
5863 _LT_TAGVAR(objext, $1)=$objext
5864
5865 # No sense in running all these tests if we already determined that
5866 # the CXX compiler isn't working. Some variables (like enable_shared)
5867 # are currently assumed to apply to all compilers on this platform,
5868 # and will be corrupted by setting them based on a non-working compiler.
5869 if test "$_lt_caught_CXX_error" != yes; then
5870 # Code to be used in simple compile tests
5871 lt_simple_compile_test_code="int some_variable = 0;"
5872
5873 # Code to be used in simple link tests
5874 lt_simple_link_test_code='int main(int, char *[[]]) { return(0); }'
5875
5876 # ltmain only uses $CC for tagged configurations so make sure $CC is set.
5877 _LT_TAG_COMPILER
5878
5879 # save warnings/boilerplate of simple test code
5880 _LT_COMPILER_BOILERPLATE
5881 _LT_LINKER_BOILERPLATE
5882
5883 # Allow CC to be a program name with arguments.
5884 lt_save_CC=$CC
5885 lt_save_CFLAGS=$CFLAGS
5886 lt_save_LD=$LD
5887 lt_save_GCC=$GCC
5888 GCC=$GXX
5889 lt_save_with_gnu_ld=$with_gnu_ld
5890 lt_save_path_LD=$lt_cv_path_LD
5891 if test -n "${lt_cv_prog_gnu_ldcxx+set}"; then
5892 lt_cv_prog_gnu_ld=$lt_cv_prog_gnu_ldcxx
5893 else
5894 $as_unset lt_cv_prog_gnu_ld
5895 fi
5896 if test -n "${lt_cv_path_LDCXX+set}"; then
5897 lt_cv_path_LD=$lt_cv_path_LDCXX
5898 else
5899 $as_unset lt_cv_path_LD
5900 fi
5901 test -z "${LDCXX+set}" || LD=$LDCXX
5902 CC=${CXX-"c++"}
5903 CFLAGS=$CXXFLAGS
5904 compiler=$CC
5905 _LT_TAGVAR(compiler, $1)=$CC
5906 _LT_CC_BASENAME([$compiler])
5907
5908 if test -n "$compiler"; then
5909 # We don't want -fno-exception when compiling C++ code, so set the
5910 # no_builtin_flag separately
5911 if test "$GXX" = yes; then
5912 _LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=' -fno-builtin'
5913 else
5914 _LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=
5915 fi
5916
5917 if test "$GXX" = yes; then
5918 # Set up default GNU C++ configuration
5919
5920 LT_PATH_LD
5921
5922 # Check if GNU C++ uses GNU ld as the underlying linker, since the
5923 # archiving commands below assume that GNU ld is being used.
5924 if test "$with_gnu_ld" = yes; then
5925 _LT_TAGVAR(archive_cmds, $1)='$CC $pic_flag -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib'
5926 _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'
5927
5928 _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
5929 _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic'
5930
5931 # If archive_cmds runs LD, not CC, wlarc should be empty
5932 # XXX I think wlarc can be eliminated in ltcf-cxx, but I need to
5933 # investigate it a little bit more. (MM)
5934 wlarc='${wl}'
5935
5936 # ancient GNU ld didn't support --whole-archive et. al.
5937 if eval "`$CC -print-prog-name=ld` --help 2>&1" |
5938 $GREP 'no-whole-archive' > /dev/null; then
5939 _LT_TAGVAR(whole_archive_flag_spec, $1)="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive'
5940 else
5941 _LT_TAGVAR(whole_archive_flag_spec, $1)=
5942 fi
5943 else
5944 with_gnu_ld=no
5945 wlarc=
5946
5947 # A generic and very simple default shared library creation
5948 # command for GNU C++ for the case where it uses the native
5949 # linker, instead of GNU ld. If possible, this setting should
5950 # overridden to take advantage of the native linker features on
5951 # the platform it is being used on.
5952 _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $lib'
5953 fi
5954
5955 # Commands to make compiler produce verbose output that lists
5956 # what "hidden" libraries, object files and flags are used when
5957 # linking a shared library.
5958 output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP "\-L"'
5959
5960 else
5961 GXX=no
5962 with_gnu_ld=no
5963 wlarc=
5964 fi
5965
5966 # PORTME: fill in a description of your system's C++ link characteristics
5967 AC_MSG_CHECKING([whether the $compiler linker ($LD) supports shared libraries])
5968 _LT_TAGVAR(ld_shlibs, $1)=yes
5969 case $host_os in
5970 aix3*)
5971 # FIXME: insert proper C++ library support
5972 _LT_TAGVAR(ld_shlibs, $1)=no
5973 ;;
5974 aix[[4-9]]*)
5975 if test "$host_cpu" = ia64; then
5976 # On IA64, the linker does run time linking by default, so we don't
5977 # have to do anything special.
5978 aix_use_runtimelinking=no
5979 exp_sym_flag='-Bexport'
5980 no_entry_flag=""
5981 else
5982 aix_use_runtimelinking=no
5983
5984 # Test if we are trying to use run time linking or normal
5985 # AIX style linking. If -brtl is somewhere in LDFLAGS, we
5986 # need to do runtime linking.
5987 case $host_os in aix4.[[23]]|aix4.[[23]].*|aix[[5-9]]*)
5988 for ld_flag in $LDFLAGS; do
5989 case $ld_flag in
5990 *-brtl*)
5991 aix_use_runtimelinking=yes
5992 break
5993 ;;
5994 esac
5995 done
5996 ;;
5997 esac
5998
5999 exp_sym_flag='-bexport'
6000 no_entry_flag='-bnoentry'
6001 fi
6002
6003 # When large executables or shared objects are built, AIX ld can
6004 # have problems creating the table of contents. If linking a library
6005 # or program results in "error TOC overflow" add -mminimal-toc to
6006 # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not
6007 # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS.
6008
6009 _LT_TAGVAR(archive_cmds, $1)=''
6010 _LT_TAGVAR(hardcode_direct, $1)=yes
6011 _LT_TAGVAR(hardcode_direct_absolute, $1)=yes
6012 _LT_TAGVAR(hardcode_libdir_separator, $1)=':'
6013 _LT_TAGVAR(link_all_deplibs, $1)=yes
6014 _LT_TAGVAR(file_list_spec, $1)='${wl}-f,'
6015
6016 if test "$GXX" = yes; then
6017 case $host_os in aix4.[[012]]|aix4.[[012]].*)
6018 # We only want to do this on AIX 4.2 and lower, the check
6019 # below for broken collect2 doesn't work under 4.3+
6020 collect2name=`${CC} -print-prog-name=collect2`
6021 if test -f "$collect2name" &&
6022 strings "$collect2name" | $GREP resolve_lib_name >/dev/null
6023 then
6024 # We have reworked collect2
6025 :
6026 else
6027 # We have old collect2
6028 _LT_TAGVAR(hardcode_direct, $1)=unsupported
6029 # It fails to find uninstalled libraries when the uninstalled
6030 # path is not listed in the libpath. Setting hardcode_minus_L
6031 # to unsupported forces relinking
6032 _LT_TAGVAR(hardcode_minus_L, $1)=yes
6033 _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
6034 _LT_TAGVAR(hardcode_libdir_separator, $1)=
6035 fi
6036 esac
6037 shared_flag='-shared'
6038 if test "$aix_use_runtimelinking" = yes; then
6039 shared_flag="$shared_flag "'${wl}-G'
6040 fi
6041 else
6042 # not using gcc
6043 if test "$host_cpu" = ia64; then
6044 # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release
6045 # chokes on -Wl,-G. The following line is correct:
6046 shared_flag='-G'
6047 else
6048 if test "$aix_use_runtimelinking" = yes; then
6049 shared_flag='${wl}-G'
6050 else
6051 shared_flag='${wl}-bM:SRE'
6052 fi
6053 fi
6054 fi
6055
6056 _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-bexpall'
6057 # It seems that -bexpall does not export symbols beginning with
6058 # underscore (_), so it is better to generate a list of symbols to
6059 # export.
6060 _LT_TAGVAR(always_export_symbols, $1)=yes
6061 if test "$aix_use_runtimelinking" = yes; then
6062 # Warning - without using the other runtime loading flags (-brtl),
6063 # -berok will link without error, but may produce a broken library.
6064 _LT_TAGVAR(allow_undefined_flag, $1)='-berok'
6065 # Determine the default libpath from the value encoded in an empty
6066 # executable.
6067 _LT_SYS_MODULE_PATH_AIX([$1])
6068 _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath"
6069
6070 _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"
6071 else
6072 if test "$host_cpu" = ia64; then
6073 _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R $libdir:/usr/lib:/lib'
6074 _LT_TAGVAR(allow_undefined_flag, $1)="-z nodefs"
6075 _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"
6076 else
6077 # Determine the default libpath from the value encoded in an
6078 # empty executable.
6079 _LT_SYS_MODULE_PATH_AIX([$1])
6080 _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath"
6081 # Warning - without using the other run time loading flags,
6082 # -berok will link without error, but may produce a broken library.
6083 _LT_TAGVAR(no_undefined_flag, $1)=' ${wl}-bernotok'
6084 _LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-berok'
6085 if test "$with_gnu_ld" = yes; then
6086 # We only use this code for GNU lds that support --whole-archive.
6087 _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive$convenience ${wl}--no-whole-archive'
6088 else
6089 # Exported symbols can be pulled into shared objects from archives
6090 _LT_TAGVAR(whole_archive_flag_spec, $1)='$convenience'
6091 fi
6092 _LT_TAGVAR(archive_cmds_need_lc, $1)=yes
6093 # This is similar to how AIX traditionally builds its shared
6094 # libraries.
6095 _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'
6096 fi
6097 fi
6098 ;;
6099
6100 beos*)
6101 if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then
6102 _LT_TAGVAR(allow_undefined_flag, $1)=unsupported
6103 # Joseph Beckenbach <jrb3@best.com> says some releases of gcc
6104 # support --undefined. This deserves some investigation. FIXME
6105 _LT_TAGVAR(archive_cmds, $1)='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
6106 else
6107 _LT_TAGVAR(ld_shlibs, $1)=no
6108 fi
6109 ;;
6110
6111 chorus*)
6112 case $cc_basename in
6113 *)
6114 # FIXME: insert proper C++ library support
6115 _LT_TAGVAR(ld_shlibs, $1)=no
6116 ;;
6117 esac
6118 ;;
6119
6120 cygwin* | mingw* | pw32* | cegcc*)
6121 case $GXX,$cc_basename in
6122 ,cl* | no,cl*)
6123 # Native MSVC
6124 # hardcode_libdir_flag_spec is actually meaningless, as there is
6125 # no search path for DLLs.
6126 _LT_TAGVAR(hardcode_libdir_flag_spec, $1)=' '
6127 _LT_TAGVAR(allow_undefined_flag, $1)=unsupported
6128 _LT_TAGVAR(always_export_symbols, $1)=yes
6129 _LT_TAGVAR(file_list_spec, $1)='@'
6130 # Tell ltmain to make .lib files, not .a files.
6131 libext=lib
6132 # Tell ltmain to make .dll files, not .so files.
6133 shrext_cmds=".dll"
6134 # FIXME: Setting linknames here is a bad hack.
6135 _LT_TAGVAR(archive_cmds, $1)='$CC -o $output_objdir/$soname $libobjs $compiler_flags $deplibs -Wl,-dll~linknames='
6136 _LT_TAGVAR(archive_expsym_cmds, $1)='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then
6137 $SED -n -e 's/\\\\\\\(.*\\\\\\\)/-link\\\ -EXPORT:\\\\\\\1/' -e '1\\\!p' < $export_symbols > $output_objdir/$soname.exp;
6138 else
6139 $SED -e 's/\\\\\\\(.*\\\\\\\)/-link\\\ -EXPORT:\\\\\\\1/' < $export_symbols > $output_objdir/$soname.exp;
6140 fi~
6141 $CC -o $tool_output_objdir$soname $libobjs $compiler_flags $deplibs "@$tool_output_objdir$soname.exp" -Wl,-DLL,-IMPLIB:"$tool_output_objdir$libname.dll.lib"~
6142 linknames='
6143 # The linker will not automatically build a static lib if we build a DLL.
6144 # _LT_TAGVAR(old_archive_from_new_cmds, $1)='true'
6145 _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes
6146 # Don't use ranlib
6147 _LT_TAGVAR(old_postinstall_cmds, $1)='chmod 644 $oldlib'
6148 _LT_TAGVAR(postlink_cmds, $1)='lt_outputfile="@OUTPUT@"~
6149 lt_tool_outputfile="@TOOL_OUTPUT@"~
6150 case $lt_outputfile in
6151 *.exe|*.EXE) ;;
6152 *)
6153 lt_outputfile="$lt_outputfile.exe"
6154 lt_tool_outputfile="$lt_tool_outputfile.exe"
6155 ;;
6156 esac~
6157 func_to_tool_file "$lt_outputfile"~
6158 if test "$MANIFEST_TOOL" != ":" && test -f "$lt_outputfile.manifest"; then
6159 $MANIFEST_TOOL -manifest "$lt_tool_outputfile.manifest" -outputresource:"$lt_tool_outputfile" || exit 1;
6160 $RM "$lt_outputfile.manifest";
6161 fi'
6162 ;;
6163 *)
6164 # g++
6165 # _LT_TAGVAR(hardcode_libdir_flag_spec, $1) is actually meaningless,
6166 # as there is no search path for DLLs.
6167 _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
6168 _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-all-symbols'
6169 _LT_TAGVAR(allow_undefined_flag, $1)=unsupported
6170 _LT_TAGVAR(always_export_symbols, $1)=no
6171 _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes
6172
6173 if $LD --help 2>&1 | $GREP 'auto-import' > /dev/null; then
6174 _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'
6175 # If the export-symbols file already is a .def file (1st line
6176 # is EXPORTS), use it as is; otherwise, prepend...
6177 _LT_TAGVAR(archive_expsym_cmds, $1)='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then
6178 cp $export_symbols $output_objdir/$soname.def;
6179 else
6180 echo EXPORTS > $output_objdir/$soname.def;
6181 cat $export_symbols >> $output_objdir/$soname.def;
6182 fi~
6183 $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'
6184 else
6185 _LT_TAGVAR(ld_shlibs, $1)=no
6186 fi
6187 ;;
6188 esac
6189 ;;
6190 darwin* | rhapsody*)
6191 _LT_DARWIN_LINKER_FEATURES($1)
6192 ;;
6193
6194 dgux*)
6195 case $cc_basename in
6196 ec++*)
6197 # FIXME: insert proper C++ library support
6198 _LT_TAGVAR(ld_shlibs, $1)=no
6199 ;;
6200 ghcx*)
6201 # Green Hills C++ Compiler
6202 # FIXME: insert proper C++ library support
6203 _LT_TAGVAR(ld_shlibs, $1)=no
6204 ;;
6205 *)
6206 # FIXME: insert proper C++ library support
6207 _LT_TAGVAR(ld_shlibs, $1)=no
6208 ;;
6209 esac
6210 ;;
6211
6212 freebsd2.*)
6213 # C++ shared libraries reported to be fairly broken before
6214 # switch to ELF
6215 _LT_TAGVAR(ld_shlibs, $1)=no
6216 ;;
6217
6218 freebsd-elf*)
6219 _LT_TAGVAR(archive_cmds_need_lc, $1)=no
6220 ;;
6221
6222 freebsd* | dragonfly*)
6223 # FreeBSD 3 and later use GNU C++ and GNU ld with standard ELF
6224 # conventions
6225 _LT_TAGVAR(ld_shlibs, $1)=yes
6226 ;;
6227
6228 gnu*)
6229 ;;
6230
6231 haiku*)
6232 _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
6233 _LT_TAGVAR(link_all_deplibs, $1)=yes
6234 ;;
6235
6236 hpux9*)
6237 _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir'
6238 _LT_TAGVAR(hardcode_libdir_separator, $1)=:
6239 _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E'
6240 _LT_TAGVAR(hardcode_direct, $1)=yes
6241 _LT_TAGVAR(hardcode_minus_L, $1)=yes # Not in the search PATH,
6242 # but as the default
6243 # location of the library.
6244
6245 case $cc_basename in
6246 CC*)
6247 # FIXME: insert proper C++ library support
6248 _LT_TAGVAR(ld_shlibs, $1)=no
6249 ;;
6250 aCC*)
6251 _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'
6252 # Commands to make compiler produce verbose output that lists
6253 # what "hidden" libraries, object files and flags are used when
6254 # linking a shared library.
6255 #
6256 # There doesn't appear to be a way to prevent this compiler from
6257 # explicitly linking system object files so we need to strip them
6258 # from the output so that they don't get included in the library
6259 # dependencies.
6260 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"'
6261 ;;
6262 *)
6263 if test "$GXX" = yes; then
6264 _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'
6265 else
6266 # FIXME: insert proper C++ library support
6267 _LT_TAGVAR(ld_shlibs, $1)=no
6268 fi
6269 ;;
6270 esac
6271 ;;
6272
6273 hpux10*|hpux11*)
6274 if test $with_gnu_ld = no; then
6275 _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir'
6276 _LT_TAGVAR(hardcode_libdir_separator, $1)=:
6277
6278 case $host_cpu in
6279 hppa*64*|ia64*)
6280 ;;
6281 *)
6282 _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E'
6283 ;;
6284 esac
6285 fi
6286 case $host_cpu in
6287 hppa*64*|ia64*)
6288 _LT_TAGVAR(hardcode_direct, $1)=no
6289 _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
6290 ;;
6291 *)
6292 _LT_TAGVAR(hardcode_direct, $1)=yes
6293 _LT_TAGVAR(hardcode_direct_absolute, $1)=yes
6294 _LT_TAGVAR(hardcode_minus_L, $1)=yes # Not in the search PATH,
6295 # but as the default
6296 # location of the library.
6297 ;;
6298 esac
6299
6300 case $cc_basename in
6301 CC*)
6302 # FIXME: insert proper C++ library support
6303 _LT_TAGVAR(ld_shlibs, $1)=no
6304 ;;
6305 aCC*)
6306 case $host_cpu in
6307 hppa*64*)
6308 _LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
6309 ;;
6310 ia64*)
6311 _LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
6312 ;;
6313 *)
6314 _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'
6315 ;;
6316 esac
6317 # Commands to make compiler produce verbose output that lists
6318 # what "hidden" libraries, object files and flags are used when
6319 # linking a shared library.
6320 #
6321 # There doesn't appear to be a way to prevent this compiler from
6322 # explicitly linking system object files so we need to strip them
6323 # from the output so that they don't get included in the library
6324 # dependencies.
6325 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"'
6326 ;;
6327 *)
6328 if test "$GXX" = yes; then
6329 if test $with_gnu_ld = no; then
6330 case $host_cpu in
6331 hppa*64*)
6332 _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib -fPIC ${wl}+h ${wl}$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
6333 ;;
6334 ia64*)
6335 _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'
6336 ;;
6337 *)
6338 _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'
6339 ;;
6340 esac
6341 fi
6342 else
6343 # FIXME: insert proper C++ library support
6344 _LT_TAGVAR(ld_shlibs, $1)=no
6345 fi
6346 ;;
6347 esac
6348 ;;
6349
6350 interix[[3-9]]*)
6351 _LT_TAGVAR(hardcode_direct, $1)=no
6352 _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
6353 _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir'
6354 _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E'
6355 # Hack: On Interix 3.x, we cannot compile PIC because of a broken gcc.
6356 # Instead, shared libraries are loaded at an image base (0x10000000 by
6357 # default) and relocated if they conflict, which is a slow very memory
6358 # consuming and fragmenting process. To avoid this, we pick a random,
6359 # 256 KiB-aligned image base between 0x50000000 and 0x6FFC0000 at link
6360 # time. Moving up from 0x10000000 also allows more sbrk(2) space.
6361 _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'
6362 _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'
6363 ;;
6364 irix5* | irix6*)
6365 case $cc_basename in
6366 CC*)
6367 # SGI C++
6368 _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'
6369
6370 # Archives containing C++ object files must be created using
6371 # "CC -ar", where "CC" is the IRIX C++ compiler. This is
6372 # necessary to make sure instantiated templates are included
6373 # in the archive.
6374 _LT_TAGVAR(old_archive_cmds, $1)='$CC -ar -WR,-u -o $oldlib $oldobjs'
6375 ;;
6376 *)
6377 if test "$GXX" = yes; then
6378 if test "$with_gnu_ld" = no; then
6379 _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'
6380 else
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"` -o $lib'
6382 fi
6383 fi
6384 _LT_TAGVAR(link_all_deplibs, $1)=yes
6385 ;;
6386 esac
6387 _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
6388 _LT_TAGVAR(hardcode_libdir_separator, $1)=:
6389 _LT_TAGVAR(inherit_rpath, $1)=yes
6390 ;;
6391
6392 linux* | k*bsd*-gnu | kopensolaris*-gnu)
6393 case $cc_basename in
6394 KCC*)
6395 # Kuck and Associates, Inc. (KAI) C++ Compiler
6396
6397 # KCC will only create a shared library if the output file
6398 # ends with ".so" (or ".sl" for HP-UX), so rename the library
6399 # to its proper name (with version) after linking.
6400 _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'
6401 _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'
6402 # Commands to make compiler produce verbose output that lists
6403 # what "hidden" libraries, object files and flags are used when
6404 # linking a shared library.
6405 #
6406 # There doesn't appear to be a way to prevent this compiler from
6407 # explicitly linking system object files so we need to strip them
6408 # from the output so that they don't get included in the library
6409 # dependencies.
6410 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"'
6411
6412 _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir'
6413 _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic'
6414
6415 # Archives containing C++ object files must be created using
6416 # "CC -Bstatic", where "CC" is the KAI C++ compiler.
6417 _LT_TAGVAR(old_archive_cmds, $1)='$CC -Bstatic -o $oldlib $oldobjs'
6418 ;;
6419 icpc* | ecpc* )
6420 # Intel C++
6421 with_gnu_ld=yes
6422 # version 8.0 and above of icpc choke on multiply defined symbols
6423 # if we add $predep_objects and $postdep_objects, however 7.1 and
6424 # earlier do not add the objects themselves.
6425 case `$CC -V 2>&1` in
6426 *"Version 7."*)
6427 _LT_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib'
6428 _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'
6429 ;;
6430 *) # Version 8.0 or newer
6431 tmp_idyn=
6432 case $host_cpu in
6433 ia64*) tmp_idyn=' -i_dynamic';;
6434 esac
6435 _LT_TAGVAR(archive_cmds, $1)='$CC -shared'"$tmp_idyn"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
6436 _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'
6437 ;;
6438 esac
6439 _LT_TAGVAR(archive_cmds_need_lc, $1)=no
6440 _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir'
6441 _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic'
6442 _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive$convenience ${wl}--no-whole-archive'
6443 ;;
6444 pgCC* | pgcpp*)
6445 # Portland Group C++ compiler
6446 case `$CC -V` in
6447 *pgCC\ [[1-5]].* | *pgcpp\ [[1-5]].*)
6448 _LT_TAGVAR(prelink_cmds, $1)='tpldir=Template.dir~
6449 rm -rf $tpldir~
6450 $CC --prelink_objects --instantiation_dir $tpldir $objs $libobjs $compile_deplibs~
6451 compile_command="$compile_command `find $tpldir -name \*.o | sort | $NL2SP`"'
6452 _LT_TAGVAR(old_archive_cmds, $1)='tpldir=Template.dir~
6453 rm -rf $tpldir~
6454 $CC --prelink_objects --instantiation_dir $tpldir $oldobjs$old_deplibs~
6455 $AR $AR_FLAGS $oldlib$oldobjs$old_deplibs `find $tpldir -name \*.o | sort | $NL2SP`~
6456 $RANLIB $oldlib'
6457 _LT_TAGVAR(archive_cmds, $1)='tpldir=Template.dir~
6458 rm -rf $tpldir~
6459 $CC --prelink_objects --instantiation_dir $tpldir $predep_objects $libobjs $deplibs $convenience $postdep_objects~
6460 $CC -shared $pic_flag $predep_objects $libobjs $deplibs `find $tpldir -name \*.o | sort | $NL2SP` $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname -o $lib'
6461 _LT_TAGVAR(archive_expsym_cmds, $1)='tpldir=Template.dir~
6462 rm -rf $tpldir~
6463 $CC --prelink_objects --instantiation_dir $tpldir $predep_objects $libobjs $deplibs $convenience $postdep_objects~
6464 $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'
6465 ;;
6466 *) # Version 6 and above use weak symbols
6467 _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname -o $lib'
6468 _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'
6469 ;;
6470 esac
6471
6472 _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}--rpath ${wl}$libdir'
6473 _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic'
6474 _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'
6475 ;;
6476 cxx*)
6477 # Compaq C++
6478 _LT_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib'
6479 _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'
6480
6481 runpath_var=LD_RUN_PATH
6482 _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir'
6483 _LT_TAGVAR(hardcode_libdir_separator, $1)=:
6484
6485 # Commands to make compiler produce verbose output that lists
6486 # what "hidden" libraries, object files and flags are used when
6487 # linking a shared library.
6488 #
6489 # There doesn't appear to be a way to prevent this compiler from
6490 # explicitly linking system object files so we need to strip them
6491 # from the output so that they don't get included in the library
6492 # dependencies.
6493 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'
6494 ;;
6495 xl* | mpixl* | bgxl*)
6496 # IBM XL 8.0 on PPC, with GNU ld
6497 _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
6498 _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic'
6499 _LT_TAGVAR(archive_cmds, $1)='$CC -qmkshrobj $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
6500 if test "x$supports_anon_versioning" = xyes; then
6501 _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $output_objdir/$libname.ver~
6502 cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~
6503 echo "local: *; };" >> $output_objdir/$libname.ver~
6504 $CC -qmkshrobj $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib'
6505 fi
6506 ;;
6507 *)
6508 case `$CC -V 2>&1 | sed 5q` in
6509 *Sun\ C*)
6510 # Sun C++ 5.9
6511 _LT_TAGVAR(no_undefined_flag, $1)=' -zdefs'
6512 _LT_TAGVAR(archive_cmds, $1)='$CC -G${allow_undefined_flag} -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
6513 _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'
6514 _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir'
6515 _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'
6516 _LT_TAGVAR(compiler_needs_object, $1)=yes
6517
6518 # Not sure whether something based on
6519 # $CC $CFLAGS -v conftest.$objext -o libconftest$shared_ext 2>&1
6520 # would be better.
6521 output_verbose_link_cmd='func_echo_all'
6522
6523 # Archives containing C++ object files must be created using
6524 # "CC -xar", where "CC" is the Sun C++ compiler. This is
6525 # necessary to make sure instantiated templates are included
6526 # in the archive.
6527 _LT_TAGVAR(old_archive_cmds, $1)='$CC -xar -o $oldlib $oldobjs'
6528 ;;
6529 esac
6530 ;;
6531 esac
6532 ;;
6533
6534 lynxos*)
6535 # FIXME: insert proper C++ library support
6536 _LT_TAGVAR(ld_shlibs, $1)=no
6537 ;;
6538
6539 m88k*)
6540 # FIXME: insert proper C++ library support
6541 _LT_TAGVAR(ld_shlibs, $1)=no
6542 ;;
6543
6544 mvs*)
6545 case $cc_basename in
6546 cxx*)
6547 # FIXME: insert proper C++ library support
6548 _LT_TAGVAR(ld_shlibs, $1)=no
6549 ;;
6550 *)
6551 # FIXME: insert proper C++ library support
6552 _LT_TAGVAR(ld_shlibs, $1)=no
6553 ;;
6554 esac
6555 ;;
6556
6557 netbsd*)
6558 if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then
6559 _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $predep_objects $libobjs $deplibs $postdep_objects $linker_flags'
6560 wlarc=
6561 _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir'
6562 _LT_TAGVAR(hardcode_direct, $1)=yes
6563 _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
6564 fi
6565 # Workaround some broken pre-1.5 toolchains
6566 output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP conftest.$objext | $SED -e "s:-lgcc -lc -lgcc::"'
6567 ;;
6568
6569 *nto* | *qnx*)
6570 _LT_TAGVAR(ld_shlibs, $1)=yes
6571 ;;
6572
6573 openbsd2*)
6574 # C++ shared libraries are fairly broken
6575 _LT_TAGVAR(ld_shlibs, $1)=no
6576 ;;
6577
6578 openbsd*)
6579 if test -f /usr/libexec/ld.so; then
6580 _LT_TAGVAR(hardcode_direct, $1)=yes
6581 _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
6582 _LT_TAGVAR(hardcode_direct_absolute, $1)=yes
6583 _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $lib'
6584 _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir'
6585 if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then
6586 _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'
6587 _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E'
6588 _LT_TAGVAR(whole_archive_flag_spec, $1)="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive'
6589 fi
6590 output_verbose_link_cmd=func_echo_all
6591 else
6592 _LT_TAGVAR(ld_shlibs, $1)=no
6593 fi
6594 ;;
6595
6596 osf3* | osf4* | osf5*)
6597 case $cc_basename in
6598 KCC*)
6599 # Kuck and Associates, Inc. (KAI) C++ Compiler
6600
6601 # KCC will only create a shared library if the output file
6602 # ends with ".so" (or ".sl" for HP-UX), so rename the library
6603 # to its proper name (with version) after linking.
6604 _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'
6605
6606 _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir'
6607 _LT_TAGVAR(hardcode_libdir_separator, $1)=:
6608
6609 # Archives containing C++ object files must be created using
6610 # the KAI C++ compiler.
6611 case $host in
6612 osf3*) _LT_TAGVAR(old_archive_cmds, $1)='$CC -Bstatic -o $oldlib $oldobjs' ;;
6613 *) _LT_TAGVAR(old_archive_cmds, $1)='$CC -o $oldlib $oldobjs' ;;
6614 esac
6615 ;;
6616 RCC*)
6617 # Rational C++ 2.4.1
6618 # FIXME: insert proper C++ library support
6619 _LT_TAGVAR(ld_shlibs, $1)=no
6620 ;;
6621 cxx*)
6622 case $host in
6623 osf3*)
6624 _LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*'
6625 _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'
6626 _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
6627 ;;
6628 *)
6629 _LT_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*'
6630 _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'
6631 _LT_TAGVAR(archive_expsym_cmds, $1)='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done~
6632 echo "-hidden">> $lib.exp~
6633 $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~
6634 $RM $lib.exp'
6635 _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir'
6636 ;;
6637 esac
6638
6639 _LT_TAGVAR(hardcode_libdir_separator, $1)=:
6640
6641 # Commands to make compiler produce verbose output that lists
6642 # what "hidden" libraries, object files and flags are used when
6643 # linking a shared library.
6644 #
6645 # There doesn't appear to be a way to prevent this compiler from
6646 # explicitly linking system object files so we need to strip them
6647 # from the output so that they don't get included in the library
6648 # dependencies.
6649 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"'
6650 ;;
6651 *)
6652 if test "$GXX" = yes && test "$with_gnu_ld" = no; then
6653 _LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*'
6654 case $host in
6655 osf3*)
6656 _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'
6657 ;;
6658 *)
6659 _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'
6660 ;;
6661 esac
6662
6663 _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
6664 _LT_TAGVAR(hardcode_libdir_separator, $1)=:
6665
6666 # Commands to make compiler produce verbose output that lists
6667 # what "hidden" libraries, object files and flags are used when
6668 # linking a shared library.
6669 output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP "\-L"'
6670
6671 else
6672 # FIXME: insert proper C++ library support
6673 _LT_TAGVAR(ld_shlibs, $1)=no
6674 fi
6675 ;;
6676 esac
6677 ;;
6678
6679 psos*)
6680 # FIXME: insert proper C++ library support
6681 _LT_TAGVAR(ld_shlibs, $1)=no
6682 ;;
6683
6684 sunos4*)
6685 case $cc_basename in
6686 CC*)
6687 # Sun C++ 4.x
6688 # FIXME: insert proper C++ library support
6689 _LT_TAGVAR(ld_shlibs, $1)=no
6690 ;;
6691 lcc*)
6692 # Lucid
6693 # FIXME: insert proper C++ library support
6694 _LT_TAGVAR(ld_shlibs, $1)=no
6695 ;;
6696 *)
6697 # FIXME: insert proper C++ library support
6698 _LT_TAGVAR(ld_shlibs, $1)=no
6699 ;;
6700 esac
6701 ;;
6702
6703 solaris*)
6704 case $cc_basename in
6705 CC* | sunCC*)
6706 # Sun C++ 4.2, 5.x and Centerline C++
6707 _LT_TAGVAR(archive_cmds_need_lc,$1)=yes
6708 _LT_TAGVAR(no_undefined_flag, $1)=' -zdefs'
6709 _LT_TAGVAR(archive_cmds, $1)='$CC -G${allow_undefined_flag} -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
6710 _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~
6711 $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'
6712
6713 _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir'
6714 _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
6715 case $host_os in
6716 solaris2.[[0-5]] | solaris2.[[0-5]].*) ;;
6717 *)
6718 # The compiler driver will combine and reorder linker options,
6719 # but understands `-z linker_flag'.
6720 # Supported since Solaris 2.6 (maybe 2.5.1?)
6721 _LT_TAGVAR(whole_archive_flag_spec, $1)='-z allextract$convenience -z defaultextract'
6722 ;;
6723 esac
6724 _LT_TAGVAR(link_all_deplibs, $1)=yes
6725
6726 output_verbose_link_cmd='func_echo_all'
6727
6728 # Archives containing C++ object files must be created using
6729 # "CC -xar", where "CC" is the Sun C++ compiler. This is
6730 # necessary to make sure instantiated templates are included
6731 # in the archive.
6732 _LT_TAGVAR(old_archive_cmds, $1)='$CC -xar -o $oldlib $oldobjs'
6733 ;;
6734 gcx*)
6735 # Green Hills C++ Compiler
6736 _LT_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib'
6737
6738 # The C++ compiler must be used to create the archive.
6739 _LT_TAGVAR(old_archive_cmds, $1)='$CC $LDFLAGS -archive -o $oldlib $oldobjs'
6740 ;;
6741 *)
6742 # GNU C++ compiler with Solaris linker
6743 if test "$GXX" = yes && test "$with_gnu_ld" = no; then
6744 _LT_TAGVAR(no_undefined_flag, $1)=' ${wl}-z ${wl}defs'
6745 if $CC --version | $GREP -v '^2\.7' > /dev/null; then
6746 _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'
6747 _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~
6748 $CC -shared $pic_flag -nostdlib ${wl}-M $wl$lib.exp -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$RM $lib.exp'
6749
6750 # Commands to make compiler produce verbose output that lists
6751 # what "hidden" libraries, object files and flags are used when
6752 # linking a shared library.
6753 output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP "\-L"'
6754 else
6755 # g++ 2.7 appears to require `-G' NOT `-shared' on this
6756 # platform.
6757 _LT_TAGVAR(archive_cmds, $1)='$CC -G -nostdlib $LDFLAGS $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib'
6758 _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~
6759 $CC -G -nostdlib ${wl}-M $wl$lib.exp -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$RM $lib.exp'
6760
6761 # Commands to make compiler produce verbose output that lists
6762 # what "hidden" libraries, object files and flags are used when
6763 # linking a shared library.
6764 output_verbose_link_cmd='$CC -G $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP "\-L"'
6765 fi
6766
6767 _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R $wl$libdir'
6768 case $host_os in
6769 solaris2.[[0-5]] | solaris2.[[0-5]].*) ;;
6770 *)
6771 _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract'
6772 ;;
6773 esac
6774 fi
6775 ;;
6776 esac
6777 ;;
6778
6779 sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[[01]].[[10]]* | unixware7* | sco3.2v5.0.[[024]]*)
6780 _LT_TAGVAR(no_undefined_flag, $1)='${wl}-z,text'
6781 _LT_TAGVAR(archive_cmds_need_lc, $1)=no
6782 _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
6783 runpath_var='LD_RUN_PATH'
6784
6785 case $cc_basename in
6786 CC*)
6787 _LT_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
6788 _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
6789 ;;
6790 *)
6791 _LT_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
6792 _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
6793 ;;
6794 esac
6795 ;;
6796
6797 sysv5* | sco3.2v5* | sco5v6*)
6798 # Note: We can NOT use -z defs as we might desire, because we do not
6799 # link with -lc, and that would cause any symbols used from libc to
6800 # always be unresolved, which means just about no library would
6801 # ever link correctly. If we're not using GNU ld we use -z text
6802 # though, which does catch some bad symbols but isn't as heavy-handed
6803 # as -z defs.
6804 _LT_TAGVAR(no_undefined_flag, $1)='${wl}-z,text'
6805 _LT_TAGVAR(allow_undefined_flag, $1)='${wl}-z,nodefs'
6806 _LT_TAGVAR(archive_cmds_need_lc, $1)=no
6807 _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
6808 _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R,$libdir'
6809 _LT_TAGVAR(hardcode_libdir_separator, $1)=':'
6810 _LT_TAGVAR(link_all_deplibs, $1)=yes
6811 _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-Bexport'
6812 runpath_var='LD_RUN_PATH'
6813
6814 case $cc_basename in
6815 CC*)
6816 _LT_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
6817 _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
6818 _LT_TAGVAR(old_archive_cmds, $1)='$CC -Tprelink_objects $oldobjs~
6819 '"$_LT_TAGVAR(old_archive_cmds, $1)"
6820 _LT_TAGVAR(reload_cmds, $1)='$CC -Tprelink_objects $reload_objs~
6821 '"$_LT_TAGVAR(reload_cmds, $1)"
6822 ;;
6823 *)
6824 _LT_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
6825 _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
6826 ;;
6827 esac
6828 ;;
6829
6830 tandem*)
6831 case $cc_basename in
6832 NCC*)
6833 # NonStop-UX NCC 3.20
6834 # FIXME: insert proper C++ library support
6835 _LT_TAGVAR(ld_shlibs, $1)=no
6836 ;;
6837 *)
6838 # FIXME: insert proper C++ library support
6839 _LT_TAGVAR(ld_shlibs, $1)=no
6840 ;;
6841 esac
6842 ;;
6843
6844 vxworks*)
6845 # FIXME: insert proper C++ library support
6846 _LT_TAGVAR(ld_shlibs, $1)=no
6847 ;;
6848
6849 *)
6850 # FIXME: insert proper C++ library support
6851 _LT_TAGVAR(ld_shlibs, $1)=no
6852 ;;
6853 esac
6854
6855 AC_MSG_RESULT([$_LT_TAGVAR(ld_shlibs, $1)])
6856 test "$_LT_TAGVAR(ld_shlibs, $1)" = no && can_build_shared=no
6857
6858 _LT_TAGVAR(GCC, $1)="$GXX"
6859 _LT_TAGVAR(LD, $1)="$LD"
6860
6861 ## CAVEAT EMPTOR:
6862 ## There is no encapsulation within the following macros, do not change
6863 ## the running order or otherwise move them around unless you know exactly
6864 ## what you are doing...
6865 _LT_SYS_HIDDEN_LIBDEPS($1)
6866 _LT_COMPILER_PIC($1)
6867 _LT_COMPILER_C_O($1)
6868 _LT_COMPILER_FILE_LOCKS($1)
6869 _LT_LINKER_SHLIBS($1)
6870 _LT_SYS_DYNAMIC_LINKER($1)
6871 _LT_LINKER_HARDCODE_LIBPATH($1)
6872
6873 _LT_CONFIG($1)
6874 fi # test -n "$compiler"
6875
6876 CC=$lt_save_CC
6877 CFLAGS=$lt_save_CFLAGS
6878 LDCXX=$LD
6879 LD=$lt_save_LD
6880 GCC=$lt_save_GCC
6881 with_gnu_ld=$lt_save_with_gnu_ld
6882 lt_cv_path_LDCXX=$lt_cv_path_LD
6883 lt_cv_path_LD=$lt_save_path_LD
6884 lt_cv_prog_gnu_ldcxx=$lt_cv_prog_gnu_ld
6885 lt_cv_prog_gnu_ld=$lt_save_with_gnu_ld
6886 fi # test "$_lt_caught_CXX_error" != yes
6887
6888 AC_LANG_POP
6889 ])# _LT_LANG_CXX_CONFIG
6890
6891
6892 # _LT_FUNC_STRIPNAME_CNF
6893 # ----------------------
6894 # func_stripname_cnf prefix suffix name
6895 # strip PREFIX and SUFFIX off of NAME.
6896 # PREFIX and SUFFIX must not contain globbing or regex special
6897 # characters, hashes, percent signs, but SUFFIX may contain a leading
6898 # dot (in which case that matches only a dot).
6899 #
6900 # This function is identical to the (non-XSI) version of func_stripname,
6901 # except this one can be used by m4 code that may be executed by configure,
6902 # rather than the libtool script.
6903 m4_defun([_LT_FUNC_STRIPNAME_CNF],[dnl
6904 AC_REQUIRE([_LT_DECL_SED])
6905 AC_REQUIRE([_LT_PROG_ECHO_BACKSLASH])
6906 func_stripname_cnf ()
6907 {
6908 case ${2} in
6909 .*) func_stripname_result=`$ECHO "${3}" | $SED "s%^${1}%%; s%\\\\${2}\$%%"`;;
6910 *) func_stripname_result=`$ECHO "${3}" | $SED "s%^${1}%%; s%${2}\$%%"`;;
6911 esac
6912 } # func_stripname_cnf
6913 ])# _LT_FUNC_STRIPNAME_CNF
6914
6915 # _LT_SYS_HIDDEN_LIBDEPS([TAGNAME])
6916 # ---------------------------------
6917 # Figure out "hidden" library dependencies from verbose
6918 # compiler output when linking a shared library.
6919 # Parse the compiler output and extract the necessary
6920 # objects, libraries and library flags.
6921 m4_defun([_LT_SYS_HIDDEN_LIBDEPS],
6922 [m4_require([_LT_FILEUTILS_DEFAULTS])dnl
6923 AC_REQUIRE([_LT_FUNC_STRIPNAME_CNF])dnl
6924 # Dependencies to place before and after the object being linked:
6925 _LT_TAGVAR(predep_objects, $1)=
6926 _LT_TAGVAR(postdep_objects, $1)=
6927 _LT_TAGVAR(predeps, $1)=
6928 _LT_TAGVAR(postdeps, $1)=
6929 _LT_TAGVAR(compiler_lib_search_path, $1)=
6930
6931 dnl we can't use the lt_simple_compile_test_code here,
6932 dnl because it contains code intended for an executable,
6933 dnl not a library. It's possible we should let each
6934 dnl tag define a new lt_????_link_test_code variable,
6935 dnl but it's only used here...
6936 m4_if([$1], [], [cat > conftest.$ac_ext <<_LT_EOF
6937 int a;
6938 void foo (void) { a = 0; }
6939 _LT_EOF
6940 ], [$1], [CXX], [cat > conftest.$ac_ext <<_LT_EOF
6941 class Foo
6942 {
6943 public:
6944 Foo (void) { a = 0; }
6945 private:
6946 int a;
6947 };
6948 _LT_EOF
6949 ], [$1], [F77], [cat > conftest.$ac_ext <<_LT_EOF
6950 subroutine foo
6951 implicit none
6952 integer*4 a
6953 a=0
6954 return
6955 end
6956 _LT_EOF
6957 ], [$1], [FC], [cat > conftest.$ac_ext <<_LT_EOF
6958 subroutine foo
6959 implicit none
6960 integer a
6961 a=0
6962 return
6963 end
6964 _LT_EOF
6965 ], [$1], [GCJ], [cat > conftest.$ac_ext <<_LT_EOF
6966 public class foo {
6967 private int a;
6968 public void bar (void) {
6969 a = 0;
6970 }
6971 };
6972 _LT_EOF
6973 ], [$1], [GO], [cat > conftest.$ac_ext <<_LT_EOF
6974 package foo
6975 func foo() {
6976 }
6977 _LT_EOF
6978 ])
6979
6980 _lt_libdeps_save_CFLAGS=$CFLAGS
6981 case "$CC $CFLAGS " in #(
6982 *\ -flto*\ *) CFLAGS="$CFLAGS -fno-lto" ;;
6983 *\ -fwhopr*\ *) CFLAGS="$CFLAGS -fno-whopr" ;;
6984 *\ -fuse-linker-plugin*\ *) CFLAGS="$CFLAGS -fno-use-linker-plugin" ;;
6985 esac
6986
6987 dnl Parse the compiler output and extract the necessary
6988 dnl objects, libraries and library flags.
6989 if AC_TRY_EVAL(ac_compile); then
6990 # Parse the compiler output and extract the necessary
6991 # objects, libraries and library flags.
6992
6993 # Sentinel used to keep track of whether or not we are before
6994 # the conftest object file.
6995 pre_test_object_deps_done=no
6996
6997 for p in `eval "$output_verbose_link_cmd"`; do
6998 case ${prev}${p} in
6999
7000 -L* | -R* | -l*)
7001 # Some compilers place space between "-{L,R}" and the path.
7002 # Remove the space.
7003 if test $p = "-L" ||
7004 test $p = "-R"; then
7005 prev=$p
7006 continue
7007 fi
7008
7009 # Expand the sysroot to ease extracting the directories later.
7010 if test -z "$prev"; then
7011 case $p in
7012 -L*) func_stripname_cnf '-L' '' "$p"; prev=-L; p=$func_stripname_result ;;
7013 -R*) func_stripname_cnf '-R' '' "$p"; prev=-R; p=$func_stripname_result ;;
7014 -l*) func_stripname_cnf '-l' '' "$p"; prev=-l; p=$func_stripname_result ;;
7015 esac
7016 fi
7017 case $p in
7018 =*) func_stripname_cnf '=' '' "$p"; p=$lt_sysroot$func_stripname_result ;;
7019 esac
7020 if test "$pre_test_object_deps_done" = no; then
7021 case ${prev} in
7022 -L | -R)
7023 # Internal compiler library paths should come after those
7024 # provided the user. The postdeps already come after the
7025 # user supplied libs so there is no need to process them.
7026 if test -z "$_LT_TAGVAR(compiler_lib_search_path, $1)"; then
7027 _LT_TAGVAR(compiler_lib_search_path, $1)="${prev}${p}"
7028 else
7029 _LT_TAGVAR(compiler_lib_search_path, $1)="${_LT_TAGVAR(compiler_lib_search_path, $1)} ${prev}${p}"
7030 fi
7031 ;;
7032 # The "-l" case would never come before the object being
7033 # linked, so don't bother handling this case.
7034 esac
7035 else
7036 if test -z "$_LT_TAGVAR(postdeps, $1)"; then
7037 _LT_TAGVAR(postdeps, $1)="${prev}${p}"
7038 else
7039 _LT_TAGVAR(postdeps, $1)="${_LT_TAGVAR(postdeps, $1)} ${prev}${p}"
7040 fi
7041 fi
7042 prev=
7043 ;;
7044
7045 *.lto.$objext) ;; # Ignore GCC LTO objects
7046 *.$objext)
7047 # This assumes that the test object file only shows up
7048 # once in the compiler output.
7049 if test "$p" = "conftest.$objext"; then
7050 pre_test_object_deps_done=yes
7051 continue
7052 fi
7053
7054 if test "$pre_test_object_deps_done" = no; then
7055 if test -z "$_LT_TAGVAR(predep_objects, $1)"; then
7056 _LT_TAGVAR(predep_objects, $1)="$p"
7057 else
7058 _LT_TAGVAR(predep_objects, $1)="$_LT_TAGVAR(predep_objects, $1) $p"
7059 fi
7060 else
7061 if test -z "$_LT_TAGVAR(postdep_objects, $1)"; then
7062 _LT_TAGVAR(postdep_objects, $1)="$p"
7063 else
7064 _LT_TAGVAR(postdep_objects, $1)="$_LT_TAGVAR(postdep_objects, $1) $p"
7065 fi
7066 fi
7067 ;;
7068
7069 *) ;; # Ignore the rest.
7070
7071 esac
7072 done
7073
7074 # Clean up.
7075 rm -f a.out a.exe
7076 else
7077 echo "libtool.m4: error: problem compiling $1 test program"
7078 fi
7079
7080 $RM -f confest.$objext
7081 CFLAGS=$_lt_libdeps_save_CFLAGS
7082
7083 # PORTME: override above test on systems where it is broken
7084 m4_if([$1], [CXX],
7085 [case $host_os in
7086 interix[[3-9]]*)
7087 # Interix 3.5 installs completely hosed .la files for C++, so rather than
7088 # hack all around it, let's just trust "g++" to DTRT.
7089 _LT_TAGVAR(predep_objects,$1)=
7090 _LT_TAGVAR(postdep_objects,$1)=
7091 _LT_TAGVAR(postdeps,$1)=
7092 ;;
7093
7094 linux*)
7095 case `$CC -V 2>&1 | sed 5q` in
7096 *Sun\ C*)
7097 # Sun C++ 5.9
7098
7099 # The more standards-conforming stlport4 library is
7100 # incompatible with the Cstd library. Avoid specifying
7101 # it if it's in CXXFLAGS. Ignore libCrun as
7102 # -library=stlport4 depends on it.
7103 case " $CXX $CXXFLAGS " in
7104 *" -library=stlport4 "*)
7105 solaris_use_stlport4=yes
7106 ;;
7107 esac
7108
7109 if test "$solaris_use_stlport4" != yes; then
7110 _LT_TAGVAR(postdeps,$1)='-library=Cstd -library=Crun'
7111 fi
7112 ;;
7113 esac
7114 ;;
7115
7116 solaris*)
7117 case $cc_basename in
7118 CC* | sunCC*)
7119 # The more standards-conforming stlport4 library is
7120 # incompatible with the Cstd library. Avoid specifying
7121 # it if it's in CXXFLAGS. Ignore libCrun as
7122 # -library=stlport4 depends on it.
7123 case " $CXX $CXXFLAGS " in
7124 *" -library=stlport4 "*)
7125 solaris_use_stlport4=yes
7126 ;;
7127 esac
7128
7129 # Adding this requires a known-good setup of shared libraries for
7130 # Sun compiler versions before 5.6, else PIC objects from an old
7131 # archive will be linked into the output, leading to subtle bugs.
7132 if test "$solaris_use_stlport4" != yes; then
7133 _LT_TAGVAR(postdeps,$1)='-library=Cstd -library=Crun'
7134 fi
7135 ;;
7136 esac
7137 ;;
7138 esac
7139 ])
7140
7141 case " $_LT_TAGVAR(postdeps, $1) " in
7142 *" -lc "*) _LT_TAGVAR(archive_cmds_need_lc, $1)=no ;;
7143 esac
7144 _LT_TAGVAR(compiler_lib_search_dirs, $1)=
7145 if test -n "${_LT_TAGVAR(compiler_lib_search_path, $1)}"; then
7146 _LT_TAGVAR(compiler_lib_search_dirs, $1)=`echo " ${_LT_TAGVAR(compiler_lib_search_path, $1)}" | ${SED} -e 's! -L! !g' -e 's!^ !!'`
7147 fi
7148 _LT_TAGDECL([], [compiler_lib_search_dirs], [1],
7149 [The directories searched by this compiler when creating a shared library])
7150 _LT_TAGDECL([], [predep_objects], [1],
7151 [Dependencies to place before and after the objects being linked to
7152 create a shared library])
7153 _LT_TAGDECL([], [postdep_objects], [1])
7154 _LT_TAGDECL([], [predeps], [1])
7155 _LT_TAGDECL([], [postdeps], [1])
7156 _LT_TAGDECL([], [compiler_lib_search_path], [1],
7157 [The library search path used internally by the compiler when linking
7158 a shared library])
7159 ])# _LT_SYS_HIDDEN_LIBDEPS
7160
7161
7162 # _LT_LANG_F77_CONFIG([TAG])
7163 # --------------------------
7164 # Ensure that the configuration variables for a Fortran 77 compiler are
7165 # suitably defined. These variables are subsequently used by _LT_CONFIG
7166 # to write the compiler configuration to `libtool'.
7167 m4_defun([_LT_LANG_F77_CONFIG],
7168 [AC_LANG_PUSH(Fortran 77)
7169 if test -z "$F77" || test "X$F77" = "Xno"; then
7170 _lt_disable_F77=yes
7171 fi
7172
7173 _LT_TAGVAR(archive_cmds_need_lc, $1)=no
7174 _LT_TAGVAR(allow_undefined_flag, $1)=
7175 _LT_TAGVAR(always_export_symbols, $1)=no
7176 _LT_TAGVAR(archive_expsym_cmds, $1)=
7177 _LT_TAGVAR(export_dynamic_flag_spec, $1)=
7178 _LT_TAGVAR(hardcode_direct, $1)=no
7179 _LT_TAGVAR(hardcode_direct_absolute, $1)=no
7180 _LT_TAGVAR(hardcode_libdir_flag_spec, $1)=
7181 _LT_TAGVAR(hardcode_libdir_separator, $1)=
7182 _LT_TAGVAR(hardcode_minus_L, $1)=no
7183 _LT_TAGVAR(hardcode_automatic, $1)=no
7184 _LT_TAGVAR(inherit_rpath, $1)=no
7185 _LT_TAGVAR(module_cmds, $1)=
7186 _LT_TAGVAR(module_expsym_cmds, $1)=
7187 _LT_TAGVAR(link_all_deplibs, $1)=unknown
7188 _LT_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds
7189 _LT_TAGVAR(reload_flag, $1)=$reload_flag
7190 _LT_TAGVAR(reload_cmds, $1)=$reload_cmds
7191 _LT_TAGVAR(no_undefined_flag, $1)=
7192 _LT_TAGVAR(whole_archive_flag_spec, $1)=
7193 _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=no
7194
7195 # Source file extension for f77 test sources.
7196 ac_ext=f
7197
7198 # Object file extension for compiled f77 test sources.
7199 objext=o
7200 _LT_TAGVAR(objext, $1)=$objext
7201
7202 # No sense in running all these tests if we already determined that
7203 # the F77 compiler isn't working. Some variables (like enable_shared)
7204 # are currently assumed to apply to all compilers on this platform,
7205 # and will be corrupted by setting them based on a non-working compiler.
7206 if test "$_lt_disable_F77" != yes; then
7207 # Code to be used in simple compile tests
7208 lt_simple_compile_test_code="\
7209 subroutine t
7210 return
7211 end
7212 "
7213
7214 # Code to be used in simple link tests
7215 lt_simple_link_test_code="\
7216 program t
7217 end
7218 "
7219
7220 # ltmain only uses $CC for tagged configurations so make sure $CC is set.
7221 _LT_TAG_COMPILER
7222
7223 # save warnings/boilerplate of simple test code
7224 _LT_COMPILER_BOILERPLATE
7225 _LT_LINKER_BOILERPLATE
7226
7227 # Allow CC to be a program name with arguments.
7228 lt_save_CC="$CC"
7229 lt_save_GCC=$GCC
7230 lt_save_CFLAGS=$CFLAGS
7231 CC=${F77-"f77"}
7232 CFLAGS=$FFLAGS
7233 compiler=$CC
7234 _LT_TAGVAR(compiler, $1)=$CC
7235 _LT_CC_BASENAME([$compiler])
7236 GCC=$G77
7237 if test -n "$compiler"; then
7238 AC_MSG_CHECKING([if libtool supports shared libraries])
7239 AC_MSG_RESULT([$can_build_shared])
7240
7241 AC_MSG_CHECKING([whether to build shared libraries])
7242 test "$can_build_shared" = "no" && enable_shared=no
7243
7244 # On AIX, shared libraries and static libraries use the same namespace, and
7245 # are all built from PIC.
7246 case $host_os in
7247 aix3*)
7248 test "$enable_shared" = yes && enable_static=no
7249 if test -n "$RANLIB"; then
7250 archive_cmds="$archive_cmds~\$RANLIB \$lib"
7251 postinstall_cmds='$RANLIB $lib'
7252 fi
7253 ;;
7254 aix[[4-9]]*)
7255 if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then
7256 test "$enable_shared" = yes && enable_static=no
7257 fi
7258 ;;
7259 esac
7260 AC_MSG_RESULT([$enable_shared])
7261
7262 AC_MSG_CHECKING([whether to build static libraries])
7263 # Make sure either enable_shared or enable_static is yes.
7264 test "$enable_shared" = yes || enable_static=yes
7265 AC_MSG_RESULT([$enable_static])
7266
7267 _LT_TAGVAR(GCC, $1)="$G77"
7268 _LT_TAGVAR(LD, $1)="$LD"
7269
7270 ## CAVEAT EMPTOR:
7271 ## There is no encapsulation within the following macros, do not change
7272 ## the running order or otherwise move them around unless you know exactly
7273 ## what you are doing...
7274 _LT_COMPILER_PIC($1)
7275 _LT_COMPILER_C_O($1)
7276 _LT_COMPILER_FILE_LOCKS($1)
7277 _LT_LINKER_SHLIBS($1)
7278 _LT_SYS_DYNAMIC_LINKER($1)
7279 _LT_LINKER_HARDCODE_LIBPATH($1)
7280
7281 _LT_CONFIG($1)
7282 fi # test -n "$compiler"
7283
7284 GCC=$lt_save_GCC
7285 CC="$lt_save_CC"
7286 CFLAGS="$lt_save_CFLAGS"
7287 fi # test "$_lt_disable_F77" != yes
7288
7289 AC_LANG_POP
7290 ])# _LT_LANG_F77_CONFIG
7291
7292
7293 # _LT_LANG_FC_CONFIG([TAG])
7294 # -------------------------
7295 # Ensure that the configuration variables for a Fortran compiler are
7296 # suitably defined. These variables are subsequently used by _LT_CONFIG
7297 # to write the compiler configuration to `libtool'.
7298 m4_defun([_LT_LANG_FC_CONFIG],
7299 [AC_LANG_PUSH(Fortran)
7300
7301 if test -z "$FC" || test "X$FC" = "Xno"; then
7302 _lt_disable_FC=yes
7303 fi
7304
7305 _LT_TAGVAR(archive_cmds_need_lc, $1)=no
7306 _LT_TAGVAR(allow_undefined_flag, $1)=
7307 _LT_TAGVAR(always_export_symbols, $1)=no
7308 _LT_TAGVAR(archive_expsym_cmds, $1)=
7309 _LT_TAGVAR(export_dynamic_flag_spec, $1)=
7310 _LT_TAGVAR(hardcode_direct, $1)=no
7311 _LT_TAGVAR(hardcode_direct_absolute, $1)=no
7312 _LT_TAGVAR(hardcode_libdir_flag_spec, $1)=
7313 _LT_TAGVAR(hardcode_libdir_separator, $1)=
7314 _LT_TAGVAR(hardcode_minus_L, $1)=no
7315 _LT_TAGVAR(hardcode_automatic, $1)=no
7316 _LT_TAGVAR(inherit_rpath, $1)=no
7317 _LT_TAGVAR(module_cmds, $1)=
7318 _LT_TAGVAR(module_expsym_cmds, $1)=
7319 _LT_TAGVAR(link_all_deplibs, $1)=unknown
7320 _LT_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds
7321 _LT_TAGVAR(reload_flag, $1)=$reload_flag
7322 _LT_TAGVAR(reload_cmds, $1)=$reload_cmds
7323 _LT_TAGVAR(no_undefined_flag, $1)=
7324 _LT_TAGVAR(whole_archive_flag_spec, $1)=
7325 _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=no
7326
7327 # Source file extension for fc test sources.
7328 ac_ext=${ac_fc_srcext-f}
7329
7330 # Object file extension for compiled fc test sources.
7331 objext=o
7332 _LT_TAGVAR(objext, $1)=$objext
7333
7334 # No sense in running all these tests if we already determined that
7335 # the FC compiler isn't working. Some variables (like enable_shared)
7336 # are currently assumed to apply to all compilers on this platform,
7337 # and will be corrupted by setting them based on a non-working compiler.
7338 if test "$_lt_disable_FC" != yes; then
7339 # Code to be used in simple compile tests
7340 lt_simple_compile_test_code="\
7341 subroutine t
7342 return
7343 end
7344 "
7345
7346 # Code to be used in simple link tests
7347 lt_simple_link_test_code="\
7348 program t
7349 end
7350 "
7351
7352 # ltmain only uses $CC for tagged configurations so make sure $CC is set.
7353 _LT_TAG_COMPILER
7354
7355 # save warnings/boilerplate of simple test code
7356 _LT_COMPILER_BOILERPLATE
7357 _LT_LINKER_BOILERPLATE
7358
7359 # Allow CC to be a program name with arguments.
7360 lt_save_CC="$CC"
7361 lt_save_GCC=$GCC
7362 lt_save_CFLAGS=$CFLAGS
7363 CC=${FC-"f95"}
7364 CFLAGS=$FCFLAGS
7365 compiler=$CC
7366 GCC=$ac_cv_fc_compiler_gnu
7367
7368 _LT_TAGVAR(compiler, $1)=$CC
7369 _LT_CC_BASENAME([$compiler])
7370
7371 if test -n "$compiler"; then
7372 AC_MSG_CHECKING([if libtool supports shared libraries])
7373 AC_MSG_RESULT([$can_build_shared])
7374
7375 AC_MSG_CHECKING([whether to build shared libraries])
7376 test "$can_build_shared" = "no" && enable_shared=no
7377
7378 # On AIX, shared libraries and static libraries use the same namespace, and
7379 # are all built from PIC.
7380 case $host_os in
7381 aix3*)
7382 test "$enable_shared" = yes && enable_static=no
7383 if test -n "$RANLIB"; then
7384 archive_cmds="$archive_cmds~\$RANLIB \$lib"
7385 postinstall_cmds='$RANLIB $lib'
7386 fi
7387 ;;
7388 aix[[4-9]]*)
7389 if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then
7390 test "$enable_shared" = yes && enable_static=no
7391 fi
7392 ;;
7393 esac
7394 AC_MSG_RESULT([$enable_shared])
7395
7396 AC_MSG_CHECKING([whether to build static libraries])
7397 # Make sure either enable_shared or enable_static is yes.
7398 test "$enable_shared" = yes || enable_static=yes
7399 AC_MSG_RESULT([$enable_static])
7400
7401 _LT_TAGVAR(GCC, $1)="$ac_cv_fc_compiler_gnu"
7402 _LT_TAGVAR(LD, $1)="$LD"
7403
7404 ## CAVEAT EMPTOR:
7405 ## There is no encapsulation within the following macros, do not change
7406 ## the running order or otherwise move them around unless you know exactly
7407 ## what you are doing...
7408 _LT_SYS_HIDDEN_LIBDEPS($1)
7409 _LT_COMPILER_PIC($1)
7410 _LT_COMPILER_C_O($1)
7411 _LT_COMPILER_FILE_LOCKS($1)
7412 _LT_LINKER_SHLIBS($1)
7413 _LT_SYS_DYNAMIC_LINKER($1)
7414 _LT_LINKER_HARDCODE_LIBPATH($1)
7415
7416 _LT_CONFIG($1)
7417 fi # test -n "$compiler"
7418
7419 GCC=$lt_save_GCC
7420 CC=$lt_save_CC
7421 CFLAGS=$lt_save_CFLAGS
7422 fi # test "$_lt_disable_FC" != yes
7423
7424 AC_LANG_POP
7425 ])# _LT_LANG_FC_CONFIG
7426
7427
7428 # _LT_LANG_GCJ_CONFIG([TAG])
7429 # --------------------------
7430 # Ensure that the configuration variables for the GNU Java Compiler compiler
7431 # are suitably defined. These variables are subsequently used by _LT_CONFIG
7432 # to write the compiler configuration to `libtool'.
7433 m4_defun([_LT_LANG_GCJ_CONFIG],
7434 [AC_REQUIRE([LT_PROG_GCJ])dnl
7435 AC_LANG_SAVE
7436
7437 # Source file extension for Java test sources.
7438 ac_ext=java
7439
7440 # Object file extension for compiled Java test sources.
7441 objext=o
7442 _LT_TAGVAR(objext, $1)=$objext
7443
7444 # Code to be used in simple compile tests
7445 lt_simple_compile_test_code="class foo {}"
7446
7447 # Code to be used in simple link tests
7448 lt_simple_link_test_code='public class conftest { public static void main(String[[]] argv) {}; }'
7449
7450 # ltmain only uses $CC for tagged configurations so make sure $CC is set.
7451 _LT_TAG_COMPILER
7452
7453 # save warnings/boilerplate of simple test code
7454 _LT_COMPILER_BOILERPLATE
7455 _LT_LINKER_BOILERPLATE
7456
7457 # Allow CC to be a program name with arguments.
7458 lt_save_CC=$CC
7459 lt_save_CFLAGS=$CFLAGS
7460 lt_save_GCC=$GCC
7461 GCC=yes
7462 CC=${GCJ-"gcj"}
7463 CFLAGS=$GCJFLAGS
7464 compiler=$CC
7465 _LT_TAGVAR(compiler, $1)=$CC
7466 _LT_TAGVAR(LD, $1)="$LD"
7467 _LT_CC_BASENAME([$compiler])
7468
7469 # GCJ did not exist at the time GCC didn't implicitly link libc in.
7470 _LT_TAGVAR(archive_cmds_need_lc, $1)=no
7471
7472 _LT_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds
7473 _LT_TAGVAR(reload_flag, $1)=$reload_flag
7474 _LT_TAGVAR(reload_cmds, $1)=$reload_cmds
7475
7476 ## CAVEAT EMPTOR:
7477 ## There is no encapsulation within the following macros, do not change
7478 ## the running order or otherwise move them around unless you know exactly
7479 ## what you are doing...
7480 if test -n "$compiler"; then
7481 _LT_COMPILER_NO_RTTI($1)
7482 _LT_COMPILER_PIC($1)
7483 _LT_COMPILER_C_O($1)
7484 _LT_COMPILER_FILE_LOCKS($1)
7485 _LT_LINKER_SHLIBS($1)
7486 _LT_LINKER_HARDCODE_LIBPATH($1)
7487
7488 _LT_CONFIG($1)
7489 fi
7490
7491 AC_LANG_RESTORE
7492
7493 GCC=$lt_save_GCC
7494 CC=$lt_save_CC
7495 CFLAGS=$lt_save_CFLAGS
7496 ])# _LT_LANG_GCJ_CONFIG
7497
7498
7499 # _LT_LANG_GO_CONFIG([TAG])
7500 # --------------------------
7501 # Ensure that the configuration variables for the GNU Go compiler
7502 # are suitably defined. These variables are subsequently used by _LT_CONFIG
7503 # to write the compiler configuration to `libtool'.
7504 m4_defun([_LT_LANG_GO_CONFIG],
7505 [AC_REQUIRE([LT_PROG_GO])dnl
7506 AC_LANG_SAVE
7507
7508 # Source file extension for Go test sources.
7509 ac_ext=go
7510
7511 # Object file extension for compiled Go test sources.
7512 objext=o
7513 _LT_TAGVAR(objext, $1)=$objext
7514
7515 # Code to be used in simple compile tests
7516 lt_simple_compile_test_code="package main; func main() { }"
7517
7518 # Code to be used in simple link tests
7519 lt_simple_link_test_code='package main; func main() { }'
7520
7521 # ltmain only uses $CC for tagged configurations so make sure $CC is set.
7522 _LT_TAG_COMPILER
7523
7524 # save warnings/boilerplate of simple test code
7525 _LT_COMPILER_BOILERPLATE
7526 _LT_LINKER_BOILERPLATE
7527
7528 # Allow CC to be a program name with arguments.
7529 lt_save_CC=$CC
7530 lt_save_CFLAGS=$CFLAGS
7531 lt_save_GCC=$GCC
7532 GCC=yes
7533 CC=${GOC-"gccgo"}
7534 CFLAGS=$GOFLAGS
7535 compiler=$CC
7536 _LT_TAGVAR(compiler, $1)=$CC
7537 _LT_TAGVAR(LD, $1)="$LD"
7538 _LT_CC_BASENAME([$compiler])
7539
7540 # Go did not exist at the time GCC didn't implicitly link libc in.
7541 _LT_TAGVAR(archive_cmds_need_lc, $1)=no
7542
7543 _LT_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds
7544 _LT_TAGVAR(reload_flag, $1)=$reload_flag
7545 _LT_TAGVAR(reload_cmds, $1)=$reload_cmds
7546
7547 ## CAVEAT EMPTOR:
7548 ## There is no encapsulation within the following macros, do not change
7549 ## the running order or otherwise move them around unless you know exactly
7550 ## what you are doing...
7551 if test -n "$compiler"; then
7552 _LT_COMPILER_NO_RTTI($1)
7553 _LT_COMPILER_PIC($1)
7554 _LT_COMPILER_C_O($1)
7555 _LT_COMPILER_FILE_LOCKS($1)
7556 _LT_LINKER_SHLIBS($1)
7557 _LT_LINKER_HARDCODE_LIBPATH($1)
7558
7559 _LT_CONFIG($1)
7560 fi
7561
7562 AC_LANG_RESTORE
7563
7564 GCC=$lt_save_GCC
7565 CC=$lt_save_CC
7566 CFLAGS=$lt_save_CFLAGS
7567 ])# _LT_LANG_GO_CONFIG
7568
7569
7570 # _LT_LANG_RC_CONFIG([TAG])
7571 # -------------------------
7572 # Ensure that the configuration variables for the Windows resource compiler
7573 # are suitably defined. These variables are subsequently used by _LT_CONFIG
7574 # to write the compiler configuration to `libtool'.
7575 m4_defun([_LT_LANG_RC_CONFIG],
7576 [AC_REQUIRE([LT_PROG_RC])dnl
7577 AC_LANG_SAVE
7578
7579 # Source file extension for RC test sources.
7580 ac_ext=rc
7581
7582 # Object file extension for compiled RC test sources.
7583 objext=o
7584 _LT_TAGVAR(objext, $1)=$objext
7585
7586 # Code to be used in simple compile tests
7587 lt_simple_compile_test_code='sample MENU { MENUITEM "&Soup", 100, CHECKED }'
7588
7589 # Code to be used in simple link tests
7590 lt_simple_link_test_code="$lt_simple_compile_test_code"
7591
7592 # ltmain only uses $CC for tagged configurations so make sure $CC is set.
7593 _LT_TAG_COMPILER
7594
7595 # save warnings/boilerplate of simple test code
7596 _LT_COMPILER_BOILERPLATE
7597 _LT_LINKER_BOILERPLATE
7598
7599 # Allow CC to be a program name with arguments.
7600 lt_save_CC="$CC"
7601 lt_save_CFLAGS=$CFLAGS
7602 lt_save_GCC=$GCC
7603 GCC=
7604 CC=${RC-"windres"}
7605 CFLAGS=
7606 compiler=$CC
7607 _LT_TAGVAR(compiler, $1)=$CC
7608 _LT_CC_BASENAME([$compiler])
7609 _LT_TAGVAR(lt_cv_prog_compiler_c_o, $1)=yes
7610
7611 if test -n "$compiler"; then
7612 :
7613 _LT_CONFIG($1)
7614 fi
7615
7616 GCC=$lt_save_GCC
7617 AC_LANG_RESTORE
7618 CC=$lt_save_CC
7619 CFLAGS=$lt_save_CFLAGS
7620 ])# _LT_LANG_RC_CONFIG
7621
7622
7623 # LT_PROG_GCJ
7624 # -----------
7625 AC_DEFUN([LT_PROG_GCJ],
7626 [m4_ifdef([AC_PROG_GCJ], [AC_PROG_GCJ],
7627 [m4_ifdef([A][M_PROG_GCJ], [A][M_PROG_GCJ],
7628 [AC_CHECK_TOOL(GCJ, gcj,)
7629 test "x${GCJFLAGS+set}" = xset || GCJFLAGS="-g -O2"
7630 AC_SUBST(GCJFLAGS)])])[]dnl
7631 ])
7632
7633 # Old name:
7634 AU_ALIAS([LT_AC_PROG_GCJ], [LT_PROG_GCJ])
7635 dnl aclocal-1.4 backwards compatibility:
7636 dnl AC_DEFUN([LT_AC_PROG_GCJ], [])
7637
7638
7639 # LT_PROG_GO
7640 # ----------
7641 AC_DEFUN([LT_PROG_GO],
7642 [AC_CHECK_TOOL(GOC, gccgo,)
7643 ])
7644
7645
7646 # LT_PROG_RC
7647 # ----------
7648 AC_DEFUN([LT_PROG_RC],
7649 [AC_CHECK_TOOL(RC, windres,)
7650 ])
7651
7652 # Old name:
7653 AU_ALIAS([LT_AC_PROG_RC], [LT_PROG_RC])
7654 dnl aclocal-1.4 backwards compatibility:
7655 dnl AC_DEFUN([LT_AC_PROG_RC], [])
7656
7657
7658 # _LT_DECL_EGREP
7659 # --------------
7660 # If we don't have a new enough Autoconf to choose the best grep
7661 # available, choose the one first in the user's PATH.
7662 m4_defun([_LT_DECL_EGREP],
7663 [AC_REQUIRE([AC_PROG_EGREP])dnl
7664 AC_REQUIRE([AC_PROG_FGREP])dnl
7665 test -z "$GREP" && GREP=grep
7666 _LT_DECL([], [GREP], [1], [A grep program that handles long lines])
7667 _LT_DECL([], [EGREP], [1], [An ERE matcher])
7668 _LT_DECL([], [FGREP], [1], [A literal string matcher])
7669 dnl Non-bleeding-edge autoconf doesn't subst GREP, so do it here too
7670 AC_SUBST([GREP])
7671 ])
7672
7673
7674 # _LT_DECL_OBJDUMP
7675 # --------------
7676 # If we don't have a new enough Autoconf to choose the best objdump
7677 # available, choose the one first in the user's PATH.
7678 m4_defun([_LT_DECL_OBJDUMP],
7679 [AC_CHECK_TOOL(OBJDUMP, objdump, false)
7680 test -z "$OBJDUMP" && OBJDUMP=objdump
7681 _LT_DECL([], [OBJDUMP], [1], [An object symbol dumper])
7682 AC_SUBST([OBJDUMP])
7683 ])
7684
7685 # _LT_DECL_DLLTOOL
7686 # ----------------
7687 # Ensure DLLTOOL variable is set.
7688 m4_defun([_LT_DECL_DLLTOOL],
7689 [AC_CHECK_TOOL(DLLTOOL, dlltool, false)
7690 test -z "$DLLTOOL" && DLLTOOL=dlltool
7691 _LT_DECL([], [DLLTOOL], [1], [DLL creation program])
7692 AC_SUBST([DLLTOOL])
7693 ])
7694
7695 # _LT_DECL_SED
7696 # ------------
7697 # Check for a fully-functional sed program, that truncates
7698 # as few characters as possible. Prefer GNU sed if found.
7699 m4_defun([_LT_DECL_SED],
7700 [AC_PROG_SED
7701 test -z "$SED" && SED=sed
7702 Xsed="$SED -e 1s/^X//"
7703 _LT_DECL([], [SED], [1], [A sed program that does not truncate output])
7704 _LT_DECL([], [Xsed], ["\$SED -e 1s/^X//"],
7705 [Sed that helps us avoid accidentally triggering echo(1) options like -n])
7706 ])# _LT_DECL_SED
7707
7708 m4_ifndef([AC_PROG_SED], [
7709 ############################################################
7710 # NOTE: This macro has been submitted for inclusion into #
7711 # GNU Autoconf as AC_PROG_SED. When it is available in #
7712 # a released version of Autoconf we should remove this #
7713 # macro and use it instead. #
7714 ############################################################
7715
7716 m4_defun([AC_PROG_SED],
7717 [AC_MSG_CHECKING([for a sed that does not truncate output])
7718 AC_CACHE_VAL(lt_cv_path_SED,
7719 [# Loop through the user's path and test for sed and gsed.
7720 # Then use that list of sed's as ones to test for truncation.
7721 as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
7722 for as_dir in $PATH
7723 do
7724 IFS=$as_save_IFS
7725 test -z "$as_dir" && as_dir=.
7726 for lt_ac_prog in sed gsed; do
7727 for ac_exec_ext in '' $ac_executable_extensions; do
7728 if $as_executable_p "$as_dir/$lt_ac_prog$ac_exec_ext"; then
7729 lt_ac_sed_list="$lt_ac_sed_list $as_dir/$lt_ac_prog$ac_exec_ext"
7730 fi
7731 done
7732 done
7733 done
7734 IFS=$as_save_IFS
7735 lt_ac_max=0
7736 lt_ac_count=0
7737 # Add /usr/xpg4/bin/sed as it is typically found on Solaris
7738 # along with /bin/sed that truncates output.
7739 for lt_ac_sed in $lt_ac_sed_list /usr/xpg4/bin/sed; do
7740 test ! -f $lt_ac_sed && continue
7741 cat /dev/null > conftest.in
7742 lt_ac_count=0
7743 echo $ECHO_N "0123456789$ECHO_C" >conftest.in
7744 # Check for GNU sed and select it if it is found.
7745 if "$lt_ac_sed" --version 2>&1 < /dev/null | grep 'GNU' > /dev/null; then
7746 lt_cv_path_SED=$lt_ac_sed
7747 break
7748 fi
7749 while true; do
7750 cat conftest.in conftest.in >conftest.tmp
7751 mv conftest.tmp conftest.in
7752 cp conftest.in conftest.nl
7753 echo >>conftest.nl
7754 $lt_ac_sed -e 's/a$//' < conftest.nl >conftest.out || break
7755 cmp -s conftest.out conftest.nl || break
7756 # 10000 chars as input seems more than enough
7757 test $lt_ac_count -gt 10 && break
7758 lt_ac_count=`expr $lt_ac_count + 1`
7759 if test $lt_ac_count -gt $lt_ac_max; then
7760 lt_ac_max=$lt_ac_count
7761 lt_cv_path_SED=$lt_ac_sed
7762 fi
7763 done
7764 done
7765 ])
7766 SED=$lt_cv_path_SED
7767 AC_SUBST([SED])
7768 AC_MSG_RESULT([$SED])
7769 ])#AC_PROG_SED
7770 ])#m4_ifndef
7771
7772 # Old name:
7773 AU_ALIAS([LT_AC_PROG_SED], [AC_PROG_SED])
7774 dnl aclocal-1.4 backwards compatibility:
7775 dnl AC_DEFUN([LT_AC_PROG_SED], [])
7776
7777
7778 # _LT_CHECK_SHELL_FEATURES
7779 # ------------------------
7780 # Find out whether the shell is Bourne or XSI compatible,
7781 # or has some other useful features.
7782 m4_defun([_LT_CHECK_SHELL_FEATURES],
7783 [AC_MSG_CHECKING([whether the shell understands some XSI constructs])
7784 # Try some XSI features
7785 xsi_shell=no
7786 ( _lt_dummy="a/b/c"
7787 test "${_lt_dummy##*/},${_lt_dummy%/*},${_lt_dummy#??}"${_lt_dummy%"$_lt_dummy"}, \
7788 = c,a/b,b/c, \
7789 && eval 'test $(( 1 + 1 )) -eq 2 \
7790 && test "${#_lt_dummy}" -eq 5' ) >/dev/null 2>&1 \
7791 && xsi_shell=yes
7792 AC_MSG_RESULT([$xsi_shell])
7793 _LT_CONFIG_LIBTOOL_INIT([xsi_shell='$xsi_shell'])
7794
7795 AC_MSG_CHECKING([whether the shell understands "+="])
7796 lt_shell_append=no
7797 ( foo=bar; set foo baz; eval "$[1]+=\$[2]" && test "$foo" = barbaz ) \
7798 >/dev/null 2>&1 \
7799 && lt_shell_append=yes
7800 AC_MSG_RESULT([$lt_shell_append])
7801 _LT_CONFIG_LIBTOOL_INIT([lt_shell_append='$lt_shell_append'])
7802
7803 if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then
7804 lt_unset=unset
7805 else
7806 lt_unset=false
7807 fi
7808 _LT_DECL([], [lt_unset], [0], [whether the shell understands "unset"])dnl
7809
7810 # test EBCDIC or ASCII
7811 case `echo X|tr X '\101'` in
7812 A) # ASCII based system
7813 # \n is not interpreted correctly by Solaris 8 /usr/ucb/tr
7814 lt_SP2NL='tr \040 \012'
7815 lt_NL2SP='tr \015\012 \040\040'
7816 ;;
7817 *) # EBCDIC based system
7818 lt_SP2NL='tr \100 \n'
7819 lt_NL2SP='tr \r\n \100\100'
7820 ;;
7821 esac
7822 _LT_DECL([SP2NL], [lt_SP2NL], [1], [turn spaces into newlines])dnl
7823 _LT_DECL([NL2SP], [lt_NL2SP], [1], [turn newlines into spaces])dnl
7824 ])# _LT_CHECK_SHELL_FEATURES
7825
7826
7827 # _LT_PROG_FUNCTION_REPLACE (FUNCNAME, REPLACEMENT-BODY)
7828 # ------------------------------------------------------
7829 # In `$cfgfile', look for function FUNCNAME delimited by `^FUNCNAME ()$' and
7830 # '^} FUNCNAME ', and replace its body with REPLACEMENT-BODY.
7831 m4_defun([_LT_PROG_FUNCTION_REPLACE],
7832 [dnl {
7833 sed -e '/^$1 ()$/,/^} # $1 /c\
7834 $1 ()\
7835 {\
7836 m4_bpatsubsts([$2], [$], [\\], [^\([ ]\)], [\\\1])
7837 } # Extended-shell $1 implementation' "$cfgfile" > $cfgfile.tmp \
7838 && mv -f "$cfgfile.tmp" "$cfgfile" \
7839 || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp")
7840 test 0 -eq $? || _lt_function_replace_fail=:
7841 ])
7842
7843
7844 # _LT_PROG_REPLACE_SHELLFNS
7845 # -------------------------
7846 # Replace existing portable implementations of several shell functions with
7847 # equivalent extended shell implementations where those features are available..
7848 m4_defun([_LT_PROG_REPLACE_SHELLFNS],
7849 [if test x"$xsi_shell" = xyes; then
7850 _LT_PROG_FUNCTION_REPLACE([func_dirname], [dnl
7851 case ${1} in
7852 */*) func_dirname_result="${1%/*}${2}" ;;
7853 * ) func_dirname_result="${3}" ;;
7854 esac])
7855
7856 _LT_PROG_FUNCTION_REPLACE([func_basename], [dnl
7857 func_basename_result="${1##*/}"])
7858
7859 _LT_PROG_FUNCTION_REPLACE([func_dirname_and_basename], [dnl
7860 case ${1} in
7861 */*) func_dirname_result="${1%/*}${2}" ;;
7862 * ) func_dirname_result="${3}" ;;
7863 esac
7864 func_basename_result="${1##*/}"])
7865
7866 _LT_PROG_FUNCTION_REPLACE([func_stripname], [dnl
7867 # pdksh 5.2.14 does not do ${X%$Y} correctly if both X and Y are
7868 # positional parameters, so assign one to ordinary parameter first.
7869 func_stripname_result=${3}
7870 func_stripname_result=${func_stripname_result#"${1}"}
7871 func_stripname_result=${func_stripname_result%"${2}"}])
7872
7873 _LT_PROG_FUNCTION_REPLACE([func_split_long_opt], [dnl
7874 func_split_long_opt_name=${1%%=*}
7875 func_split_long_opt_arg=${1#*=}])
7876
7877 _LT_PROG_FUNCTION_REPLACE([func_split_short_opt], [dnl
7878 func_split_short_opt_arg=${1#??}
7879 func_split_short_opt_name=${1%"$func_split_short_opt_arg"}])
7880
7881 _LT_PROG_FUNCTION_REPLACE([func_lo2o], [dnl
7882 case ${1} in
7883 *.lo) func_lo2o_result=${1%.lo}.${objext} ;;
7884 *) func_lo2o_result=${1} ;;
7885 esac])
7886
7887 _LT_PROG_FUNCTION_REPLACE([func_xform], [ func_xform_result=${1%.*}.lo])
7888
7889 _LT_PROG_FUNCTION_REPLACE([func_arith], [ func_arith_result=$(( $[*] ))])
7890
7891 _LT_PROG_FUNCTION_REPLACE([func_len], [ func_len_result=${#1}])
7892 fi
7893
7894 if test x"$lt_shell_append" = xyes; then
7895 _LT_PROG_FUNCTION_REPLACE([func_append], [ eval "${1}+=\\${2}"])
7896
7897 _LT_PROG_FUNCTION_REPLACE([func_append_quoted], [dnl
7898 func_quote_for_eval "${2}"
7899 dnl m4 expansion turns \\\\ into \\, and then the shell eval turns that into \
7900 eval "${1}+=\\\\ \\$func_quote_for_eval_result"])
7901
7902 # Save a `func_append' function call where possible by direct use of '+='
7903 sed -e 's%func_append \([[a-zA-Z_]]\{1,\}\) "%\1+="%g' $cfgfile > $cfgfile.tmp \
7904 && mv -f "$cfgfile.tmp" "$cfgfile" \
7905 || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp")
7906 test 0 -eq $? || _lt_function_replace_fail=:
7907 else
7908 # Save a `func_append' function call even when '+=' is not available
7909 sed -e 's%func_append \([[a-zA-Z_]]\{1,\}\) "%\1="$\1%g' $cfgfile > $cfgfile.tmp \
7910 && mv -f "$cfgfile.tmp" "$cfgfile" \
7911 || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp")
7912 test 0 -eq $? || _lt_function_replace_fail=:
7913 fi
7914
7915 if test x"$_lt_function_replace_fail" = x":"; then
7916 AC_MSG_WARN([Unable to substitute extended shell functions in $ofile])
7917 fi
7918 ])
7919
7920 # _LT_PATH_CONVERSION_FUNCTIONS
7921 # -----------------------------
7922 # Determine which file name conversion functions should be used by
7923 # func_to_host_file (and, implicitly, by func_to_host_path). These are needed
7924 # for certain cross-compile configurations and native mingw.
7925 m4_defun([_LT_PATH_CONVERSION_FUNCTIONS],
7926 [AC_REQUIRE([AC_CANONICAL_HOST])dnl
7927 AC_REQUIRE([AC_CANONICAL_BUILD])dnl
7928 AC_MSG_CHECKING([how to convert $build file names to $host format])
7929 AC_CACHE_VAL(lt_cv_to_host_file_cmd,
7930 [case $host in
7931 *-*-mingw* )
7932 case $build in
7933 *-*-mingw* ) # actually msys
7934 lt_cv_to_host_file_cmd=func_convert_file_msys_to_w32
7935 ;;
7936 *-*-cygwin* )
7937 lt_cv_to_host_file_cmd=func_convert_file_cygwin_to_w32
7938 ;;
7939 * ) # otherwise, assume *nix
7940 lt_cv_to_host_file_cmd=func_convert_file_nix_to_w32
7941 ;;
7942 esac
7943 ;;
7944 *-*-cygwin* )
7945 case $build in
7946 *-*-mingw* ) # actually msys
7947 lt_cv_to_host_file_cmd=func_convert_file_msys_to_cygwin
7948 ;;
7949 *-*-cygwin* )
7950 lt_cv_to_host_file_cmd=func_convert_file_noop
7951 ;;
7952 * ) # otherwise, assume *nix
7953 lt_cv_to_host_file_cmd=func_convert_file_nix_to_cygwin
7954 ;;
7955 esac
7956 ;;
7957 * ) # unhandled hosts (and "normal" native builds)
7958 lt_cv_to_host_file_cmd=func_convert_file_noop
7959 ;;
7960 esac
7961 ])
7962 to_host_file_cmd=$lt_cv_to_host_file_cmd
7963 AC_MSG_RESULT([$lt_cv_to_host_file_cmd])
7964 _LT_DECL([to_host_file_cmd], [lt_cv_to_host_file_cmd],
7965 [0], [convert $build file names to $host format])dnl
7966
7967 AC_MSG_CHECKING([how to convert $build file names to toolchain format])
7968 AC_CACHE_VAL(lt_cv_to_tool_file_cmd,
7969 [#assume ordinary cross tools, or native build.
7970 lt_cv_to_tool_file_cmd=func_convert_file_noop
7971 case $host in
7972 *-*-mingw* )
7973 case $build in
7974 *-*-mingw* ) # actually msys
7975 lt_cv_to_tool_file_cmd=func_convert_file_msys_to_w32
7976 ;;
7977 esac
7978 ;;
7979 esac
7980 ])
7981 to_tool_file_cmd=$lt_cv_to_tool_file_cmd
7982 AC_MSG_RESULT([$lt_cv_to_tool_file_cmd])
7983 _LT_DECL([to_tool_file_cmd], [lt_cv_to_tool_file_cmd],
7984 [0], [convert $build files to toolchain format])dnl
7985 ])# _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 #! /bin/sh
1 # Common stub for a few missing GNU programs while installing.
2
3 scriptversion=2012-01-06.18; # UTC
4
5 # Copyright (C) 1996-2012 Free Software Foundation, Inc.
6 # Originally by Fran,cois Pinard <pinard@iro.umontreal.ca>, 1996.
7
8 # This program is free software; you can redistribute it and/or modify
9 # it under the terms of the GNU General Public License as published by
10 # the Free Software Foundation; either version 2, or (at your option)
11 # any later version.
12
13 # This program is distributed in the hope that it will be useful,
14 # but WITHOUT ANY WARRANTY; without even the implied warranty of
15 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 # GNU General Public License for more details.
17
18 # You should have received a copy of the GNU General Public License
19 # along with this program. If not, see <http://www.gnu.org/licenses/>.
20
21 # As a special exception to the GNU General Public License, if you
22 # distribute this file as part of a program that contains a
23 # configuration script generated by Autoconf, you may include it under
24 # the same distribution terms that you use for the rest of that program.
25
26 if test $# -eq 0; then
27 echo 1>&2 "Try '$0 --help' for more information"
28 exit 1
29 fi
30
31 run=:
32 sed_output='s/.* --output[ =]\([^ ]*\).*/\1/p'
33 sed_minuso='s/.* -o \([^ ]*\).*/\1/p'
34
35 # In the cases where this matters, 'missing' is being run in the
36 # srcdir already.
37 if test -f configure.ac; then
38 configure_ac=configure.ac
39 else
40 configure_ac=configure.in
41 fi
42
43 msg="missing on your system"
44
45 case $1 in
46 --run)
47 # Try to run requested program, and just exit if it succeeds.
48 run=
49 shift
50 "$@" && exit 0
51 # Exit code 63 means version mismatch. This often happens
52 # when the user try to use an ancient version of a tool on
53 # a file that requires a minimum version. In this case we
54 # we should proceed has if the program had been absent, or
55 # if --run hadn't been passed.
56 if test $? = 63; then
57 run=:
58 msg="probably too old"
59 fi
60 ;;
61
62 -h|--h|--he|--hel|--help)
63 echo "\
64 $0 [OPTION]... PROGRAM [ARGUMENT]...
65
66 Handle 'PROGRAM [ARGUMENT]...' for when PROGRAM is missing, or return an
67 error status if there is no known handling for PROGRAM.
68
69 Options:
70 -h, --help display this help and exit
71 -v, --version output version information and exit
72 --run try to run the given command, and emulate it if it fails
73
74 Supported PROGRAM values:
75 aclocal touch file 'aclocal.m4'
76 autoconf touch file 'configure'
77 autoheader touch file 'config.h.in'
78 autom4te touch the output file, or create a stub one
79 automake touch all 'Makefile.in' files
80 bison create 'y.tab.[ch]', if possible, from existing .[ch]
81 flex create 'lex.yy.c', if possible, from existing .c
82 help2man touch the output file
83 lex create 'lex.yy.c', if possible, from existing .c
84 makeinfo touch the output file
85 yacc create 'y.tab.[ch]', if possible, from existing .[ch]
86
87 Version suffixes to PROGRAM as well as the prefixes 'gnu-', 'gnu', and
88 'g' are ignored when checking the name.
89
90 Send bug reports to <bug-automake@gnu.org>."
91 exit $?
92 ;;
93
94 -v|--v|--ve|--ver|--vers|--versi|--versio|--version)
95 echo "missing $scriptversion (GNU Automake)"
96 exit $?
97 ;;
98
99 -*)
100 echo 1>&2 "$0: Unknown '$1' option"
101 echo 1>&2 "Try '$0 --help' for more information"
102 exit 1
103 ;;
104
105 esac
106
107 # normalize program name to check for.
108 program=`echo "$1" | sed '
109 s/^gnu-//; t
110 s/^gnu//; t
111 s/^g//; t'`
112
113 # Now exit if we have it, but it failed. Also exit now if we
114 # don't have it and --version was passed (most likely to detect
115 # the program). This is about non-GNU programs, so use $1 not
116 # $program.
117 case $1 in
118 lex*|yacc*)
119 # Not GNU programs, they don't have --version.
120 ;;
121
122 *)
123 if test -z "$run" && ($1 --version) > /dev/null 2>&1; then
124 # We have it, but it failed.
125 exit 1
126 elif test "x$2" = "x--version" || test "x$2" = "x--help"; then
127 # Could not run --version or --help. This is probably someone
128 # running '$TOOL --version' or '$TOOL --help' to check whether
129 # $TOOL exists and not knowing $TOOL uses missing.
130 exit 1
131 fi
132 ;;
133 esac
134
135 # If it does not exist, or fails to run (possibly an outdated version),
136 # try to emulate it.
137 case $program in
138 aclocal*)
139 echo 1>&2 "\
140 WARNING: '$1' is $msg. You should only need it if
141 you modified 'acinclude.m4' or '${configure_ac}'. You might want
142 to install the Automake and Perl packages. Grab them from
143 any GNU archive site."
144 touch aclocal.m4
145 ;;
146
147 autoconf*)
148 echo 1>&2 "\
149 WARNING: '$1' is $msg. You should only need it if
150 you modified '${configure_ac}'. You might want to install the
151 Autoconf and GNU m4 packages. Grab them from any GNU
152 archive site."
153 touch configure
154 ;;
155
156 autoheader*)
157 echo 1>&2 "\
158 WARNING: '$1' is $msg. You should only need it if
159 you modified 'acconfig.h' or '${configure_ac}'. You might want
160 to install the Autoconf and GNU m4 packages. Grab them
161 from any GNU archive site."
162 files=`sed -n 's/^[ ]*A[CM]_CONFIG_HEADER(\([^)]*\)).*/\1/p' ${configure_ac}`
163 test -z "$files" && files="config.h"
164 touch_files=
165 for f in $files; do
166 case $f in
167 *:*) touch_files="$touch_files "`echo "$f" |
168 sed -e 's/^[^:]*://' -e 's/:.*//'`;;
169 *) touch_files="$touch_files $f.in";;
170 esac
171 done
172 touch $touch_files
173 ;;
174
175 automake*)
176 echo 1>&2 "\
177 WARNING: '$1' is $msg. You should only need it if
178 you modified 'Makefile.am', 'acinclude.m4' or '${configure_ac}'.
179 You might want to install the Automake and Perl packages.
180 Grab them from any GNU archive site."
181 find . -type f -name Makefile.am -print |
182 sed 's/\.am$/.in/' |
183 while read f; do touch "$f"; done
184 ;;
185
186 autom4te*)
187 echo 1>&2 "\
188 WARNING: '$1' is needed, but is $msg.
189 You might have modified some files without having the
190 proper tools for further handling them.
191 You can get '$1' as part of Autoconf from any GNU
192 archive site."
193
194 file=`echo "$*" | sed -n "$sed_output"`
195 test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"`
196 if test -f "$file"; then
197 touch $file
198 else
199 test -z "$file" || exec >$file
200 echo "#! /bin/sh"
201 echo "# Created by GNU Automake missing as a replacement of"
202 echo "# $ $@"
203 echo "exit 0"
204 chmod +x $file
205 exit 1
206 fi
207 ;;
208
209 bison*|yacc*)
210 echo 1>&2 "\
211 WARNING: '$1' $msg. You should only need it if
212 you modified a '.y' file. You may need the Bison package
213 in order for those modifications to take effect. You can get
214 Bison from any GNU archive site."
215 rm -f y.tab.c y.tab.h
216 if test $# -ne 1; then
217 eval LASTARG=\${$#}
218 case $LASTARG in
219 *.y)
220 SRCFILE=`echo "$LASTARG" | sed 's/y$/c/'`
221 if test -f "$SRCFILE"; then
222 cp "$SRCFILE" y.tab.c
223 fi
224 SRCFILE=`echo "$LASTARG" | sed 's/y$/h/'`
225 if test -f "$SRCFILE"; then
226 cp "$SRCFILE" y.tab.h
227 fi
228 ;;
229 esac
230 fi
231 if test ! -f y.tab.h; then
232 echo >y.tab.h
233 fi
234 if test ! -f y.tab.c; then
235 echo 'main() { return 0; }' >y.tab.c
236 fi
237 ;;
238
239 lex*|flex*)
240 echo 1>&2 "\
241 WARNING: '$1' is $msg. You should only need it if
242 you modified a '.l' file. You may need the Flex package
243 in order for those modifications to take effect. You can get
244 Flex from any GNU archive site."
245 rm -f lex.yy.c
246 if test $# -ne 1; then
247 eval LASTARG=\${$#}
248 case $LASTARG in
249 *.l)
250 SRCFILE=`echo "$LASTARG" | sed 's/l$/c/'`
251 if test -f "$SRCFILE"; then
252 cp "$SRCFILE" lex.yy.c
253 fi
254 ;;
255 esac
256 fi
257 if test ! -f lex.yy.c; then
258 echo 'main() { return 0; }' >lex.yy.c
259 fi
260 ;;
261
262 help2man*)
263 echo 1>&2 "\
264 WARNING: '$1' is $msg. You should only need it if
265 you modified a dependency of a manual page. You may need the
266 Help2man package in order for those modifications to take
267 effect. You can get Help2man from any GNU archive site."
268
269 file=`echo "$*" | sed -n "$sed_output"`
270 test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"`
271 if test -f "$file"; then
272 touch $file
273 else
274 test -z "$file" || exec >$file
275 echo ".ab help2man is required to generate this page"
276 exit $?
277 fi
278 ;;
279
280 makeinfo*)
281 echo 1>&2 "\
282 WARNING: '$1' is $msg. You should only need it if
283 you modified a '.texi' or '.texinfo' file, or any other file
284 indirectly affecting the aspect of the manual. The spurious
285 call might also be the consequence of using a buggy 'make' (AIX,
286 DU, IRIX). You might want to install the Texinfo package or
287 the GNU make package. Grab either from any GNU archive site."
288 # The file to touch is that specified with -o ...
289 file=`echo "$*" | sed -n "$sed_output"`
290 test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"`
291 if test -z "$file"; then
292 # ... or it is the one specified with @setfilename ...
293 infile=`echo "$*" | sed 's/.* \([^ ]*\) *$/\1/'`
294 file=`sed -n '
295 /^@setfilename/{
296 s/.* \([^ ]*\) *$/\1/
297 p
298 q
299 }' $infile`
300 # ... or it is derived from the source name (dir/f.texi becomes f.info)
301 test -z "$file" && file=`echo "$infile" | sed 's,.*/,,;s,.[^.]*$,,'`.info
302 fi
303 # If the file does not exist, the user really needs makeinfo;
304 # let's fail without touching anything.
305 test -f $file || exit 1
306 touch $file
307 ;;
308
309 *)
310 echo 1>&2 "\
311 WARNING: '$1' is needed, and is $msg.
312 You might have modified some files without having the
313 proper tools for further handling them. Check the 'README' file,
314 it often tells you about the needed prerequisites for installing
315 this package. You may also peek at any GNU archive site, in case
316 some other package would contain this missing '$1' program."
317 exit 1
318 ;;
319 esac
320
321 exit 0
322
323 # Local variables:
324 # eval: (add-hook 'write-file-hooks 'time-stamp)
325 # time-stamp-start: "scriptversion="
326 # time-stamp-format: "%:y-%02m-%02d.%02H"
327 # time-stamp-time-zone: "UTC"
328 # time-stamp-end: "; # UTC"
329 # End:
0 proposed getdns cache design
1 Glen Wiley <gwiley@verisign.com>
2
3 API Description Requirements
4 ============================
5 Considerations regarding cache are slightly different depending on
6 whether we are operating as a stub resolver or a recursive resolver.
7 The API description requires that we operate as a recursive resolver
8 and considers stub resolver behavior optional.
9
10 Recursive Resolver Cache
11 ========================
12 Caching is arguably an important feature for most recursive resolvers.
13 In this case we are not intending a replacement for the fully
14 functional recursive resolvers already available (BIND, Unbound, etc.)
15 so we shoudl limit a cache implementation to behaviors important to
16 proper operation of a recursive resolver.
17
18 DNSSEC validation can potentially triggers more queries than a simple
19 request for a A RR so I think it makes sense to cache root and TLD
20 data. Once we have gone that far it isn't much of a reach to cache
21 at each layer in the hierarchy (depth will not increase the coding
22 effort or defect rates).
23
24 Bear in mind that this resolver will only answer local processes,
25 it is not listening for queries over the network.
26
27 Stub Resolver Cache
28 ===================
29 One well supported poition is that a stub resolver should not cache
30 DNS replies as it relies on a proximate recursive resolver for
31 iterative resolution and caching. DNSSEC validation introduces
32 a potential use case for caching even when we would prefer to not
33 cache DNS replies in the stub resolver. I'd like to avoid a
34 religious debate about whether a stub resolver should have a cache
35 and focus on what we need to make the getdns API best suited to
36 its intended focus.
37
38 Since a cache makes sense for a recursive resolver we will need
39 to implement it anyway. With that in mind I recommend that we
40 use a configuration setting to enable caching and control its
41 behavior when running as a stub resolver.
42
43 Cache Design Points
44 ===================
45 If we assume that we need a cache implementation (which I concede is
46 not yet decided) then I would recommend the following design points:
47
48 Local configuration via API or local file (e.g. /etc/getdns.conf, ~/.getdnsrc)
49 - turn cache on/off
50 - turn negative cache on/off
51 - use a per user cache vs. system wide cache
52 - max TTL/TTL override (separate for pos/neg cache entries)
53 - inclusions (use cache for specified domains) (maybe over-eng)
54 - exceptions (avoid ache for specified domains) (maybe over-eng)
55 - persistant vs. transitory cache
56
57 - cache data store via Berkely db to allow for persistance
58
59 - negative cache TTL derived from SOA
60
61 - positive cache TTL
62
63 - max entries - flush oldest entries when max reached
64
65 - if a TTL for an entry in the cache is within 1 minute of expiring the
66 library should refresh that cache entry after answering the query so
67 that the next request for that entry does not experience latency
0 The problem of how to fetch the trust anchor for DNSSEC validation can
1 be solved in a number of different ways. RFC 5011 provides a process
2 for updating the trust anchor, however the fundamental problem of how
3 to boot strap a trust anchor is a little more difficult.
4
5 Each of the solutions spans a continuum from easy for the operator but
6 offering weak security to hard for the operator but offering strong
7 security. Some of the options we considered are:
8
9
10 Manual
11 ------
12 If the system operator manually fetches the KSK from a well trusted
13 source and places it on the system he can rest assured that the trust
14 anchor is the most reliable. This is also the most difficult approach
15 and fits least well with our goal of providing an easy to use library
16 for non-DNS experts.
17
18 Manual fetching can be done via a web browser, if the user ensures
19 that he handles the certificate for the ICANN website then it is a
20 respectably secure approach.
21
22
23 Key Fetch Tool in Source
24 ------------------------
25 An application can be provided with the library that the system
26 operator can invoke to bootstrap the key material. This application
27 would include the ICANN website and could perform the key retrieval
28 using a valid certificate. Although the certificate may be included in
29 the source tree, the certificates are typically longer lived than the
30 root KSK.
31
32
33 Key in Source
34 -------------
35 The KSK can be placed in the sources which is probably the easiest for
36 the system operator and is sufficiently secure provided the source
37 deliver process is secure.
38
39 One downside to this approach is that the source package becomes stale
40 following a KSK roll. This can be partially mitigated by providing
41 clear diagnostic messages for the user if they attempt to validate
42 DNSSEC responses with outdated keys.
43
44
45 Automatically Fetch Key Via ICANN Website
46 -----------------------------------------
47 One of the easiest approaches is to embed the URL from which we fetch
48 the KSK into the sources, the library can quietly fetch the KSK if one
49 isn't available on the system. This has some potential security
50 risks.
51
52
5858 CFLAGS=@CFLAGS@ -Wall -I$(srcdir)/ -I/usr/local/include -std=c99
5959 LDFLAGS=@LDFLAGS@ @LIBS@
6060
61 EXTENSION_LDFLAGS=@EXTENSION_LDFLAGS@
6261 EXTENSION_LIBEVENT_LIB=@EXTENSION_LIBEVENT_LIB@
6362 EXTENSION_LIBEVENT_EXT_LIBS=@EXTENSION_LIBEVENT_EXT_LIBS@
63 EXTENSION_LIBEVENT_LDFLAGS=@EXTENSION_LIBEVENT_LDFLAGS@
64 EXTENSION_LIBEV_LIB=@EXTENSION_LIBEV_LIB@
65 EXTENSION_LIBEV_EXT_LIBS=@EXTENSION_LIBEV_EXT_LIBS@
66 EXTENSION_LIBEV_LDFLAGS=@EXTENSION_LIBEV_LDFLAGS@
6467 EXTENSION_LIBUV_LIB=@EXTENSION_LIBUV_LIB@
6568 EXTENSION_LIBUV_EXT_LIBS=@EXTENSION_LIBUV_EXT_LIBS@
66 EXTENSION_LIBEV_LIB=@EXTENSION_LIBEV_LIB@
67 EXTENSION_LIBEV_EXT_LIBS=@EXTENSION_LIBEV_EXT_LIBS@
69 EXTENSION_LIBUV_LDFLAGS=@EXTENSION_LIBUV_LDFLAGS@
6870
6971 GETDNS_OBJ=sync.lo context.lo list.lo dict.lo convert.lo general.lo \
7072 hostname.lo service.lo request-internal.lo util-internal.lo \
8688 $(INSTALL) -m 755 -d $(DESTDIR)$(includedir)
8789 $(INSTALL) -m 755 -d $(DESTDIR)$(includedir)/getdns
8890 $(INSTALL) -m 644 $(srcdir)/getdns/getdns.h $(DESTDIR)$(includedir)/getdns/getdns.h
89 $(INSTALL) -m 644 $(srcdir)/getdns/getdns.h $(DESTDIR)$(includedir)/getdns/getdns_extra.h
91 $(INSTALL) -m 644 $(srcdir)/getdns/getdns_extra.h $(DESTDIR)$(includedir)/getdns/getdns_extra.h
9092 $(INSTALL) -m 755 -d $(DESTDIR)$(libdir)
9193 $(LIBTOOL) --mode=install cp libgetdns.la $(DESTDIR)$(libdir)
9294 if test $(have_libevent) = 1 ; then $(INSTALL) -m 644 $(srcdir)/getdns/getdns_ext_libevent.h $(DESTDIR)$(includedir)/getdns/ ; $(LIBTOOL) --mode=install cp $(EXTENSION_LIBEVENT_LIB) $(DESTDIR)$(libdir) ; fi
9799
98100 uninstall:
99101 rm -rf $(DESTDIR)$(includedir)/getdns
100 $(LIBTOOL) --mode=uninstall rm -f $(DESTDIR)$(libdir)/libgetdns.la $(DESTDIR)$(libdir)/$(EXTENSION_LIBEVENT_LIB) $(DESTDIR)$(libdir)/$(EXTENSION_LIBUV_LIB) $(DESTDIR)$(libdir)/$(EXTENSION_LIBEV_LIB)
102 $(LIBTOOL) --mode=uninstall rm -f $(DESTDIR)$(libdir)/libgetdns.la
103 if test $(have_libevent) = 1; then $(LIBTOOL) --mode=uninstall rm -f $(DESTDIR)$(libdir)/$(EXTENSION_LIBEVENT_LIB) ; fi
104 if test $(have_libuv) = 1; then $(LIBTOOL) --mode=uninstall rm -f $(DESTDIR)$(libdir)/$(EXTENSION_LIBUV_LIB) ; fi
105 if test $(have_libev) = 1; then $(LIBTOOL) --mode=uninstall rm -f $(DESTDIR)$(libdir)/$(EXTENSION_LIBEV_LIB) ; fi
101106
102107 libgetdns_ext_event.la: libgetdns.la extension/libevent.lo
103 $(LIBTOOL) --tag=CC --mode=link $(CC) $(CFLAGS) -o $@ extension/libevent.lo ./.libs/libgetdns.la $(EXTENSION_LDFLAGS) $(EXTENSION_LIBEVENT_EXT_LIBS) -rpath $(libdir) -version-info $(libversion) -no-undefined -release $(version)
108 $(LIBTOOL) --tag=CC --mode=link $(CC) $(CFLAGS) -o $@ extension/libevent.lo ./.libs/libgetdns.la $(EXTENSION_LIBEVENT_LDFLAGS) $(EXTENSION_LIBEVENT_EXT_LIBS) -rpath $(libdir) -version-info $(libversion) -no-undefined -release $(version)
104109
105110 libgetdns_ext_uv.la: libgetdns.la extension/libuv.lo
106 $(LIBTOOL) --tag=CC --mode=link $(CC) $(CFLAGS) -o $@ extension/libuv.lo ./.libs/libgetdns.la $(EXTENSION_LDFLAGS) $(EXTENSION_LIBUV_EXT_LIBS) -rpath $(libdir) -version-info $(libversion) -no-undefined -release $(version)
111 $(LIBTOOL) --tag=CC --mode=link $(CC) $(CFLAGS) -o $@ extension/libuv.lo ./.libs/libgetdns.la $(EXTENSION_LIBUV_LDFLAGS) $(EXTENSION_LIBUV_EXT_LIBS) -rpath $(libdir) -version-info $(libversion) -no-undefined -release $(version)
107112
108113 libgetdns_ext_ev.la: libgetdns.la extension/libev.lo
109 $(LIBTOOL) --tag=CC --mode=link $(CC) $(CFLAGS) -o $@ extension/libev.lo ./.libs/libgetdns.la $(EXTENSION_LDFLAGS) $(EXTENSION_LIBEV_EXT_LIBS) -rpath $(libdir) -version-info $(libversion) -no-undefined -release $(version)
114 $(LIBTOOL) --tag=CC --mode=link $(CC) $(CFLAGS) -o $@ extension/libev.lo ./.libs/libgetdns.la $(EXTENSION_LIBEV_LDFLAGS) $(EXTENSION_LIBEV_EXT_LIBS) -rpath $(libdir) -version-info $(libversion) -no-undefined -release $(version)
110115
111116 libgetdns.la: $(GETDNS_OBJ)
112117 $(LIBTOOL) --tag=CC --mode=link $(CC) $(CFLAGS) -o $@ $(GETDNS_OBJ) $(LDFLAGS) -rpath $(libdir) -version-info $(libversion) -no-undefined -release $(version)
+0
-130
src/config.h less more
0 /* src/config.h. Generated from config.h.in by configure. */
1 /* src/config.h.in. Generated from configure.ac by autoheader. */
2
3 /* Define to 1 if you have the <dlfcn.h> header file. */
4 #define HAVE_DLFCN_H 1
5
6 /* Define to 1 if you have the <event2/event.h> header file. */
7 #define HAVE_EVENT2_EVENT_H 1
8
9 /* Define to 1 if you have the `event_base_free' function. */
10 #define HAVE_EVENT_BASE_FREE 1
11
12 /* Define to 1 if you have the `event_base_new' function. */
13 #define HAVE_EVENT_BASE_NEW 1
14
15 /* Define to 1 if you have the <event.h> header file. */
16 /* #undef HAVE_EVENT_H */
17
18 /* Define to 1 if you have the <ev.h> header file. */
19 /* #undef HAVE_EV_H */
20
21 /* Define to 1 if you have the <inttypes.h> header file. */
22 #define HAVE_INTTYPES_H 1
23
24 /* Define to 1 if you have the `idn' library (-lidn). */
25 #define HAVE_LIBIDN 1
26
27 /* Define to 1 if you have the `ldns' library (-lldns). */
28 #define HAVE_LIBLDNS 1
29
30 /* Define to 1 if you have the `unbound' library (-lunbound). */
31 #define HAVE_LIBUNBOUND 1
32
33 /* Define to 1 if you have the <memory.h> header file. */
34 #define HAVE_MEMORY_H 1
35
36 /* Define to 1 if you have the <netinet/in.h> header file. */
37 #define HAVE_NETINET_IN_H 1
38
39 /* Define to 1 if you have the <stdint.h> header file. */
40 #define HAVE_STDINT_H 1
41
42 /* Define to 1 if you have the <stdlib.h> header file. */
43 #define HAVE_STDLIB_H 1
44
45 /* Define to 1 if you have the <strings.h> header file. */
46 #define HAVE_STRINGS_H 1
47
48 /* Define to 1 if you have the <string.h> header file. */
49 #define HAVE_STRING_H 1
50
51 /* Define to 1 if you have the <sys/stat.h> header file. */
52 #define HAVE_SYS_STAT_H 1
53
54 /* Define to 1 if you have the <sys/types.h> header file. */
55 #define HAVE_SYS_TYPES_H 1
56
57 /* Define to 1 if you have the <unistd.h> header file. */
58 #define HAVE_UNISTD_H 1
59
60 /* Define to 1 if you have the <uv.h> header file. */
61 /* #undef HAVE_UV_H */
62
63 /* Define to the sub-directory in which libtool stores uninstalled libraries.
64 */
65 #define LT_OBJDIR ".libs/"
66
67 /* Define to the address where bug reports for this package should be sent. */
68 #define PACKAGE_BUGREPORT "stub-resolver@verisignlabs.com"
69
70 /* Define to the full name of this package. */
71 #define PACKAGE_NAME "getdns"
72
73 /* Define to the full name and version of this package. */
74 #define PACKAGE_STRING "getdns 0.1.0"
75
76 /* Define to the one symbol short name of this package. */
77 #define PACKAGE_TARNAME "getdns"
78
79 /* Define to the home page for this package. */
80 #define PACKAGE_URL "http://www.getdnsapi.net"
81
82 /* Define to the version of this package. */
83 #define PACKAGE_VERSION "0.1.0"
84
85 /* Define to 1 if you have the ANSI C header files. */
86 #define STDC_HEADERS 1
87
88 /* System configuration dir */
89 #define SYSCONFDIR sysconfdir
90
91 /* Default trust anchor file */
92 #define TRUST_ANCHOR_FILE "/etc/unbound/getdns-root.key"
93
94 /* Define for Solaris 2.5.1 so the uint32_t typedef from <sys/synch.h>,
95 <pthread.h>, or <semaphore.h> is not used. If the typedef were allowed, the
96 #define below would cause a syntax error. */
97 /* #undef _UINT32_T */
98
99 /* Define for Solaris 2.5.1 so the uint64_t typedef from <sys/synch.h>,
100 <pthread.h>, or <semaphore.h> is not used. If the typedef were allowed, the
101 #define below would cause a syntax error. */
102 /* #undef _UINT64_T */
103
104 /* Define for Solaris 2.5.1 so the uint8_t typedef from <sys/synch.h>,
105 <pthread.h>, or <semaphore.h> is not used. If the typedef were allowed, the
106 #define below would cause a syntax error. */
107 /* #undef _UINT8_T */
108
109 /* Define to `unsigned int' if <sys/types.h> does not define. */
110 /* #undef size_t */
111
112 /* Define to `unsigned char' if <sys/types.h> does not define. */
113 /* #undef u_char */
114
115 /* Define to the type of an unsigned integer type of width exactly 16 bits if
116 such a type exists and the standard includes do not define it. */
117 /* #undef uint16_t */
118
119 /* Define to the type of an unsigned integer type of width exactly 32 bits if
120 such a type exists and the standard includes do not define it. */
121 /* #undef uint32_t */
122
123 /* Define to the type of an unsigned integer type of width exactly 64 bits if
124 such a type exists and the standard includes do not define it. */
125 /* #undef uint64_t */
126
127 /* Define to the type of an unsigned integer type of width exactly 8 bits if
128 such a type exists and the standard includes do not define it. */
129 /* #undef uint8_t */
5959 /* Define to 1 if you have the <uv.h> header file. */
6060 #undef HAVE_UV_H
6161
62 /* Define to 1 if the system has the type `u_char'. */
63 #undef HAVE_U_CHAR
64
6265 /* Define to the sub-directory in which libtool stores uninstalled libraries.
6366 */
6467 #undef LT_OBJDIR
108111 /* Define to `unsigned int' if <sys/types.h> does not define. */
109112 #undef size_t
110113
111 /* Define to `unsigned char' if <sys/types.h> does not define. */
112 #undef u_char
113
114114 /* Define to the type of an unsigned integer type of width exactly 16 bits if
115115 such a type exists and the standard includes do not define it. */
116116 #undef uint16_t
415415 if (!result) {
416416 return GETDNS_RETURN_GENERIC_ERROR;
417417 }
418 result->processing = 0;
418419 result->destroying = 0;
419420 result->my_mf.mf_arg = userarg;
420421 result->my_mf.mf.ext.malloc = malloc;
436437
437438
438439 result->resolution_type = GETDNS_RESOLUTION_RECURSING;
439 if(create_default_namespaces(result) != GETDNS_RETURN_GOOD)
440 if(create_default_namespaces(result) != GETDNS_RETURN_GOOD) {
441 getdns_context_destroy(result);
440442 return GETDNS_RETURN_GENERIC_ERROR;
443 }
441444
442445 result->timeout = 5000;
443446 result->follow_redirects = GETDNS_REDIRECTS_FOLLOW;
468471 result->dns_transport = GETDNS_TRANSPORT_UDP_FIRST_AND_FALL_BACK_TO_TCP;
469472 result->limit_outstanding_queries = 0;
470473 result->has_ta = priv_getdns_parse_ta_file(NULL, NULL);
474 result->return_dnssec_status = GETDNS_EXTENSION_FALSE;
471475 if (!result->outbound_requests ||
472476 !result->timeouts_by_id ||
473477 !result->timeouts_by_time) {
527531 * Call this to dispose of resources associated with a context once you
528532 * are done with it.
529533 */
530 void
534 getdns_return_t
531535 getdns_context_destroy(struct getdns_context *context)
532536 {
533537 if (context == NULL) {
534 return;
538 return GETDNS_RETURN_INVALID_PARAMETER;
539 }
540 // If being destroyed during getdns callback,
541 // return an error
542 if (context->processing > 0) {
543 return GETDNS_RETURN_INVALID_PARAMETER;
544 }
545 if (context->destroying) {
546 return GETDNS_RETURN_BAD_CONTEXT;
535547 }
536548 context->destroying = 1;
537549 cancel_outstanding_requests(context, 1);
569581 GETDNS_FREE(context->my_mf, context->timeouts_by_time);
570582
571583 GETDNS_FREE(context->my_mf, context);
572 return;
584 return GETDNS_RETURN_GOOD;
573585 } /* getdns_context_destroy */
574586
575587 /*
12021214 getdns_transaction_t transaction_id)
12031215 {
12041216 RETURN_IF_NULL(context, GETDNS_RETURN_INVALID_PARAMETER);
1217 context->processing = 1;
12051218 getdns_return_t r = getdns_context_cancel_request(context, transaction_id, 1);
12061219 if (context->extension) {
12071220 context->extension->request_count_changed(context,
12081221 context->outbound_requests->count, context->extension_data);
12091222 }
1223 context->processing = 0;
12101224 return r;
12111225 } /* getdns_cancel_callback */
12121226
14091423 return GETDNS_RETURN_GOOD;
14101424 }
14111425
1412
1426 getdns_return_t
1427 getdns_context_request_timed_out(struct getdns_dns_req
1428 *req) {
1429 getdns_context* context = req->context;
1430 getdns_transaction_t trans_id = req->trans_id;
1431 getdns_callback_t cb = req->user_callback;
1432 void *user_arg = req->user_pointer;
1433
1434 /* cancel the req - also clears it from outbound and cleans up*/
1435 getdns_context_cancel_request(context, trans_id, 0);
1436 context->processing = 1;
1437 cb(context, GETDNS_CALLBACK_TIMEOUT, NULL, user_arg, trans_id);
1438 context->processing = 0;
1439 if (context->extension) {
1440 context->extension->request_count_changed(context,
1441 context->outbound_requests->count, context->extension_data);
1442 }
1443 return GETDNS_RETURN_GOOD;
1444 }
14131445
14141446 char *
14151447 getdns_strdup(const struct mem_funcs *mfs, const char *s)
15041536 /* process async reqs */
15051537 getdns_return_t getdns_context_process_async(struct getdns_context* context) {
15061538 RETURN_IF_NULL(context, GETDNS_RETURN_INVALID_PARAMETER);
1539 context->processing = 1;
15071540 if (ub_poll(context->unbound_ctx)) {
15081541 if (ub_process(context->unbound_ctx) != 0) {
15091542 /* need an async return code? */
1543 context->processing = 0;
15101544 return GETDNS_RETURN_GENERIC_ERROR;
15111545 }
15121546 }
1547 // reset the processing flag
1548 context->processing = 0;
15131549 if (context->extension != NULL) {
15141550 /* no need to process timeouts since it is delegated
15151551 * to the extension */
15231559 return GETDNS_RETURN_GENERIC_ERROR;
15241560 }
15251561 ldns_rbnode_t* next_timeout = ldns_rbtree_first(context->timeouts_by_time);
1526 while (next_timeout) {
1562 getdns_return_t r = GETDNS_RETURN_GOOD;
1563 while (next_timeout && r == GETDNS_RETURN_GOOD) {
15271564 getdns_timeout_data_t* timeout_data = (getdns_timeout_data_t*) next_timeout->data;
15281565 if (timeout_cmp(timeout_data, &key) > 0) {
15291566 /* no more timeouts need to be fired. */
15401577 }
15411578
15421579 /* fire the timeout */
1543 timeout_data->callback(timeout_data->userarg);
1544 }
1545
1546 return GETDNS_RETURN_GOOD;
1580 r = timeout_data->callback(timeout_data->userarg);
1581 }
1582
1583 return r;
15471584 }
15481585
15491586 typedef struct timeout_accumulator {
15761613 getdns_return_t
15771614 getdns_extension_detach_eventloop(struct getdns_context* context)
15781615 {
1579 RETURN_IF_NULL(context, GETDNS_RETURN_INVALID_PARAMETER);
1580 getdns_return_t r = GETDNS_RETURN_GOOD;
1581 if (context->extension) {
1582 /* cancel all outstanding requests */
1583 cancel_outstanding_requests(context, 1);
1584 r = context->extension->cleanup_data(context, context->extension_data);
1585 if (r != GETDNS_RETURN_GOOD) {
1586 return r;
1587 }
1588 context->extension = NULL;
1589 context->extension_data = NULL;
1590 }
1591 return r;
1616 RETURN_IF_NULL(context, GETDNS_RETURN_INVALID_PARAMETER);
1617 getdns_return_t r = GETDNS_RETURN_GOOD;
1618 if (context->extension) {
1619 /* When called from within a callback, do not execute pending
1620 * context destroys.
1621 * The (other) callback handler will handle it.
1622 *
1623 * ( because callbacks occur in cancel_outstanding_requests,
1624 * and they may destroy the context )
1625 */
1626 context->processing = 1;
1627 /* cancel all outstanding requests */
1628 cancel_outstanding_requests(context, 1);
1629 r = context->extension->cleanup_data(context,
1630 context->extension_data);
1631 if (r == GETDNS_RETURN_GOOD) {
1632 context->extension = NULL;
1633 context->extension_data = NULL;
1634 }
1635 context->processing = 0;
1636 }
1637 return r;
15921638 }
15931639
15941640 getdns_return_t
17821828 getdns_return_t
17831829 getdns_context_set_return_dnssec_status(getdns_context* context, int enabled) {
17841830 RETURN_IF_NULL(context, GETDNS_RETURN_INVALID_PARAMETER);
1785 if (enabled != GETDNS_EXTENSION_TRUE ||
1831 if (enabled != GETDNS_EXTENSION_TRUE &&
17861832 enabled != GETDNS_EXTENSION_FALSE) {
17871833 return GETDNS_RETURN_INVALID_PARAMETER;
17881834 }
17901836 return GETDNS_RETURN_GOOD;
17911837 }
17921838
1839 getdns_return_t
1840 getdns_context_set_use_threads(getdns_context* context, int use_threads) {
1841 RETURN_IF_NULL(context, GETDNS_RETURN_INVALID_PARAMETER);
1842 if (context->resolution_type_set != 0) {
1843 /* already setup */
1844 return GETDNS_RETURN_CONTEXT_UPDATE_FAIL;
1845 }
1846 int r = 0;
1847 if (use_threads)
1848 r = ub_ctx_async(context->unbound_ctx, 1);
1849 else
1850 r = ub_ctx_async(context->unbound_ctx, 0);
1851 return r == 0 ? GETDNS_RETURN_GOOD : GETDNS_RETURN_CONTEXT_UPDATE_FAIL;
1852 }
1853
17931854 /* context.c */
8989
9090 getdns_update_callback update_callback;
9191
92 int processing;
9293 int destroying;
9394
9495 struct mem_funcs mf;
155156 /* clear the outbound request from being tracked - does not cancel it */
156157 getdns_return_t getdns_context_clear_outbound_request(struct getdns_dns_req
157158 *req);
159
160 getdns_return_t getdns_context_request_timed_out(struct getdns_dns_req
161 *req);
162
158163 /* cancel callback internal - flag to indicate if req should be freed and callback fired */
159164 getdns_return_t getdns_context_cancel_request(struct getdns_context *context,
160165 getdns_transaction_t transaction_id, int fire_callback);
5454 getdns_dict_find(const struct getdns_dict *dict, const char *key)
5555 {
5656 return (struct getdns_dict_item *)
57 ldns_rbtree_search((ldns_rbtree_t *)&(dict->root), key);
57 ldns_rbtree_search((ldns_rbtree_t *)&(dict->root), key);
5858 } /* getdns_dict_find */
5959
6060 struct getdns_dict_item *
6363 struct getdns_dict_item *item;
6464
6565 item = (struct getdns_dict_item *)
66 ldns_rbtree_search(&(dict->root), key);
66 ldns_rbtree_search(&(dict->root), key);
6767
6868 if (!item) {
6969 /* add a node */
8080 */
8181 getdns_return_t
8282 getdns_dict_get_names(const struct getdns_dict * dict,
83 struct getdns_list ** answer)
83 struct getdns_list ** answer)
8484 {
8585 struct getdns_dict_item *item;
8686 size_t index;
9090 return GETDNS_RETURN_INVALID_PARAMETER;
9191
9292 *answer = getdns_list_create_with_extended_memory_functions(
93 dict->mf.mf_arg, dict->mf.mf.ext.malloc,
94 dict->mf.mf.ext.realloc, dict->mf.mf.ext.free);
93 dict->mf.mf_arg, dict->mf.mf.ext.malloc,
94 dict->mf.mf.ext.realloc, dict->mf.mf.ext.free);
9595 if (!*answer)
9696 return GETDNS_RETURN_NO_SUCH_DICT_NAME;
9797
9898 LDNS_RBTREE_FOR(item, struct getdns_dict_item *,
99 (ldns_rbtree_t *)&(dict->root)) {
99 (ldns_rbtree_t *)&(dict->root)) {
100100 if (getdns_list_add_item(*answer, &index) != GETDNS_RETURN_GOOD)
101101 continue;
102102 bindata.size = strlen(item->node.key) + 1;
109109 /*---------------------------------------- getdns_dict_get_data_type */
110110 getdns_return_t
111111 getdns_dict_get_data_type(const struct getdns_dict * dict, const char *name,
112 getdns_data_type * answer)
112 getdns_data_type * answer)
113113 {
114114 struct getdns_dict_item *item;
115115
127127 /*---------------------------------------- getdns_dict_get_dict */
128128 getdns_return_t
129129 getdns_dict_get_dict(const struct getdns_dict * dict, const char *name,
130 struct getdns_dict ** answer)
130 struct getdns_dict ** answer)
131131 {
132132 struct getdns_dict_item *item;
133133
136136
137137 item = getdns_dict_find(dict, name);
138138 if (!item)
139 return GETDNS_RETURN_NO_SUCH_DICT_NAME;
140
141 if (item->dtype != t_dict)
139 return GETDNS_RETURN_NO_SUCH_DICT_NAME;
140
141 if (item->dtype != t_dict)
142142 return GETDNS_RETURN_WRONG_TYPE_REQUESTED;
143143
144144 *answer = item->data.dict;
148148 /*---------------------------------------- getdns_dict_get_list */
149149 getdns_return_t
150150 getdns_dict_get_list(const struct getdns_dict * dict, const char *name,
151 struct getdns_list ** answer)
151 struct getdns_list ** answer)
152152 {
153153 struct getdns_dict_item *item;
154154
157157
158158 item = getdns_dict_find(dict, name);
159159 if (!item)
160 return GETDNS_RETURN_NO_SUCH_DICT_NAME;
161
162 if (item->dtype != t_list)
160 return GETDNS_RETURN_NO_SUCH_DICT_NAME;
161
162 if (item->dtype != t_list)
163163 return GETDNS_RETURN_WRONG_TYPE_REQUESTED;
164164
165165 *answer = item->data.list;
169169 /*---------------------------------------- getdns_dict_get_bindata */
170170 getdns_return_t
171171 getdns_dict_get_bindata(const struct getdns_dict * dict, const char *name,
172 struct getdns_bindata ** answer)
172 struct getdns_bindata ** answer)
173173 {
174174 struct getdns_dict_item *item;
175175
178178
179179 item = getdns_dict_find(dict, name);
180180 if (!item)
181 return GETDNS_RETURN_NO_SUCH_DICT_NAME;
182
183 if (item->dtype != t_bindata)
181 return GETDNS_RETURN_NO_SUCH_DICT_NAME;
182
183 if (item->dtype != t_bindata)
184184 return GETDNS_RETURN_WRONG_TYPE_REQUESTED;
185185
186186 *answer = item->data.bindata;
190190 /*---------------------------------------- getdns_dict_get_int */
191191 getdns_return_t
192192 getdns_dict_get_int(const struct getdns_dict * dict, const char *name,
193 uint32_t * answer)
193 uint32_t * answer)
194194 {
195195 struct getdns_dict_item *item;
196196
199199
200200 item = getdns_dict_find(dict, name);
201201 if (!item)
202 return GETDNS_RETURN_NO_SUCH_DICT_NAME;
203
204 if (item->dtype != t_int)
202 return GETDNS_RETURN_NO_SUCH_DICT_NAME;
203
204 if (item->dtype != t_int)
205205 return GETDNS_RETURN_WRONG_TYPE_REQUESTED;
206206
207207 *answer = item->data.n;
210210
211211 struct getdns_dict *
212212 getdns_dict_create_with_extended_memory_functions(
213 void *userarg,
214 void *(*malloc)(void *userarg, size_t),
215 void *(*realloc)(void *userarg, void *, size_t),
216 void (*free)(void *userarg, void *))
213 void *userarg,
214 void *(*malloc)(void *userarg, size_t),
215 void *(*realloc)(void *userarg, void *, size_t),
216 void (*free)(void *userarg, void *))
217217 {
218218 struct getdns_dict *dict;
219219 mf_union mf;
223223
224224 mf.ext.malloc = malloc;
225225 dict = userarg == MF_PLAIN
226 ? (struct getdns_dict*)(*mf.pln.malloc)(
227 sizeof(struct getdns_dict))
228 : (struct getdns_dict*)(*mf.ext.malloc)(userarg,
229 sizeof(struct getdns_dict));
226 ? (struct getdns_dict*)(*mf.pln.malloc)(
227 sizeof(struct getdns_dict))
228 : (struct getdns_dict*)(*mf.ext.malloc)(userarg,
229 sizeof(struct getdns_dict));
230230 if (!dict)
231231 return NULL;
232232
236236 dict->mf.mf.ext.free = free;
237237
238238 ldns_rbtree_init(&(dict->root),
239 (int (*)(const void *, const void *)) strcmp);
239 (int (*)(const void *, const void *)) strcmp);
240240 return dict;
241241 }
242242
243243 struct getdns_dict *
244244 getdns_dict_create_with_memory_functions(void *(*malloc)(size_t),
245 void *(*realloc)(void *, size_t), void (*free)(void *))
245 void *(*realloc)(void *, size_t), void (*free)(void *))
246246 {
247247 mf_union mf;
248248 mf.pln.malloc = malloc;
249249 mf.pln.realloc = realloc;
250250 mf.pln.free = free;
251251 return getdns_dict_create_with_extended_memory_functions(
252 MF_PLAIN, mf.ext.malloc, mf.ext.realloc, mf.ext.free);
252 MF_PLAIN, mf.ext.malloc, mf.ext.realloc, mf.ext.free);
253253 }
254254
255255 /*-------------------------- getdns_dict_create_with_context */
258258 {
259259 if (context)
260260 return getdns_dict_create_with_extended_memory_functions(
261 context->mf.mf_arg, context->mf.mf.ext.malloc,
262 context->mf.mf.ext.realloc, context->mf.mf.ext.free);
261 context->mf.mf_arg, context->mf.mf.ext.malloc,
262 context->mf.mf.ext.realloc, context->mf.mf.ext.free);
263263 else
264264 return getdns_dict_create_with_memory_functions(&malloc,
265 &realloc, &free);
265 &realloc, &free);
266266 } /* getdns_dict_create_with_context */
267267
268268 /*---------------------------------------- getdns_dict_create */
283283 */
284284 getdns_return_t
285285 getdns_dict_copy(const struct getdns_dict * srcdict,
286 struct getdns_dict ** dstdict)
286 struct getdns_dict ** dstdict)
287287 {
288288 struct getdns_dict_item *item;
289289 char *key;
297297 return GETDNS_RETURN_GOOD;
298298 }
299299 *dstdict = getdns_dict_create_with_extended_memory_functions(
300 srcdict->mf.mf_arg,
301 srcdict->mf.mf.ext.malloc,
302 srcdict->mf.mf.ext.realloc,
303 srcdict->mf.mf.ext.free);
300 srcdict->mf.mf_arg,
301 srcdict->mf.mf.ext.malloc,
302 srcdict->mf.mf.ext.realloc,
303 srcdict->mf.mf.ext.free);
304304 if (!*dstdict)
305305 return GETDNS_RETURN_GENERIC_ERROR;
306306
307307 retval = GETDNS_RETURN_GOOD;
308308 LDNS_RBTREE_FOR(item, struct getdns_dict_item *,
309 (struct ldns_rbtree_t *)&(srcdict->root)) {
309 (struct ldns_rbtree_t *)&(srcdict->root)) {
310310 key = (char *) item->node.key;
311311 switch (item->dtype) {
312312 case t_bindata:
313313 retval = getdns_dict_set_bindata(*dstdict, key,
314 item->data.bindata);
314 item->data.bindata);
315315 break;
316316
317317 case t_dict:
318318 retval = getdns_dict_set_dict(*dstdict, key,
319 item->data.dict);
319 item->data.dict);
320320 break;
321321
322322 case t_int:
323323 retval = getdns_dict_set_int(*dstdict, key,
324 item->data.n);
324 item->data.n);
325325 break;
326326
327327 case t_list:
328328 retval = getdns_dict_set_list(*dstdict, key,
329 item->data.list);
329 item->data.list);
330330 break;
331331 }
332332 if (retval != GETDNS_RETURN_GOOD) {
372372 } /* getdns_dict_item_free */
373373
374374 /*---------------------------------------- getdns_dict_destroy */
375 void
375 getdns_return_t
376376 getdns_dict_destroy(struct getdns_dict *dict)
377377 {
378378 if (!dict)
379 return;
379 return GETDNS_RETURN_INVALID_PARAMETER;
380380
381381 ldns_traverse_postorder(&(dict->root),
382 getdns_dict_item_free, dict);
382 getdns_dict_item_free, dict);
383383 GETDNS_FREE(dict->mf, dict);
384 return GETDNS_RETURN_GOOD;
384385 } /* getdns_dict_destroy */
385386
386387 /*---------------------------------------- getdns_dict_set_dict */
387388 getdns_return_t
388389 getdns_dict_set_dict(struct getdns_dict * dict, const char *name,
389 const struct getdns_dict * child_dict)
390 const struct getdns_dict * child_dict)
390391 {
391392 struct getdns_dict_item *item;
392393 struct getdns_dict *newdict;
412413 /*---------------------------------------- getdns_dict_set_list */
413414 getdns_return_t
414415 getdns_dict_set_list(struct getdns_dict * dict, const char *name,
415 const struct getdns_list * child_list)
416 const struct getdns_list * child_list)
416417 {
417418 struct getdns_dict_item *item;
418419 struct getdns_list *newlist;
438439 /*---------------------------------------- getdns_dict_set_bindata */
439440 getdns_return_t
440441 getdns_dict_set_bindata(struct getdns_dict * dict, const char *name,
441 const struct getdns_bindata * child_bindata)
442 const struct getdns_bindata * child_bindata)
442443 {
443444 struct getdns_dict_item *item;
444445 struct getdns_bindata *newbindata;
463464 /*---------------------------------------- getdns_dict_set_int */
464465 getdns_return_t
465466 getdns_dict_set_int(struct getdns_dict * dict, const char *name,
466 uint32_t child_uint32)
467 uint32_t child_uint32)
467468 {
468469 struct getdns_dict_item *item;
469470
489490 getdns_indent(size_t indent)
490491 {
491492 static const char *spaces = " "
492 " ";
493 " ";
493494 return spaces + 80 - (indent < 80 ? indent : 0);
494495 } /* getdns_indent */
495496
502503 n_labels++;
503504 }
504505 return i == bindata->size && n_labels > 1 &&
505 bindata->data[bindata->size - 1] == 0;
506 bindata->data[bindata->size - 1] == 0;
506507 }
507508
508509 /*---------------------------------------- getdns_pp_bindata */
516517 */
517518 static int
518519 getdns_pp_bindata(ldns_buffer * buf, size_t indent,
519 struct getdns_bindata *bindata)
520 struct getdns_bindata *bindata)
520521 {
521522 size_t i, p = ldns_buffer_position(buf);
522523 uint8_t *dptr;
541542
542543 } else if (priv_getdns_bindata_is_dname(bindata)) {
543544 if (GETDNS_RETURN_GOOD ==
544 getdns_convert_dns_name_to_fqdn(bindata, &dname) &&
545 ldns_buffer_printf(buf, "for %s>", dname) < 0) {
545 getdns_convert_dns_name_to_fqdn(bindata, &dname) &&
546 ldns_buffer_printf(buf, "for %s>", dname) < 0) {
546547 free(dname);
547548 return -1;
548549 }
552553 if (ldns_buffer_printf(buf, "of 0x") < 0)
553554 return -1;
554555 for (dptr = bindata->data;
555 dptr < bindata->data + bindata->size; dptr++) {
556 dptr < bindata->data + bindata->size; dptr++) {
556557 if (dptr - bindata->data >= 16) {
557558 if (ldns_buffer_printf(buf, "...") < 0)
558559 return -1;
569570
570571 static int
571572 getdns_pp_dict(ldns_buffer * buf, size_t indent,
572 const struct getdns_dict *dict);
573 const struct getdns_dict *dict);
573574
574575 /*---------------------------------------- getdns_pp_list */
575576 /**
612613 switch (dtype) {
613614 case t_int:
614615 if (getdns_list_get_int(list, i, &int_item) !=
615 GETDNS_RETURN_GOOD ||
616 ldns_buffer_printf(buf, "%d", (int) int_item) < 0)
616 GETDNS_RETURN_GOOD ||
617 ldns_buffer_printf(buf, "%d", (int) int_item) < 0)
617618 return -1;
618619 break;
619620
620621 case t_bindata:
621622 if (getdns_list_get_bindata(list, i, &bindata_item) !=
622 GETDNS_RETURN_GOOD)
623 GETDNS_RETURN_GOOD)
623624 return -1;
624625 if (getdns_pp_bindata(buf, indent, bindata_item) < 0)
625626 return -1;
627628
628629 case t_list:
629630 if (getdns_list_get_list(list, i, &list_item) !=
630 GETDNS_RETURN_GOOD)
631 GETDNS_RETURN_GOOD)
631632 return -1;
632633 if (getdns_pp_list(buf, indent, list_item) < 0)
633634 return -1;
635636
636637 case t_dict:
637638 if (getdns_list_get_dict(list, i, &dict_item) !=
638 GETDNS_RETURN_GOOD)
639 GETDNS_RETURN_GOOD)
639640 return -1;
640641 if (getdns_pp_dict(buf, indent, dict_item) < 0)
641642 return -1;
735736 */
736737 static int
737738 getdns_pp_dict(ldns_buffer * buf, size_t indent,
738 const struct getdns_dict *dict)
739 const struct getdns_dict *dict)
739740 {
740741 size_t i, length, p = ldns_buffer_position(buf);
741742 struct getdns_dict_item *item;
750751 i = 0;
751752 indent += 2;
752753 LDNS_RBTREE_FOR(item, struct getdns_dict_item *,
753 (ldns_rbtree_t *)&(dict->root)) {
754 (ldns_rbtree_t *)&(dict->root)) {
754755 if (ldns_buffer_printf(buf, "%s\n%s\"%s\":", (i ? "," : "")
755756 , getdns_indent(indent)
756757 , item->node.key) < 0)
759760 switch (item->dtype) {
760761 case t_int:
761762 if ((strcmp(item->node.key, "type") == 0 ||
762 strcmp(item->node.key, "type_covered") == 0 ||
763 strcmp(item->node.key, "qtype") == 0) &&
764 (strval = priv_getdns_rr_type_name(item->data.n))) {
763 strcmp(item->node.key, "type_covered") == 0 ||
764 strcmp(item->node.key, "qtype") == 0) &&
765 (strval = priv_getdns_rr_type_name(item->data.n))) {
765766 if (ldns_buffer_printf(
766 buf, " GETDNS_RRTYPE_%s", strval) < 0)
767 buf, " GETDNS_RRTYPE_%s", strval) < 0)
767768 return -1;
768769 break;
769770 }
770 if ((strcmp(item->node.key, "answer_type") == 0 ||
771 strcmp(item->node.key, "dnssec_status") == 0 ||
772 strcmp(item->node.key, "status") == 0) &&
773 (strval =
774 priv_getdns_get_const_info(item->data.n)->name)) {
771 if ((strcmp(item->node.key, "answer_type") == 0 ||
772 strcmp(item->node.key, "dnssec_status") == 0 ||
773 strcmp(item->node.key, "status") == 0) &&
774 (strval =
775 priv_getdns_get_const_info(item->data.n)->name)) {
775776 if (ldns_buffer_printf(buf, " %s", strval) < 0)
776777 return -1;
777778 break;
778779 }
779 if ((strcmp(item->node.key, "class") == 0 ||
780 strcmp(item->node.key, "qclass") == 0) &&
781 priv_getdns_print_class(buf, item->data.n))
780 if ((strcmp(item->node.key, "class") == 0 ||
781 strcmp(item->node.key, "qclass") == 0) &&
782 priv_getdns_print_class(buf, item->data.n))
782783 break;
783 if (strcmp(item->node.key, "opcode") == 0 &&
784 priv_getdns_print_opcode(buf, item->data.n))
784 if (strcmp(item->node.key, "opcode") == 0 &&
785 priv_getdns_print_opcode(buf, item->data.n))
785786 break;
786 if (strcmp(item->node.key, "rcode") == 0 &&
787 priv_getdns_print_rcode(buf, item->data.n))
787 if (strcmp(item->node.key, "rcode") == 0 &&
788 priv_getdns_print_rcode(buf, item->data.n))
788789 break;
789790 if (ldns_buffer_printf(buf, " %d", item->data.n) < 0)
790791 return -1;
868869 getdns_return_t
869870 getdns_dict_remove_name(struct getdns_dict *this_dict, const char *name)
870871 {
871 struct getdns_dict_item *item;
872
873 if (!this_dict || !name)
874 return GETDNS_RETURN_INVALID_PARAMETER;
875
876 item = getdns_dict_find(this_dict, name);
877 if (!item)
878 return GETDNS_RETURN_NO_SUCH_DICT_NAME;
879
880 /* cleanup */
881 ldns_rbtree_delete(&this_dict->root, name);
882 getdns_dict_item_free(&item->node, this_dict);
872 struct getdns_dict_item *item;
873
874 if (!this_dict || !name)
875 return GETDNS_RETURN_INVALID_PARAMETER;
876
877 item = getdns_dict_find(this_dict, name);
878 if (!item)
879 return GETDNS_RETURN_NO_SUCH_DICT_NAME;
880
881 /* cleanup */
882 ldns_rbtree_delete(&this_dict->root, name);
883 getdns_dict_item_free(&item->node, this_dict);
883884
884885 return GETDNS_RETURN_GENERIC_ERROR;
885886 }
2626 #include <getdns/getdns.h>
2727 #include <getdns/getdns_ext_libevent.h>
2828 #ifdef HAVE_EVENT2_EVENT_H
29 #include <event2/event.h>
29 #include <event2/event.h>
3030 #else
31 # ifndef u_char
32 # define u_char unsigned char
33 # endif
34 #include <event.h>
31 #include <event.h>
3532 #endif
33
34 #ifndef HAVE_U_CHAR
35 typedef unsigned char u_char;
36 #endif
5858 static void
5959 getdns_libev_cb(struct ev_loop *loop, struct ev_io *handle, int revents) {
6060 struct getdns_context* context = (struct getdns_context*) handle->data;
61 getdns_context_process_async(context);
61 if (getdns_context_process_async(context) == GETDNS_RETURN_BAD_CONTEXT) {
62 // context destroyed
63 return;
64 }
6265 uint32_t rc = getdns_context_get_num_pending_requests(context, NULL);
6366 struct getdns_libev_data* ev_data =
6467 (struct getdns_libev_data*) getdns_context_get_extension_data(context);
6972 getdns_libev_timeout_cb(struct ev_loop *loop, struct ev_timer* handle, int status) {
7073 getdns_timeout_data_t* timeout_data = (getdns_timeout_data_t*) handle->data;
7174 timeout_data->callback(timeout_data->userarg);
72 uint32_t rc = getdns_context_get_num_pending_requests(timeout_data->context, NULL);
73 struct getdns_libev_data* ev_data =
74 (struct getdns_libev_data*) getdns_context_get_extension_data(timeout_data->context);
75 request_count_changed(rc, ev_data);
7675 }
7776
7877 /* getdns extension functions */
8787 static void
8888 getdns_libevent_cb(evutil_socket_t fd, short what, void *userarg) {
8989 struct getdns_context* context = (struct getdns_context*) userarg;
90 getdns_context_process_async(context);
90 if (getdns_context_process_async(context) == GETDNS_RETURN_BAD_CONTEXT) {
91 // context destroyed
92 return;
93 }
9194 uint32_t rc = getdns_context_get_num_pending_requests(context, NULL);
9295 struct event_data* ev_data =
9396 (struct event_data*) getdns_context_get_extension_data(context);
98101 getdns_libevent_timeout_cb(evutil_socket_t fd, short what, void* userarg) {
99102 getdns_timeout_data_t* timeout_data = (getdns_timeout_data_t*) userarg;
100103 timeout_data->callback(timeout_data->userarg);
101 uint32_t rc = getdns_context_get_num_pending_requests(timeout_data->context, NULL);
102 struct event_data* ev_data =
103 (struct event_data*) getdns_context_get_extension_data(timeout_data->context);
104 request_count_changed(rc, ev_data);
105104 }
106105
107106 /* getdns extension functions */
4343 struct getdns_libuv_data {
4444 uv_loop_t* loop;
4545 uv_poll_t* poll_handle;
46 uint8_t polling;
4746 };
4847
4948 static void request_count_changed(uint32_t request_count, struct getdns_libuv_data *uv_data);
5251 static void
5352 getdns_libuv_cb(uv_poll_t* handle, int status, int events) {
5453 struct getdns_context* context = (struct getdns_context*) handle->data;
55 getdns_context_process_async(context);
54 if (getdns_context_process_async(context) == GETDNS_RETURN_BAD_CONTEXT) {
55 // context destroyed
56 return;
57 }
5658 uint32_t rc = getdns_context_get_num_pending_requests(context, NULL);
5759 struct getdns_libuv_data* uv_data =
5860 (struct getdns_libuv_data*) getdns_context_get_extension_data(context);
6163
6264 static void
6365 request_count_changed(uint32_t request_count, struct getdns_libuv_data *uv_data) {
64 if (request_count > 0 && uv_data->polling == 0) {
66 if (request_count > 0 && !uv_is_active((uv_handle_t*) uv_data->poll_handle)) {
6567 uv_poll_start(uv_data->poll_handle, UV_READABLE, getdns_libuv_cb);
66 uv_data->polling = 1;
67 } else if (request_count == 0 && uv_data->polling == 1) {
68 } else if (request_count == 0 && uv_is_active((uv_handle_t*) uv_data->poll_handle)) {
6869 uv_poll_stop(uv_data->poll_handle);
69 uv_data->polling = 0;
7070 }
7171 }
7272
7474 getdns_libuv_timeout_cb(uv_timer_t* handle, int status) {
7575 getdns_timeout_data_t* timeout_data = (getdns_timeout_data_t*) handle->data;
7676 timeout_data->callback(timeout_data->userarg);
77 uint32_t rc = getdns_context_get_num_pending_requests(timeout_data->context, NULL);
78 struct getdns_libuv_data* uv_data =
79 (struct getdns_libuv_data*) getdns_context_get_extension_data(timeout_data->context);
80 request_count_changed(rc, uv_data);
8177 }
8278
8379 static void
8480 getdns_libuv_close_cb(uv_handle_t* handle) {
85 if (handle) {
86 free(handle);
87 }
81 free(handle);
8882 }
8983
9084 /* getdns extension functions */
162156 }
163157 int fd = getdns_context_fd(context);
164158 uv_data->poll_handle = (uv_poll_t*) malloc(sizeof(uv_poll_t));
159 if (!uv_data->poll_handle) {
160 free(uv_data);
161 return GETDNS_RETURN_MEMORY_ERROR;
162 }
165163 uv_poll_init(uv_loop, uv_data->poll_handle, fd);
166164 uv_data->poll_handle->data = context;
167165 uv_data->loop = uv_loop;
168 uv_data->polling = 0;
169166 return getdns_extension_set_eventloop(context, &LIBUV_EXT, uv_data);
170167 } /* getdns_extension_set_libuv_loop */
4949
5050 /* declarations */
5151 static void ub_resolve_callback(void* mydata, int err, struct ub_result* result);
52 static void ub_resolve_timeout(void *arg);
53 static void ub_local_resolve_timeout(void *arg);
52 static getdns_return_t ub_resolve_timeout(void *arg);
53 static getdns_return_t ub_local_resolve_timeout(void *arg);
5454
5555 static void handle_network_request_error(getdns_network_req * netreq, int err);
5656 static void handle_dns_request_complete(getdns_dns_req * dns_req);
6464 } netreq_cb_data;
6565
6666 /* cancel, cleanup and send timeout to callback */
67 static void
67 static getdns_return_t
6868 ub_resolve_timeout(void *arg)
6969 {
7070 getdns_dns_req *dns_req = (getdns_dns_req *) arg;
71 struct getdns_context *context = dns_req->context;
72 getdns_transaction_t trans_id = dns_req->trans_id;
73 getdns_callback_t cb = dns_req->user_callback;
74 void *user_arg = dns_req->user_pointer;
75
76 /* cancel the req - also clears it from outbound and cleans up*/
77 getdns_context_cancel_request(context, trans_id, 0);
78
79 cb(context, GETDNS_CALLBACK_TIMEOUT, NULL, user_arg, trans_id);
80 }
81
82 static void
71 return getdns_context_request_timed_out(dns_req);
72 }
73
74 static getdns_return_t
8375 ub_local_resolve_timeout(void *arg)
8476 {
8577 netreq_cb_data *cb_data = (netreq_cb_data *) arg;
9890
9991 /* cleanup the state */
10092 GETDNS_FREE(dnsreq->my_mf, cb_data);
93 return GETDNS_RETURN_GOOD;
10194 }
10295
10396 void priv_getdns_call_user_callback(getdns_dns_req *dns_req,
(New empty file)
0 This directory contains the getdns API description that serves as the target of this implementation.
648648 * you MUST copy those instances BEFORE you destroy the list else
649649 * unpleasant things will happen at run-time
650650 */
651 void getdns_list_destroy(getdns_list *this_list);
651 getdns_return_t getdns_list_destroy(getdns_list *this_list);
652652
653653 /**
654654 * assign the child_dict to an item in a parent list, the parent list copies
715715 * be aware that if you have fetched any data from the dictionary it will
716716 * no longer be available (you are likely to experience bad things if you try)
717717 */
718 void getdns_dict_destroy(getdns_dict *this_dict);
718 getdns_return_t getdns_dict_destroy(getdns_dict *this_dict);
719719
720720 getdns_return_t getdns_dict_set_dict(getdns_dict *this_dict,
721721 const char *name, const getdns_dict *child_dict);
814814 void (*free) (void *userarg, void *)
815815 );
816816
817 void getdns_context_destroy(getdns_context *context);
817 getdns_return_t getdns_context_destroy(getdns_context *context);
818818
819819 getdns_return_t
820820 getdns_cancel_callback(getdns_context *context,
3030 #include <getdns/getdns.h>
3131 #include <sys/time.h>
3232
33 #ifdef __cplusplus
34 extern "C" {
35 #endif
36
3337 /* Enable the return_dnssec_status extension on every request.
3438 value is either GETDNS_EXTENSION_TRUE or GETDNS_EXTENSION_FALSE
3539 returns GETDNS_RETURN_GOOD on success or GETDNS_RETURN_INVALID_PARAMETER
5458 /* process async reqs */
5559 getdns_return_t getdns_context_process_async(getdns_context* context);
5660
61 /* tells underlying unbound to use background threads or fork */
62 getdns_return_t getdns_context_set_use_threads(getdns_context* context, int use_threads);
5763
5864 /* extensions */
59 typedef void (*getdns_timeout_callback) (void* userarg);
65 typedef getdns_return_t (*getdns_timeout_callback) (void* userarg);
6066
6167 /* context timeout data */
6268 typedef struct getdns_timeout_data {
114120 getdns_return_t
115121 getdns_extension_detach_eventloop(struct getdns_context* context);
116122
123 #ifdef __cplusplus
124 }
125 #endif
117126
118127 #endif
0 <!DOCTYPE html SYSTEM 'about:legacy-compat'>
1 <html><head><title>DNS API Description</title>
2 <meta http-equiv="Content-type" content="text/html;charset=UTF-8">
3
4 <!--
5 Need different returns for getdns_address, getdns_hostname, and getdns_service;
6 also need to fix examples
7 -->
8
9 <style type="text/css">
10 <!--
11 div.forh { white-space: pre; font-family: monospace; margin-top: 0; margin-bottom: 0 }
12 h1 { font-size: 18pt; }
13 h2 { font-size: 14pt; }
14 p { margin-bottom: 0 }
15 p.title { font-size: 24pt; font-weight: bold; margin-top: 0; margin-bottom: 0; text-align: center; }
16 p.title2 { font-size: 12pt; margin-top: 0; text-align: center; }
17 p.define { font-family: monospace; font-weight: bold; margin-bottom: 0; margin-left: 2em; }
18 p.descrip { margin-left: 4em; margin-top: 0; }
19 p.cont { margin-top: 0 }
20 p.bull { margin-top: 0; margin-bottom: 0 }
21 p.bull:before { content: "• " }
22 pre { margin-bottom: 0 }
23 table { border-spacing: 8pt }
24 td, th { vertical-align: top; text-align: left }
25 td.num { font-weight: bold; width: 2em }
26 tr.code { font-family: monospace }
27 .done { background: lightgreen }
28 .wontdo { background: lightpink }
29 .moved { background: lightskyblue }
30 .default { font-weight: bold }
31 /* The following is for Pygments-highlighted code */
32 .highlight .hll { background-color: #ffffcc }
33 .highlight { background: #ffffff; }
34 .highlight .c { color: #408080; font-style: italic } /* Comment */
35 .highlight .err { border: 1px solid #FF0000 } /* Error */
36 .highlight .k { color: #008000; font-weight: bold } /* Keyword */
37 .highlight .o { color: #666666 } /* Operator */
38 .highlight .cm { color: #408080; font-style: italic } /* Comment.Multiline */
39 .highlight .cp { color: #BC7A00 } /* Comment.Preproc */
40 .highlight .c1 { color: #408080; font-style: italic } /* Comment.Single */
41 .highlight .cs { color: #408080; font-style: italic } /* Comment.Special */
42 .highlight .gd { color: #A00000 } /* Generic.Deleted */
43 .highlight .ge { font-style: italic } /* Generic.Emph */
44 .highlight .gr { color: #FF0000 } /* Generic.Error */
45 .highlight .gh { color: #000080; font-weight: bold } /* Generic.Heading */
46 .highlight .gi { color: #00A000 } /* Generic.Inserted */
47 .highlight .go { color: #808080 } /* Generic.Output */
48 .highlight .gp { color: #000080; font-weight: bold } /* Generic.Prompt */
49 .highlight .gs { font-weight: bold } /* Generic.Strong */
50 .highlight .gu { color: #800080; font-weight: bold } /* Generic.Subheading */
51 .highlight .gt { color: #0040D0 } /* Generic.Traceback */
52 .highlight .kc { color: #008000; font-weight: bold } /* Keyword.Constant */
53 .highlight .kd { color: #008000; font-weight: bold } /* Keyword.Declaration */
54 .highlight .kn { color: #008000; font-weight: bold } /* Keyword.Namespace */
55 .highlight .kp { color: #008000 } /* Keyword.Pseudo */
56 .highlight .kr { color: #008000; font-weight: bold } /* Keyword.Reserved */
57 .highlight .kt { color: #B00040 } /* Keyword.Type */
58 .highlight .m { color: #666666 } /* Literal.Number */
59 .highlight .s { color: #BA2121 } /* Literal.String */
60 .highlight .na { color: #7D9029 } /* Name.Attribute */
61 .highlight .nb { color: #008000 } /* Name.Builtin */
62 .highlight .nc { color: #0000FF; font-weight: bold } /* Name.Class */
63 .highlight .no { color: #880000 } /* Name.Constant */
64 .highlight .nd { color: #AA22FF } /* Name.Decorator */
65 .highlight .ni { color: #999999; font-weight: bold } /* Name.Entity */
66 .highlight .ne { color: #D2413A; font-weight: bold } /* Name.Exception */
67 .highlight .nf { color: #0000FF } /* Name.Function */
68 .highlight .nl { color: #A0A000 } /* Name.Label */
69 .highlight .nn { color: #0000FF; font-weight: bold } /* Name.Namespace */
70 .highlight .nt { color: #008000; font-weight: bold } /* Name.Tag */
71 .highlight .nv { color: #19177C } /* Name.Variable */
72 .highlight .ow { color: #AA22FF; font-weight: bold } /* Operator.Word */
73 .highlight .w { color: #bbbbbb } /* Text.Whitespace */
74 .highlight .mf { color: #666666 } /* Literal.Number.Float */
75 .highlight .mh { color: #666666 } /* Literal.Number.Hex */
76 .highlight .mi { color: #666666 } /* Literal.Number.Integer */
77 .highlight .mo { color: #666666 } /* Literal.Number.Oct */
78 .highlight .sb { color: #BA2121 } /* Literal.String.Backtick */
79 .highlight .sc { color: #BA2121 } /* Literal.String.Char */
80 .highlight .sd { color: #BA2121; font-style: italic } /* Literal.String.Doc */
81 .highlight .s2 { color: #BA2121 } /* Literal.String.Double */
82 .highlight .se { color: #BB6622; font-weight: bold } /* Literal.String.Escape */
83 .highlight .sh { color: #BA2121 } /* Literal.String.Heredoc */
84 .highlight .si { color: #BB6688; font-weight: bold } /* Literal.String.Interpol */
85 .highlight .sx { color: #008000 } /* Literal.String.Other */
86 .highlight .sr { color: #BB6688 } /* Literal.String.Regex */
87 .highlight .s1 { color: #BA2121 } /* Literal.String.Single */
88 .highlight .ss { color: #19177C } /* Literal.String.Symbol */
89 .highlight .bp { color: #008000 } /* Name.Builtin.Pseudo */
90 .highlight .vc { color: #19177C } /* Name.Variable.Class */
91 .highlight .vg { color: #19177C } /* Name.Variable.Global */
92 .highlight .vi { color: #19177C } /* Name.Variable.Instance */
93 .highlight .il { color: #666666 } /* Literal.Number.Integer.Long */-->
94 </style>
95 </head><body>
96
97 <p class=title>Description of the <code>getdns</code> API</p>
98 <p class=title2>Paul Hoffman, Editor</p>
99 <p class=title2>Document version: "getdns December 2013"</p>
100
101 <p>This document describes a modern asynchronous DNS API. This new API is intended to be useful to
102 application developers and operating system distributors as a way of making
103 all types of DNS information easily available in many types of programs. The major features
104 of this new API are:</p>
105
106 <ul>
107 <li>Full support for event-driven programming</li>
108 <li>Supports DNSSEC in multiple ways</li>
109 <li>Mirroring of the resolution in <code>getaddrinfo()</code></li>
110 <li>Easily supports all RRtypes, even those yet to be defined</li>
111 </ul>
112
113 <p>There is more background into the design and future goals of this API
114 <a href="#Commentary">later in this document</a>.</p>
115
116 <p>This document was discussed on the <a href="http://www.vpnc.org/mailman/listinfo/getdns-api">
117 getdns-api mailing list</a>; future versions of the API might be discussed there as well.
118 (If you
119 want to contact the editor off-list, please send mail to <a
120 href="mailto:paul.hoffman@vpnc.org">paul.hoffman@vpnc.org</a>.)</p>
121
122 <h1>1. The <code>getdns</code> Async Functions</h1>
123
124 <p>The API has four async functions:</p>
125
126 <ul>
127
128 <li><code>getdns_address</code> for doing <code>getaddrinfo()</code>-like address lookups</li>
129
130 <li><code>getdns_hostname</code> for doing <code>getnameinfo()</code>-like name lookups</li>
131
132 <li><code>getdns_service</code> for getting results from SRV lookups</li>
133
134 <li><code>getdns_general</code> for looking up any type of DNS record</li>
135
136 </ul>
137
138 <h2>1.1 <code>getdns_general()</code></h2>
139
140 <div class=forh id="getdnsfuncgeneral">getdns_return_t
141 getdns_general(
142 struct getdns_context *context,
143 const char *name,
144 uint16_t request_type,
145 struct getdns_dict *extensions,
146 void *userarg,
147 getdns_transaction_t *transaction_id,
148 getdns_callback_t callbackfn
149 );
150 </div>
151
152 <p class=define><code><b>context</b></code></p>
153 <p class=descrip>A pointer to the DNS context that is to be used with this call. DNS contexts are
154 described <a href="#Contexts">later in this document</a>. Note that a context <i>must</i> be created
155 before calling the function.</p>
156
157 <p class=define><code><b>*name</b></code></p>
158 <p class=descrip>This is a null-terminted string consisting of either an
159 ASCII-based domain name to be looked up, or a null-terminted text string that is an IPv4 or IPv6 address.
160 The values here follow the rules in section 2.1 of RFC 4343
161 to allow non-ASCII octets and special characters in labels.</p>
162
163 <p class=define><code><b>request_type</b></code></p>
164 <p class=descrip>Specifies the RRtype for the query; the RRtype numbers are listed in the IANA
165 registry. For example, to get the NS records, <code>request_type</code> would be 2. The API also has
166 defined macros for most of the RRtypes by name; the definition names all start with
167 "<code>GETDNS_RRTYPE_</code>". For example, to get the NS records, you can also set the
168 <code>request_type</code> to <code>GETDNS_RRTYPE_NS</code>.
169 (The full list of request types is always
170 <a href="http://www.iana.org/assignments/dns-parameters/dns-parameters.xml">here</a>.)</p>
171
172 <p class=define><code><b>*extensions</b></code></p>
173 <p class=descrip>Specifies the extensions for this request; the value may be NULL if there are no
174 extensions. See <a href="#Extensions">the section below</a> for information on how to specify
175 the extensions used for a request.</p>
176
177 <p class=define><code><b>*userarg</b></code></p>
178 <p class=descrip>A void* that is passed to the function, which the funciton
179 returns to the callback function untouched. <code>userarg</code> can be used by the callback
180 function for any user-specific data needed. This can be NULL.</p>
181
182 <p class=define><code><b>*transaction_id</b></code></p>
183 <p class=descrip>A pointer to a value that is filled in by the
184 function to identify the callback being made.
185 This pointer can be NULL, in which case it is ignored and no value is assigned.
186 The <code>getdns_cancel_callback()</code> function uses the
187 <code>transaction_id</code> to determine which callback is to be cancelled.
188 If the function fails,
189 <code>transaction_id</code> is set to 0.</p>
190
191 <p class=define><code><b>*callbackfn</b></code></p>
192 <p class=descrip>A pointer to a callback function that is defined by the application.
193 Typically, the callback function will do all the processing on the results from
194 the API. The parameters of the callback are defined below. This really needs
195 to be a pointer to a function (and not something like NULL); otherwise, the
196 results are unpredictable.</p>
197
198 <p>The async <code>getdns</code> functions return <code>GETDNS_RETURN_GOOD</code> if the call was properly formatted.
199 It returns <code>GETDNS_RETURN_BAD_DOMAIN_NAME</code> if the API determines that the name passed to
200 the function was bad, <code>GETDNS_RETURN_BAD_CONTEXT</code> if the context pointer is bad,
201 <code>GETDNS_RETURN_NO_SUCH_EXTENSION</code> if one or more extensions do not exist, or
202 <code>GETDNS_RETURN_EXTENSION_MISFORMAT</code> if the contents of one or more of the
203 extensions is incorrect. All of the return values are given <a
204 href="#ReturnCodes">later in this document</a>.</p>
205
206 <h2>1.2 <code>getdns_address()</code></h2>
207
208 <div class=forh id="getdnsfuncaddress">getdns_return_t
209 getdns_address(
210 struct getdns_context *context,
211 const char *name,
212 struct getdns_dict *extensions,
213 void *userarg,
214 getdns_transaction_t *transaction_id,
215 getdns_callback_t callbackfn
216 );
217 </div>
218
219 <p>There are three critical differences between <code>getdns_address()</code> and
220 <code>getdns_general()</code> beyond the missing <code>request_type</code> argument:</p>
221
222 <ul>
223
224 <li>In <code>getdns_address()</code>, the <code>name</code> argument can only take a host name.</li>
225
226 <li>You do not need to include a <code>return_both_v4_and_v6</code> extension with the call in
227 <code>getdns_address()</code>: it will always return both IPv4 and IPv6 addresses.</li>
228
229 <li><code>getdns_address()</code> always uses all of namespaces from the context (to better emulate
230 <code>getaddrinfo()</code>), while <code>getdns_general()</code> only uses the DNS namespace.</li>
231
232 </ul>
233
234 <h2>1.3 <code>getdns_hostname()</code></h2>
235
236 <div class=forh id="getdnsfunchostname">getdns_return_t
237 getdns_hostname(
238 struct getdns_context *context,
239 struct getdns_dict *address,
240 struct getdns_dict *extensions,
241 void *userarg,
242 getdns_transaction_t *transaction_id,
243 getdns_callback_t callbackfn
244 );
245 </div>
246
247 <p>The address is given as a <code>getdns_dict</code> data structure (defined below). The list must
248 have two names: <code>address_type</code> (whose value is a bindata; it is currently either "IPv4"
249 or "IPv6" (which are case-sensitive)) and <code>address_data</code> (whose value is a bindata).</p>
250
251 <h2>1.4 <code>getdns_service()</code></h2>
252
253 <div class=forh id="getdnsfuncservice">getdns_return_t
254 getdns_service(
255 struct getdns_context *context,
256 const char *name,
257 struct getdns_dict *extensions,
258 void *userarg,
259 getdns_transaction_t *transaction_id,
260 getdns_callback_t callbackfn
261 );
262 </div>
263
264 <p><code>name</code> must be a domain name for an SRV lookup; the call returns the
265 relevant SRV information for the name.</p>
266
267 <h2>1.5 Callback Functions for <code>getdns</code></h2>
268
269 <p>A call to the async <code>getdns</code> functions typically returns before any network or file I/O occurs. After
270 the API marshalls all the needed information, it calls the callback function that was passed by the
271 application. The callback function might be called at any time, even before the calling function
272 has returned. The API guarantees that the callback will be called exactly once unless the calling function
273 returned an error, in which case the callback function is never called.<p>
274
275 <p>The <code>getdns</code> calling function calls the callback with the parameters defined
276 as follows:</p>
277 <div class=forh id="getdns_callback_t">
278 typedef void (*getdns_callback_t)(
279 struct getdns_context *context,
280 uint16_t callback_type,
281 struct getdns_dict *response,
282 void *userarg,
283 getdns_transaction_t transaction_id);
284 </div>
285
286 <p class=define><code><b>context</b></code></p>
287 <p class=descrip>The DNS context that was used in the calling function. See <a
288 href="#ContextInitial">below</a> for a description of the basic use of contexts, and <a
289 href="#Contexts">later</a> for more advanced use.</p>
290
291 <p class=define><code><b>callback_type</b></code></p>
292 <p class=descrip>Supplies the reason for the callback. See below for the codes and reasons.</p>
293
294 <p class=define><code><b>*response</b></code></p>
295 <p class=descrip>A response object with the response data. This is described below. The response
296 object is part of the API's memory space, and will be freed by the API with the callback returns.</p>
297
298 <p class=define><code><b>*userarg</b></code></p>
299 <p class=descrip>Identical to the <code>*userarg</code> passed to the calling function.</p>
300
301 <p class=define><code><b>transaction_id</b></code></p>
302 <p class=descrip>The transaction identifier that was assigned by the calling function.</p>
303
304 <p>The following are the values for callback_type.</p>
305
306 <p class=define>GETDNS_CALLBACK_COMPLETE</p>
307 <p class=descrip>The response has the requested data in it</p>
308 <p class=define>GETDNS_CALLBACK_CANCEL</p>
309 <p class=descrip>The calling program cancelled the callback; response is NULL</p>
310 <p class=define>GETDNS_CALLBACK_TIMEOUT</p>
311 <p class=descrip>The requested action timed out; response is NULL</p>
312 <p class=define>GETDNS_CALLBACK_ERROR</p>
313 <p class=descrip>The requested action had an error; response is NULL</p>
314
315
316 <h2>1.6 <a id="ContextInitial">Setting Up The DNS Context</a></h2>
317
318 <p>Calls to <code>getdns</code> functions require a DNS context, which is a group of API settings
319 that affect how DNS calls are made. For most applications, a default context is sufficient.</p>
320
321 <p>To create a new DNS context, use the function:</p>
322
323 <div class=forh>getdns_return_t
324 getdns_context_create(
325 struct getdns_context **context,
326 int set_from_os
327 );
328 </div>
329
330 <p class=cont>The call to <code>getdns_context_create</code> immediately returns a context that can
331 be used with other API calls; that context contains the API's default values. Most applications will
332 want <code>set_from_os</code> set to <code>1</code>.</p>
333
334 <div class=forh>getdns_return_t
335 getdns_context_create_with_memory_functions(
336 struct getdns_context **context,
337 int set_from_os,
338 void *(*malloc)(size_t),
339 void *(*realloc)(void *, size_t),
340 void (*free)(void *)
341 );
342 getdns_return_t
343 getdns_context_create_with_extended_memory_functions(
344 struct getdns_context **context,
345 int set_from_os,
346 void *userarg,
347 void *(*malloc)(void *userarg, size_t),
348 void *(*realloc)(void *userarg, void *, size_t),
349 void (*free)(void *userarg, void *)
350 );
351 </div>
352
353 <p>To clean up the context, including cleaning up all outstanding transactions that were called
354 using this context, use the function:</p>
355
356 <div class=forh>void
357 getdns_context_destroy(
358 struct getdns_context *context
359 );
360 </div>
361
362 <p class=cont>When <code>getdns_context_destroy()</code> returns, the
363 application knows that all outstanding transactions associated with this
364 context will have been called; callbacks that had not been called before
365 <code>getdns_context_destroy()</code> was called will be called with a callback_type of
366 <code>GETDNS_CALLBACK_CANCEL</code>. <code>getdns_context_destroy()</code> returns after
367 all of the needed cleanup is done and callbacks are made.</p>
368
369 <h2>1.7 Canceling a Callback</h2>
370
371 <p>To cancel an outstanding callback, use the following function.</p>
372
373 <div class=forh>getdns_return_t
374 getdns_cancel_callback(
375 struct getdns_context *context,
376 getdns_transaction_t transaction_id
377 );
378 </div>
379
380 <p class=cont>This causes the API to call the callback with a <code>callback_type</code> of
381 <code>GETDNS_CALLBACK_CANCEL</code> if the callback for this <code>transaction_id</code> has not
382 already been called. This will cancel the callback regardless of what the original call was
383 doing (such as in the middle of a DNS request, while DNSSEC validation is happening, and so on).
384 The callback code for cancellation should clean up any memory related to the
385 identified call, such as to deallocate the memory for the userarg.
386 <code>getdns_cancel_callback()</code> may return immediately, even before the callback finishes its
387 work and returns. Calling <code>getdns_cancel_callback()</code> with a <code>transaction_id</code>
388 of a callback that has already been called or an unknown <code>transaction_id</code> returns
389 <code>GETDNS_RETURN_UNKNOWN_TRANSACTION</code>; otherwise, <code>getdns_cancel_callback()</code>
390 returns <code>GETDNS_RETURN_GOOD</code>.</p>
391
392 <h2>1.8 Event-driven Programs</h2>
393
394 <p>Event-driven programs (sometimes called "async programs") require an event
395 base and event loop (among other things). Different event libraries have
396 different structures or the event base. Because of this, there is no standard
397 method to set the event base in the DNS API: those are all added as
398 extensions. The API is distributed as a core package and one or more sets of
399 extensions to align with event libraries. It is mandatory to use one of the extension
400 functions to set the event base in the DNS context; this is required before
401 calling any event-driven calls like the <code>getdns</code> functions.</p>
402
403 <p>Each implementation of the DNS API will specify an extension function that
404 tells the DNS context which event base is being used. For example, one
405 implementation of this API that uses the libevent event library might name
406 this function "<code>getdns_extension_set_libevent_base()</code>" while
407 another might name it
408 "<code>getdns_extension_set_eventbase_for_libevent()</code>"; the two
409 extension functions could have very different calling patterns and return
410 values. Thus, the application developer <i>must</i> read the API documentation
411 (not just this design document) in order to determine what extension function
412 to use to tell the API the event base to use.</p>
413
414 <p>The structure of a typical event-driven application might look like the following pseudocode.
415 The code in italics is specific to the event mechanism.</p>
416
417 <pre>
418 Includes for one or more regular C libraries
419 <i>An include for the getdns library specific to the event library you use</i>
420 Definition of your callback function
421 Get the DNS data from the allocated pointer
422 Process that data
423 Check for errors
424 Definition of main()
425 Create context
426 <i>Set up your event base</i>
427 <i>Point the context to your event base</i>
428 Set up the getdns call arguments
429 Make the getdns call
430 Check if the getdns return is good
431 Destroy the context
432 Exit
433 </pre>
434
435 <p>The API does not have direct support for a polling interface. Instead, the callback interface is
436 specifically designed to allow an application that wants to process results in polling instead of in
437 callbacks to be able to create its own polling interface fairly trivially. Such a program would
438 create a data structure for the calls, including their <code>transaction_id</code> and
439 <code>userarg</code>. The <code>userarg</code> could be the polling data structure or have a pointer to it.
440 The application would have just
441 one callback function for all requests, and that function would copy the <code>response</code> into
442 application memory, update the data structure based on the <code>transaction_id</code> index,
443 and return from the callback. The polling code could then check the data structure for any updates
444 at its leisure.</p>
445
446 <h2>1.9 Calling the API Synchronously (Without Events)</h2>
447
448 <p>Thare are functions parallel to the four <code>getdns</code> async functions,
449 except that there is no callback. That is, when an application calls one of these
450 synchronous functions, the
451 API gathers all the required information and then returns the result. The value returned is exactly the
452 same as the response returned in the callback if you had used the async version of the function.</p>
453
454 <div class=forh>getdns_return_t
455 getdns_general_sync(
456 struct getdns_context *context,
457 const char *name,
458 uint16_t request_type,
459 struct getdns_dict *extensions,
460 struct getdns_dict **response
461 );
462 </div>
463
464 <div class=forh>getdns_return_t
465 getdns_address_sync(
466 struct getdns_context *context,
467 const char *name,
468 struct getdns_dict *extensions,
469 struct getdns_dict **response
470 );
471 </div>
472
473 <div class=forh>getdns_return_t
474 getdns_hostname_sync(
475 struct getdns_context *context,
476 struct getdns_dict *address,
477 struct getdns_dict *extensions,
478 struct getdns_dict **response
479 );
480 </div>
481
482 <div class=forh>getdns_return_t
483 getdns_service_sync(
484 struct getdns_context *context,
485 const char *name,
486 struct getdns_dict *extensions,
487 struct getdns_dict **response
488 );
489 </div>
490
491 <p>When you are done with the data in the response, use the following function so that the API can
492 free the memory from its internal pool.</p>
493
494 <pre>void
495 getdns_dict_destroy(
496 struct getdns_dict *response
497 );
498 </pre>
499
500 <h1>2. Data structures in the API</h1>
501
502 <p>The API returns data structures. The data structure is not a representational language like JSON:
503 it is really just a data structure. Data structures can have four types of members:</p>
504
505 <ul>
506
507 <li><span class=default>list</span> is an ordered list, like JSON and Python lists.
508 The members of the list can be any of the four data types.</li>
509
510 <li><span class=default>dict</span> is a name-value pair, like a JSON object or Python dict. The
511 name is a string literal, and the value can be any of the four data types. The order of the
512 name-value pairs in a dict is not important.</li>
513
514 <li><span class=default>int</span> is an integer compatible with uint32_t.</li>
515
516 <li><span class=default>bindata</span> is a struct to hold binary data. It is defined as
517 <code>{ size_t size; uint8_t *binary_stuff; }</code>.</li>
518
519 </ul>
520
521 <p>The API comes with helper functions to get data from the list and dict data types:</p>
522
523 <div class=forh id="datagetters">
524 /* Lists: get the length, get the data_type of the value at a given
525 position, and get the data at a given position */
526 getdns_return_t getdns_list_get_length(struct getdns_list *this_list, size_t *answer);
527 getdns_return_t getdns_list_get_data_type(struct getdns_list *this_list, size_t index, getdns_data_type *answer);
528 getdns_return_t getdns_list_get_dict(struct getdns_list *this_list, size_t index, struct getdns_dict **answer);
529 getdns_return_t getdns_list_get_list(struct getdns_list *this_list, size_t index, struct getdns_list **answer);
530 getdns_return_t getdns_list_get_bindata(struct getdns_list *this_list, size_t index, struct getdns_bindata **answer);
531 getdns_return_t getdns_list_get_int(struct getdns_list *this_list, size_t index, uint32_t *answer);
532
533 /* Dicts: get the list of names, get the data_type of the
534 value at a given name, and get the data at a given name */
535 getdns_return_t getdns_dict_get_names(struct getdns_dict *this_dict, struct getdns_list **answer);
536 getdns_return_t getdns_dict_get_data_type(struct getdns_dict *this_dict, char *name, getdns_data_type *answer);
537 getdns_return_t getdns_dict_get_dict(struct getdns_dict *this_dict, char *name, struct getdns_dict **answer);
538 getdns_return_t getdns_dict_get_list(struct getdns_dict *this_dict, char *name, struct getdns_list **answer);
539 getdns_return_t getdns_dict_get_bindata(struct getdns_dict *this_dict, char *name, struct getdns_bindata **answer);
540 getdns_return_t getdns_dict_get_int(struct getdns_dict *this_dict, char *name, uint32_t *answer);
541 </div>
542
543 <p>All of these helper getter functions return <code>GETDNS_RETURN_GOOD</code> if the call is successful.
544 The list functions will return <code>GETDNS_RETURN_NO_SUCH_LIST_ITEM</code> if the index argument is
545 out of range; the dict functions will return <code>GETDNS_RETURN_NO_SUCH_DICT_NAME</code> if the name
546 argument doesn't exist in the dict. The functions also return <code>GETDNS_RETURN_WRONG_TYPE_REQUESTED</code>
547 if the requested data type doesn't match the contents of the indexed argument or name.</p>
548
549 <p>This document uses graphical representations of data structures. It is important to note that
550 this is only a graphical representation; the brackets, commas, quotation marks, comments, and so on
551 are not part of the data. Also, this document uses macro names instead of some of the int
552 arguments; of course, the data structures have the actual int in them.</p>
553
554 <h2>2.1 Creating Data Structures</h2>
555
556 <p>Some of the features of the API require that you create your own data structures to be used in
557 arguments passed to the API. For example, if you want to use any extensions for the calling functions,
558 you need to create a dict. The requisite functions are:</p>
559
560 <div class=forh id="datasetters">
561 /* Lists: create, destroy, and set the data at a given position */
562 struct getdns_list * getdns_list_create();
563 struct getdns_list * getdns_list_create_with_context(
564 struct getdns_context *context
565 );
566 struct getdns_list * getdns_list_create_with_memory_functions(
567 void *(*malloc)(size_t),
568 void *(*realloc)(void *, size_t),
569 void (*free)(void *)
570 );
571 struct getdns_list * getdns_list_create_with_extended_memory_functions(
572 void *userarg,
573 void *(*malloc)(void *userarg, size_t),
574 void *(*realloc)(void *userarg, void *, size_t),
575 void (*free)(void *userarg, void *)
576 );
577 void getdns_list_destroy(struct getdns_list *this_list);
578 getdns_return_t getdns_list_set_dict(struct getdns_list *this_list, size_t index, struct getdns_dict *child_dict);
579 getdns_return_t getdns_list_set_list(struct getdns_list *this_list, size_t index, struct getdns_list *child_list);
580 getdns_return_t getdns_list_set_bindata(struct getdns_list *this_list, size_t index, struct getdns_bindata *child_bindata);
581 getdns_return_t getdns_list_set_int(struct getdns_list *this_list, size_t index, uint32_t child_uint32);
582
583 /* Dicts: create, destroy, and set the data at a given name */
584 struct getdns_dict * getdns_dict_create();
585 struct getdns_dict * getdns_dict_create_with_context(
586 struct getdns_context *context
587 );
588 struct getdns_dict * getdns_dict_create_with_memory_functions(
589 void *(*malloc)(size_t),
590 void *(*realloc)(void *, size_t),
591 void (*free)(void *)
592 );
593 struct getdns_dict * getdns_dict_create_with_extended_memory_functions(
594 void *userarg,
595 void *(*malloc)(void *userarg, size_t),
596 void *(*realloc)(void *userarg, void *, size_t),
597 void (*free)(void *userarg, void *)
598 );
599 void getdns_dict_destroy(struct getdns_dict *this_dict);
600 getdns_return_t getdns_dict_set_dict(struct getdns_dict *this_dict, char *name, struct getdns_dict *child_dict);
601 getdns_return_t getdns_dict_set_list(struct getdns_dict *this_dict, char *name, struct getdns_list *child_list);
602 getdns_return_t getdns_dict_set_bindata(struct getdns_dict *this_dict, char *name, struct getdns_bindata *child_bindata);
603 getdns_return_t getdns_dict_set_int(struct getdns_dict *this_dict, char *name, uint32_t child_uint32);
604 getdns_return_t getdns_dict_remove_name(struct getdns_dict *this_dict, char *name);
605 </div>
606
607 <p>Lists are extended with the <code>getdns_list_set_</code> calls with the <code>index</code> set to the
608 size of the list (such as 0 for an empty list). Dicts are extended with the <code>getdns_dict_set_</code> calls
609 with the <code>name</code> set to a name that does not yet exist. Name-value pairs are removed with
610 <code>getdns_dict_remove_name()</code>.</p>
611
612 <p>These helper setter functions return <code>GETDNS_RETURN_GOOD</code> if the call is successful.
613 The functions return <code>GETDNS_RETURN_WRONG_TYPE_REQUESTED</code> if the requested data type
614 doesn't match the contents of the indexed argument or name. The list functions will return
615 <code>GETDNS_RETURN_NO_SUCH_LIST_ITEM</code> if the index argument is higher than the length of the
616 list. <code>getdns_dict_remove_name()</code> will return
617 <code>GETDNS_RETURN_NO_SUCH_DICT_NAME</code> if the name argument doesn't exist in the dict. </p>
618
619 <h1>3. <a id="Extensions">Extensions</a></h1>
620
621 <p>Extensions are dict data structures. The names in the dict are the names of the extensions.
622 The definition of each extension describes the value associated with the name. For most extensions,
623 it is an on-off boolean, and the value is <code>GETDNS_EXTENSION_TRUE</code>. (There is
624 not currently a good reason to specify an extension name and give it a value of <code>GETDNS_EXTENSION_FALSE</code>,
625 but that is allowed by the API.)</p>
626
627 <p>For example, to create a dict for extensions and specify the extension to only return
628 results that have been validated with DNSSEC, you might use:</p>
629
630 <pre>
631 /* . . . */
632 struct getdns_dict * this_extensions = getdns_dict_create();
633 this_ret = getdns_dict_set_int(this_extensions, "dnssec_return_only_secure", GETDNS_EXTENSION_TRUE);
634 /* . . . Do some processing with the extensions and results . . . */
635 /* Remember to clean up memory*/
636 getdns_dict_destroy(this_extensions);
637 </pre>
638
639 <p>The extensions described in this section are are:
640
641 <ul>
642
643 <li><code>dnssec_return_status</code></li>
644
645 <li><code>dnssec_return_only_secure</code></li>
646
647 <li><code>dnssec_return_supporting_responses</code></li>
648
649 <li><code>return_both_v4_and_v6</code></li>
650
651 <li><code>add_opt_parameters</code></li>
652
653 <li><code>add_warning_for_bad_dns</code></li>
654
655 <li><code>specify_class</code></li>
656
657 <li><code>return_api_information</code></li>
658
659 <li><code>return_call_debugging</code></li>
660
661 </ul>
662
663 <h2>3.1 Extensions for DNSSEC</h2>
664
665 <p>If an application wants the API to do DNSSEC validation for a request, it must set one or more
666 DNSSEC-related extensions. Note that the default is for none of these extensions to be set and
667 the API will not perform DNSSEC, and thus will return results sooner.</p>
668
669 <p>To return the DNSSEC status for each DNS record in the <code>replies_tree</code> list, use the
670 <code>dnssec_return_status</code> extension. The extension's value (an int) is set to
671 <code>GETDNS_EXTENSION_TRUE</code> to cause the returned status to have the name
672 <code>dnssec_status</code> (an int) added to the other names in the record's dict ("header",
673 "question", and so on). The values for that name are <code>GETDNS_DNSSEC_SECURE</code>,
674 <code>GETDNS_DNSSEC_BOGUS</code>, <code>GETDNS_DNSSEC_INDETERMINATE</code>, and
675 <code>GETDNS_DNSSEC_INSECURE</code>. Thus, a reply might look like:</p>
676
677 <pre>
678 { # This is the first reply
679 "dnssec_status": GETDNS_DNSSEC_INDETERMINATE,
680 "header": { "id": 23456, "qr": 1, "opcode": 0, ... },
681 . . .
682 </pre>
683
684 <p>If instead of returning the status, you want to only see secure results, use the
685 <code>dnssec_return_only_secure</code> extension. The extension's value (an int) is set to
686 <code>GETDNS_EXTENSION_TRUE</code> to cause only records that the API can validate as secure with
687 DNSSEC to be returned in the <code>replies_tree</code> and <code>replies_full</code> lists. No
688 additional names are added to the dict of the record; the change is that some records might not
689 appear in the results. When this context option is set, if the API receives DNS replies but none
690 are determined to be secure, the error code at the top level of the response object is
691 <code>GETDNS_RESPSTATUS_NO_SECURE_ANSWERS</code>.</p>
692
693 <p>Applications that want to do their own validation will want to have the DNSSEC-related records
694 for a particular response. Use the <code>dnssec_return_supporting_responses</code> extension. The
695 extension's value (an int) is set to <code>GETDNS_EXTENSION_TRUE</code> to cause a set
696 of additional DNSSEC-related records needed for validation to be returned in the response object.
697 This set comes as <code>additional_dnssec</code> (a list) at the top level of the response object.
698 This list includes any trust anchors needed for the validation. Thus, a reply might look like:</p>
699
700 <pre>
701 { # This is the response object
702 "additional_dnssec": [ &lt;bindata of the first DNSSEC record&gt;, &lt;bindata of the second DNSSEC record&gt; ... ],
703 "replies_tree":
704 [
705 . . .
706 </pre>
707
708 <p>If a request is using a context in which stub resolution is set, and that request also has
709 any of the <code>dnssec_return_status</code>, <code>dnssec_return_only_secure</code>, or
710 <code>dnssec_return_supporting_responses</code> extensions specified, the API will not perform
711 the request and will instead return an error of <code>GETDNS_RETURN_DNSSEC_WITH_STUB_DISALLOWED</code>.</p>
712
713 <h2>3.2 Returning Both IPv4 and IPv6 Responses</h2>
714
715 <p>Many applications want to get both IPv4 and IPv6 addresses in a single call so that the results
716 can be processed together. The <code>getdns_address</code> and <code>getdns_address_sync</code>
717 functions are able to do this automatically. If you are using the <code>getdns_general</code> or
718 <code>getdns_general_sync</code> function, you can enable this with the
719 <code>return_both_v4_and_v6</code> extension. The extension's value (an int) is set to
720 <code>GETDNS_EXTENSION_TRUE</code> to cause the results to be the lookup of either A or AAAA records
721 to include any A and AAAA records for the queried name (otherwise, the extension does nothing).
722 These results are expected to be used with Happy Eyeballs systems that will find the best socket for
723 an application.</p>
724
725 <h2>3.3 Setting Up OPT Resource Records</h2>
726
727 <p>For lookups that need an OPT resource record in the Additional Data section, use the
728 <code>add_opt_parameters</code> extension. The extension's value (a dict) contains the
729 parameters; these are described in more detail in RFC 2671. They are:</p>
730
731 <ul>
732
733 <li><code>maximum_udp_payload_size</code> (an int), a value between 512 and 65535; if not specified,
734 this defaults to those from the DNS context</li>
735
736 <li><code>extended_rcode</code> (an int), a value between 0 and 255; if not specified,
737 this defaults to those from the DNS context</li>
738
739 <li><code>version</code> (an int), a value between 0 and 255; if not specified, this
740 defaults to 0</li>
741
742 <li><code>do_bit</code> (an int), a value between 0 and 1; if not specified, this defaults
743 to those from the DNS context</li>
744
745 <li><code>options</code> (a list) contains dicts for each option to be specified.
746 Each list time contains two names: <code>option_code</code> (an int) and <code>option_data</code>
747 (a bindata). The API marshalls the entire set of options into a properly-formatted RDATA
748 for the resource record.</li>
749
750 </ul>
751
752 <p>It is very important to note that the OPT resource record specified in the
753 <code>add_opt_parameters</code> extension might not be the same the one that the API sends in the
754 query. For example, if the application also includes any of the DNSSEC extensions, the API will make
755 sure that the OPT resource record sets the resource record appropriately, making the needed changes
756 to the settings from the <code>add_opt_parameters</code> extension.</p>
757
758 <p>The use of this extension can conflict with the values in the DNS context. For example,
759 the default for an OS might be a maximum payload size of 65535, but the extension might specify
760 1550. In such a case, the API will honor the values stated in the extension, but will honor the
761 values from the DNS context if values are not given in the extension.</p>
762
763 <h2>3.4 Getting Warnings for Responses that Violate the DNS Standard</h2>
764
765 <p>To receive a warning if a particular response violates some parts of the DNS standard, use
766 the <code>add_warning_for_bad_dns</code> extension. The extension's value (an int) is set to
767 <code>GETDNS_EXTENSION_TRUE</code> to cause each reply in the <code>replies_tree</code>
768 to contain an additional name, <code>bad_dns</code> (a list). The list is zero or more
769 ints that indicate types of bad DNS found in that reply. The list of values is:
770
771 <p class=define>GETDNS_BAD_DNS_CNAME_IN_TARGET</p>
772 <p class=descrip>A DNS query type that does not allow a target to be a CNAME pointed to a CNAME</p>
773 <p class=define>GETDNS_BAD_DNS_ALL_NUMERIC_LABEL</p>
774 <p class=descrip>One or more labels in a returned domain name is all-numeric; this is not legal for a hostname</p>
775 <p class=define>GETDNS_BAD_DNS_CNAME_RETURNED_FOR_OTHER_TYPE</p>
776 <p class=descrip>A DNS query for a type other than CNAME returned a CNAME response</p>
777
778
779 <h2>3.5 Using Other Class Types</h2>
780
781 <p>The vast majority of DNS requests are made with the Internet (IN) class. To make a request in a
782 different DNS class, use, the <code>specify_class</code> extension. The extension's value (an int)
783 contains the class number. Few applications will ever use this extension.</p>
784
785 <h2>3.6 Extensions Relating to the API</h2>
786
787 <p>An application might want to see information about the API itself. Use the
788 <code>return_api_information</code> extension. An application that wants to get this information
789 before a "real" query is issued can add this extension to a PTR query for 127.0.0.1.
790 The extension's value (an int) is set to
791 <code>GETDNS_EXTENSION_TRUE</code> to add the following to the top level of the response object:</p>
792
793 <ul>
794
795 <li><code>version_string</code> (a bindata) represents the version string for this version of the DNS
796 API.</li>
797
798 <li><code>implementation_string</code> (a bindata) is a string set by the API implementer. It might
799 be human-readable, and it might have information in it useful to an application developer (but it doesn't
800 have to).</li>
801
802 <li><code>resolver_type</code> (an int) is the type of resolver that the API is acting as in this context:
803 <code>GETDNS_CONTEXT_RECURSING</code> or <code>GETDNS_CONTEXT_STUB</code> (it will be
804 a recursing resolver unless the application changed this in a context.</li>
805
806 <li><code>all_context</code> (a dict) with names for all the types of context. This can be used with
807 getdns_pretty_print_dict() for debugging.</li>
808
809 </ul>
810
811 <p>An application might want to see debugging information for queries such as the length of time it
812 takes for each query to return to the API. Use the <code>return_call_debugging</code> extension. The
813 extension's value (an int) is set to <code>GETDNS_EXTENSION_TRUE</code> to add the name
814 <code>call_debugging</code> (a list) to the top level of the response object. Each member of the
815 list is a dict that represents one call made for the call to the API. Each member has the following
816 names:</p>
817
818 <ul>
819 <li><code>query_name</code> (a bindata) is the name that was sent</li>
820 <li><code>query_type</code> (an int) is the type that was queried for</li>
821 <li><code>query_to</code> (a bindata) is the address to which the query was sent</li>
822 <li><code>start_time</code> (a bindata) is the time the query started in milliseconds since the epoch,
823 represented as a uint64_t</li>
824 <li><code>end_time</code> (a bindata) is the time the query was received in milliseconds since the epoch,
825 represented as a uint64_t</li>
826 <li><code>entire_reply</code> (a bindata) is the entire response received</li>
827 <li><code>dnssec_result</code> (an int) is the DNSSEC status, or <code>GETDNS_DNSSEC_NOT_PERFORMED</code>
828 if DNSSEC validation was not performed</li>
829 </ul>
830
831 <h1>4. Response Data from Queries</h1>
832
833 <p>The callback function contains a pointer to a response object.
834 A response object is always a dict. The response
835 object always contains at least three names: <code>replies_full</code> (a list) and
836 <code>replies_tree</code> (a list), and <code>status</code> (an int).
837 <code>replies_full</code> is a list of DNS replies (each is bindata) as they appear on the wire.
838 <code>replies_tree</code> is a list of DNS replies (each is a dict) with the various part of the
839 reply parsed out. <code>status</code> is a status code for the query.</p>
840
841 <p>Because the API might be extended in the future, a response object might also contain names other
842 than <code>replies_full</code>, <code>replies_tree</code>, and <code>status</code>. Similarly, any
843 of the dicts described here might be extended in later versions of the API. Thus, an application
844 using the API must not assume that it knows all possible names in a dict.</p>
845
846 <p>The following lists the status codes for response objects. Note that, if the status is that there
847 are no responses for the query, the lists in <code>replies_full</code> and <code>replies_tree</code>
848 will have zero length.</p>
849
850 <p class=define>GETDNS_RESPSTATUS_GOOD</p>
851 <p class=descrip>At least one response was returned</p>
852 <p class=define>GETDNS_RESPSTATUS_NO_NAME</p>
853 <p class=descrip>Queries for the name yielded all negative responses</p>
854 <p class=define>GETDNS_RESPSTATUS_ALL_TIMEOUT</p>
855 <p class=descrip>All queries for the name timed out</p>
856 <p class=define>GETDNS_RESPSTATUS_NO_SECURE_ANSWERS</p>
857 <p class=descrip>The context setting for getting only secure responses was specified, and at least one DNS response was received, but no DNS response was determined to be secure through DNSSEC.</p>
858
859
860 <p>The top level of <code>replies_tree</code> can optionally have the following names: <code>canonical_name</code> (a
861 bindata), <code>intermediate_aliases</code> (a list), <code>answer_ipv4_address</code> (a bindata),
862 <code>answer_ipv6_address</code> (a bindata), and <code>answer_type</code> (an int).</p>
863
864 <ul>
865
866 <li>The value of <code>canonical_name</code> is the name that the API used for its lookup. It is in
867 FQDN presentation format.</li>
868
869 <li>The values in the <code>intermediate_aliases</code> list are domain names from any CNAME or
870 unsynthesized DNAME found when resolving the original query. The list might have zero entries
871 if there were no CNAMEs in the path. These may be useful, for example, for name comparisons
872 when following the rules in RFC 6125.</li>
873
874 <li>The value of <code>answer_ipv4_address</code> and <code>answer_ipv6_address</code> are
875 the addresses of the server from which the answer was received.</li>
876
877 <li>The value of <code>answer_type</code> is the type of name service that generated the response.
878 The values are:</li>
879
880 </ul>
881
882 <p class=define>GETDNS_NAMETYPE_DNS</p>
883 <p class=descrip>Normal DNS (RFC 1035)</p>
884 <p class=define>GETDNS_NAMETYPE_WINS</p>
885 <p class=descrip>The WINS name service (some reference needed)</p>
886
887
888 <p>If the call was <code>getdns_address</code> or <code>getdns_address_sync</code>, the top level
889 of <code>replies_tree</code> has an additional name, <code>just_address_answers</code> (a list).
890 The value of <code>just_address_answers</code> is a list that contains all of the A and AAAA
891 records from the answer sections of any of the replies, in the order they appear in the replies.
892 Each item in the list is a dict with at least two names: <code>address_type</code> (whose value is
893 a bindata; it is currently either "IPv4" or "IPv6") and <code>address_data</code> (whose value is a bindata).
894 Note that the <code>dnssec_return_only_secure</code> extension affects
895 what will appear in the <code>just_address_answers</code> list. Also note if later versions of the
896 DNS return other address types, those types will appear in this list as well.</p>
897
898 <p>The API can make service discovery through SRV records easier. If
899 the call was <code>getdns_service</code> or <code>getdns_service_sync</code>,
900 the top level of <code>replies_tree</code> has an additional name,
901 <code>srv_addresses</code> (a list).
902 The list is ordered by priority and weight based on the weighting
903 algorithm in RFC 2782, lowest priority value first. Each element
904 of the list is dict has at least two names: <code>port</code> and <code>domain_name</code>. If the
905 API was able to determine the address of the target domain name (such as from its cache or from the
906 Additional section of responses), the dict for an element will also contain
907 <code>address_type</code> (whose value is a bindata; it is currently either "IPv4" or "IPv6") and
908 <code>address_data</code> (whose value is a bindata). Note that the
909 <code>dnssec_return_only_secure</code> extension affects what will appear in the
910 <code>srv_addresses</code> list.</p>
911
912 <h2>4.1 Structure of DNS <code>replies_tree</code></h2>
913
914 <p>The names in each entry in the the <code>replies_tree</code> list for DNS responses include
915 <code>header</code> (a dict), <code>question</code> (a dict), <code>answer</code> (a list),
916 <code>authority</code> (a list), and <code>additional</code> (a list), corresponding to the sections
917 in the DNS message format. The answer, authority, and additional lists each contain zero or more
918 dicts, with each dict in each list representing a resource record.</p>
919
920 <p>The names in the <code>header</code> dict are all the fields from Section 4.1.1. of RFC 1035.
921 They are: <code>id</code>, <code>qr</code>, <code>opcode</code>, <code>aa</code>, <code>tc</code>,
922 <code>rd</code>, <code>ra</code>, <code>z</code>, <code>rcode</code>, <code>qdcount</code>,
923 <code>ancount</code>, <code>nscount</code>, and <code>arcount</code>. All are ints.</p>
924
925 <p>The names in the <code>question</code> dict are the three fields from Section 4.1.2. of RFC 1035:
926 <code>qname</code> (a bindata), <code>qtype</code> (an int), and <code>qclass</code> (an int).</p>
927
928 <p>Resource records are a bit different than headers and question sections in that the RDATA portion
929 often has its own structure. The other names in the resource record dicts are <code>name</code> (a
930 bindata), <code>type</code> (an int), <code>class</code> (an int), <code>ttl</code> (an int) and
931 <code>rdata</code> (a dict); there is no name equivalent to the RDLENGTH field.</p>
932
933 <p>The <code>rdata</code> dict has different names for each response type. There is a <a
934 href="#TypeList">complete list of the types defined</a> in the API. For names that end in
935 "-obsolete" or "-unknown", the bindata is the entire RDATA field. For example, the
936 <code>rdata</code> for an A record has a name <code>ipv4_address</code> (a bindata); the
937 <code>rdata</code> for an SRV record has the names <code>priority</code> (an int),
938 <code>weight</code> (an int), <code>port</code> (an int), and <code>target</code> (a bindata).</p>
939
940 <p>Each <code>rdata</code> dict also has a <code>rdata_raw</code> field (a bindata). This is useful
941 for types not defined in this version of the API. It also might be of value if a later version of
942 the API allows for additional parsers. Thus, doing a query for types not known by the API still will
943 return a result: an <code>rdata</code> with just a <code>rdata_raw</code>.</p>
944
945 <p>It is expected that later extensions to the API will give some DNS types different names. It is
946 also possible that later extensions will change the names for some of the DNS types listed above.</p>
947
948 <p>For example, a response to a <code>getdns_address()</code> call for www.example.com would
949 look something like this:</p>
950
951 <pre>
952 { # This is the response object
953 "replies_full": [ &lt;bindata of the first response&gt;, &lt;bindata of the second response&gt; ],
954 "just_address_answers": [ &lt;bindata of 0x0a0b0c01&gt;, &lt;bindata of 0x33445566334455663344556633445566&gt; ],
955 "canonical_name": &lt;bindata of "www.example.com"&gt;,
956 "answer_type": GETDNS_NAMETYPE_DNS,
957 "intermediate_aliases": [],
958 "replies_tree":
959 [
960 { # This is the first reply
961 "header": { "id": 23456, "qr": 1, "opcode": 0, ... },
962 "question": { "qname": &lt;bindata of "www.example.com"&gt;, "qtype": 1, "qclass": 1 },
963 "answer":
964 [
965 {
966 "name": &lt;bindata of "www.example.com"&gt;,
967 "type": 1,
968 "class": 1,
969 "ttl": 33000,
970 "rdata":
971 {
972 "ipv4_address": &lt;bindata of 0x0a0b0c01&gt;
973 "rdata_raw": &lt;bindata of 0x0a0b0c01&gt;
974 }
975 }
976 ],
977 "authority":
978 [
979 {
980 "name": &lt;bindata of "ns1.example.com"&gt;,
981 "type": 1,
982 "class": 1,
983 "ttl": 600,
984 "rdata":
985 {
986 "ipv4_address": &lt;bindata of 0x65439876&gt;
987 "rdata_raw": &lt;bindata of 0x65439876&gt;
988 }
989 }
990 ]
991 "additional": [],
992 "canonical_name": &lt;bindata of "www.example.com"&gt;,
993 "answer_type": GETDNS_NAMETYPE_DNS
994 },
995 { # This is the second reply
996 "header": { "id": 47809, "qr": 1, "opcode": 0, ... },
997 "question": { "qname": &lt;bindata of "www.example.com"&gt;, "qtype": 28, "qclass": 1 },
998 "answer":
999 [
1000 {
1001 "name": &lt;bindata of "www.example.com"&gt;,
1002 "type": 28,
1003 "class": 1,
1004 "ttl": 1000,
1005 "rdata":
1006 {
1007 "ipv6_address": &lt;bindata of 0x33445566334455663344556633445566&gt;
1008 "rdata_raw": &lt;bindata of 0x33445566334455663344556633445566&gt;
1009 }
1010 }
1011 ],
1012 "authority": [ # Same as for other record... ]
1013 "additional": [],
1014 },
1015 ]
1016 }
1017 </pre>
1018
1019 <p>In DNS responses, domain names are treated special. RFC 1035 describes a form of name compression
1020 that requires that the entire record be available for analysis. The API deals with this by
1021 converting compressed names into full names when returning names in the <code>replies_tree</code>.
1022 This conversion happens for <code>qname</code> in <code>question</code>; <code>name</code> in the
1023 <code>answer</code>, <code>authority</code>, and <code>additional</code>; and in domain names in the
1024 data in names under <code>rdata</code> where the response type is AFSDB, CNAME, MX, NS, PTR, RP, RT, and SOA.</p>
1025
1026 <h2>4.2 Converting Domain Names</h2>
1027
1028 <p>Names in DNS fields are stored in a fashion very different from the normal presentation format
1029 normally used in applications. The DNS format is described in the first paragraph in Section 3.1 of
1030 RFC 1035; the presentation format here is a null-terminated string with interior dots. These helper
1031 functions only work with names in the DNS format that are not compressed. They are useful for
1032 converting domain names in the <code>replies_tree</code> to and from the FQDN presentation
1033 format.</p>
1034
1035 <p><code>getdns_convert_dns_name_to_fqdn()</code> converts a domain name in DNS format to the
1036 presentation format. For example, the hex sequence <code>03 77 77 77 07 65 78 61 6d 70 6c 65 03 63
1037 6f 6d 00</code> would be converted to "www.example.com".
1038 <code>getdns_convert_fqdn_to_dns_name()</code> does the reverse: it converts a null-terminated
1039 string in FQDN format to bytes in DNS format.</p>
1040
1041 <div class=forh>
1042 char *
1043 getdns_convert_dns_name_to_fqdn(
1044 char *name_from_dns_response
1045 );
1046
1047 char *
1048 getdns_convert_fqdn_to_dns_name(
1049 char *fqdn_as_string
1050 );
1051 </div>
1052
1053 <h1>5. Additional Definitions and Descriptions</h1>
1054
1055 <h2>5.1 A Few Needed Definitions</h2>
1056
1057 <div class=forh id="Various">struct getdns_context;
1058 typedef uint16_t getdns_return_t;
1059 typedef uint64_t getdns_transaction_t;
1060 typedef enum getdns_data_type {
1061 t_dict, t_list, t_int, t_bindata
1062 } getdns_data_type;
1063 struct getdns_bindata {
1064 size_t size;
1065 uint8_t *data;
1066 };
1067 struct getdns_dict;
1068 struct getdns_list;
1069 </div>
1070
1071 <h2>5.2 <a id="ReturnCodes">Return Codes</a></h2>
1072
1073 <p>The return codes for all the functions are:</p>
1074
1075 <p class=define>GETDNS_RETURN_GOOD</p>
1076 <p class=descrip>Good</p>
1077 <p class=define>GETDNS_RETURN_GENERIC_ERROR</p>
1078 <p class=descrip>Generic error</p>
1079 <p class=define>GETDNS_RETURN_BAD_DOMAIN_NAME</p>
1080 <p class=descrip>Badly-formed domain name in first argument</p>
1081 <p class=define>GETDNS_RETURN_BAD_CONTEXT</p>
1082 <p class=descrip>Bad value for a context type</p>
1083 <p class=define>GETDNS_RETURN_CONTEXT_UPDATE_FAIL</p>
1084 <p class=descrip>Did not update the context</p>
1085 <p class=define>GETDNS_RETURN_UNKNOWN_TRANSACTION</p>
1086 <p class=descrip>An attempt was made to cancel a callback with a transaction_id that is not recognized</p>
1087 <p class=define>GETDNS_RETURN_NO_SUCH_LIST_ITEM</p>
1088 <p class=descrip>A helper function for lists had an index argument that was too high.</p>
1089 <p class=define>GETDNS_RETURN_NO_SUCH_DICT_NAME</p>
1090 <p class=descrip>A helper function for dicts had a name argument that for a name that is not in the dict.</p>
1091 <p class=define>GETDNS_RETURN_WRONG_TYPE_REQUESTED</p>
1092 <p class=descrip>A helper function was supposed to return a certain type for an item, but the wrong type was given.</p>
1093 <p class=define>GETDNS_RETURN_NO_SUCH_EXTENSION</p>
1094 <p class=descrip>A name in the extensions dict is not a valid extension.</p>
1095 <p class=define>GETDNS_RETURN_EXTENSION_MISFORMAT</p>
1096 <p class=descrip>One or more of the extensions have a bad format.</p>
1097 <p class=define>GETDNS_RETURN_DNSSEC_WITH_STUB_DISALLOWED</p>
1098 <p class=descrip>A query was made with a context that is using stub resolution and a DNSSEC extension specified.</p>
1099 <p class=define>GETDNS_RETURN_MEMORY_ERROR</p>
1100 <p class=descrip>Unable to allocate the memory required.</p>
1101
1102
1103 <h2>5.3 <a id="TypeList">Types of RDATA Returned in the API</a></h2>
1104
1105 <p>The names in the <code>rdata</code> dicts in replies are:</p>
1106
1107
1108 <p class=define>A (1)</p>
1109 <p class=descrip><code>ipv4_address</code> (a bindata)</p>
1110
1111 <p class=define>NS (2)</p>
1112 <p class=descrip><code>nsdname</code> (a bindata)</p>
1113
1114 <p class=define>MD (3)</p>
1115 <p class=descrip><code>madname</code> (a bindata)</p>
1116
1117 <p class=define>MF (4)</p>
1118 <p class=descrip><code>madname</code> (a bindata)</p>
1119
1120 <p class=define>CNAME (5)</p>
1121 <p class=descrip><code>cname</code> (a bindata)</p>
1122
1123 <p class=define>SOA (6)</p>
1124 <p class=descrip><code>mname</code> (a bindata), <code>rname</code> (a bindata),
1125 <code>serial</code> (an int), <code>refresh</code> (an int), <code>refresh</code> (an int),
1126 <code>retry</code> (an int), and <code>expire</code> (an int)</p>
1127
1128 <p class=define>MB (7)</p>
1129 <p class=descrip><code>madname</code> (a bindata)</p>
1130
1131 <p class=define>MG (8)</p>
1132 <p class=descrip><code>mgmname</code> (a bindata)</p>
1133
1134 <p class=define>MR (9)</p>
1135 <p class=descrip><code>newname</code> (a bindata)</p>
1136
1137 <p class=define>NULL (10)</p>
1138 <p class=descrip><code>anything</code> (a bindata)</p>
1139
1140 <p class=define>WKS (11)</p>
1141 <p class=descrip><code>address</code> (a bindata), <code>protocol</code> (an int),
1142 and <code>bitmap</code> (a bindata)</p>
1143
1144 <p class=define>PTR (12)</p>
1145 <p class=descrip><code>ptrdname</code> (a bindata)</p>
1146
1147 <p class=define>HINFO (13)</p>
1148 <p class=descrip><code>cpu</code> (a bindata) and <code>os</code> (a bindata)</p>
1149
1150 <p class=define>MINFO (14)</p>
1151 <p class=descrip><code>rmailbx</code> (a bindata) and <code>emailbx</code> (a bindata)</p>
1152
1153 <p class=define>MX (15)</p>
1154 <p class=descrip><code>preference</code> (an int) and <code>exchange</code> (a bindata)</p>
1155
1156 <p class=define>TXT (16)</p>
1157 <p class=descrip><code>txt_strings</code> (a list) which contains zero or more bindata elements
1158 that are text strings</p>
1159
1160 <p class=define>RP (17)</p>
1161 <p class=descrip><code>mbox_dname</code> (a bindata) and <code>txt_dname</code> (a bindata)</p>
1162
1163 <p class=define>AFSDB (18)</p>
1164 <p class=descrip><code>subtype</code> (an int) and <code>hostname</code> (a bindata)</p>
1165
1166 <p class=define>X25 (19)</p>
1167 <p class=descrip><code>psdn_address</code> (a bindata)</p>
1168
1169 <p class=define>ISDN (20)</p>
1170 <p class=descrip><code>isdn_address</code> (a bindata) and <code>sa</code> (a bindata)</p>
1171
1172 <p class=define>RT (21)</p>
1173 <p class=descrip><code>preference</code> (an int) and <code>intermediate_host</code> (a bindata)</p>
1174
1175 <p class=define>NSAP (22)</p>
1176 <p class=descrip><code>nsap</code> (a bindata)</p>
1177
1178 <p class=define>SIG (24)</p>
1179 <p class=descrip><code>sig_obsolete</code> (a bindata)</p>
1180
1181 <p class=define>KEY (25)</p>
1182 <p class=descrip><code>key_obsolete</code> (a bindata)</p>
1183
1184 <p class=define>PX (26)</p>
1185 <p class=descrip><code>preference</code> (an int), <code>map822</code> (a bindata), and <code>mapx400</code> (a bindata)</p>
1186
1187 <p class=define>GPOS (27)</p>
1188 <p class=descrip><code>longitude</code> (a bindata), <code>latitude</code> (a bindata), and <code>altitude</code> (a bindata)</p>
1189
1190 <p class=define>AAAA (28)</p>
1191 <p class=descrip><code>ipv6_address</code> (a bindata)</p>
1192
1193 <p class=define>LOC (29)</p>
1194 <p class=descrip><code>loc_obsolete</code> (a bindata)</p>
1195
1196 <p class=define>NXT (30)</p>
1197 <p class=descrip><code>nxt_obsolete</code> (a bindata)</p>
1198
1199 <p class=define>EID (31)</p>
1200 <p class=descrip><code>eid_unknown</code> (a bindata)</p>
1201
1202 <p class=define>NIMLOC (32)</p>
1203 <p class=descrip><code>nimloc_unknown</code> (a bindata)</p>
1204
1205 <p class=define>SRV (33)</p>
1206 <p class=descrip><code>priority</code> (an int), <code>weight</code> (an int),
1207 <code>port</code> (an int), and <code>target</code> (a bindata)</p>
1208
1209 <p class=define>ATMA (34)</p>
1210 <p class=descrip><code>format</code> (an int) and <code>address</code> (a bindata)</p>
1211
1212 <p class=define>NAPTR (35)</p>
1213 <p class=descrip><code>order</code> (an int), <code>preference</code> (an int), <code>flags</code>
1214 (a bindata), <code>service</code> (a bindata), <code>regexp</code> (a bindata), and
1215 <code>replacement</code> (a bindata).</p>
1216
1217 <p class=define>KX (36)</p>
1218 <p class=descrip><code>preference</code> (an int) and <code>exchanger</code> (a bindata)</p>
1219
1220 <p class=define>CERT (37)</p>
1221 <p class=descrip><code>type</code> (an int), <code>key_tag</code> (an int), <code>algorithm</code> (an int),
1222 and <code>certificate_or_crl</code> (a bindata)</p>
1223
1224 <p class=define>A6 (38)</p>
1225 <p class=descrip><code>a6_obsolete</code> (a bindata)</p>
1226
1227 <p class=define>DNAME (39)</p>
1228 <p class=descrip><code>target</code> (a bindata)</p>
1229
1230 <p class=define>SINK (40)</p>
1231 <p class=descrip><code>sink_unknown</code> (a bindata)</p>
1232
1233 <p class=define>OPT (41)</p>
1234 <p class=descrip><code>options</code> (a list). Each element of the <code>options</code> list is a
1235 dict with two names: <code>option_code</code> (an int) and <code>option_data</code> (a bindata).</p>
1236
1237 <p class=define>APL (42)</p>
1238 <p class=descrip><code>apitems</code> (a list).
1239 Each element of the <code>apitems</code> list is a dict with four names:
1240 <code>address_family</code> (an int), <code>prefix</code> (an int),
1241 <code>n</code> (an int), and <code>afdpart</code> (a bindata)</p>
1242
1243 <p class=define>DS (43)</p>
1244 <p class=descrip><code>key_tag</code> (an int), <code>algorithm</code> (an int), <code>digest_type</code> (an int),
1245 and <code>digest</code> (a bindata)</p>
1246
1247 <p class=define>SSHFP (44)</p>
1248 <p class=descrip><code>algorithm</code> (an int), <code>fp_type</code> (an int),
1249 and <code>fingerprint</code> (a bindata)</p>
1250
1251 <p class=define>IPSECKEY (45)</p>
1252 <p class=descrip><code>algorithm</code> (an int), <code>gateway_type</code> (an int), <code>precedence</code> (an int),
1253 <code>gateway</code>, and <code>public_key</code> (a bindata)</p>
1254
1255 <p class=define>RRSIG (46)</p>
1256 <p class=descrip> <code>type_covered</code> (an int), <code>algorithm</code> (an int),
1257 <code>labels</code> (an int), <code>original_ttl</code> (an int), <code>signature_expiration</code>
1258 (an int), <code>signature_inception</code> (an int), <code>key_tag</code> (an int),
1259 <code>signers_name</code> (a bindata), and <code>signature</code> (a bindata)</p>
1260
1261 <p class=define>NSEC (47)</p>
1262 <p class=descrip><code>next_domain_name</code> (a bindata) and <code>type_bit_maps</code> (a bindata)</p>
1263
1264 <p class=define>DNSKEY (48)</p>
1265 <p class=descrip><code>flags</code> (an int), <code>protocol</code> (an int), <code>algorithm</code> (an int),
1266 and <code>public_key</code> (a bindata)</p>
1267
1268 <p class=define>DHCID (49)</p>
1269 <p class=descrip><code>dhcid_opaque</code> (a bindata)</p>
1270
1271 <p class=define>NSEC3 (50)</p>
1272 <p class=descrip><code>hash_algorithm</code> (an int), <code>flags</code> (an int),
1273 <code>iterations</code> (an int), <code>salt</code> (a bindata),
1274 <code>next_hashed_owner_name</code> (a bindata), and
1275 <code>type_bit_maps</code> (a bindata)</p>
1276
1277 <p class=define>NSEC3PARAM (51)</p>
1278 <p class=descrip><code>hash_algorithm</code> (an int), <code>flags</code> (an int),
1279 <code>iterations</code> (an int), and
1280 <code>salt</code> (a bindata)</p>
1281
1282 <p class=define>TLSA (52)</p>
1283 <p class=descrip><code>certificate_usage</code> (an int), <code>selector</code> (an int),
1284 <code>matching_type</code> (an int), and <code>certificate_association_data</code> (a
1285 bindata).</p>
1286
1287 <p class=define>HIP (55)</p>
1288 <p class=descrip><code>pk_algorithm</code> (an int),
1289 <code>hit</code> (a bindata), <code>public_key</code>
1290 (a bindata), and <code>rendezvous_servers</code> (a list) with each element a bindata with the dname of the rendezvous_server.</p>
1291
1292 <p class=define>NINFO (56)</p>
1293 <p class=descrip><code>ninfo_unknown</code> (a bindata)</p>
1294
1295 <p class=define>RKEY (57)</p>
1296 <p class=descrip><code>rkey_unknown</code> (a bindata)</p>
1297
1298 <p class=define>TALINK (58)</p>
1299 <p class=descrip><code>talink_unknown</code> (a bindata)</p>
1300
1301 <p class=define>CDS (59)</p>
1302 <p class=descrip><code>cds_unknown</code> (a bindata)</p>
1303
1304 <p class=define>SPF (99)</p>
1305 <p class=descrip><code>text</code> (a bindata)</p>
1306
1307 <p class=define>UINFO (100)</p>
1308 <p class=descrip><code>uinfo_unknown</code> (a bindata)</p>
1309
1310 <p class=define>UID (101)</p>
1311 <p class=descrip><code>uid_unknown</code> (a bindata)</p>
1312
1313 <p class=define>GID (102)</p>
1314 <p class=descrip><code>gid_unknown</code> (a bindata)</p>
1315
1316 <p class=define>UNSPEC (103)</p>
1317 <p class=descrip><code>unspec_unknown</code> (a bindata)</p>
1318
1319 <p class=define>NID (104)</p>
1320 <p class=descrip><code>preference</code> (an int) and
1321 <code>node_id</code> (a bindata)</p>
1322
1323 <p class=define>L32 (105)</p>
1324 <p class=descrip><code>preference</code> (an int) and <code>locator32</code> (a bindata)</p>
1325
1326 <p class=define>L64 (106)</p>
1327 <p class=descrip><code>preference</code> (an int) and <code>locator64</code> (a bindata)</p>
1328
1329 <p class=define>LP (107)</p>
1330 <p class=descrip><code>preference</code> (an int) and <code>fqdn</code> (a bindata)</p>
1331
1332 <p class=define>EUI48 (108)</p>
1333 <p class=descrip><code>eui48_address</code> (a bindata)</p>
1334
1335 <p class=define>EUI64 (109)</p>
1336 <p class=descrip><code>eui64_address</code> (a bindata)</p>
1337
1338 <p class=define>TKEY (249)</p>
1339 <p class=descrip><code>algorithm</code> (a bindata), <code>inception</code> (an int),
1340 <code>expiration</code> (an int), <code>mode</code> (an int), <code>error</code> (an int),
1341 <code>key_data</code> (a bindata), and <code>other_data</code> (a bindata)</p>
1342
1343 <p class=define>TSIG (250)</p>
1344 <p class=descrip><code>algorithm</code> (a bindata), <code>time_signed</code> (a bindata),
1345 <code>fudge</code> (an int), <code>mac</code> (a bindata), <code>original_id</code> (an int),
1346 <code>error</code> (an int), and <code>other_data</code> (a bindata)</p>
1347
1348 <p class=define>MAILB (253)</p>
1349 <p class=descrip><code>mailb-unknown</code> (a bindata)</p>
1350
1351 <p class=define>MAILA (254)</p>
1352 <p class=descrip><code>maila-unknown</code> (a bindata)</p>
1353
1354 <p class=define>URI (256)</p>
1355 <p class=descrip><code>priority</code> (an int), <code>weight</code> (an int),
1356 and <code>target</code> (a bindata)</p>
1357
1358 <p class=define>CAA (257)</p>
1359 <p class=descrip><code>flags</code> (an int), <code>tag</code> (a bindata), and <code>value</code> (a bindata)</p>
1360
1361 <p class=define>TA (32768)</p>
1362 <p class=descrip><code>ta_unknown</code> (a bindata)</p>
1363
1364 <p class=define>DLV (32769)</p>
1365 <p class=descrip>Identical to DS (43)</p>
1366
1367
1368 <h1>6. Examples</h1>
1369
1370 <p>This section gives examples of code that calls the API to do many common tasks.
1371 The purpose of the code here is to give application developers a quick hands-on
1372 demo of using the API.</p>
1373
1374 <p>Note that the examples here all use getdns_libevent.h as the include that will call in the API
1375 code as well as calling in libevent as the event library. They also use
1376 <code>getdns_context_set_libevent_base()</code> as the name of the function to set the event base in
1377 the DNS context. If you are using a different event library, you will of course use a different
1378 <code>#include</code> at the beginning of your code, and a different name for the event base
1379 function.</p>
1380
1381 <h2>6.1 Get Both IPv4 and IPv6 Addresses for a Domain Name Using Quick Results</h2>
1382
1383 <p>This is an example of a common call to <code>getdns_address()</code>.</p>
1384
1385 <br><div class="highlight"><pre><span class="cp">#include &lt;stdio.h&gt;</span>
1386 <span class="cp">#include &lt;stdint.h&gt;</span>
1387 <span class="cp">#include &lt;stdlib.h&gt;</span>
1388 <span class="cp">#include &lt;string.h&gt;</span>
1389 <span class="cp">#include &lt;inttypes.h&gt;</span>
1390 <span class="cp">#include &lt;getdns_libevent.h&gt;</span>
1391
1392 <span class="cp">#define UNUSED_PARAM(x) ((void)(x))</span>
1393
1394 <span class="cm">/* Set up the callback function, which will also do the processing of the results */</span>
1395 <span class="kt">void</span> <span class="nf">this_callbackfn</span><span class="p">(</span><span class="k">struct</span> <span class="n">getdns_context</span> <span class="o">*</span><span class="n">this_context</span><span class="p">,</span>
1396 <span class="kt">uint16_t</span> <span class="n">this_callback_type</span><span class="p">,</span>
1397 <span class="k">struct</span> <span class="n">getdns_dict</span> <span class="o">*</span><span class="n">this_response</span><span class="p">,</span>
1398 <span class="kt">void</span> <span class="o">*</span><span class="n">this_userarg</span><span class="p">,</span>
1399 <span class="kt">getdns_transaction_t</span> <span class="n">this_transaction_id</span><span class="p">)</span>
1400 <span class="p">{</span>
1401 <span class="n">UNUSED_PARAM</span><span class="p">(</span><span class="n">this_userarg</span><span class="p">);</span> <span class="cm">/* Not looking at the userarg for this example */</span>
1402 <span class="n">UNUSED_PARAM</span><span class="p">(</span><span class="n">this_context</span><span class="p">);</span> <span class="cm">/* Not looking at the context for this example */</span>
1403 <span class="kt">getdns_return_t</span> <span class="n">this_ret</span><span class="p">;</span> <span class="cm">/* Holder for all function returns */</span>
1404 <span class="k">if</span> <span class="p">(</span><span class="n">this_callback_type</span> <span class="o">==</span> <span class="n">GETDNS_CALLBACK_COMPLETE</span><span class="p">)</span> <span class="cm">/* This is a callback with data */</span>
1405 <span class="p">{</span>
1406 <span class="cm">/* Be sure the search returned something */</span>
1407 <span class="kt">uint32_t</span> <span class="n">this_error</span><span class="p">;</span>
1408 <span class="n">this_ret</span> <span class="o">=</span> <span class="n">getdns_dict_get_int</span><span class="p">(</span><span class="n">this_response</span><span class="p">,</span> <span class="s">&quot;status&quot;</span><span class="p">,</span> <span class="o">&amp;</span><span class="n">this_error</span><span class="p">);</span> <span class="c1">// Ignore any error</span>
1409 <span class="k">if</span> <span class="p">(</span><span class="n">this_error</span> <span class="o">!=</span> <span class="n">GETDNS_RESPSTATUS_GOOD</span><span class="p">)</span> <span class="c1">// If the search didn&#39;t return &quot;good&quot;</span>
1410 <span class="p">{</span>
1411 <span class="n">fprintf</span><span class="p">(</span><span class="n">stderr</span><span class="p">,</span> <span class="s">&quot;The search had no results, and a return value of %d. Exiting.</span><span class="se">\n</span><span class="s">&quot;</span><span class="p">,</span> <span class="n">this_error</span><span class="p">);</span>
1412 <span class="n">getdns_dict_destroy</span><span class="p">(</span><span class="n">this_response</span><span class="p">);</span>
1413 <span class="k">return</span><span class="p">;</span>
1414 <span class="p">}</span>
1415 <span class="k">struct</span> <span class="n">getdns_list</span> <span class="o">*</span> <span class="n">just_the_addresses_ptr</span><span class="p">;</span>
1416 <span class="n">this_ret</span> <span class="o">=</span> <span class="n">getdns_dict_get_list</span><span class="p">(</span><span class="n">this_response</span><span class="p">,</span> <span class="s">&quot;just_address_answers&quot;</span><span class="p">,</span> <span class="o">&amp;</span><span class="n">just_the_addresses_ptr</span><span class="p">);</span>
1417 <span class="k">if</span> <span class="p">(</span><span class="n">this_ret</span> <span class="o">!=</span> <span class="n">GETDNS_RETURN_GOOD</span><span class="p">)</span> <span class="c1">// This check is really not needed, but prevents a compiler error under &quot;pedantic&quot;</span>
1418 <span class="p">{</span>
1419 <span class="n">fprintf</span><span class="p">(</span><span class="n">stderr</span><span class="p">,</span> <span class="s">&quot;Trying to get the answers failed: %d</span><span class="se">\n</span><span class="s">&quot;</span><span class="p">,</span> <span class="n">this_ret</span><span class="p">);</span>
1420 <span class="n">getdns_dict_destroy</span><span class="p">(</span><span class="n">this_response</span><span class="p">);</span>
1421 <span class="k">return</span><span class="p">;</span>
1422 <span class="p">}</span>
1423 <span class="kt">size_t</span> <span class="n">num_addresses</span><span class="p">;</span>
1424 <span class="n">this_ret</span> <span class="o">=</span> <span class="n">getdns_list_get_length</span><span class="p">(</span><span class="n">just_the_addresses_ptr</span><span class="p">,</span> <span class="o">&amp;</span><span class="n">num_addresses</span><span class="p">);</span> <span class="c1">// Ignore any error</span>
1425 <span class="cm">/* Go through each record */</span>
1426 <span class="k">for</span> <span class="p">(</span> <span class="kt">size_t</span> <span class="n">rec_count</span> <span class="o">=</span> <span class="mi">0</span><span class="p">;</span> <span class="n">rec_count</span> <span class="o">&lt;</span> <span class="n">num_addresses</span><span class="p">;</span> <span class="o">++</span><span class="n">rec_count</span> <span class="p">)</span>
1427 <span class="p">{</span>
1428 <span class="k">struct</span> <span class="n">getdns_dict</span> <span class="o">*</span> <span class="n">this_address</span><span class="p">;</span>
1429 <span class="n">this_ret</span> <span class="o">=</span> <span class="n">getdns_list_get_dict</span><span class="p">(</span><span class="n">just_the_addresses_ptr</span><span class="p">,</span> <span class="n">rec_count</span><span class="p">,</span> <span class="o">&amp;</span><span class="n">this_address</span><span class="p">);</span> <span class="c1">// Ignore any error</span>
1430 <span class="cm">/* Just print the address */</span>
1431 <span class="k">struct</span> <span class="n">getdns_bindata</span> <span class="o">*</span> <span class="n">this_address_data</span><span class="p">;</span>
1432 <span class="n">this_ret</span> <span class="o">=</span> <span class="n">getdns_dict_get_bindata</span><span class="p">(</span><span class="n">this_address</span><span class="p">,</span> <span class="s">&quot;address_data&quot;</span><span class="p">,</span> <span class="o">&amp;</span><span class="n">this_address_data</span><span class="p">);</span> <span class="c1">// Ignore any error</span>
1433 <span class="kt">char</span> <span class="o">*</span><span class="n">this_address_str</span> <span class="o">=</span> <span class="n">getdns_display_ip_address</span><span class="p">(</span><span class="n">this_address_data</span><span class="p">);</span>
1434 <span class="n">printf</span><span class="p">(</span><span class="s">&quot;The address is %s</span><span class="se">\n</span><span class="s">&quot;</span><span class="p">,</span> <span class="n">this_address_str</span><span class="p">);</span>
1435 <span class="n">free</span><span class="p">(</span><span class="n">this_address_str</span><span class="p">);</span>
1436 <span class="p">}</span>
1437 <span class="p">}</span>
1438 <span class="k">else</span> <span class="k">if</span> <span class="p">(</span><span class="n">this_callback_type</span> <span class="o">==</span> <span class="n">GETDNS_CALLBACK_CANCEL</span><span class="p">)</span>
1439 <span class="n">fprintf</span><span class="p">(</span><span class="n">stderr</span><span class="p">,</span> <span class="s">&quot;The callback with ID %&quot;</span><span class="n">PRIu64</span><span class="s">&quot; was cancelled. Exiting.</span><span class="se">\n</span><span class="s">&quot;</span><span class="p">,</span> <span class="n">this_transaction_id</span><span class="p">);</span>
1440 <span class="k">else</span>
1441 <span class="n">fprintf</span><span class="p">(</span><span class="n">stderr</span><span class="p">,</span> <span class="s">&quot;The callback got a callback_type of %d. Exiting.</span><span class="se">\n</span><span class="s">&quot;</span><span class="p">,</span> <span class="n">this_callback_type</span><span class="p">);</span>
1442 <span class="n">getdns_dict_destroy</span><span class="p">(</span><span class="n">this_response</span><span class="p">);</span>
1443 <span class="p">}</span>
1444
1445 <span class="kt">int</span> <span class="nf">main</span><span class="p">()</span>
1446 <span class="p">{</span>
1447 <span class="cm">/* Create the DNS context for this call */</span>
1448 <span class="k">struct</span> <span class="n">getdns_context</span> <span class="o">*</span><span class="n">this_context</span> <span class="o">=</span> <span class="nb">NULL</span><span class="p">;</span>
1449 <span class="kt">getdns_return_t</span> <span class="n">context_create_return</span> <span class="o">=</span> <span class="n">getdns_context_create</span><span class="p">(</span><span class="o">&amp;</span><span class="n">this_context</span><span class="p">,</span> <span class="mi">1</span><span class="p">);</span>
1450 <span class="k">if</span> <span class="p">(</span><span class="n">context_create_return</span> <span class="o">!=</span> <span class="n">GETDNS_RETURN_GOOD</span><span class="p">)</span>
1451 <span class="p">{</span>
1452 <span class="n">fprintf</span><span class="p">(</span><span class="n">stderr</span><span class="p">,</span> <span class="s">&quot;Trying to create the context failed: %d&quot;</span><span class="p">,</span> <span class="n">context_create_return</span><span class="p">);</span>
1453 <span class="k">return</span><span class="p">(</span><span class="n">GETDNS_RETURN_GENERIC_ERROR</span><span class="p">);</span>
1454 <span class="p">}</span>
1455 <span class="cm">/* Create an event base and put it in the context using the unknown function name */</span>
1456 <span class="k">struct</span> <span class="n">event_base</span> <span class="o">*</span><span class="n">this_event_base</span><span class="p">;</span>
1457 <span class="n">this_event_base</span> <span class="o">=</span> <span class="n">event_base_new</span><span class="p">();</span>
1458 <span class="k">if</span> <span class="p">(</span><span class="n">this_event_base</span> <span class="o">==</span> <span class="nb">NULL</span><span class="p">)</span>
1459 <span class="p">{</span>
1460 <span class="n">fprintf</span><span class="p">(</span><span class="n">stderr</span><span class="p">,</span> <span class="s">&quot;Trying to create the event base failed.</span><span class="se">\n</span><span class="s">&quot;</span><span class="p">);</span>
1461 <span class="n">getdns_context_destroy</span><span class="p">(</span><span class="n">this_context</span><span class="p">);</span>
1462 <span class="k">return</span><span class="p">(</span><span class="n">GETDNS_RETURN_GENERIC_ERROR</span><span class="p">);</span>
1463 <span class="p">}</span>
1464 <span class="p">(</span><span class="kt">void</span><span class="p">)</span><span class="n">getdns_extension_set_libevent_base</span><span class="p">(</span><span class="n">this_context</span><span class="p">,</span> <span class="n">this_event_base</span><span class="p">);</span>
1465 <span class="cm">/* Set up the getdns call */</span>
1466 <span class="k">const</span> <span class="kt">char</span> <span class="o">*</span> <span class="n">this_name</span> <span class="o">=</span> <span class="s">&quot;www.example.com&quot;</span><span class="p">;</span>
1467 <span class="kt">char</span><span class="o">*</span> <span class="n">this_userarg</span> <span class="o">=</span> <span class="s">&quot;somestring&quot;</span><span class="p">;</span> <span class="c1">// Could add things here to help identify this call</span>
1468 <span class="kt">getdns_transaction_t</span> <span class="n">this_transaction_id</span> <span class="o">=</span> <span class="mi">0</span><span class="p">;</span>
1469
1470 <span class="cm">/* Make the call */</span>
1471 <span class="kt">getdns_return_t</span> <span class="n">dns_request_return</span> <span class="o">=</span> <span class="n">getdns_address</span><span class="p">(</span><span class="n">this_context</span><span class="p">,</span> <span class="n">this_name</span><span class="p">,</span>
1472 <span class="nb">NULL</span><span class="p">,</span> <span class="n">this_userarg</span><span class="p">,</span> <span class="o">&amp;</span><span class="n">this_transaction_id</span><span class="p">,</span> <span class="n">this_callbackfn</span><span class="p">);</span>
1473 <span class="k">if</span> <span class="p">(</span><span class="n">dns_request_return</span> <span class="o">==</span> <span class="n">GETDNS_RETURN_BAD_DOMAIN_NAME</span><span class="p">)</span>
1474 <span class="p">{</span>
1475 <span class="n">fprintf</span><span class="p">(</span><span class="n">stderr</span><span class="p">,</span> <span class="s">&quot;A bad domain name was used: %s. Exiting.</span><span class="se">\n</span><span class="s">&quot;</span><span class="p">,</span> <span class="n">this_name</span><span class="p">);</span>
1476 <span class="n">event_base_free</span><span class="p">(</span><span class="n">this_event_base</span><span class="p">);</span>
1477 <span class="n">getdns_context_destroy</span><span class="p">(</span><span class="n">this_context</span><span class="p">);</span>
1478 <span class="k">return</span><span class="p">(</span><span class="n">GETDNS_RETURN_GENERIC_ERROR</span><span class="p">);</span>
1479 <span class="p">}</span>
1480 <span class="k">else</span>
1481 <span class="p">{</span>
1482 <span class="cm">/* Call the event loop */</span>
1483 <span class="kt">int</span> <span class="n">dispatch_return</span> <span class="o">=</span> <span class="n">event_base_dispatch</span><span class="p">(</span><span class="n">this_event_base</span><span class="p">);</span>
1484 <span class="n">UNUSED_PARAM</span><span class="p">(</span><span class="n">dispatch_return</span><span class="p">);</span>
1485 <span class="c1">// TODO: check the return value above</span>
1486 <span class="p">}</span>
1487 <span class="cm">/* Clean up */</span>
1488 <span class="n">event_base_free</span><span class="p">(</span><span class="n">this_event_base</span><span class="p">);</span>
1489 <span class="n">getdns_context_destroy</span><span class="p">(</span><span class="n">this_context</span><span class="p">);</span>
1490 <span class="cm">/* Assuming we get here, leave gracefully */</span>
1491 <span class="n">exit</span><span class="p">(</span><span class="n">EXIT_SUCCESS</span><span class="p">);</span>
1492 <span class="p">}</span>
1493 </pre></div>
1494
1495
1496
1497 <h2>6.2 Get IPv4 and IPv6 Addresses for a Domain Name</h2>
1498
1499 <p>This example is similar to the previous one, except that it retrieves more information than just
1500 the addresses, so it traverses the replies_tree. In this case, it gets both the addresses and
1501 their TTLs.</p>
1502
1503 <br><div class="highlight"><pre><span class="cp">#include &lt;stdio.h&gt;</span>
1504 <span class="cp">#include &lt;stdint.h&gt;</span>
1505 <span class="cp">#include &lt;stdlib.h&gt;</span>
1506 <span class="cp">#include &lt;string.h&gt;</span>
1507 <span class="cp">#include &lt;inttypes.h&gt;</span>
1508 <span class="cp">#include &lt;getdns_libevent.h&gt;</span>
1509
1510 <span class="cp">#define UNUSED_PARAM(x) ((void)(x))</span>
1511
1512 <span class="cm">/* Set up the callback function, which will also do the processing of the results */</span>
1513 <span class="kt">void</span> <span class="nf">this_callbackfn</span><span class="p">(</span><span class="k">struct</span> <span class="n">getdns_context</span> <span class="o">*</span><span class="n">this_context</span><span class="p">,</span>
1514 <span class="kt">getdns_return_t</span> <span class="n">this_callback_type</span><span class="p">,</span>
1515 <span class="k">struct</span> <span class="n">getdns_dict</span> <span class="o">*</span><span class="n">this_response</span><span class="p">,</span>
1516 <span class="kt">void</span> <span class="o">*</span><span class="n">this_userarg</span><span class="p">,</span>
1517 <span class="kt">getdns_transaction_t</span> <span class="n">this_transaction_id</span><span class="p">)</span>
1518 <span class="p">{</span>
1519 <span class="n">UNUSED_PARAM</span><span class="p">(</span><span class="n">this_userarg</span><span class="p">);</span> <span class="cm">/* Not looking at the userarg for this example */</span>
1520 <span class="n">UNUSED_PARAM</span><span class="p">(</span><span class="n">this_context</span><span class="p">);</span> <span class="cm">/* Not looking at the context for this example */</span>
1521 <span class="kt">getdns_return_t</span> <span class="n">this_ret</span><span class="p">;</span> <span class="cm">/* Holder for all function returns */</span>
1522 <span class="k">if</span> <span class="p">(</span><span class="n">this_callback_type</span> <span class="o">==</span> <span class="n">GETDNS_CALLBACK_COMPLETE</span><span class="p">)</span> <span class="cm">/* This is a callback with data */</span>
1523 <span class="p">{</span>
1524 <span class="cm">/* Be sure the search returned something */</span>
1525 <span class="kt">uint32_t</span> <span class="n">this_error</span><span class="p">;</span>
1526 <span class="n">this_ret</span> <span class="o">=</span> <span class="n">getdns_dict_get_int</span><span class="p">(</span><span class="n">this_response</span><span class="p">,</span> <span class="s">&quot;status&quot;</span><span class="p">,</span> <span class="o">&amp;</span><span class="n">this_error</span><span class="p">);</span> <span class="c1">// Ignore any error</span>
1527 <span class="k">if</span> <span class="p">(</span><span class="n">this_error</span> <span class="o">!=</span> <span class="n">GETDNS_RESPSTATUS_GOOD</span><span class="p">)</span> <span class="c1">// If the search didn&#39;t return &quot;good&quot;</span>
1528 <span class="p">{</span>
1529 <span class="n">fprintf</span><span class="p">(</span><span class="n">stderr</span><span class="p">,</span> <span class="s">&quot;The search had no results, and a return value of %d. Exiting.</span><span class="se">\n</span><span class="s">&quot;</span><span class="p">,</span> <span class="n">this_error</span><span class="p">);</span>
1530 <span class="n">getdns_dict_destroy</span><span class="p">(</span><span class="n">this_response</span><span class="p">);</span>
1531 <span class="k">return</span><span class="p">;</span>
1532 <span class="p">}</span>
1533 <span class="cm">/* Find all the answers returned */</span>
1534 <span class="k">struct</span> <span class="n">getdns_list</span> <span class="o">*</span> <span class="n">these_answers</span><span class="p">;</span>
1535 <span class="n">this_ret</span> <span class="o">=</span> <span class="n">getdns_dict_get_list</span><span class="p">(</span><span class="n">this_response</span><span class="p">,</span> <span class="s">&quot;replies_tree&quot;</span><span class="p">,</span> <span class="o">&amp;</span><span class="n">these_answers</span><span class="p">);</span>
1536 <span class="k">if</span> <span class="p">(</span><span class="n">this_ret</span> <span class="o">==</span> <span class="n">GETDNS_RETURN_NO_SUCH_DICT_NAME</span><span class="p">)</span>
1537 <span class="p">{</span>
1538 <span class="n">fprintf</span><span class="p">(</span><span class="n">stderr</span><span class="p">,</span> <span class="s">&quot;Weird: the response had no error, but also no replies_tree. Exiting.</span><span class="se">\n</span><span class="s">&quot;</span><span class="p">);</span>
1539 <span class="n">getdns_dict_destroy</span><span class="p">(</span><span class="n">this_response</span><span class="p">);</span>
1540 <span class="k">return</span><span class="p">;</span>
1541 <span class="p">}</span>
1542 <span class="kt">size_t</span> <span class="n">num_answers</span><span class="p">;</span>
1543 <span class="n">this_ret</span> <span class="o">=</span> <span class="n">getdns_list_get_length</span><span class="p">(</span><span class="n">these_answers</span><span class="p">,</span> <span class="o">&amp;</span><span class="n">num_answers</span><span class="p">);</span>
1544 <span class="cm">/* Go through each answer */</span>
1545 <span class="k">for</span> <span class="p">(</span> <span class="kt">size_t</span> <span class="n">rec_count</span> <span class="o">=</span> <span class="mi">0</span><span class="p">;</span> <span class="n">rec_count</span> <span class="o">&lt;</span> <span class="n">num_answers</span><span class="p">;</span> <span class="o">++</span><span class="n">rec_count</span> <span class="p">)</span>
1546 <span class="p">{</span>
1547 <span class="k">struct</span> <span class="n">getdns_dict</span> <span class="o">*</span> <span class="n">this_record</span><span class="p">;</span>
1548 <span class="n">this_ret</span> <span class="o">=</span> <span class="n">getdns_list_get_dict</span><span class="p">(</span><span class="n">these_answers</span><span class="p">,</span> <span class="n">rec_count</span><span class="p">,</span> <span class="o">&amp;</span><span class="n">this_record</span><span class="p">);</span> <span class="c1">// Ignore any error</span>
1549 <span class="cm">/* Get the answer section */</span>
1550 <span class="k">struct</span> <span class="n">getdns_list</span> <span class="o">*</span> <span class="n">this_answer</span><span class="p">;</span>
1551 <span class="n">this_ret</span> <span class="o">=</span> <span class="n">getdns_dict_get_list</span><span class="p">(</span><span class="n">this_record</span><span class="p">,</span> <span class="s">&quot;answer&quot;</span><span class="p">,</span> <span class="o">&amp;</span><span class="n">this_answer</span><span class="p">);</span> <span class="c1">// Ignore any error</span>
1552 <span class="cm">/* Get each RR in the answer section */</span>
1553 <span class="kt">size_t</span> <span class="n">num_rrs</span><span class="p">;</span>
1554 <span class="n">this_ret</span> <span class="o">=</span> <span class="n">getdns_list_get_length</span><span class="p">(</span><span class="n">this_answer</span><span class="p">,</span> <span class="o">&amp;</span><span class="n">num_rrs</span><span class="p">);</span>
1555 <span class="k">for</span> <span class="p">(</span> <span class="kt">size_t</span> <span class="n">rr_count</span> <span class="o">=</span> <span class="mi">0</span><span class="p">;</span> <span class="n">rr_count</span> <span class="o">&lt;</span> <span class="n">num_rrs</span><span class="p">;</span> <span class="o">++</span><span class="n">rr_count</span> <span class="p">)</span>
1556 <span class="p">{</span>
1557 <span class="k">struct</span> <span class="n">getdns_dict</span> <span class="o">*</span><span class="n">this_rr</span> <span class="o">=</span> <span class="nb">NULL</span><span class="p">;</span>
1558 <span class="n">this_ret</span> <span class="o">=</span> <span class="n">getdns_list_get_dict</span><span class="p">(</span><span class="n">this_answer</span><span class="p">,</span> <span class="n">rr_count</span><span class="p">,</span> <span class="o">&amp;</span><span class="n">this_rr</span><span class="p">);</span> <span class="c1">// Ignore any error</span>
1559 <span class="cm">/* Get the RDATA */</span>
1560 <span class="k">struct</span> <span class="n">getdns_dict</span> <span class="o">*</span> <span class="n">this_rdata</span> <span class="o">=</span> <span class="nb">NULL</span><span class="p">;</span>
1561 <span class="n">this_ret</span> <span class="o">=</span> <span class="n">getdns_dict_get_dict</span><span class="p">(</span><span class="n">this_rr</span><span class="p">,</span> <span class="s">&quot;rdata&quot;</span><span class="p">,</span> <span class="o">&amp;</span><span class="n">this_rdata</span><span class="p">);</span> <span class="c1">// Ignore any error</span>
1562 <span class="cm">/* Get the RDATA type */</span>
1563 <span class="kt">uint32_t</span> <span class="n">this_type</span><span class="p">;</span>
1564 <span class="n">this_ret</span> <span class="o">=</span> <span class="n">getdns_dict_get_int</span><span class="p">(</span><span class="n">this_rr</span><span class="p">,</span> <span class="s">&quot;type&quot;</span><span class="p">,</span> <span class="o">&amp;</span><span class="n">this_type</span><span class="p">);</span> <span class="c1">// Ignore any error</span>
1565 <span class="cm">/* If it is type A or AAAA, print the value */</span>
1566 <span class="k">if</span> <span class="p">(</span><span class="n">this_type</span> <span class="o">==</span> <span class="n">GETDNS_RRTYPE_A</span><span class="p">)</span>
1567 <span class="p">{</span>
1568 <span class="k">struct</span> <span class="n">getdns_bindata</span> <span class="o">*</span> <span class="n">this_a_record</span> <span class="o">=</span> <span class="nb">NULL</span><span class="p">;</span>
1569 <span class="n">this_ret</span> <span class="o">=</span> <span class="n">getdns_dict_get_bindata</span><span class="p">(</span><span class="n">this_rdata</span><span class="p">,</span> <span class="s">&quot;ipv4_address&quot;</span><span class="p">,</span> <span class="o">&amp;</span><span class="n">this_a_record</span><span class="p">);</span>
1570 <span class="k">if</span> <span class="p">(</span><span class="n">this_ret</span> <span class="o">==</span> <span class="n">GETDNS_RETURN_NO_SUCH_DICT_NAME</span><span class="p">)</span>
1571 <span class="p">{</span>
1572 <span class="n">fprintf</span><span class="p">(</span><span class="n">stderr</span><span class="p">,</span> <span class="s">&quot;Weird: the A record at %d in record at %d had no address. Exiting.</span><span class="se">\n</span><span class="s">&quot;</span><span class="p">,</span>
1573 <span class="p">(</span><span class="kt">int</span><span class="p">)</span> <span class="n">rr_count</span><span class="p">,</span> <span class="p">(</span><span class="kt">int</span><span class="p">)</span> <span class="n">rec_count</span><span class="p">);</span>
1574 <span class="n">getdns_dict_destroy</span><span class="p">(</span><span class="n">this_response</span><span class="p">);</span>
1575 <span class="k">return</span><span class="p">;</span>
1576 <span class="p">}</span>
1577 <span class="kt">char</span> <span class="o">*</span><span class="n">this_address_str</span> <span class="o">=</span> <span class="n">getdns_display_ip_address</span><span class="p">(</span><span class="n">this_a_record</span><span class="p">);</span>
1578 <span class="n">printf</span><span class="p">(</span><span class="s">&quot;The IPv4 address is %s</span><span class="se">\n</span><span class="s">&quot;</span><span class="p">,</span> <span class="n">this_address_str</span><span class="p">);</span>
1579 <span class="n">free</span><span class="p">(</span><span class="n">this_address_str</span><span class="p">);</span>
1580 <span class="p">}</span>
1581 <span class="k">else</span> <span class="k">if</span> <span class="p">(</span><span class="n">this_type</span> <span class="o">==</span> <span class="n">GETDNS_RRTYPE_AAAA</span><span class="p">)</span>
1582 <span class="p">{</span>
1583 <span class="k">struct</span> <span class="n">getdns_bindata</span> <span class="o">*</span> <span class="n">this_aaaa_record</span> <span class="o">=</span> <span class="nb">NULL</span><span class="p">;</span>
1584 <span class="n">this_ret</span> <span class="o">=</span> <span class="n">getdns_dict_get_bindata</span><span class="p">(</span><span class="n">this_rdata</span><span class="p">,</span> <span class="s">&quot;ipv6_address&quot;</span><span class="p">,</span> <span class="o">&amp;</span><span class="n">this_aaaa_record</span><span class="p">);</span>
1585 <span class="k">if</span> <span class="p">(</span><span class="n">this_ret</span> <span class="o">==</span> <span class="n">GETDNS_RETURN_NO_SUCH_DICT_NAME</span><span class="p">)</span>
1586 <span class="p">{</span>
1587 <span class="n">fprintf</span><span class="p">(</span><span class="n">stderr</span><span class="p">,</span> <span class="s">&quot;Weird: the AAAA record at %d in record at %d had no address. Exiting.</span><span class="se">\n</span><span class="s">&quot;</span><span class="p">,</span>
1588 <span class="p">(</span><span class="kt">int</span><span class="p">)</span> <span class="n">rr_count</span><span class="p">,</span> <span class="p">(</span><span class="kt">int</span><span class="p">)</span> <span class="n">rec_count</span><span class="p">);</span>
1589 <span class="n">getdns_dict_destroy</span><span class="p">(</span><span class="n">this_response</span><span class="p">);</span>
1590 <span class="k">return</span><span class="p">;</span>
1591 <span class="p">}</span>
1592 <span class="kt">char</span> <span class="o">*</span><span class="n">this_address_str</span> <span class="o">=</span> <span class="n">getdns_display_ip_address</span><span class="p">(</span><span class="n">this_aaaa_record</span><span class="p">);</span>
1593 <span class="n">printf</span><span class="p">(</span><span class="s">&quot;The IPv6 address is %s</span><span class="se">\n</span><span class="s">&quot;</span><span class="p">,</span> <span class="n">this_address_str</span><span class="p">);</span>
1594 <span class="n">free</span><span class="p">(</span><span class="n">this_address_str</span><span class="p">);</span>
1595 <span class="p">}</span>
1596 <span class="p">}</span>
1597 <span class="p">}</span>
1598 <span class="p">}</span>
1599 <span class="k">else</span> <span class="k">if</span> <span class="p">(</span><span class="n">this_callback_type</span> <span class="o">==</span> <span class="n">GETDNS_CALLBACK_CANCEL</span><span class="p">)</span>
1600 <span class="n">fprintf</span><span class="p">(</span><span class="n">stderr</span><span class="p">,</span> <span class="s">&quot;The callback with ID %&quot;</span><span class="n">PRIu64</span><span class="s">&quot; was cancelled. Exiting.</span><span class="se">\n</span><span class="s">&quot;</span><span class="p">,</span> <span class="n">this_transaction_id</span><span class="p">);</span>
1601 <span class="k">else</span>
1602 <span class="n">fprintf</span><span class="p">(</span><span class="n">stderr</span><span class="p">,</span> <span class="s">&quot;The callback got a callback_type of %d. Exiting.</span><span class="se">\n</span><span class="s">&quot;</span><span class="p">,</span> <span class="n">this_callback_type</span><span class="p">);</span>
1603 <span class="n">getdns_dict_destroy</span><span class="p">(</span><span class="n">this_response</span><span class="p">);</span>
1604 <span class="p">}</span>
1605
1606 <span class="kt">int</span> <span class="nf">main</span><span class="p">()</span>
1607 <span class="p">{</span>
1608 <span class="cm">/* Create the DNS context for this call */</span>
1609 <span class="k">struct</span> <span class="n">getdns_context</span> <span class="o">*</span><span class="n">this_context</span> <span class="o">=</span> <span class="nb">NULL</span><span class="p">;</span>
1610 <span class="kt">getdns_return_t</span> <span class="n">context_create_return</span> <span class="o">=</span> <span class="n">getdns_context_create</span><span class="p">(</span><span class="o">&amp;</span><span class="n">this_context</span><span class="p">,</span> <span class="mi">1</span><span class="p">);</span>
1611 <span class="k">if</span> <span class="p">(</span><span class="n">context_create_return</span> <span class="o">!=</span> <span class="n">GETDNS_RETURN_GOOD</span><span class="p">)</span>
1612 <span class="p">{</span>
1613 <span class="n">fprintf</span><span class="p">(</span><span class="n">stderr</span><span class="p">,</span> <span class="s">&quot;Trying to create the context failed: %d</span><span class="se">\n</span><span class="s">&quot;</span><span class="p">,</span> <span class="n">context_create_return</span><span class="p">);</span>
1614 <span class="k">return</span><span class="p">(</span><span class="n">GETDNS_RETURN_GENERIC_ERROR</span><span class="p">);</span>
1615 <span class="p">}</span>
1616 <span class="cm">/* Create an event base and put it in the context using the unknown function name */</span>
1617 <span class="k">struct</span> <span class="n">event_base</span> <span class="o">*</span><span class="n">this_event_base</span><span class="p">;</span>
1618 <span class="n">this_event_base</span> <span class="o">=</span> <span class="n">event_base_new</span><span class="p">();</span>
1619 <span class="k">if</span> <span class="p">(</span><span class="n">this_event_base</span> <span class="o">==</span> <span class="nb">NULL</span><span class="p">)</span>
1620 <span class="p">{</span>
1621 <span class="n">fprintf</span><span class="p">(</span><span class="n">stderr</span><span class="p">,</span> <span class="s">&quot;Trying to create the event base failed.</span><span class="se">\n</span><span class="s">&quot;</span><span class="p">);</span>
1622 <span class="n">getdns_context_destroy</span><span class="p">(</span><span class="n">this_context</span><span class="p">);</span>
1623 <span class="k">return</span><span class="p">(</span><span class="n">GETDNS_RETURN_GENERIC_ERROR</span><span class="p">);</span>
1624 <span class="p">}</span>
1625 <span class="p">(</span><span class="kt">void</span><span class="p">)</span><span class="n">getdns_extension_set_libevent_base</span><span class="p">(</span><span class="n">this_context</span><span class="p">,</span> <span class="n">this_event_base</span><span class="p">);</span>
1626 <span class="cm">/* Set up the getdns call */</span>
1627 <span class="k">const</span> <span class="kt">char</span> <span class="o">*</span> <span class="n">this_name</span> <span class="o">=</span> <span class="s">&quot;www.example.com&quot;</span><span class="p">;</span>
1628 <span class="kt">char</span><span class="o">*</span> <span class="n">this_userarg</span> <span class="o">=</span> <span class="s">&quot;somestring&quot;</span><span class="p">;</span> <span class="c1">// Could add things here to help identify this call</span>
1629 <span class="kt">getdns_transaction_t</span> <span class="n">this_transaction_id</span> <span class="o">=</span> <span class="mi">0</span><span class="p">;</span>
1630
1631 <span class="cm">/* Make the call */</span>
1632 <span class="kt">getdns_return_t</span> <span class="n">dns_request_return</span> <span class="o">=</span> <span class="n">getdns_address</span><span class="p">(</span><span class="n">this_context</span><span class="p">,</span> <span class="n">this_name</span><span class="p">,</span>
1633 <span class="nb">NULL</span><span class="p">,</span> <span class="n">this_userarg</span><span class="p">,</span> <span class="o">&amp;</span><span class="n">this_transaction_id</span><span class="p">,</span> <span class="n">this_callbackfn</span><span class="p">);</span>
1634 <span class="k">if</span> <span class="p">(</span><span class="n">dns_request_return</span> <span class="o">==</span> <span class="n">GETDNS_RETURN_BAD_DOMAIN_NAME</span><span class="p">)</span>
1635 <span class="p">{</span>
1636 <span class="n">fprintf</span><span class="p">(</span><span class="n">stderr</span><span class="p">,</span> <span class="s">&quot;A bad domain name was used: %s. Exiting.</span><span class="se">\n</span><span class="s">&quot;</span><span class="p">,</span> <span class="n">this_name</span><span class="p">);</span>
1637 <span class="n">event_base_free</span><span class="p">(</span><span class="n">this_event_base</span><span class="p">);</span>
1638 <span class="n">getdns_context_destroy</span><span class="p">(</span><span class="n">this_context</span><span class="p">);</span>
1639 <span class="k">return</span><span class="p">(</span><span class="n">GETDNS_RETURN_GENERIC_ERROR</span><span class="p">);</span>
1640 <span class="p">}</span>
1641 <span class="k">else</span>
1642 <span class="p">{</span>
1643 <span class="cm">/* Call the event loop */</span>
1644 <span class="kt">int</span> <span class="n">dispatch_return</span> <span class="o">=</span> <span class="n">event_base_dispatch</span><span class="p">(</span><span class="n">this_event_base</span><span class="p">);</span>
1645 <span class="n">UNUSED_PARAM</span><span class="p">(</span><span class="n">dispatch_return</span><span class="p">);</span>
1646 <span class="c1">// TODO: check the return value above</span>
1647 <span class="p">}</span>
1648 <span class="cm">/* Clean up */</span>
1649 <span class="n">event_base_free</span><span class="p">(</span><span class="n">this_event_base</span><span class="p">);</span>
1650 <span class="n">getdns_context_destroy</span><span class="p">(</span><span class="n">this_context</span><span class="p">);</span>
1651 <span class="cm">/* Assuming we get here, leave gracefully */</span>
1652 <span class="n">exit</span><span class="p">(</span><span class="n">EXIT_SUCCESS</span><span class="p">);</span>
1653 <span class="p">}</span>
1654 </pre></div>
1655
1656
1657
1658 <h2>6.3 Get Addresses for a Domain Name And Their Associated DNSSEC Validation Status</h2>
1659
1660 <p>This example shows how to check for secure DNSSEC results using the
1661 <code>dnssec_return_status</code> extension. In the innermost loop of the
1662 callback function, add a check for the DNSSEC status. It shows how to add two
1663 extensions to the <code>extensions</code> argument of the call.</p>
1664
1665 <pre>
1666 struct getdns_dict * this_extensions = getdns_dict_create();
1667 this_ret = getdns_dict_set_int(this_extensions, "return_both_v4_and_v6", GETDNS_EXTENSION_TRUE);
1668 this_ret = getdns_dict_set_int(this_extensions, "dnssec_return_status", GETDNS_EXTENSION_TRUE);
1669 . . .
1670 if (*this_type == GETDNS_RRTYPE_A)
1671 {
1672 uint32_t * this_dnssec_status;
1673 this_ret = getdns_dict_get_int(this_rdata, "dnssec_status", this_dnssec_status);
1674 if (&amp;this_dnssec_status != GETDNS_DNSSEC_SECURE)
1675 {
1676 // Log the DNSSEC status somewhere
1677 }
1678 else
1679 {
1680 // Deal with the record however you were going to
1681 }
1682 }
1683 . . .
1684 </pre>
1685
1686 <p>You can put the DNSSEC status check outside the check for the particular type of record you care about, but
1687 you will then get log messages for bad status on records you might not care about as well.</p>
1688
1689 <h2>6.4 Using the API Synchronously with <code>getdns_sync_request()</code></h2>
1690
1691 <p>This example is the same as the earlier examples, but uses <code>getdns_general_sync()</code>
1692 and thus does not use the async code. Note that the processing of the answers is essentially the same
1693 as it is for the synchronous example, it is just done in <code>main()</code>.</p>
1694
1695 <br><div class="highlight"><pre><span class="cp">#include &lt;stdio.h&gt;</span>
1696 <span class="cp">#include &lt;stdint.h&gt;</span>
1697 <span class="cp">#include &lt;stdlib.h&gt;</span>
1698 <span class="cp">#include &lt;string.h&gt;</span>
1699 <span class="cp">#include &lt;inttypes.h&gt;</span>
1700 <span class="cp">#include &lt;getdns_core_only.h&gt;</span>
1701
1702 <span class="kt">int</span> <span class="nf">main</span><span class="p">()</span>
1703 <span class="p">{</span>
1704 <span class="kt">getdns_return_t</span> <span class="n">this_ret</span><span class="p">;</span> <span class="cm">/* Holder for all function returns */</span>
1705 <span class="cm">/* Create the DNS context for this call */</span>
1706 <span class="k">struct</span> <span class="n">getdns_context</span> <span class="o">*</span><span class="n">this_context</span> <span class="o">=</span> <span class="nb">NULL</span><span class="p">;</span>
1707 <span class="kt">getdns_return_t</span> <span class="n">context_create_return</span> <span class="o">=</span> <span class="n">getdns_context_create</span><span class="p">(</span><span class="o">&amp;</span><span class="n">this_context</span><span class="p">,</span> <span class="mi">1</span><span class="p">);</span>
1708 <span class="k">if</span> <span class="p">(</span><span class="n">context_create_return</span> <span class="o">!=</span> <span class="n">GETDNS_RETURN_GOOD</span><span class="p">)</span>
1709 <span class="p">{</span>
1710 <span class="n">fprintf</span><span class="p">(</span><span class="n">stderr</span><span class="p">,</span> <span class="s">&quot;Trying to create the context failed: %d</span><span class="se">\n</span><span class="s">&quot;</span><span class="p">,</span> <span class="n">context_create_return</span><span class="p">);</span>
1711 <span class="k">return</span><span class="p">(</span><span class="n">GETDNS_RETURN_GENERIC_ERROR</span><span class="p">);</span>
1712 <span class="p">}</span>
1713 <span class="cm">/* Set up the getdns_sync_request call */</span>
1714 <span class="k">const</span> <span class="kt">char</span> <span class="o">*</span> <span class="n">this_name</span> <span class="o">=</span> <span class="s">&quot;www.example.com&quot;</span><span class="p">;</span>
1715 <span class="kt">uint8_t</span> <span class="n">this_request_type</span> <span class="o">=</span> <span class="n">GETDNS_RRTYPE_A</span><span class="p">;</span>
1716 <span class="cm">/* Get the A and AAAA records */</span>
1717 <span class="k">struct</span> <span class="n">getdns_dict</span> <span class="o">*</span> <span class="n">this_extensions</span> <span class="o">=</span> <span class="n">getdns_dict_create</span><span class="p">();</span>
1718 <span class="n">this_ret</span> <span class="o">=</span> <span class="n">getdns_dict_set_int</span><span class="p">(</span><span class="n">this_extensions</span><span class="p">,</span> <span class="s">&quot;return_both_v4_and_v6&quot;</span><span class="p">,</span> <span class="n">GETDNS_EXTENSION_TRUE</span><span class="p">);</span>
1719 <span class="k">if</span> <span class="p">(</span><span class="n">this_ret</span> <span class="o">!=</span> <span class="n">GETDNS_RETURN_GOOD</span><span class="p">)</span>
1720 <span class="p">{</span>
1721 <span class="n">fprintf</span><span class="p">(</span><span class="n">stderr</span><span class="p">,</span> <span class="s">&quot;Trying to set an extension do both IPv4 and IPv6 failed: %d</span><span class="se">\n</span><span class="s">&quot;</span><span class="p">,</span> <span class="n">this_ret</span><span class="p">);</span>
1722 <span class="n">getdns_dict_destroy</span><span class="p">(</span><span class="n">this_extensions</span><span class="p">);</span>
1723 <span class="n">getdns_context_destroy</span><span class="p">(</span><span class="n">this_context</span><span class="p">);</span>
1724 <span class="k">return</span><span class="p">(</span><span class="n">GETDNS_RETURN_GENERIC_ERROR</span><span class="p">);</span>
1725 <span class="p">}</span>
1726 <span class="k">struct</span> <span class="n">getdns_dict</span> <span class="o">*</span> <span class="n">this_response</span> <span class="o">=</span> <span class="nb">NULL</span><span class="p">;</span>
1727
1728 <span class="cm">/* Make the call */</span>
1729 <span class="kt">getdns_return_t</span> <span class="n">dns_request_return</span> <span class="o">=</span> <span class="n">getdns_general_sync</span><span class="p">(</span><span class="n">this_context</span><span class="p">,</span> <span class="n">this_name</span><span class="p">,</span> <span class="n">this_request_type</span><span class="p">,</span>
1730 <span class="n">this_extensions</span><span class="p">,</span> <span class="o">&amp;</span><span class="n">this_response</span><span class="p">);</span>
1731 <span class="k">if</span> <span class="p">(</span><span class="n">dns_request_return</span> <span class="o">==</span> <span class="n">GETDNS_RETURN_BAD_DOMAIN_NAME</span><span class="p">)</span>
1732 <span class="p">{</span>
1733 <span class="n">fprintf</span><span class="p">(</span><span class="n">stderr</span><span class="p">,</span> <span class="s">&quot;A bad domain name was used: %s. Exiting.</span><span class="se">\n</span><span class="s">&quot;</span><span class="p">,</span> <span class="n">this_name</span><span class="p">);</span>
1734 <span class="n">getdns_dict_destroy</span><span class="p">(</span><span class="n">this_response</span><span class="p">);</span>
1735 <span class="n">getdns_dict_destroy</span><span class="p">(</span><span class="n">this_extensions</span><span class="p">);</span>
1736 <span class="n">getdns_context_destroy</span><span class="p">(</span><span class="n">this_context</span><span class="p">);</span>
1737 <span class="k">return</span><span class="p">(</span><span class="n">GETDNS_RETURN_GENERIC_ERROR</span><span class="p">);</span>
1738 <span class="p">}</span>
1739 <span class="k">else</span>
1740 <span class="p">{</span>
1741 <span class="cm">/* Be sure the search returned something */</span>
1742 <span class="kt">uint32_t</span> <span class="n">this_error</span><span class="p">;</span>
1743 <span class="n">this_ret</span> <span class="o">=</span> <span class="n">getdns_dict_get_int</span><span class="p">(</span><span class="n">this_response</span><span class="p">,</span> <span class="s">&quot;status&quot;</span><span class="p">,</span> <span class="o">&amp;</span><span class="n">this_error</span><span class="p">);</span> <span class="c1">// Ignore any error</span>
1744 <span class="k">if</span> <span class="p">(</span><span class="n">this_error</span> <span class="o">!=</span> <span class="n">GETDNS_RESPSTATUS_GOOD</span><span class="p">)</span> <span class="c1">// If the search didn&#39;t return &quot;good&quot;</span>
1745 <span class="p">{</span>
1746 <span class="n">fprintf</span><span class="p">(</span><span class="n">stderr</span><span class="p">,</span> <span class="s">&quot;The search had no results, and a return value of %d. Exiting.</span><span class="se">\n</span><span class="s">&quot;</span><span class="p">,</span> <span class="n">this_error</span><span class="p">);</span>
1747 <span class="n">getdns_dict_destroy</span><span class="p">(</span><span class="n">this_response</span><span class="p">);</span>
1748 <span class="n">getdns_dict_destroy</span><span class="p">(</span><span class="n">this_extensions</span><span class="p">);</span>
1749 <span class="n">getdns_context_destroy</span><span class="p">(</span><span class="n">this_context</span><span class="p">);</span>
1750 <span class="k">return</span><span class="p">(</span><span class="n">GETDNS_RETURN_GENERIC_ERROR</span><span class="p">);</span>
1751 <span class="p">}</span>
1752 <span class="k">struct</span> <span class="n">getdns_list</span> <span class="o">*</span> <span class="n">just_the_addresses_ptr</span><span class="p">;</span>
1753 <span class="n">this_ret</span> <span class="o">=</span> <span class="n">getdns_dict_get_list</span><span class="p">(</span><span class="n">this_response</span><span class="p">,</span> <span class="s">&quot;just_address_answers&quot;</span><span class="p">,</span> <span class="o">&amp;</span><span class="n">just_the_addresses_ptr</span><span class="p">);</span> <span class="c1">// Ignore any error</span>
1754 <span class="kt">size_t</span> <span class="n">num_addresses</span><span class="p">;</span>
1755 <span class="n">this_ret</span> <span class="o">=</span> <span class="n">getdns_list_get_length</span><span class="p">(</span><span class="n">just_the_addresses_ptr</span><span class="p">,</span> <span class="o">&amp;</span><span class="n">num_addresses</span><span class="p">);</span> <span class="c1">// Ignore any error</span>
1756 <span class="cm">/* Go through each record */</span>
1757 <span class="k">for</span> <span class="p">(</span> <span class="kt">size_t</span> <span class="n">rec_count</span> <span class="o">=</span> <span class="mi">0</span><span class="p">;</span> <span class="n">rec_count</span> <span class="o">&lt;</span> <span class="n">num_addresses</span><span class="p">;</span> <span class="o">++</span><span class="n">rec_count</span> <span class="p">)</span>
1758 <span class="p">{</span>
1759 <span class="k">struct</span> <span class="n">getdns_dict</span> <span class="o">*</span> <span class="n">this_address</span><span class="p">;</span>
1760 <span class="n">this_ret</span> <span class="o">=</span> <span class="n">getdns_list_get_dict</span><span class="p">(</span><span class="n">just_the_addresses_ptr</span><span class="p">,</span> <span class="n">rec_count</span><span class="p">,</span> <span class="o">&amp;</span><span class="n">this_address</span><span class="p">);</span> <span class="c1">// Ignore any error</span>
1761 <span class="cm">/* Just print the address */</span>
1762 <span class="k">struct</span> <span class="n">getdns_bindata</span> <span class="o">*</span> <span class="n">this_address_data</span><span class="p">;</span>
1763 <span class="n">this_ret</span> <span class="o">=</span> <span class="n">getdns_dict_get_bindata</span><span class="p">(</span><span class="n">this_address</span><span class="p">,</span> <span class="s">&quot;address_data&quot;</span><span class="p">,</span> <span class="o">&amp;</span><span class="n">this_address_data</span><span class="p">);</span> <span class="c1">// Ignore any error</span>
1764 <span class="kt">char</span> <span class="o">*</span><span class="n">this_address_str</span> <span class="o">=</span> <span class="n">getdns_display_ip_address</span><span class="p">(</span><span class="n">this_address_data</span><span class="p">);</span>
1765 <span class="n">printf</span><span class="p">(</span><span class="s">&quot;The address is %s</span><span class="se">\n</span><span class="s">&quot;</span><span class="p">,</span> <span class="n">this_address_str</span><span class="p">);</span>
1766 <span class="n">free</span><span class="p">(</span><span class="n">this_address_str</span><span class="p">);</span>
1767 <span class="p">}</span>
1768 <span class="p">}</span>
1769 <span class="cm">/* Clean up */</span>
1770 <span class="n">getdns_dict_destroy</span><span class="p">(</span><span class="n">this_response</span><span class="p">);</span>
1771 <span class="n">getdns_dict_destroy</span><span class="p">(</span><span class="n">this_extensions</span><span class="p">);</span>
1772 <span class="n">getdns_context_destroy</span><span class="p">(</span><span class="n">this_context</span><span class="p">);</span>
1773 <span class="cm">/* Assuming we get here, leave gracefully */</span>
1774 <span class="n">exit</span><span class="p">(</span><span class="n">EXIT_SUCCESS</span><span class="p">);</span>
1775 <span class="p">}</span>
1776 </pre></div>
1777
1778
1779
1780 <h2>6.5 Getting Names from the Reverse Tree with <code>getdns_hostname()</code></h2>
1781
1782 <p>This example shows how to use <code>getdns_hostname()</code> to get names from the DNS reverse tree.</p>
1783
1784 <p>[[[[ Something will go here soon ]]]]]</p>
1785 <!--EXAMPLESREVERSE-->
1786
1787 <h1>7. More Helper Functions</h1>
1788
1789 <p>The following two functions convert individual labels of IDNs between their Unicode
1790 encoding and their ASCII encoding. They follow the rules for IDNA 2008 described in
1791 RFC 5890-5892.</p>
1792 <div class=forh>char *
1793 getdns_convert_ulabel_to_alabel(
1794 char *ulabel
1795 );
1796 </div>
1797 <div class=forh>char *
1798 getdns_convert_alabel_to_ulabel(
1799 char *alabel
1800 );
1801 </div>
1802
1803 <p>If an application wants the API do perform DNSSEC validation without using the extensions, it
1804 can use the <code>getdns_validate_dnssec()</code> helper function.</p>
1805 <div class=forh>getdns_return_t
1806 getdns_validate_dnssec(
1807 struct getdns_bindata *record_to_validate,
1808 struct getdns_list *bundle_of_support_records,
1809 struct getdns_list *trust_anchor_rdatas
1810 );
1811 </div>
1812 <p class=cont>The <code>record_to_validate</code> is the resource record being validated. The API
1813 will use the resource records in <code>bundle_of_support_records</code> and the RDATAs in the
1814 <code>trust_ancor_rdatas</code> as trust anchors. The function returns one of
1815 <code>GETDNS_DNSSEC_SECURE</code>, <code>GETDNS_DNSSEC_BOGUS</code>,
1816 <code>GETDNS_DNSSEC_INDETERMINATE</code>, or <code>GETDNS_DNSSEC_INSECURE</code>.</p>
1817
1818 <p>There are two functions that help process data:</p>
1819
1820 <div class=forh>
1821 char *
1822 getdns_pretty_print_dict(
1823 struct getdns_dict *some_dict
1824 );
1825 </div>
1826 <p class=cont>This returns a string that is the nicely-formatted version
1827 of the dict and all of the named elements in it.</p>
1828
1829 <div class=forh>
1830 char *
1831 getdns_display_ip_address(
1832 struct getdns_bindata *bindata_of_ipv4_or_ipv6_address
1833 );
1834 </div>
1835 <p class=cont>This returns a string that is the nicely-formatted version
1836 of the IPv4 or IPv6 address in it. The API determines they type of address
1837 by the length given in the bindata.</p>
1838
1839 <h1>8. <a id="Contexts">DNS Contexts</a></h1>
1840
1841 <p>Many calls in the DNS API require a DNS context. A DNS
1842 context contains the information that the API needs in order to process DNS calls, such as the
1843 locations of upstream DNS servers, DNSSEC trust anchors, and so on. The internal structure of the
1844 DNS context is opaque, and might be different on each OS. When a context is passed to any function,
1845 it must be an allocated context; the context must not be NULL.</p>
1846
1847 <p>A typical application using this API doesn't need to know anything about contexts. Basically,
1848 the application creates a default context, uses it in the functions that require a context, and
1849 then deallocates it when done. Context manipulation is available for more DNS-aware programs,
1850 but is unlikely to be of interest to applications that just want the results of lookups for
1851 A, AAAA, SRV, and PTR records.</p>
1852
1853 <p>It is expected that contexts in implementations of the API will not necessarily be thread-safe,
1854 but they will not be thread-hostile. A context should not be used by multiple threads: create a new
1855 context for use on a different thread. It is just fine for an application to have many contexts,
1856 and some DNS-heavy applications will certainly want to have many even if the application uses
1857 a single thread.</p>
1858
1859 <p>See <a href="#ContextInitial">above</a> for the method for creating and destroying
1860 contexts. When the context is used in the API for the first time and <code>set_from_os</code> is
1861 <code>1</code>, the API starts replacing some of the values with values from the OS, such as
1862 those that would be found in res_query(3), /etc/resolv.conf, and so on, then proceeds with the new
1863 function. Some advanced users will not want the API to change the values to the OS's defaults; if
1864 <code>set_from_os</code> is <code>0</code>, the API will not do any updates to the initial
1865 values based on changes in the OS. For example, this might be useful if the API is acting
1866 as a stub resolver that is using a specific upstream recursive resolver chosen by the
1867 application, not the one that might come back from DHCP.</p>
1868
1869 <h2>8.1 Updating the Context Automatically</h2>
1870
1871 <p>The context returned by <code>getdns_context_create()</code> is updated by the API by default,
1872 such as when changes are made to /etc/resolv.conf. When there is a change, the callback function
1873 that is set in <code>getdns_context_set_context_update_callback()</code> (described below) is
1874 called.</p>
1875
1876 <p>Many of the defaults for a context come from the operating system under which the API is running.
1877 In specific, it is important that the implementation should try to replicate as best as possible the
1878 logic of a local <code>getaddrinfo()</code> when creating a new context. This includes making
1879 lookups in WINS for NetBIOS, mDNS lookups, nis names, and any other name lookup that
1880 <code>getaddrinfo()</code> normally does automatically. The API should look at nsswitch, the Windows
1881 resolver, and so on.</p>
1882
1883 <p>In the function definitions below, the choice listed <span class=default>in bold</span> is the one used
1884 for the API default context.</p>
1885
1886 <h2>8.2 Updating the Context Manually</h2>
1887
1888 <p>Setting specific values in a context are done with value-specific
1889 functions shown here. The setting functions all return either <code>GETDNS_RETURN_GOOD</code> for
1890 success, <code>GETDNS_RETURN_BAD_CONTEXT</code> for trying to set a type with a value that
1891 is not allowed, or <code>GETDNS_RETURN_CONTEXT_UPDATE_FAIL</code> for a failure to update the context.</p>
1892
1893 <p>An application can be notified when the context is changed.</p>
1894
1895 <div class=forh>
1896 getdns_return_t
1897 getdns_context_set_context_update_callback(
1898 struct getdns_context *context,
1899 void (*value)(struct getdns_context *context, uint16_t changed_item)
1900 );</div>
1901 <p class=cont>The value is a pointer to the callback function that will be
1902 called when any context is changed. Such changes might be from automatic
1903 changes from the API (such as changes to /etc/resolv.conf), or might be from any of the
1904 API functions in this section being called. The second argument to the callback function
1905 specifies which of the context changed; the context codes are listed
1906 <a href="#ContextCodes">later in this document</a>.</p>
1907
1908 <h2>8.3 Contexts for Basic Resolution</h2>
1909
1910 <div class=forh>
1911 getdns_return_t
1912 getdns_context_set_resolution_type(
1913 struct getdns_context *context,
1914 uint16_t value
1915 );</div>
1916 <p class=cont>Specifies whether DNS queries are performed with nonrecurive lookups or
1917 as a stub resolver. The value is <span class=default><code>GETDNS_CONTEXT_RECURSING</code></span> or
1918 <code>GETDNS_CONTEXT_STUB</code>.</p>
1919
1920 <p>All implementations of this API can act as recursive resolvers, and that must be the
1921 default mode of the default context.
1922 Some implementations of this API are expected to also be able to act as stub resolvers.
1923 If an
1924 implementation of this API is only able to act as a recursive resolver, a call to
1925 <code>getdns_context_set_resolution_type(somecontext, GETDNS_CONTEXT_STUB)</code> will
1926 return <code>GETDNS_RETURN_CONTEXT_UPDATE_FAIL</code>.</p>
1927
1928 <div class=forh>
1929 getdns_return_t
1930 getdns_context_set_namespaces(
1931 struct getdns_context *context,
1932 size_t namespace_count,
1933 uint16_t *namespaces
1934 );</div>
1935 <p class=cont>The <code>namespaces</code> array contains an ordered list
1936 of namespaces that will be queried.
1937 <b>Important:</b> this context setting is ignored for the <code>getdns_general</code> and
1938 <code>getdns_general_sync</code> functions; it is used for the other funtions.
1939 The values
1940 are <code>GETDNS_CONTEXT_NAMESPACE_DNS</code>,
1941 <code>GETDNS_CONTEXT_NAMESPACE_LOCALNAMES</code>,
1942 <code>GETDNS_CONTEXT_NAMESPACE_NETBIOS</code>,
1943 <code>GETDNS_CONTEXT_NAMESPACE_MDNS</code>, and
1944 <code>GETDNS_CONTEXT_NAMESPACE_NIS</code>. When a normal lookup is done,
1945 the API does the lookups in the order given and stops when it gets the
1946 first result; a different method with the same result would be to run
1947 the queries in parallel and return when it gets the first result.
1948 Because lookups might be done over different mechanisms because of the
1949 different namespaces, there can be information leakage that is similar
1950 to that seen with <code>getaddrinfo()</code>. The
1951 default is <span class=default>determined by the OS</span>.</p>
1952
1953 <div class=forh>
1954 getdns_return_t
1955 getdns_context_set_dns_transport(
1956 struct getdns_context *context,
1957 uint16_t value
1958 );</div>
1959 <p class=cont>Specifies what transport is used for DNS lookups.
1960 The value is <span class=default>
1961 <code>GETDNS_CONTEXT_UDP_FIRST_AND_FALL_BACK_TO_TCP</code></span>,
1962 <code>GETDNS_CONTEXT_UDP_ONLY</code>,
1963 <code>GETDNS_CONTEXT_TCP_ONLY</code>, or
1964 <code>GETDNS_CONTEXT_TCP_ONLY_KEEP_CONNECTIONS_OPEN</code>.</p>
1965
1966 <div class=forh>
1967 getdns_return_t
1968 getdns_context_set_limit_outstanding_queries(
1969 struct getdns_context *context,
1970 uint16_t limit
1971 );</div>
1972 <p class=cont>Specifies limit the number of outstanding DNS queries.
1973 The API will block itself from sending more queries if it is about to exceed
1974 this value, and instead keep those queries in an internal queue.
1975 The a value of <span class=default>0</span> indicates that
1976 the number of outstanding DNS queries is unlimited.</p>
1977
1978 <div class=forh>
1979 getdns_return_t
1980 getdns_context_set_timeout(
1981 struct getdns_context *context,
1982 uint16_t timeout
1983 );</div>
1984 <p class=cont>Specifies number of seconds the API will wait for request to return.
1985 The default is <span class=default>not specified</span>.</p>
1986
1987 <h2>8.4 Context for Recursive Resolvers</h2>
1988
1989 <div class=forh>
1990 getdns_return_t
1991 getdns_context_set_follow_redirects(
1992 struct getdns_context *context,
1993 uint16_t value
1994 );</div>
1995 <p class=cont>Specifies whether or not DNS queries follow redirects.
1996 The value is <span class=default><code>GETDNS_CONTEXT_FOLLOW_REDIRECTS</code></span> for normal
1997 following of redirects though CNAME and DNAME; or
1998 <code>GETDNS_CONTEXT_DO_NOT_FOLLOW_REDIRECTS</code> to cause any lookups that would have gone
1999 through CNAME and DNAME to return the CNAME or DNAME, not the eventual target.</p>
2000
2001 <div class=forh>
2002 getdns_return_t
2003 getdns_context_set_dns_root_servers(
2004 struct getdns_context *context,
2005 struct getdns_list *addresses
2006 );</div>
2007 <p class=cont>The list contains dicts that are addresses to be used for looking up top-level
2008 domains; the default is the list of <b>"normal" IANA root servers</b>. Each dict in the list
2009 contains at least two names: <code>address_type</code> (whose value is a bindata; it is currently
2010 either "IPv4" or "IPv6") and <code>address_data</code> (whose value is a bindata).</p>
2011
2012 <h2>8.5 Context for Local Naming</h2>
2013
2014 <div class=forh>
2015 getdns_return_t
2016 getdns_context_set_append_name(
2017 struct getdns_context *context,
2018 uint16_t value
2019 );</div>
2020 <p class=cont>Specifies whether to append a suffix to the query string
2021 before the API starts resolving a name.
2022 The value is <span class=default>
2023 <code>GETDNS_CONTEXT_APPEND_NAME_ALWAYS</code></span>,
2024 <code>GETDNS_CONTEXT_APPEND_NAME_ONLY_TO_SINGLE_LABEL_AFTER_FAILURE</code>,
2025 <code>GETDNS_CONTEXT_APPEND_NAME_ONLY_TO_MULTIPLE_LABEL_NAME_AFTER_FAILURE</code>,
2026 or <code>GETDNS_CONTEXT_DO_NOT_APPEND_NAMES</code>. This controls
2027 whether or not to append the suffix given by <code>getdns_context_set_suffix</code></p>
2028
2029 <div class=forh>
2030 getdns_return_t
2031 getdns_context_set_suffix(
2032 struct getdns_context *context,
2033 struct getdns_list *value
2034 );</div>
2035 <p class=cont>The value is a list of bindatas that are strings that are
2036 to be appended based on <code>getdns_context_set_append_name</code>; the default is an <span
2037 class=default>empty list</span>. The values here follow the rules in section 2.1 of RFC 4343
2038 to allow non-ASCII octets and special characters in labels.</p>
2039
2040 <h2>8.6 Context for DNSSEC</h2>
2041
2042 <p>These context settings affect queries that have extensions that specify the use of DNSSEC.</p>
2043
2044 <p>Applications that need to specify the DNSSEC trust anchors can use:</p>
2045 <div class=forh>
2046 getdns_return_t
2047 getdns_context_set_dnssec_trust_anchors(
2048 struct getdns_context *context,
2049 struct getdns_list *value
2050 );</div>
2051 <p class=cont>The value is a list of bindatas that are the DNSSEC trust anchors. The default
2052 is the trust anchors from the <span class=default>IANA root</span>. The trust anchors
2053 are expressed as RDATAs from DNSKEY resource records.</p>
2054
2055 <p>In the rare case that an application needs to set the DNSSEC skew, it can:</p>
2056 <div class=forh>
2057 getdns_return_t
2058 getdns_context_set_dnssec_allowed_skew(
2059 struct getdns_context *context,
2060 uint16_t value
2061 );</div>
2062 <p class=cont>The value is the number of seconds of skew that is allowed in either direction when
2063 checking an RRSIG's Expiration and Inception fields. The default
2064 is <span class=default>0</span>.</p>
2065
2066 <h2>8.7 Context Specific to Stub Resolvers</h2>
2067
2068 <p>An application can change the quering mechanism of a context to be to act as a stub
2069 resolver. Such an application might first get the default information to make this change
2070 from the operating system, probably through DHCP.</p>
2071
2072 <p>Note that if a context is changed to being a stub resolver, this automatically prevents the application
2073 from using the extenstions for DNSSEC. An application that wants to both do DNSSEC and stub resolution
2074 must do its own DNSSEC processing, possibly with the <code>getdns_validate_dnssec()</code> function.</p>
2075
2076 <div class=forh>
2077 getdns_return_t
2078 getdns_context_set_stub_resolution(
2079 struct getdns_context *context,
2080 struct getdns_list *upstream_list
2081 );</div>
2082 <p class=cont>The list of dicts define where a stub resolver will send queries. Each dict contains
2083 at least two names: <code>address_type</code> (whose value is a bindata; it is currently either
2084 "IPv4" or "IPv6") and <code>address_data</code> (whose value is a bindata). It might also contain
2085 <code>port</code> to specify which port to use to contact these DNS servers; the default is 53. If
2086 the stub and a recursive resolver both support TSIG (RFC 2845), the <code>upstream_list</code> entry
2087 can also contain <code>tsig_algorithm</code> (a bindata) that is the name of the TSIG hash
2088 algorithm, and <code>tsig_secret</code> (a bindata) that is the TSIG key.</p>
2089
2090 <h2>8.8 Context for EDNS</h2>
2091
2092 <p>These context settings affect queries that have extensions that specify the use of OPT resource records.
2093 These come from RFC 2671.</p>
2094
2095 <div class=forh>
2096 getdns_return_t
2097 getdns_context_set_edns_maximum_udp_payload_size(
2098 struct getdns_context *context,
2099 uint16_t value
2100 );</div>
2101 <p class=cont>The value is between 512 and 65535; the default
2102 is <span class=default>512</span>.</p>
2103
2104 <div class=forh>
2105 getdns_return_t
2106 getdns_context_set_edns_extended_rcode(
2107 struct getdns_context *context,
2108 uint8_t value
2109 );</div>
2110 <p class=cont>The value is between 0 and 255; the default
2111 is <span class=default>0</span>.</p>
2112
2113 <div class=forh>
2114 getdns_return_t
2115 getdns_context_set_edns_version(
2116 struct getdns_context *context,
2117 uint8_t value
2118 );</div>
2119 <p class=cont>The value is between 0 and 255; the default
2120 is <span class=default>0</span>.</p>
2121
2122 <div class=forh>
2123 getdns_return_t
2124 getdns_context_set_edns_do_bit(
2125 struct getdns_context *context,
2126 uint8_t value
2127 );</div>
2128 <p class=cont>The value is between 0 and 1; the default
2129 is <span class=default>0</span>.</p>
2130
2131 <h2>8.9 Context Use of Custom Memory Management Functions</h2>
2132
2133 <div class=forh>
2134 getdns_return_t
2135 getdns_context_set_memory_functions(
2136 struct getdns_context *context,
2137 void *(*malloc) (size_t),
2138 void *(*realloc) (void *, size_t),
2139 void (*free) (void *)
2140 );</div>
2141 <p class=cont>The given memory management functions will be used for creating the response dicts.
2142 The response dicts inherit the custom memory management functions from the context and will deallocate themselves (and their members) with the custom deallocator.
2143 By default, the system <span class=default>malloc</span>, <span class=default>realloc</span>, and <span>free</span> are used.</p>
2144
2145 <div class=forh>
2146 getdns_return_t
2147 getdns_context_set_extended_memory_functions(
2148 struct getdns_context *context,
2149 void *userarg,
2150 void *(*malloc)(void *userarg, size_t sz),
2151 void *(*realloc)(void *userarg, void *ptr, size_t sz),
2152 void (*free)(void *userarg, void *ptr)
2153 );</div>
2154 <p class=cont>The given extended memory management functions will be used for creating the response dicts.
2155 The value of <code>userarg</code> argument will be passed to the custom <code>malloc</code>, <code>realloc</code>, and <code>free</code>.
2156 The response dicts inherit the custom memory management functions and the value for <code>userarg</code> from the context and will deallocate themselves (and their members) with the custom deallocator.</p>
2157
2158 <h2>8.10 <a id="ContextCodes">Context Codes</a></h2>
2159
2160 <p>The context codes for <code>getdns_context_set_context_update_callback()</code> are:</p>
2161
2162 <p class=define>GETDNS_CONTEXT_CODE_NAMESPACES</p>
2163 <p class=descrip>Change related to <code>getdns_context_set_namespaces</code></p>
2164 <p class=define>GETDNS_CONTEXT_CODE_RESOLUTION_TYPE</p>
2165 <p class=descrip>Change related to <code>getdns_context_set_resolution_type</code></p>
2166 <p class=define>GETDNS_CONTEXT_CODE_FOLLOW_REDIRECTS</p>
2167 <p class=descrip>Change related to <code>getdns_context_set_follow_redirects</code></p>
2168 <p class=define>GETDNS_CONTEXT_CODE_UPSTREAM_RECURSIVE_SERVERS</p>
2169 <p class=descrip>Change related to <code>getdns_context_set_upstream_recursive_servers</code></p>
2170 <p class=define>GETDNS_CONTEXT_CODE_DNS_ROOT_SERVERS</p>
2171 <p class=descrip>Change related to <code>getdns_context_set_dns_root_servers</code></p>
2172 <p class=define>GETDNS_CONTEXT_CODE_DNS_TRANSPORT</p>
2173 <p class=descrip>Change related to <code>getdns_context_set_dns_transport</code></p>
2174 <p class=define>GETDNS_CONTEXT_CODE_LIMIT_OUTSTANDING_QUERIES</p>
2175 <p class=descrip>Change related to <code>getdns_context_set_limit_outstanding_queries</code></p>
2176 <p class=define>GETDNS_CONTEXT_CODE_APPEND_NAME</p>
2177 <p class=descrip>Change related to <code>getdns_context_set_append_name</code></p>
2178 <p class=define>GETDNS_CONTEXT_CODE_SUFFIX</p>
2179 <p class=descrip>Change related to <code>getdns_context_set_suffix</code></p>
2180 <p class=define>GETDNS_CONTEXT_CODE_DNSSEC_TRUST_ANCHORS</p>
2181 <p class=descrip>Change related to <code>getdns_context_set_dnssec_trust_anchors</code></p>
2182 <p class=define>GETDNS_CONTEXT_CODE_EDNS_MAXIMUM_UDP_PAYLOAD_SIZE</p>
2183 <p class=descrip>Change related to <code>getdns_context_set_edns_maximum_udp_payload_size</code></p>
2184 <p class=define>GETDNS_CONTEXT_CODE_EDNS_EXTENDED_RCODE</p>
2185 <p class=descrip>Change related to <code>getdns_context_set_edns_extended_rcode</code></p>
2186 <p class=define>GETDNS_CONTEXT_CODE_EDNS_VERSION</p>
2187 <p class=descrip>Change related to <code>getdns_context_set_edns_version</code></p>
2188 <p class=define>GETDNS_CONTEXT_CODE_EDNS_DO_BIT</p>
2189 <p class=descrip>Change related to <code>getdns_context_set_edns_do_bit</code></p>
2190 <p class=define>GETDNS_CONTEXT_CODE_DNSSEC_ALLOWED_SKEW</p>
2191 <p class=descrip>Change related to <code>getdns_context_set_dnssec_allowed_skew</code></p>
2192 <p class=define>GETDNS_CONTEXT_CODE_MEMORY_FUNCTIONS</p>
2193 <p class=descrip>Change related to <code>getdns_context_set_memory_functions</code></p>
2194 <p class=define>GETDNS_CONTEXT_CODE_TIMEOUT</p>
2195 <p class=descrip>Change related to <code>getdns_context_set_timeout</code></p>
2196
2197
2198 <h1>9. The Generated Files</h1>
2199
2200 <p>There is <a href="getdns-0.371.tgz">a tarball</a> that includes the .h files,
2201 the examples, and so on. The examples all make, even though there is no API implementation, based
2202 on a pseudo-implementation in the tarball; see make-examples-PLATFORM.sh. Note that this currently builds fine
2203 on the Macintosh and Ubuntu; help is definitely appreciated on making the build process
2204 work on more platforms if it fails there.</p>
2205
2206 <h1>10. <a id="Commentary">Commentary</a></h1>
2207
2208 <p>The following description of the API may be of value to those who might implement the design, and
2209 those who are using an implementation of the design.</p>
2210
2211 <h2>10.1 API Design Considerations</h2>
2212
2213 <p>The genesis of this DNS API design was seeing other DNS API designs flounder. There are other
2214 DNS APIs already available (such as draft-hayatnagarkar-dnsext-validator-api, as well
2215 as DNSSEC APIs in BIND and Unbound), but there has been very little uptake of them. In talking to
2216 application developers, there was a consistent story: that they felt that the APIs were developed by and
2217 for DNS people, not applications developers.</p>
2218
2219 <p>This API design comes from talking to a small handful of applications developers about what they
2220 would want to see in a modern DNS API. Now that the API is public, it would be great to hear from many
2221 more application developers about whether it would meet their needs if it was implemented. My goal
2222 is to create a design that is a natural follow-on to <code>getaddrinfo()</code> that has all the
2223 capabilities that most application developers might want now or in the next few years: access to all
2224 types of DNS records (including those which are yet to be defined), full DNSSEC awareness, IDN
2225 handling, and parity for IPv4 and IPv6 addresses.</p>
2226
2227 <p>Note that this is just a design for a new API: there is no implementation of the design yet, but
2228 at least one is being worked on. The process of designing the API without implementing it at the
2229 same time has the huge advantage that major design changes could be made without any worry about
2230 "but we already coded it the other way". In the early revisions of this document, many fundamental
2231 design choices changed over and over, and even bike-shedding-like changes were allowed because they
2232 didn't involve any programming effort.</p>
2233
2234 <p>This work was done independently, not through the IETF because the IETF generally doesn't take on
2235 API work, and has explicitly avoided DNS API work in the past.</p>
2236
2237 <p>This API design has a Creative Commons license so that it can be
2238 used widely by potential API implementers. This also allows other people who want to fork the design
2239 to do so cleanly. Of course, any implementation of this API can choose whatever kind of license the
2240 API implementer wishes, but it would be fabulous if one or more such implementations had Creative
2241 Commons or BSD-ish licenses.</p>
2242
2243 <p>The API relies heavily on C macros and hopefully has no magic numbers.</p>
2244
2245 <h2>10.2 API Implementation Considerations</h2>
2246
2247 <p>All implementations of this API must act as recursive resolvers, and some might choose not to be
2248 able to act as stub resolvers. Note that all implementations of this API must be DNSSEC validators.</p>
2249
2250 <p>Because there are many C event libraries available, and they have different calling routines,
2251 it is the implementation of an API that determines which event library is used. This is certainly
2252 not optimal for C programmers, but they appear to have gotten used to is so far. All implementations
2253 of this API must support synchronous calls with <code>getdns_sync_request()</code>.</p>
2254
2255 <p>Versions are differentiated by version strings instead of version numbers. The version string for
2256 this API is "getdns April 2013". Each implementation is free to set the implementation string as it
2257 feels fit.</p>
2258
2259 <p>The API's .h file contains a macro called <code>GETDNS_COMPILATION_COMMENT</code>. This can be useful
2260 to an application which will use the API because it can check the string without calling any
2261 functions. Each time the API implementation is compiled, this string should be updated with unique
2262 information about the implementation build.</p>
2263
2264 <p>The implementation of both the async and sync <code>getdns</code> functions will
2265 copy all the values of the parameters into local memory, in case the application changes or
2266 deallocates them.</p>
2267
2268 <hr width=90%>
2269
2270 <p><a rel="license" href="http://creativecommons.org/licenses/by/3.0/deed.en_US"><img alt="Creative
2271 Commons License" style="border-width:0" src="http://i.creativecommons.org/l/by/3.0/80x15.png"
2272 /></a><br />This work is licensed under a <a rel="license"
2273 href="http://creativecommons.org/licenses/by/3.0/deed.en_US">Creative Commons Attribution 3.0
2274 Unported License</a>.</p>
2275
2276 </body></html>
0 #!/bin/sh
1 # install - install a program, script, or datafile
2
3 scriptversion=2009-04-28.21; # UTC
4
5 # This originates from X11R5 (mit/util/scripts/install.sh), which was
6 # later released in X11R6 (xc/config/util/install.sh) with the
7 # following copyright and license.
8 #
9 # Copyright (C) 1994 X Consortium
10 #
11 # Permission is hereby granted, free of charge, to any person obtaining a copy
12 # of this software and associated documentation files (the "Software"), to
13 # deal in the Software without restriction, including without limitation the
14 # rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
15 # sell copies of the Software, and to permit persons to whom the Software is
16 # furnished to do so, subject to the following conditions:
17 #
18 # The above copyright notice and this permission notice shall be included in
19 # all copies or substantial portions of the Software.
20 #
21 # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
22 # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
23 # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
24 # X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
25 # AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNEC-
26 # TION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
27 #
28 # Except as contained in this notice, the name of the X Consortium shall not
29 # be used in advertising or otherwise to promote the sale, use or other deal-
30 # ings in this Software without prior written authorization from the X Consor-
31 # tium.
32 #
33 #
34 # FSF changes to this file are in the public domain.
35 #
36 # Calling this script install-sh is preferred over install.sh, to prevent
37 # `make' implicit rules from creating a file called install from it
38 # when there is no Makefile.
39 #
40 # This script is compatible with the BSD install script, but was written
41 # from scratch.
42
43 nl='
44 '
45 IFS=" "" $nl"
46
47 # set DOITPROG to echo to test this script
48
49 # Don't use :- since 4.3BSD and earlier shells don't like it.
50 doit=${DOITPROG-}
51 if test -z "$doit"; then
52 doit_exec=exec
53 else
54 doit_exec=$doit
55 fi
56
57 # Put in absolute file names if you don't have them in your path;
58 # or use environment vars.
59
60 chgrpprog=${CHGRPPROG-chgrp}
61 chmodprog=${CHMODPROG-chmod}
62 chownprog=${CHOWNPROG-chown}
63 cmpprog=${CMPPROG-cmp}
64 cpprog=${CPPROG-cp}
65 mkdirprog=${MKDIRPROG-mkdir}
66 mvprog=${MVPROG-mv}
67 rmprog=${RMPROG-rm}
68 stripprog=${STRIPPROG-strip}
69
70 posix_glob='?'
71 initialize_posix_glob='
72 test "$posix_glob" != "?" || {
73 if (set -f) 2>/dev/null; then
74 posix_glob=
75 else
76 posix_glob=:
77 fi
78 }
79 '
80
81 posix_mkdir=
82
83 # Desired mode of installed file.
84 mode=0755
85
86 chgrpcmd=
87 chmodcmd=$chmodprog
88 chowncmd=
89 mvcmd=$mvprog
90 rmcmd="$rmprog -f"
91 stripcmd=
92
93 src=
94 dst=
95 dir_arg=
96 dst_arg=
97
98 copy_on_change=false
99 no_target_directory=
100
101 usage="\
102 Usage: $0 [OPTION]... [-T] SRCFILE DSTFILE
103 or: $0 [OPTION]... SRCFILES... DIRECTORY
104 or: $0 [OPTION]... -t DIRECTORY SRCFILES...
105 or: $0 [OPTION]... -d DIRECTORIES...
106
107 In the 1st form, copy SRCFILE to DSTFILE.
108 In the 2nd and 3rd, copy all SRCFILES to DIRECTORY.
109 In the 4th, create DIRECTORIES.
110
111 Options:
112 --help display this help and exit.
113 --version display version info and exit.
114
115 -c (ignored)
116 -C install only if different (preserve the last data modification time)
117 -d create directories instead of installing files.
118 -g GROUP $chgrpprog installed files to GROUP.
119 -m MODE $chmodprog installed files to MODE.
120 -o USER $chownprog installed files to USER.
121 -s $stripprog installed files.
122 -t DIRECTORY install into DIRECTORY.
123 -T report an error if DSTFILE is a directory.
124
125 Environment variables override the default commands:
126 CHGRPPROG CHMODPROG CHOWNPROG CMPPROG CPPROG MKDIRPROG MVPROG
127 RMPROG STRIPPROG
128 "
129
130 while test $# -ne 0; do
131 case $1 in
132 -c) ;;
133
134 -C) copy_on_change=true;;
135
136 -d) dir_arg=true;;
137
138 -g) chgrpcmd="$chgrpprog $2"
139 shift;;
140
141 --help) echo "$usage"; exit $?;;
142
143 -m) mode=$2
144 case $mode in
145 *' '* | *' '* | *'
146 '* | *'*'* | *'?'* | *'['*)
147 echo "$0: invalid mode: $mode" >&2
148 exit 1;;
149 esac
150 shift;;
151
152 -o) chowncmd="$chownprog $2"
153 shift;;
154
155 -s) stripcmd=$stripprog;;
156
157 -t) dst_arg=$2
158 shift;;
159
160 -T) no_target_directory=true;;
161
162 --version) echo "$0 $scriptversion"; exit $?;;
163
164 --) shift
165 break;;
166
167 -*) echo "$0: invalid option: $1" >&2
168 exit 1;;
169
170 *) break;;
171 esac
172 shift
173 done
174
175 if test $# -ne 0 && test -z "$dir_arg$dst_arg"; then
176 # When -d is used, all remaining arguments are directories to create.
177 # When -t is used, the destination is already specified.
178 # Otherwise, the last argument is the destination. Remove it from $@.
179 for arg
180 do
181 if test -n "$dst_arg"; then
182 # $@ is not empty: it contains at least $arg.
183 set fnord "$@" "$dst_arg"
184 shift # fnord
185 fi
186 shift # arg
187 dst_arg=$arg
188 done
189 fi
190
191 if test $# -eq 0; then
192 if test -z "$dir_arg"; then
193 echo "$0: no input file specified." >&2
194 exit 1
195 fi
196 # It's OK to call `install-sh -d' without argument.
197 # This can happen when creating conditional directories.
198 exit 0
199 fi
200
201 if test -z "$dir_arg"; then
202 trap '(exit $?); exit' 1 2 13 15
203
204 # Set umask so as not to create temps with too-generous modes.
205 # However, 'strip' requires both read and write access to temps.
206 case $mode in
207 # Optimize common cases.
208 *644) cp_umask=133;;
209 *755) cp_umask=22;;
210
211 *[0-7])
212 if test -z "$stripcmd"; then
213 u_plus_rw=
214 else
215 u_plus_rw='% 200'
216 fi
217 cp_umask=`expr '(' 777 - $mode % 1000 ')' $u_plus_rw`;;
218 *)
219 if test -z "$stripcmd"; then
220 u_plus_rw=
221 else
222 u_plus_rw=,u+rw
223 fi
224 cp_umask=$mode$u_plus_rw;;
225 esac
226 fi
227
228 for src
229 do
230 # Protect names starting with `-'.
231 case $src in
232 -*) src=./$src;;
233 esac
234
235 if test -n "$dir_arg"; then
236 dst=$src
237 dstdir=$dst
238 test -d "$dstdir"
239 dstdir_status=$?
240 else
241
242 # Waiting for this to be detected by the "$cpprog $src $dsttmp" command
243 # might cause directories to be created, which would be especially bad
244 # if $src (and thus $dsttmp) contains '*'.
245 if test ! -f "$src" && test ! -d "$src"; then
246 echo "$0: $src does not exist." >&2
247 exit 1
248 fi
249
250 if test -z "$dst_arg"; then
251 echo "$0: no destination specified." >&2
252 exit 1
253 fi
254
255 dst=$dst_arg
256 # Protect names starting with `-'.
257 case $dst in
258 -*) dst=./$dst;;
259 esac
260
261 # If destination is a directory, append the input filename; won't work
262 # if double slashes aren't ignored.
263 if test -d "$dst"; then
264 if test -n "$no_target_directory"; then
265 echo "$0: $dst_arg: Is a directory" >&2
266 exit 1
267 fi
268 dstdir=$dst
269 dst=$dstdir/`basename "$src"`
270 dstdir_status=0
271 else
272 # Prefer dirname, but fall back on a substitute if dirname fails.
273 dstdir=`
274 (dirname "$dst") 2>/dev/null ||
275 expr X"$dst" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
276 X"$dst" : 'X\(//\)[^/]' \| \
277 X"$dst" : 'X\(//\)$' \| \
278 X"$dst" : 'X\(/\)' \| . 2>/dev/null ||
279 echo X"$dst" |
280 sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
281 s//\1/
282 q
283 }
284 /^X\(\/\/\)[^/].*/{
285 s//\1/
286 q
287 }
288 /^X\(\/\/\)$/{
289 s//\1/
290 q
291 }
292 /^X\(\/\).*/{
293 s//\1/
294 q
295 }
296 s/.*/./; q'
297 `
298
299 test -d "$dstdir"
300 dstdir_status=$?
301 fi
302 fi
303
304 obsolete_mkdir_used=false
305
306 if test $dstdir_status != 0; then
307 case $posix_mkdir in
308 '')
309 # Create intermediate dirs using mode 755 as modified by the umask.
310 # This is like FreeBSD 'install' as of 1997-10-28.
311 umask=`umask`
312 case $stripcmd.$umask in
313 # Optimize common cases.
314 *[2367][2367]) mkdir_umask=$umask;;
315 .*0[02][02] | .[02][02] | .[02]) mkdir_umask=22;;
316
317 *[0-7])
318 mkdir_umask=`expr $umask + 22 \
319 - $umask % 100 % 40 + $umask % 20 \
320 - $umask % 10 % 4 + $umask % 2
321 `;;
322 *) mkdir_umask=$umask,go-w;;
323 esac
324
325 # With -d, create the new directory with the user-specified mode.
326 # Otherwise, rely on $mkdir_umask.
327 if test -n "$dir_arg"; then
328 mkdir_mode=-m$mode
329 else
330 mkdir_mode=
331 fi
332
333 posix_mkdir=false
334 case $umask in
335 *[123567][0-7][0-7])
336 # POSIX mkdir -p sets u+wx bits regardless of umask, which
337 # is incompatible with FreeBSD 'install' when (umask & 300) != 0.
338 ;;
339 *)
340 tmpdir=${TMPDIR-/tmp}/ins$RANDOM-$$
341 trap 'ret=$?; rmdir "$tmpdir/d" "$tmpdir" 2>/dev/null; exit $ret' 0
342
343 if (umask $mkdir_umask &&
344 exec $mkdirprog $mkdir_mode -p -- "$tmpdir/d") >/dev/null 2>&1
345 then
346 if test -z "$dir_arg" || {
347 # Check for POSIX incompatibilities with -m.
348 # HP-UX 11.23 and IRIX 6.5 mkdir -m -p sets group- or
349 # other-writeable bit of parent directory when it shouldn't.
350 # FreeBSD 6.1 mkdir -m -p sets mode of existing directory.
351 ls_ld_tmpdir=`ls -ld "$tmpdir"`
352 case $ls_ld_tmpdir in
353 d????-?r-*) different_mode=700;;
354 d????-?--*) different_mode=755;;
355 *) false;;
356 esac &&
357 $mkdirprog -m$different_mode -p -- "$tmpdir" && {
358 ls_ld_tmpdir_1=`ls -ld "$tmpdir"`
359 test "$ls_ld_tmpdir" = "$ls_ld_tmpdir_1"
360 }
361 }
362 then posix_mkdir=:
363 fi
364 rmdir "$tmpdir/d" "$tmpdir"
365 else
366 # Remove any dirs left behind by ancient mkdir implementations.
367 rmdir ./$mkdir_mode ./-p ./-- 2>/dev/null
368 fi
369 trap '' 0;;
370 esac;;
371 esac
372
373 if
374 $posix_mkdir && (
375 umask $mkdir_umask &&
376 $doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir"
377 )
378 then :
379 else
380
381 # The umask is ridiculous, or mkdir does not conform to POSIX,
382 # or it failed possibly due to a race condition. Create the
383 # directory the slow way, step by step, checking for races as we go.
384
385 case $dstdir in
386 /*) prefix='/';;
387 -*) prefix='./';;
388 *) prefix='';;
389 esac
390
391 eval "$initialize_posix_glob"
392
393 oIFS=$IFS
394 IFS=/
395 $posix_glob set -f
396 set fnord $dstdir
397 shift
398 $posix_glob set +f
399 IFS=$oIFS
400
401 prefixes=
402
403 for d
404 do
405 test -z "$d" && continue
406
407 prefix=$prefix$d
408 if test -d "$prefix"; then
409 prefixes=
410 else
411 if $posix_mkdir; then
412 (umask=$mkdir_umask &&
413 $doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir") && break
414 # Don't fail if two instances are running concurrently.
415 test -d "$prefix" || exit 1
416 else
417 case $prefix in
418 *\'*) qprefix=`echo "$prefix" | sed "s/'/'\\\\\\\\''/g"`;;
419 *) qprefix=$prefix;;
420 esac
421 prefixes="$prefixes '$qprefix'"
422 fi
423 fi
424 prefix=$prefix/
425 done
426
427 if test -n "$prefixes"; then
428 # Don't fail if two instances are running concurrently.
429 (umask $mkdir_umask &&
430 eval "\$doit_exec \$mkdirprog $prefixes") ||
431 test -d "$dstdir" || exit 1
432 obsolete_mkdir_used=true
433 fi
434 fi
435 fi
436
437 if test -n "$dir_arg"; then
438 { test -z "$chowncmd" || $doit $chowncmd "$dst"; } &&
439 { test -z "$chgrpcmd" || $doit $chgrpcmd "$dst"; } &&
440 { test "$obsolete_mkdir_used$chowncmd$chgrpcmd" = false ||
441 test -z "$chmodcmd" || $doit $chmodcmd $mode "$dst"; } || exit 1
442 else
443
444 # Make a couple of temp file names in the proper directory.
445 dsttmp=$dstdir/_inst.$$_
446 rmtmp=$dstdir/_rm.$$_
447
448 # Trap to clean up those temp files at exit.
449 trap 'ret=$?; rm -f "$dsttmp" "$rmtmp" && exit $ret' 0
450
451 # Copy the file name to the temp name.
452 (umask $cp_umask && $doit_exec $cpprog "$src" "$dsttmp") &&
453
454 # and set any options; do chmod last to preserve setuid bits.
455 #
456 # If any of these fail, we abort the whole thing. If we want to
457 # ignore errors from any of these, just make sure not to ignore
458 # errors from the above "$doit $cpprog $src $dsttmp" command.
459 #
460 { test -z "$chowncmd" || $doit $chowncmd "$dsttmp"; } &&
461 { test -z "$chgrpcmd" || $doit $chgrpcmd "$dsttmp"; } &&
462 { test -z "$stripcmd" || $doit $stripcmd "$dsttmp"; } &&
463 { test -z "$chmodcmd" || $doit $chmodcmd $mode "$dsttmp"; } &&
464
465 # If -C, don't bother to copy if it wouldn't change the file.
466 if $copy_on_change &&
467 old=`LC_ALL=C ls -dlL "$dst" 2>/dev/null` &&
468 new=`LC_ALL=C ls -dlL "$dsttmp" 2>/dev/null` &&
469
470 eval "$initialize_posix_glob" &&
471 $posix_glob set -f &&
472 set X $old && old=:$2:$4:$5:$6 &&
473 set X $new && new=:$2:$4:$5:$6 &&
474 $posix_glob set +f &&
475
476 test "$old" = "$new" &&
477 $cmpprog "$dst" "$dsttmp" >/dev/null 2>&1
478 then
479 rm -f "$dsttmp"
480 else
481 # Rename the file to the real destination.
482 $doit $mvcmd -f "$dsttmp" "$dst" 2>/dev/null ||
483
484 # The rename failed, perhaps because mv can't rename something else
485 # to itself, or perhaps because mv is so ancient that it does not
486 # support -f.
487 {
488 # Now remove or move aside any old file at destination location.
489 # We try this two ways since rm can't unlink itself on some
490 # systems and the destination file might be busy for other
491 # reasons. In this case, the final cleanup might fail but the new
492 # file should still install successfully.
493 {
494 test ! -f "$dst" ||
495 $doit $rmcmd -f "$dst" 2>/dev/null ||
496 { $doit $mvcmd -f "$dst" "$rmtmp" 2>/dev/null &&
497 { $doit $rmcmd -f "$rmtmp" 2>/dev/null; :; }
498 } ||
499 { echo "$0: cannot unlink or rename $dst" >&2
500 (exit 1); exit 1
501 }
502 } &&
503
504 # Now rename the file to the real destination.
505 $doit $mvcmd "$dsttmp" "$dst"
506 }
507 fi || exit 1
508
509 trap '' 0
510 fi
511 done
512
513 # Local variables:
514 # eval: (add-hook 'write-file-hooks 'time-stamp)
515 # time-stamp-start: "scriptversion="
516 # time-stamp-format: "%:y-%02m-%02d.%02H"
517 # time-stamp-time-zone: "UTC"
518 # time-stamp-end: "; # UTC"
519 # End:
0 #!/bin/sh
1 # install - install a program, script, or datafile
2
3 scriptversion=2011-11-20.07; # UTC
4
5 # This originates from X11R5 (mit/util/scripts/install.sh), which was
6 # later released in X11R6 (xc/config/util/install.sh) with the
7 # following copyright and license.
8 #
9 # Copyright (C) 1994 X Consortium
10 #
11 # Permission is hereby granted, free of charge, to any person obtaining a copy
12 # of this software and associated documentation files (the "Software"), to
13 # deal in the Software without restriction, including without limitation the
14 # rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
15 # sell copies of the Software, and to permit persons to whom the Software is
16 # furnished to do so, subject to the following conditions:
17 #
18 # The above copyright notice and this permission notice shall be included in
19 # all copies or substantial portions of the Software.
20 #
21 # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
22 # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
23 # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
24 # X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
25 # AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNEC-
26 # TION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
27 #
28 # Except as contained in this notice, the name of the X Consortium shall not
29 # be used in advertising or otherwise to promote the sale, use or other deal-
30 # ings in this Software without prior written authorization from the X Consor-
31 # tium.
32 #
33 #
34 # FSF changes to this file are in the public domain.
35 #
36 # Calling this script install-sh is preferred over install.sh, to prevent
37 # 'make' implicit rules from creating a file called install from it
38 # when there is no Makefile.
39 #
40 # This script is compatible with the BSD install script, but was written
41 # from scratch.
42
43 nl='
44 '
45 IFS=" "" $nl"
46
47 # set DOITPROG to echo to test this script
48
49 # Don't use :- since 4.3BSD and earlier shells don't like it.
50 doit=${DOITPROG-}
51 if test -z "$doit"; then
52 doit_exec=exec
53 else
54 doit_exec=$doit
55 fi
56
57 # Put in absolute file names if you don't have them in your path;
58 # or use environment vars.
59
60 chgrpprog=${CHGRPPROG-chgrp}
61 chmodprog=${CHMODPROG-chmod}
62 chownprog=${CHOWNPROG-chown}
63 cmpprog=${CMPPROG-cmp}
64 cpprog=${CPPROG-cp}
65 mkdirprog=${MKDIRPROG-mkdir}
66 mvprog=${MVPROG-mv}
67 rmprog=${RMPROG-rm}
68 stripprog=${STRIPPROG-strip}
69
70 posix_glob='?'
71 initialize_posix_glob='
72 test "$posix_glob" != "?" || {
73 if (set -f) 2>/dev/null; then
74 posix_glob=
75 else
76 posix_glob=:
77 fi
78 }
79 '
80
81 posix_mkdir=
82
83 # Desired mode of installed file.
84 mode=0755
85
86 chgrpcmd=
87 chmodcmd=$chmodprog
88 chowncmd=
89 mvcmd=$mvprog
90 rmcmd="$rmprog -f"
91 stripcmd=
92
93 src=
94 dst=
95 dir_arg=
96 dst_arg=
97
98 copy_on_change=false
99 no_target_directory=
100
101 usage="\
102 Usage: $0 [OPTION]... [-T] SRCFILE DSTFILE
103 or: $0 [OPTION]... SRCFILES... DIRECTORY
104 or: $0 [OPTION]... -t DIRECTORY SRCFILES...
105 or: $0 [OPTION]... -d DIRECTORIES...
106
107 In the 1st form, copy SRCFILE to DSTFILE.
108 In the 2nd and 3rd, copy all SRCFILES to DIRECTORY.
109 In the 4th, create DIRECTORIES.
110
111 Options:
112 --help display this help and exit.
113 --version display version info and exit.
114
115 -c (ignored)
116 -C install only if different (preserve the last data modification time)
117 -d create directories instead of installing files.
118 -g GROUP $chgrpprog installed files to GROUP.
119 -m MODE $chmodprog installed files to MODE.
120 -o USER $chownprog installed files to USER.
121 -s $stripprog installed files.
122 -t DIRECTORY install into DIRECTORY.
123 -T report an error if DSTFILE is a directory.
124
125 Environment variables override the default commands:
126 CHGRPPROG CHMODPROG CHOWNPROG CMPPROG CPPROG MKDIRPROG MVPROG
127 RMPROG STRIPPROG
128 "
129
130 while test $# -ne 0; do
131 case $1 in
132 -c) ;;
133
134 -C) copy_on_change=true;;
135
136 -d) dir_arg=true;;
137
138 -g) chgrpcmd="$chgrpprog $2"
139 shift;;
140
141 --help) echo "$usage"; exit $?;;
142
143 -m) mode=$2
144 case $mode in
145 *' '* | *' '* | *'
146 '* | *'*'* | *'?'* | *'['*)
147 echo "$0: invalid mode: $mode" >&2
148 exit 1;;
149 esac
150 shift;;
151
152 -o) chowncmd="$chownprog $2"
153 shift;;
154
155 -s) stripcmd=$stripprog;;
156
157 -t) dst_arg=$2
158 # Protect names problematic for 'test' and other utilities.
159 case $dst_arg in
160 -* | [=\(\)!]) dst_arg=./$dst_arg;;
161 esac
162 shift;;
163
164 -T) no_target_directory=true;;
165
166 --version) echo "$0 $scriptversion"; exit $?;;
167
168 --) shift
169 break;;
170
171 -*) echo "$0: invalid option: $1" >&2
172 exit 1;;
173
174 *) break;;
175 esac
176 shift
177 done
178
179 if test $# -ne 0 && test -z "$dir_arg$dst_arg"; then
180 # When -d is used, all remaining arguments are directories to create.
181 # When -t is used, the destination is already specified.
182 # Otherwise, the last argument is the destination. Remove it from $@.
183 for arg
184 do
185 if test -n "$dst_arg"; then
186 # $@ is not empty: it contains at least $arg.
187 set fnord "$@" "$dst_arg"
188 shift # fnord
189 fi
190 shift # arg
191 dst_arg=$arg
192 # Protect names problematic for 'test' and other utilities.
193 case $dst_arg in
194 -* | [=\(\)!]) dst_arg=./$dst_arg;;
195 esac
196 done
197 fi
198
199 if test $# -eq 0; then
200 if test -z "$dir_arg"; then
201 echo "$0: no input file specified." >&2
202 exit 1
203 fi
204 # It's OK to call 'install-sh -d' without argument.
205 # This can happen when creating conditional directories.
206 exit 0
207 fi
208
209 if test -z "$dir_arg"; then
210 do_exit='(exit $ret); exit $ret'
211 trap "ret=129; $do_exit" 1
212 trap "ret=130; $do_exit" 2
213 trap "ret=141; $do_exit" 13
214 trap "ret=143; $do_exit" 15
215
216 # Set umask so as not to create temps with too-generous modes.
217 # However, 'strip' requires both read and write access to temps.
218 case $mode in
219 # Optimize common cases.
220 *644) cp_umask=133;;
221 *755) cp_umask=22;;
222
223 *[0-7])
224 if test -z "$stripcmd"; then
225 u_plus_rw=
226 else
227 u_plus_rw='% 200'
228 fi
229 cp_umask=`expr '(' 777 - $mode % 1000 ')' $u_plus_rw`;;
230 *)
231 if test -z "$stripcmd"; then
232 u_plus_rw=
233 else
234 u_plus_rw=,u+rw
235 fi
236 cp_umask=$mode$u_plus_rw;;
237 esac
238 fi
239
240 for src
241 do
242 # Protect names problematic for 'test' and other utilities.
243 case $src in
244 -* | [=\(\)!]) src=./$src;;
245 esac
246
247 if test -n "$dir_arg"; then
248 dst=$src
249 dstdir=$dst
250 test -d "$dstdir"
251 dstdir_status=$?
252 else
253
254 # Waiting for this to be detected by the "$cpprog $src $dsttmp" command
255 # might cause directories to be created, which would be especially bad
256 # if $src (and thus $dsttmp) contains '*'.
257 if test ! -f "$src" && test ! -d "$src"; then
258 echo "$0: $src does not exist." >&2
259 exit 1
260 fi
261
262 if test -z "$dst_arg"; then
263 echo "$0: no destination specified." >&2
264 exit 1
265 fi
266 dst=$dst_arg
267
268 # If destination is a directory, append the input filename; won't work
269 # if double slashes aren't ignored.
270 if test -d "$dst"; then
271 if test -n "$no_target_directory"; then
272 echo "$0: $dst_arg: Is a directory" >&2
273 exit 1
274 fi
275 dstdir=$dst
276 dst=$dstdir/`basename "$src"`
277 dstdir_status=0
278 else
279 # Prefer dirname, but fall back on a substitute if dirname fails.
280 dstdir=`
281 (dirname "$dst") 2>/dev/null ||
282 expr X"$dst" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
283 X"$dst" : 'X\(//\)[^/]' \| \
284 X"$dst" : 'X\(//\)$' \| \
285 X"$dst" : 'X\(/\)' \| . 2>/dev/null ||
286 echo X"$dst" |
287 sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
288 s//\1/
289 q
290 }
291 /^X\(\/\/\)[^/].*/{
292 s//\1/
293 q
294 }
295 /^X\(\/\/\)$/{
296 s//\1/
297 q
298 }
299 /^X\(\/\).*/{
300 s//\1/
301 q
302 }
303 s/.*/./; q'
304 `
305
306 test -d "$dstdir"
307 dstdir_status=$?
308 fi
309 fi
310
311 obsolete_mkdir_used=false
312
313 if test $dstdir_status != 0; then
314 case $posix_mkdir in
315 '')
316 # Create intermediate dirs using mode 755 as modified by the umask.
317 # This is like FreeBSD 'install' as of 1997-10-28.
318 umask=`umask`
319 case $stripcmd.$umask in
320 # Optimize common cases.
321 *[2367][2367]) mkdir_umask=$umask;;
322 .*0[02][02] | .[02][02] | .[02]) mkdir_umask=22;;
323
324 *[0-7])
325 mkdir_umask=`expr $umask + 22 \
326 - $umask % 100 % 40 + $umask % 20 \
327 - $umask % 10 % 4 + $umask % 2
328 `;;
329 *) mkdir_umask=$umask,go-w;;
330 esac
331
332 # With -d, create the new directory with the user-specified mode.
333 # Otherwise, rely on $mkdir_umask.
334 if test -n "$dir_arg"; then
335 mkdir_mode=-m$mode
336 else
337 mkdir_mode=
338 fi
339
340 posix_mkdir=false
341 case $umask in
342 *[123567][0-7][0-7])
343 # POSIX mkdir -p sets u+wx bits regardless of umask, which
344 # is incompatible with FreeBSD 'install' when (umask & 300) != 0.
345 ;;
346 *)
347 tmpdir=${TMPDIR-/tmp}/ins$RANDOM-$$
348 trap 'ret=$?; rmdir "$tmpdir/d" "$tmpdir" 2>/dev/null; exit $ret' 0
349
350 if (umask $mkdir_umask &&
351 exec $mkdirprog $mkdir_mode -p -- "$tmpdir/d") >/dev/null 2>&1
352 then
353 if test -z "$dir_arg" || {
354 # Check for POSIX incompatibilities with -m.
355 # HP-UX 11.23 and IRIX 6.5 mkdir -m -p sets group- or
356 # other-writable bit of parent directory when it shouldn't.
357 # FreeBSD 6.1 mkdir -m -p sets mode of existing directory.
358 ls_ld_tmpdir=`ls -ld "$tmpdir"`
359 case $ls_ld_tmpdir in
360 d????-?r-*) different_mode=700;;
361 d????-?--*) different_mode=755;;
362 *) false;;
363 esac &&
364 $mkdirprog -m$different_mode -p -- "$tmpdir" && {
365 ls_ld_tmpdir_1=`ls -ld "$tmpdir"`
366 test "$ls_ld_tmpdir" = "$ls_ld_tmpdir_1"
367 }
368 }
369 then posix_mkdir=:
370 fi
371 rmdir "$tmpdir/d" "$tmpdir"
372 else
373 # Remove any dirs left behind by ancient mkdir implementations.
374 rmdir ./$mkdir_mode ./-p ./-- 2>/dev/null
375 fi
376 trap '' 0;;
377 esac;;
378 esac
379
380 if
381 $posix_mkdir && (
382 umask $mkdir_umask &&
383 $doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir"
384 )
385 then :
386 else
387
388 # The umask is ridiculous, or mkdir does not conform to POSIX,
389 # or it failed possibly due to a race condition. Create the
390 # directory the slow way, step by step, checking for races as we go.
391
392 case $dstdir in
393 /*) prefix='/';;
394 [-=\(\)!]*) prefix='./';;
395 *) prefix='';;
396 esac
397
398 eval "$initialize_posix_glob"
399
400 oIFS=$IFS
401 IFS=/
402 $posix_glob set -f
403 set fnord $dstdir
404 shift
405 $posix_glob set +f
406 IFS=$oIFS
407
408 prefixes=
409
410 for d
411 do
412 test X"$d" = X && continue
413
414 prefix=$prefix$d
415 if test -d "$prefix"; then
416 prefixes=
417 else
418 if $posix_mkdir; then
419 (umask=$mkdir_umask &&
420 $doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir") && break
421 # Don't fail if two instances are running concurrently.
422 test -d "$prefix" || exit 1
423 else
424 case $prefix in
425 *\'*) qprefix=`echo "$prefix" | sed "s/'/'\\\\\\\\''/g"`;;
426 *) qprefix=$prefix;;
427 esac
428 prefixes="$prefixes '$qprefix'"
429 fi
430 fi
431 prefix=$prefix/
432 done
433
434 if test -n "$prefixes"; then
435 # Don't fail if two instances are running concurrently.
436 (umask $mkdir_umask &&
437 eval "\$doit_exec \$mkdirprog $prefixes") ||
438 test -d "$dstdir" || exit 1
439 obsolete_mkdir_used=true
440 fi
441 fi
442 fi
443
444 if test -n "$dir_arg"; then
445 { test -z "$chowncmd" || $doit $chowncmd "$dst"; } &&
446 { test -z "$chgrpcmd" || $doit $chgrpcmd "$dst"; } &&
447 { test "$obsolete_mkdir_used$chowncmd$chgrpcmd" = false ||
448 test -z "$chmodcmd" || $doit $chmodcmd $mode "$dst"; } || exit 1
449 else
450
451 # Make a couple of temp file names in the proper directory.
452 dsttmp=$dstdir/_inst.$$_
453 rmtmp=$dstdir/_rm.$$_
454
455 # Trap to clean up those temp files at exit.
456 trap 'ret=$?; rm -f "$dsttmp" "$rmtmp" && exit $ret' 0
457
458 # Copy the file name to the temp name.
459 (umask $cp_umask && $doit_exec $cpprog "$src" "$dsttmp") &&
460
461 # and set any options; do chmod last to preserve setuid bits.
462 #
463 # If any of these fail, we abort the whole thing. If we want to
464 # ignore errors from any of these, just make sure not to ignore
465 # errors from the above "$doit $cpprog $src $dsttmp" command.
466 #
467 { test -z "$chowncmd" || $doit $chowncmd "$dsttmp"; } &&
468 { test -z "$chgrpcmd" || $doit $chgrpcmd "$dsttmp"; } &&
469 { test -z "$stripcmd" || $doit $stripcmd "$dsttmp"; } &&
470 { test -z "$chmodcmd" || $doit $chmodcmd $mode "$dsttmp"; } &&
471
472 # If -C, don't bother to copy if it wouldn't change the file.
473 if $copy_on_change &&
474 old=`LC_ALL=C ls -dlL "$dst" 2>/dev/null` &&
475 new=`LC_ALL=C ls -dlL "$dsttmp" 2>/dev/null` &&
476
477 eval "$initialize_posix_glob" &&
478 $posix_glob set -f &&
479 set X $old && old=:$2:$4:$5:$6 &&
480 set X $new && new=:$2:$4:$5:$6 &&
481 $posix_glob set +f &&
482
483 test "$old" = "$new" &&
484 $cmpprog "$dst" "$dsttmp" >/dev/null 2>&1
485 then
486 rm -f "$dsttmp"
487 else
488 # Rename the file to the real destination.
489 $doit $mvcmd -f "$dsttmp" "$dst" 2>/dev/null ||
490
491 # The rename failed, perhaps because mv can't rename something else
492 # to itself, or perhaps because mv is so ancient that it does not
493 # support -f.
494 {
495 # Now remove or move aside any old file at destination location.
496 # We try this two ways since rm can't unlink itself on some
497 # systems and the destination file might be busy for other
498 # reasons. In this case, the final cleanup might fail but the new
499 # file should still install successfully.
500 {
501 test ! -f "$dst" ||
502 $doit $rmcmd -f "$dst" 2>/dev/null ||
503 { $doit $mvcmd -f "$dst" "$rmtmp" 2>/dev/null &&
504 { $doit $rmcmd -f "$rmtmp" 2>/dev/null; :; }
505 } ||
506 { echo "$0: cannot unlink or rename $dst" >&2
507 (exit 1); exit 1
508 }
509 } &&
510
511 # Now rename the file to the real destination.
512 $doit $mvcmd "$dsttmp" "$dst"
513 }
514 fi || exit 1
515
516 trap '' 0
517 fi
518 done
519
520 # Local variables:
521 # eval: (add-hook 'write-file-hooks 'time-stamp)
522 # time-stamp-start: "scriptversion="
523 # time-stamp-format: "%:y-%02m-%02d.%02H"
524 # time-stamp-time-zone: "UTC"
525 # time-stamp-end: "; # UTC"
526 # End:
5252 /*---------------------------------------- getdns_list_get_data_type */
5353 getdns_return_t
5454 getdns_list_get_data_type(const struct getdns_list * list, size_t index,
55 getdns_data_type * answer)
56 {
57 if (!list || !answer)
58 return GETDNS_RETURN_INVALID_PARAMETER;
55 getdns_data_type * answer)
56 {
57 if (!list || !answer)
58 return GETDNS_RETURN_INVALID_PARAMETER;
5959
6060 if (index >= list->numinuse)
6161 return GETDNS_RETURN_NO_SUCH_LIST_ITEM;
6767 /*---------------------------------------- getdns_list_get_dict */
6868 getdns_return_t
6969 getdns_list_get_dict(const struct getdns_list * list, size_t index,
70 struct getdns_dict ** answer)
71 {
72 if (!list || !answer)
73 return GETDNS_RETURN_INVALID_PARAMETER;
74
75 if (index >= list->numinuse)
76 return GETDNS_RETURN_NO_SUCH_LIST_ITEM;
77
78 if (list->items[index].dtype != t_dict)
70 struct getdns_dict ** answer)
71 {
72 if (!list || !answer)
73 return GETDNS_RETURN_INVALID_PARAMETER;
74
75 if (index >= list->numinuse)
76 return GETDNS_RETURN_NO_SUCH_LIST_ITEM;
77
78 if (list->items[index].dtype != t_dict)
7979 return GETDNS_RETURN_WRONG_TYPE_REQUESTED;
8080
8181 *answer = list->items[index].data.dict;
8585 /*---------------------------------------- getdns_list_get_list */
8686 getdns_return_t
8787 getdns_list_get_list(const struct getdns_list * list, size_t index,
88 struct getdns_list ** answer)
89 {
90 if (!list || !answer)
91 return GETDNS_RETURN_INVALID_PARAMETER;
88 struct getdns_list ** answer)
89 {
90 if (!list || !answer)
91 return GETDNS_RETURN_INVALID_PARAMETER;
9292
9393 if (index >= list->numinuse)
9494 return GETDNS_RETURN_NO_SUCH_LIST_ITEM;
103103 /*---------------------------------------- getdns_list_get_bindata */
104104 getdns_return_t
105105 getdns_list_get_bindata(const struct getdns_list * list, size_t index,
106 struct getdns_bindata ** answer)
107 {
108
109 if (!list || !answer)
110 return GETDNS_RETURN_INVALID_PARAMETER;
111
112 if (index >= list->numinuse)
113 return GETDNS_RETURN_NO_SUCH_LIST_ITEM;
106 struct getdns_bindata ** answer)
107 {
108
109 if (!list || !answer)
110 return GETDNS_RETURN_INVALID_PARAMETER;
111
112 if (index >= list->numinuse)
113 return GETDNS_RETURN_NO_SUCH_LIST_ITEM;
114114
115115 if (list->items[index].dtype != t_bindata)
116116 return GETDNS_RETURN_WRONG_TYPE_REQUESTED;
122122 /*---------------------------------------- getdns_list_get_int */
123123 getdns_return_t
124124 getdns_list_get_int(const struct getdns_list * list, size_t index,
125 uint32_t * answer)
126 {
127 if (!list || !answer)
128 return GETDNS_RETURN_INVALID_PARAMETER;
129
130 if (index >= list->numinuse)
131 return GETDNS_RETURN_NO_SUCH_LIST_ITEM;
125 uint32_t * answer)
126 {
127 if (!list || !answer)
128 return GETDNS_RETURN_INVALID_PARAMETER;
129
130 if (index >= list->numinuse)
131 return GETDNS_RETURN_NO_SUCH_LIST_ITEM;
132132
133133 if (list->items[index].dtype != t_int)
134134 return GETDNS_RETURN_WRONG_TYPE_REQUESTED;
154154 return GETDNS_RETURN_INVALID_PARAMETER;
155155
156156 newlist = GETDNS_XREALLOC(list->mf, list->items,
157 struct getdns_list_item,
158 list->numalloc + GETDNS_LIST_BLOCKSZ);
157 struct getdns_list_item,
158 list->numalloc + GETDNS_LIST_BLOCKSZ);
159159 if (!newlist)
160160 return GETDNS_RETURN_GENERIC_ERROR;
161161
167167 /*---------------------------------------- getdns_list_copy */
168168 getdns_return_t
169169 getdns_list_copy(const struct getdns_list * srclist,
170 struct getdns_list ** dstlist)
170 struct getdns_list ** dstlist)
171171 {
172172 int i;
173173 size_t index;
181181 return GETDNS_RETURN_GOOD;
182182 }
183183 *dstlist = getdns_list_create_with_extended_memory_functions(
184 srclist->mf.mf_arg,
185 srclist->mf.mf.ext.malloc,
186 srclist->mf.mf.ext.realloc,
187 srclist->mf.mf.ext.free
184 srclist->mf.mf_arg,
185 srclist->mf.mf.ext.malloc,
186 srclist->mf.mf.ext.realloc,
187 srclist->mf.mf.ext.free
188188 );
189189 if (!dstlist)
190190 return GETDNS_RETURN_GENERIC_ERROR;
199199 switch (srclist->items[i].dtype) {
200200 case t_int:
201201 retval = getdns_list_set_int(*dstlist, index,
202 srclist->items[i].data.n);
202 srclist->items[i].data.n);
203203 break;
204204
205205 case t_list:
206206 retval =getdns_list_set_list(*dstlist, index,
207 srclist->items[i].data.list);
207 srclist->items[i].data.list);
208208 break;
209209
210210 case t_bindata:
211211 retval = getdns_list_set_bindata(*dstlist, index,
212 srclist->items[i].data.bindata);
212 srclist->items[i].data.bindata);
213213 break;
214214
215215 case t_dict:
216216 retval = getdns_list_set_dict(*dstlist, index,
217 srclist->items[i].data.dict);
217 srclist->items[i].data.dict);
218218 break;
219219 }
220220 if (retval != GETDNS_RETURN_GOOD) {
228228
229229 struct getdns_list *
230230 getdns_list_create_with_extended_memory_functions(
231 void *userarg,
232 void *(*malloc)(void *userarg, size_t),
233 void *(*realloc)(void *userarg, void *, size_t),
234 void (*free)(void *userarg, void *))
231 void *userarg,
232 void *(*malloc)(void *userarg, size_t),
233 void *(*realloc)(void *userarg, void *, size_t),
234 void (*free)(void *userarg, void *))
235235 {
236236 struct getdns_list *list;
237237 mf_union mf;
241241
242242 mf.ext.malloc = malloc;
243243 list = userarg == MF_PLAIN
244 ? (struct getdns_list *)(*mf.pln.malloc)(
245 sizeof(struct getdns_list))
246 : (struct getdns_list *)(*mf.ext.malloc)(userarg,
247 sizeof(struct getdns_list));
244 ? (struct getdns_list *)(*mf.pln.malloc)(
245 sizeof(struct getdns_list))
246 : (struct getdns_list *)(*mf.ext.malloc)(userarg,
247 sizeof(struct getdns_list));
248248 if (!list)
249249 return NULL;
250250
265265
266266 struct getdns_list *
267267 getdns_list_create_with_memory_functions(void *(*malloc)(size_t),
268 void *(*realloc)(void *, size_t), void (*free)(void *))
268 void *(*realloc)(void *, size_t), void (*free)(void *))
269269 {
270270 mf_union mf;
271271 mf.pln.malloc = malloc;
272272 mf.pln.realloc = realloc;
273273 mf.pln.free = free;
274274 return getdns_list_create_with_extended_memory_functions(
275 MF_PLAIN, mf.ext.malloc, mf.ext.realloc, mf.ext.free);
275 MF_PLAIN, mf.ext.malloc, mf.ext.realloc, mf.ext.free);
276276 }
277277
278278
282282 {
283283 if (context)
284284 return getdns_list_create_with_extended_memory_functions(
285 context->mf.mf_arg,
286 context->mf.mf.ext.malloc,
287 context->mf.mf.ext.realloc,
288 context->mf.mf.ext.free
285 context->mf.mf_arg,
286 context->mf.mf.ext.malloc,
287 context->mf.mf.ext.realloc,
288 context->mf.mf.ext.free
289289 );
290290 else
291291 return getdns_list_create_with_memory_functions(malloc,
292 realloc, free);
292 realloc, free);
293293 } /* getdns_list_create_with_context */
294294
295295 /*---------------------------------------- getdns_list_create */
313313
314314 case t_bindata:
315315 getdns_bindata_destroy(&list->mf,
316 list->items[index].data.bindata);
316 list->items[index].data.bindata);
317317 break;
318318
319319 default:
322322 }
323323
324324 /*---------------------------------------- getdns_list_destroy */
325 void
325 getdns_return_t
326326 getdns_list_destroy(struct getdns_list *list)
327327 {
328328 size_t i;
329329
330330 if (!list)
331 return;
331 return GETDNS_RETURN_INVALID_PARAMETER;
332332
333333 for (i = 0; i < list->numinuse; i++)
334334 getdns_list_destroy_item(list, i);
336336 if (list->items)
337337 GETDNS_FREE(list->mf, list->items);
338338 GETDNS_FREE(list->mf, list);
339 return GETDNS_RETURN_GOOD;
339340 } /* getdns_list_destroy */
340341
341342 /*---------------------------------------- getdns_list_add_item */
353354 return retval;
354355 }
355356 *index = list->numinuse;
356 list->items[*index].dtype = t_int;
357 list->items[*index].data.n = 0;
357 list->items[*index].dtype = t_int;
358 list->items[*index].data.n = 0;
358359 list->numinuse++;
359360 return GETDNS_RETURN_GOOD;
360361 } /* getdns_list_add_item */
362363 /*---------------------------------------- getdns_list_set_dict */
363364 getdns_return_t
364365 getdns_list_set_dict(struct getdns_list * list, size_t index,
365 const struct getdns_dict * child_dict)
366 const struct getdns_dict * child_dict)
366367 {
367368 struct getdns_dict *newdict;
368369 getdns_return_t retval;
394395 /*---------------------------------------- getdns_list_set_list */
395396 getdns_return_t
396397 getdns_list_set_list(struct getdns_list * list, size_t index,
397 const struct getdns_list * child_list)
398 const struct getdns_list * child_list)
398399 {
399400 struct getdns_list *newlist;
400401 getdns_return_t retval;
426427 /*---------------------------------------- getdns_list_set_bindata */
427428 getdns_return_t
428429 getdns_list_set_bindata(struct getdns_list * list, size_t index,
429 const struct getdns_bindata * child_bindata)
430 const struct getdns_bindata * child_bindata)
430431 {
431432 struct getdns_bindata *newbindata;
432433 getdns_return_t retval;
458459 /*---------------------------------------- getdns_list_set_int */
459460 getdns_return_t
460461 getdns_list_set_int(struct getdns_list * list, size_t index,
461 uint32_t child_int)
462 uint32_t child_int)
462463 {
463464 getdns_return_t retval;
464465
0 #!/bin/sh
1
2 cat > const-info.c << END_OF_HEAD
3 /* WARNING! This file is generated by the mk-const-info.c.sh program.
4 * Do not edit manually!
5 */
6 #include <getdns/getdns.h>
7 #include <stdlib.h>
8 #include "const-info.h"
9
10 static struct const_info consts_info[] = {
11 { -1, NULL, "/* <unknown getdns value> */" },
12 END_OF_HEAD
13 awk '/^[ ]+GETDNS_[A-Z_]+[ ]+=[ ]+[0-9]+/{ print "\t{ "$3", \""$1"\", "$1"_TEXT }," }/^#define GETDNS_[A-Z_]+[ ]+[0-9]+/ && !/^#define GETDNS_RRTYPE/ && !/_TEXT/{ print "\t{ "$3", \""$2"\", "$2"_TEXT },"}' getdns/getdns.h | sed 's/,,/,/g' >> const-info.c
14 cat >> const-info.c << END_OF_TAIL
15 };
16
17 static int const_info_cmp(const void *a, const void *b)
18 {
19 return ((struct const_info *) a)->code - ((struct const_info *) b)->code;
20 }
21 struct const_info *
22 priv_getdns_get_const_info(int value)
23 {
24 struct const_info key = { value, "", "" };
25 struct const_info *i = bsearch(&key, consts_info,
26 sizeof(consts_info) / sizeof(struct const_info),
27 sizeof(struct const_info), const_info_cmp);
28 if (i)
29 return i;
30 return consts_info;
31 }
32
33 END_OF_TAIL
34
35
4343 have_libev = @have_libev@
4444
4545 EXTENSION_LIBEVENT_EXT_LIBS=@EXTENSION_LIBEVENT_EXT_LIBS@
46 EXTENSION_LIBEVENT_LDFLAGS=@EXTENSION_LIBEVENT_LDFLAGS@
4647 EXTENSION_LIBUV_EXT_LIBS=@EXTENSION_LIBUV_EXT_LIBS@
48 EXTENSION_LIBUV_LDFLAGS=@EXTENSION_LIBUV_LDFLAGS@
4749 EXTENSION_LIBEV_EXT_LIBS=@EXTENSION_LIBEV_EXT_LIBS@
50 EXTENSION_LIBEV_LDFLAGS=@EXTENSION_LIBEV_LDFLAGS@
4851
4952 CHECK_UV_PROG=@CHECK_UV_PROG@
5053 CHECK_EVENT_PROG=@CHECK_EVENT_PROG@
7275 $(LIBTOOL) --tag=CC --mode=link $(CC) $(CFLAGS) $(LDFLAGS) $(LDLIBS) -o $@ tests_list.o testmessages.o
7376
7477 tests_stub_async: tests_stub_async.o testmessages.o
75 $(LIBTOOL) --tag=CC --mode=link $(CC) $(CFLAGS) $(LDFLAGS) -lgetdns_ext_event $(LDLIBS) -o $@ tests_stub_async.o testmessages.o
78 $(LIBTOOL) --tag=CC --mode=link $(CC) $(CFLAGS) $(LDFLAGS) $(LDLIBS) -o $@ tests_stub_async.o testmessages.o
7679
7780 tests_stub_sync: tests_stub_sync.o
7881 $(LIBTOOL) --tag=CC --mode=link $(CC) $(CFLAGS) $(LDFLAGS) $(LDLIBS) -o $@ tests_stub_sync.o
8487 $(LIBTOOL) --tag=CC --mode=link $(CC) $(CFLAGS) $(LDFLAGS) $(LDLIBS) -lpthread -o $@ check_getdns.o check_getdns_common.o check_getdns_context_set_timeout.o check_getdns_selectloop.o
8588
8689 check_getdns_event: check_getdns.o check_getdns_common.o check_getdns_context_set_timeout.o check_getdns_libevent.o
87 $(LIBTOOL) --tag=CC --mode=link $(CC) $(CFLAGS) $(LDFLAGS) -lpthread -lgetdns_ext_event $(EXTENSION_LIBEVENT_EXT_LIBS) $(LDLIBS) -o $@ check_getdns.o check_getdns_common.o check_getdns_context_set_timeout.o check_getdns_libevent.o
90 $(LIBTOOL) --tag=CC --mode=link $(CC) $(CFLAGS) $(LDFLAGS) -lpthread -lgetdns_ext_event $(EXTENSION_LIBEVENT_LDFLAGS) $(EXTENSION_LIBEVENT_EXT_LIBS) $(LDLIBS) -o $@ check_getdns.o check_getdns_common.o check_getdns_context_set_timeout.o check_getdns_libevent.o
8891
8992 check_getdns_uv: check_getdns.o check_getdns_common.o check_getdns_context_set_timeout.o check_getdns_libuv.o
90 $(LIBTOOL) --tag=CC --mode=link $(CC) $(CFLAGS) $(LDFLAGS) -lpthread -lgetdns_ext_uv $(EXTENSION_LIBUV_EXT_LIBS) $(LDLIBS) -o $@ check_getdns.o check_getdns_common.o check_getdns_context_set_timeout.o check_getdns_libuv.o
93 $(LIBTOOL) --tag=CC --mode=link $(CC) $(CFLAGS) $(LDFLAGS) -lpthread -lgetdns_ext_uv $(EXTENSION_LIBUV_LDFLAGS) $(EXTENSION_LIBUV_EXT_LIBS) $(LDLIBS) -o $@ check_getdns.o check_getdns_common.o check_getdns_context_set_timeout.o check_getdns_libuv.o
9194
9295 check_getdns_ev: check_getdns.o check_getdns_common.o check_getdns_context_set_timeout.o check_getdns_libev.o
93 $(LIBTOOL) --tag=CC --mode=link $(CC) $(CFLAGS) $(LDFLAGS) -lpthread -lgetdns_ext_ev $(EXTENSION_LIBEV_EXT_LIBS) $(LDLIBS) -o $@ check_getdns.o check_getdns_common.o check_getdns_context_set_timeout.o check_getdns_libev.o
96 $(LIBTOOL) --tag=CC --mode=link $(CC) $(CFLAGS) $(LDFLAGS) -lpthread -lgetdns_ext_ev $(EXTENSION_LIBEV_LDFLAGS) $(EXTENSION_LIBEV_EXT_LIBS) $(LDLIBS) -o $@ check_getdns.o check_getdns_common.o check_getdns_context_set_timeout.o check_getdns_libev.o
9497
9598 tests_dnssec: tests_dnssec.o testmessages.o
96 $(LIBTOOL) --tag=CC --mode=link $(CC) $(CFLAGS) $(LDFLAGS) -lgetdns_ext_event $(LDLIBS) -o $@ tests_dnssec.o testmessages.o
99 $(LIBTOOL) --tag=CC --mode=link $(CC) $(CFLAGS) $(LDFLAGS) $(LDLIBS) -o $@ tests_dnssec.o testmessages.o
97100
98101
99102 test: all
0 The programs in this directory are intended to provide a regression
1 test suite - we should be adding tests here as we build the package.
2
3 When building unit tests one approach that makes regression testing
4 easy is to generate canonical output and maintain that with the
5 code. Changes to the code should produce output that matches the
6 canonical output, if it doesn't then the developer needs to look at
7 the differences to determine whether something broke or is fixed. Once
8 the new output is verified it can replace the canonical output.
9
10 A typical flow might be illustrated via tests_list:
11 - build tests_list (an executable linked against the library)
12 - run the regression tests
13 ./tests_list > tests_list.out
14 - compare output to canonical output
15 diff tests_list.out tests_list.can > tests_list.res
16 - if there are any diffs then a change affected the output
17 - verify the new output and copy it to tests_list.can
18 - commit the new canonical output to the repository
19
20 Some of the tests that remain to be implemented:
21 - memory leak testing integrated into the test progs
257257 ck_assert_msg(ptr_records == 1, "Expected to find one PTR record in answer section, got %d", ptr_records);
258258 }
259259
260 void destroy_callbackfn(struct getdns_context *context,
261 getdns_callback_type_t callback_type,
262 struct getdns_dict *response,
263 void *userarg,
264 getdns_transaction_t transaction_id) {
265 int* flag = (int*)userarg;
266 *flag = 1;
267 getdns_dict_destroy(response);
268 ck_assert_msg(getdns_context_destroy(context) != GETDNS_RETURN_GOOD,
269 "Expected getdns_context_destroy to not succeed");
270 }
271
260272 /*
261273 * callbackfn is the callback function given to all
262274 * asynchronous query tests. It is expected to only
8484 * The CONTEXT_FREE macro is used to
8585 * destroy the current context.
8686 */
87 #define CONTEXT_DESTROY getdns_context_destroy(context);
87 #define CONTEXT_DESTROY \
88 ASSERT_RC(getdns_context_destroy(context), \
89 GETDNS_RETURN_GOOD, \
90 "Return code from getdns_context_destroy()");
8891
8992 /*
9093 * The EVENT_BASE_CREATE macro is used to
185188 */
186189 void assert_ptr_in_answer(struct extracted_response *ex_response);
187190
191
192 void destroy_callbackfn(struct getdns_context *context,
193 getdns_callback_type_t callback_type,
194 struct getdns_dict *response,
195 void *userarg,
196 getdns_transaction_t transaction_id);
188197 /*
189198 * callbackfn is the callback function given to all
190199 * asynchronous query tests. It is expected to only
176176 }
177177 END_TEST
178178
179 START_TEST (getdns_context_destroy_7)
180 {
181 /*
182 * destroy called immediately following getdns_address
183 * expect: callback should be called before getdns_context_destroy() returns
184 */
185 struct getdns_context *context = NULL;
186 void* eventloop = NULL;
187 getdns_transaction_t transaction_id = 0;
188
189 int flag = 0; /* Initialize flag */
190
191 CONTEXT_CREATE(TRUE);
192 EVENT_BASE_CREATE;
193
194 ASSERT_RC(getdns_address(context, "google.com", NULL,
195 &flag, &transaction_id, destroy_callbackfn),
196 GETDNS_RETURN_GOOD, "Return code from getdns_address()");
197
198 RUN_EVENT_LOOP;
199
200 CONTEXT_DESTROY;
201
202 ck_assert_msg(flag == 1, "flag should == 1, got %d", flag);
203 }
204 END_TEST
205
206 START_TEST (getdns_context_destroy_8)
207 {
208 /*
209 * destroy called immediately following getdns_address
210 * expect: callback should be called before getdns_context_destroy() returns
211 */
212 struct getdns_context *context = NULL;
213 void* eventloop = NULL;
214 getdns_transaction_t transaction_id = 0;
215
216 int flag = 0; /* Initialize flag */
217
218 CONTEXT_CREATE(TRUE);
219 EVENT_BASE_CREATE;
220
221 ASSERT_RC(getdns_address(context, "google.com", NULL,
222 &flag, &transaction_id, destroy_callbackfn),
223 GETDNS_RETURN_GOOD, "Return code from getdns_address()");
224 getdns_cancel_callback(context, transaction_id);
225 RUN_EVENT_LOOP;
226
227 CONTEXT_DESTROY;
228
229 ck_assert_msg(flag == 1, "flag should == 1, got %d", flag);
230 }
231 END_TEST
232
233 START_TEST (getdns_context_destroy_9)
234 {
235 /*
236 * destroy called immediately following getdns_address
237 * expect: callback should be called before getdns_context_destroy() returns
238 */
239 struct getdns_context *context = NULL;
240 void* eventloop = NULL;
241 getdns_transaction_t transaction_id = 0;
242
243 int flag = 0; /* Initialize flag */
244
245 CONTEXT_CREATE(TRUE);
246 // set timeout to something unreasonable
247 getdns_context_set_timeout(context, 1);
248 EVENT_BASE_CREATE;
249
250 ASSERT_RC(getdns_address(context, "google.com", NULL,
251 &flag, &transaction_id, destroy_callbackfn),
252 GETDNS_RETURN_GOOD, "Return code from getdns_address()");
253 ASSERT_RC(getdns_address(context, "getdnsapi.net", NULL,
254 &flag, &transaction_id, destroy_callbackfn),
255 GETDNS_RETURN_GOOD, "Return code from getdns_address()");
256
257 RUN_EVENT_LOOP;
258
259 CONTEXT_DESTROY;
260
261 ck_assert_msg(flag == 1, "flag should == 1, got %d", flag);
262 }
263 END_TEST
264
179265 void verify_getdns_context_destroy(struct extracted_response *ex_response)
180266 {
181267 /*
207293 tcase_add_test(tc_pos, getdns_context_destroy_4);
208294 tcase_add_test(tc_pos, getdns_context_destroy_5);
209295 tcase_add_test(tc_pos, getdns_context_destroy_6);
296 tcase_add_test(tc_pos, getdns_context_destroy_7);
297 tcase_add_test(tc_pos, getdns_context_destroy_8);
298 tcase_add_test(tc_pos, getdns_context_destroy_9);
210299 suite_add_tcase(s, tc_pos);
211300
212301 return s;
4343 FD_ZERO(&read_fds);
4444 FD_SET(fd, &read_fds);
4545 select(fd + 1, &read_fds, NULL, NULL, &tv);
46 getdns_context_process_async(context);
46 if (getdns_context_process_async(context) != GETDNS_RETURN_GOOD) {
47 // context destroyed
48 break;
49 }
4750 }
4851 }
4952
3333
3434
3535 #include "config.h"
36 #ifdef HAVE_EVENT2_EVENT_H
37 # include <event2/event.h>
38 #else
39 # include <event.h>
40 #endif
4136 #include <stdio.h>
4237 #include <stdlib.h>
4338 #include <string.h>
4439 #include "testmessages.h"
4540 #include <getdns/getdns.h>
46 #include <getdns/getdns_ext_libevent.h>
41 #include <getdns/getdns_extra.h>
4742
4843 /* Set up the callback function, which will also do the processing of the results */
4944 void
5045 callbackfn(struct getdns_context *context,
51 getdns_callback_type_t callback_type,
52 struct getdns_dict *response, void *userarg,
53 getdns_transaction_t transaction_id)
46 getdns_callback_type_t callback_type,
47 struct getdns_dict *response, void *userarg,
48 getdns_transaction_t transaction_id)
5449 {
5550 struct getdns_list *validation_chain;
5651 struct getdns_list *trust_anchors;
6459 do {
6560 if (callback_type == GETDNS_CALLBACK_CANCEL) {
6661 fprintf(stderr,
67 "The callback with ID %llu was cancelled.\n",
68 (long long unsigned int)transaction_id);
62 "The callback with ID %llu was cancelled.\n",
63 (long long unsigned int)transaction_id);
6964 break;
7065 } else if (callback_type != GETDNS_CALLBACK_COMPLETE) {
7166 fprintf(stderr,
72 "The callback got a callback_type of %d.\n",
73 callback_type);
67 "The callback got a callback_type of %d.\n",
68 callback_type);
7469 break;
7570 }
7671 r = getdns_dict_get_list(response,
77 "validation_chain", &validation_chain);
72 "validation_chain", &validation_chain);
7873 if (r != GETDNS_RETURN_GOOD) {
7974 fprintf(stderr,
80 "Could not get \"validation_chain\" from response:"
81 " %d\n", r);
75 "Could not get \"validation_chain\" from response:"
76 " %d\n", r);
8277 break;
8378 }
8479 r = getdns_dict_get_list(response, "replies_tree", &replies_tree);
8580 if (r != GETDNS_RETURN_GOOD) {
8681 fprintf(stderr,
87 "Could not get \"replies_tree\" from response:"
88 " %d\n", r);
82 "Could not get \"replies_tree\" from response:"
83 " %d\n", r);
8984 break;
9085 }
9186 r = getdns_list_get_length(replies_tree, &replies_tree_length);
9287 if (r != GETDNS_RETURN_GOOD) {
9388 fprintf(stderr,
94 "Could not get length of the replies_tree:"
95 " %d\n", r);
89 "Could not get length of the replies_tree:"
90 " %d\n", r);
9691 break;
9792 }
9893 trust_anchors = getdns_root_trust_anchor(NULL);
9994 if (! trust_anchors) {
10095 fprintf(stderr,
101 "No root trust anchor present:"
102 " %d\n", r);
96 "No root trust anchor present:"
97 " %d\n", r);
10398 break;
10499 }
105100 for (i = 0; i < replies_tree_length; i++) {
106101 r = getdns_list_get_dict(replies_tree, i, &reply);
107102 if (r != GETDNS_RETURN_GOOD) {
108103 fprintf(stderr,
109 "Could not get \"reply\" from replies_tree:"
110 " %d\n", r);
104 "Could not get \"reply\" from replies_tree:"
105 " %d\n", r);
111106 break;
112107 }
113108 r = getdns_dict_get_list(reply, "answer", &answer);
114109 if (r != GETDNS_RETURN_GOOD) {
115110 fprintf(stderr,
116 "Could not get \"answer\" from reply:"
117 " %d\n", r);
111 "Could not get \"answer\" from reply:"
112 " %d\n", r);
118113 break;
119114 }
120115 r = getdns_list_get_length(answer, &answer_length);
121116 if (r != GETDNS_RETURN_GOOD) {
122117 fprintf(stderr,
123 "Could not get length of answer list:"
124 " %d\n", r);
118 "Could not get length of answer list:"
119 " %d\n", r);
125120 break;
126121 }
127122 if (answer_length == 0)
128123 continue;
129124
130125 r = getdns_validate_dnssec(answer,
131 validation_chain, trust_anchors);
126 validation_chain, trust_anchors);
132127 printf("getdns_validate_dnssec returned: %d\n", r);
133128 }
134129 getdns_list_destroy(trust_anchors);
135130 } while (0);
136131 getdns_dict_destroy(response);
137 (void) event_base_loopexit((struct event_base *)userarg, NULL);
138132 }
139133
140134 int
143137 const char *name = argc > 1 ? argv[1] : "www.example.com";
144138 struct getdns_context *context;
145139 struct getdns_dict *extensions;
146 struct event_base *event_base = NULL;
147140 getdns_transaction_t transaction_id = 0;
148141 getdns_return_t r;
149
142 struct timeval tv;
143
150144 r = getdns_context_create(&context, 1);
151145 if (r != GETDNS_RETURN_GOOD) {
152146 fprintf(stderr, "Create context failed: %d", r);
167161 GETDNS_EXTENSION_TRUE);
168162 if (r != GETDNS_RETURN_GOOD) {
169163 fprintf(stderr, "Could not set extension "
170 "\"dnssec_return_validation_chain\": %d\n", r);
164 "\"dnssec_return_validation_chain\": %d\n", r);
171165 goto done_destroy_extensions;
172 }
173
174 /* Create an event base and put it in the context */
175 event_base = event_base_new();
176 if (event_base == NULL) {
177 fprintf(stderr, "Trying to create the event base failed.");
178 r = GETDNS_RETURN_GENERIC_ERROR;
179 goto done_destroy_extensions;
180 }
181 (void) getdns_extension_set_libevent_base(context, event_base);
166 }
182167
183168 /* Make the call */
184 r = getdns_address(context, name, extensions, event_base,
185 &transaction_id, callbackfn);
169 r = getdns_address(context, name, extensions, NULL,
170 &transaction_id, callbackfn);
186171 if (r == GETDNS_RETURN_BAD_DOMAIN_NAME) {
187172 fprintf(stderr, "Bad domain name: %s.", name);
188173 goto done_destroy_extensions;
189174 }
190175 /* Call the event loop */
191 event_base_dispatch(event_base);
176 while (getdns_context_get_num_pending_requests(context, &tv) > 0) {
177 int fd = getdns_context_fd(context);
178 fd_set read_fds;
179 FD_ZERO(&read_fds);
180 FD_SET(fd, &read_fds);
181 select(fd + 1, &read_fds, NULL, NULL, &tv);
182 if (getdns_context_process_async(context) != GETDNS_RETURN_GOOD) {
183 // context destroyed
184 break;
185 }
186 }
192187
193188 /* Clean up */
194189 done_destroy_extensions:
196191 done_destroy_context:
197192 getdns_context_destroy(context);
198193
199 /* Event base must be destroyed after the context, because
200 * the context has to re-register its sockets from the eventbase,
201 * who has to communicate this to the system event-mechanism.
202 */
203 if (event_base)
204 event_base_free(event_base);
205
206194 return r;
207195 }
3232 */
3333
3434 #include "config.h"
35 #ifdef HAVE_EVENT2_EVENT_H
36 # include <event2/event.h>
37 #else
38 # include <event.h>
39 #endif
4035 #include <stdio.h>
4136 #include <stdlib.h>
4237 #include <string.h>
4338 #include "testmessages.h"
4439 #include <getdns/getdns.h>
45 #include <getdns/getdns_ext_libevent.h>
40 #include <getdns/getdns_extra.h>
4641 #include <sys/time.h>
4742
4843 /* Set up the callback function, which will also do the processing of the results */
4944 void
5045 this_callbackfn(struct getdns_context *this_context,
51 getdns_callback_type_t this_callback_type,
52 struct getdns_dict *this_response,
53 void *this_userarg, getdns_transaction_t this_transaction_id)
46 getdns_callback_type_t this_callback_type,
47 struct getdns_dict *this_response,
48 void *this_userarg, getdns_transaction_t this_transaction_id)
5449 {
5550 if (this_callback_type == GETDNS_CALLBACK_COMPLETE) { /* This is a callback with data */
5651 char *res = getdns_pretty_print_dict(this_response);
5954
6055 } else if (this_callback_type == GETDNS_CALLBACK_CANCEL)
6156 fprintf(stderr,
62 "The callback with ID %llu was cancelled. Exiting.",
63 (unsigned long long)this_transaction_id);
57 "The callback with ID %llu was cancelled. Exiting.",
58 (unsigned long long)this_transaction_id);
6459 else
6560 fprintf(stderr,
66 "The callback got a callback_type of %d. Exiting.",
67 this_callback_type);
61 "The callback got a callback_type of %d. Exiting.",
62 this_callback_type);
6863 getdns_dict_destroy(this_response);
6964 }
7065
7469 /* Create the DNS context for this call */
7570 struct getdns_context *this_context = NULL;
7671 getdns_return_t context_create_return =
77 getdns_context_create(&this_context, 1);
72 getdns_context_create(&this_context, 1);
7873 if (context_create_return != GETDNS_RETURN_GOOD) {
7974 fprintf(stderr, "Trying to create the context failed: %d",
80 context_create_return);
75 context_create_return);
8176 return (GETDNS_RETURN_GENERIC_ERROR);
8277 }
8378 getdns_context_set_resolution_type(this_context, GETDNS_RESOLUTION_STUB);
8479
8580 getdns_context_set_timeout(this_context, 5000);
8681 /* Create an event base and put it in the context using the unknown function name */
87 struct event_base *this_event_base;
88 this_event_base = event_base_new();
89 if (this_event_base == NULL) {
90 fprintf(stderr, "Trying to create the event base failed.");
91 getdns_context_destroy(this_context);
92 return (GETDNS_RETURN_GENERIC_ERROR);
93 }
94 if (getdns_extension_set_libevent_base(this_context,
95 this_event_base) != GETDNS_RETURN_GOOD) {
96 fprintf(stderr, "Setting event base failed.");
97 getdns_context_destroy(this_context);
98 return (GETDNS_RETURN_GENERIC_ERROR);
99 }
10082 /* Set up the getdns call */
10183 const char *this_name = argc > 1 ? argv[1] : "getdnsapi.net";
10284 char *this_userarg = "somestring"; // Could add things here to help identify this call
10486
10587 /* Make the call */
10688 getdns_return_t dns_request_return =
107 getdns_general(this_context, this_name, GETDNS_RRTYPE_A,
108 NULL, this_userarg, &this_transaction_id, this_callbackfn);
89 getdns_general(this_context, this_name, GETDNS_RRTYPE_A,
90 NULL, this_userarg, &this_transaction_id, this_callbackfn);
10991 if (dns_request_return == GETDNS_RETURN_BAD_DOMAIN_NAME) {
11092 fprintf(stderr, "A bad domain name was used: %s. Exiting.",
111 this_name);
93 this_name);
11294 getdns_context_destroy(this_context);
113 event_base_free(this_event_base);
11495 return (GETDNS_RETURN_GENERIC_ERROR);
11596 }
116 // dns_request_return = getdns_service(this_context, this_name, NULL, this_userarg, &this_transaction_id,
117 // this_callbackfn);
118 // if (dns_request_return == GETDNS_RETURN_BAD_DOMAIN_NAME)
119 // {
120 // fprintf(stderr, "A bad domain name was used: %s. Exiting.", this_name);
121 // return(GETDNS_RETURN_GENERIC_ERROR);
122 // }
12397 else {
12498 /* Call the event loop */
125 event_base_loop(this_event_base, EVLOOP_ONCE);
126 while (getdns_context_get_num_pending_requests(this_context, NULL) > 0) {
127 event_base_loop(this_event_base, EVLOOP_ONCE);
128 }
129 // TODO: check the return value above
99 struct timeval tv;
100 while (getdns_context_get_num_pending_requests(this_context, &tv) > 0) {
101 int fd = getdns_context_fd(this_context);
102 fd_set read_fds;
103 FD_ZERO(&read_fds);
104 FD_SET(fd, &read_fds);
105 select(fd + 1, &read_fds, NULL, NULL, &tv);
106 if (getdns_context_process_async(this_context) != GETDNS_RETURN_GOOD) {
107 // context destroyed
108 break;
109 }
110 }
130111 }
131112 /* Clean up */
132113 getdns_context_destroy(this_context);
133 /* the event base can only be free'd after the context has removed
134 * all of its events from it */
135 event_base_free(this_event_base);
136114 /* Assuming we get here, leave gracefully */
137115 exit(EXIT_SUCCESS);
138116 } /* main */
551551 completed_request->extensions, "dnssec_return_only_secure");
552552 dnssec_return_status = dnssec_return_only_secure || is_extension_set(
553553 completed_request->extensions, "dnssec_return_status") ||
554 completed_request->return_dnssec_status == GETDNS_EXTENSION_TRUE;
554 completed_request->return_dnssec_status == GETDNS_EXTENSION_TRUE;
555555
556556 if (completed_request->first_req->request_class == GETDNS_RRTYPE_A ||
557557 completed_request->first_req->request_class ==