/[path-sandbox]/trunk/libtool
Gentoo

Contents of /trunk/libtool

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2 - (show annotations) (download)
Fri Nov 19 22:03:42 2004 UTC (9 years, 9 months ago) by ferringb
File size: 213695 byte(s)
Initial revision

1 #! /bin/sh
2
3 # libtoolT - Provide generalized library-building support services.
4 # Generated automatically by (GNU sandbox 1.1)
5 # NOTE: Changes made to this file will be lost: look at ltmain.sh.
6 #
7 # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001
8 # Free Software Foundation, Inc.
9 #
10 # This file is part of GNU Libtool:
11 # Originally by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996
12 #
13 # This program is free software; you can redistribute it and/or modify
14 # it under the terms of the GNU General Public License as published by
15 # the Free Software Foundation; either version 2 of the License, or
16 # (at your option) any later version.
17 #
18 # This program is distributed in the hope that it will be useful, but
19 # WITHOUT ANY WARRANTY; without even the implied warranty of
20 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
21 # General Public License for more details.
22 #
23 # You should have received a copy of the GNU General Public License
24 # along with this program; if not, write to the Free Software
25 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
26 #
27 # As a special exception to the GNU General Public License, if you
28 # distribute this file as part of a program that contains a
29 # configuration script generated by Autoconf, you may include it under
30 # the same distribution terms that you use for the rest of that program.
31
32 # A sed program that does not truncate output.
33 SED="/bin/sed"
34
35 # Sed that helps us avoid accidentally triggering echo(1) options like -n.
36 Xsed="/bin/sed -e s/^X//"
37
38 # The HP-UX ksh and POSIX shell print the target directory to stdout
39 # if CDPATH is set.
40 if test "X${CDPATH+set}" = Xset; then CDPATH=:; export CDPATH; fi
41
42 # The names of the tagged configurations supported by this script.
43 available_tags=" CXX F77"
44
45 # ### BEGIN LIBTOOL CONFIG
46
47 # Libtool was configured on host everest:
48
49 # Shell to use when invoking shell scripts.
50 SHELL="/bin/sh"
51
52 # Whether or not to build shared libraries.
53 build_libtool_libs=yes
54
55 # Whether or not to build static libraries.
56 build_old_libs=yes
57
58 # Whether or not to add -lc for building shared libraries.
59 build_libtool_need_lc=no
60
61 # Whether or not to disallow shared libs when runtime libs are static
62 allow_libtool_libs_with_static_runtimes=no
63
64 # Whether or not to optimize for fast installation.
65 fast_install=yes
66
67 # The host system.
68 host_alias=
69 host=i686-pc-linux-gnu
70
71 # An echo program that does not interpret backslashes.
72 echo="echo"
73
74 # The archiver.
75 AR="ar"
76 AR_FLAGS="cru"
77
78 # A C compiler.
79 LTCC="gcc"
80
81 # A language-specific compiler.
82 CC="gcc"
83
84 # Is the compiler the GNU C compiler?
85 with_gcc=yes
86
87 # An ERE matcher.
88 EGREP="grep -E"
89
90 # The linker used to build libraries.
91 LD="/usr/i686-pc-linux-gnu/bin/ld"
92
93 # Whether we need hard or soft links.
94 LN_S="ln -s"
95
96 # A BSD-compatible nm program.
97 NM="/usr/bin/nm -B"
98
99 # A symbol stripping program
100 STRIP="strip"
101
102 # Used to examine libraries when file_magic_cmd begins "file"
103 MAGIC_CMD=file
104
105 # Used on cygwin: DLL creation program.
106 DLLTOOL="dlltool"
107
108 # Used on cygwin: object dumper.
109 OBJDUMP="objdump"
110
111 # Used on cygwin: assembler.
112 AS="as"
113
114 # The name of the directory that contains temporary libtool files.
115 objdir=.libs
116
117 # How to create reloadable object files.
118 reload_flag=" -r"
119 reload_cmds="\$LD\$reload_flag -o \$output\$reload_objs"
120
121 # How to pass a linker flag through the compiler.
122 wl="-Wl,"
123
124 # Object file suffix (normally "o").
125 objext="o"
126
127 # Old archive suffix (normally "a").
128 libext="a"
129
130 # Shared library suffix (normally ".so").
131 shrext='.so'
132
133 # Executable file suffix (normally "").
134 exeext=""
135
136 # Additional compiler flags for building library objects.
137 pic_flag=" -fPIC -DPIC"
138 pic_mode=default
139
140 # What is the maximum length of a command?
141 max_cmd_len=32768
142
143 # Does compiler simultaneously support -c and -o options?
144 compiler_c_o="yes"
145
146 # Must we lock files when doing compilation ?
147 need_locks="no"
148
149 # Do we need the lib prefix for modules?
150 need_lib_prefix=no
151
152 # Do we need a version for libraries?
153 need_version=no
154
155 # Whether dlopen is supported.
156 dlopen_support=unknown
157
158 # Whether dlopen of programs is supported.
159 dlopen_self=unknown
160
161 # Whether dlopen of statically linked programs is supported.
162 dlopen_self_static=unknown
163
164 # Compiler flag to prevent dynamic linking.
165 link_static_flag="-static"
166
167 # Compiler flag to turn off builtin functions.
168 no_builtin_flag=" -fno-builtin"
169
170 # Compiler flag to allow reflexive dlopens.
171 export_dynamic_flag_spec="\${wl}--export-dynamic"
172
173 # Compiler flag to generate shared objects directly from archives.
174 whole_archive_flag_spec="\${wl}--whole-archive\$convenience \${wl}--no-whole-archive"
175
176 # Compiler flag to generate thread-safe objects.
177 thread_safe_flag_spec=""
178
179 # Library versioning type.
180 version_type=linux
181
182 # Format of library name prefix.
183 libname_spec="lib\$name"
184
185 # List of archive names. First name is the real one, the rest are links.
186 # The last name is the one that the linker finds with -lNAME.
187 library_names_spec="\${libname}\${release}\${shared_ext}\$versuffix \${libname}\${release}\${shared_ext}\$major \$libname\${shared_ext}"
188
189 # The coded name of the library, if different from the real name.
190 soname_spec="\${libname}\${release}\${shared_ext}\$major"
191
192 # Commands used to build and install an old-style archive.
193 RANLIB="ranlib"
194 old_archive_cmds="\$AR \$AR_FLAGS \$oldlib\$oldobjs\$old_deplibs~\$RANLIB \$oldlib"
195 old_postinstall_cmds="\$RANLIB \$oldlib~chmod 644 \$oldlib"
196 old_postuninstall_cmds=""
197
198 # Create an old-style archive from a shared archive.
199 old_archive_from_new_cmds=""
200
201 # Create a temporary old-style archive to link instead of a shared archive.
202 old_archive_from_expsyms_cmds=""
203
204 # Commands used to build and install a shared archive.
205 archive_cmds="\$CC -shared \$libobjs \$deplibs \$compiler_flags \${wl}-soname \$wl\$soname -o \$lib"
206 archive_expsym_cmds="\$echo \\\"{ global:\\\" > \$output_objdir/\$libname.ver~
207 cat \$export_symbols | sed -e \\\"s/\\\\(.*\\\\)/\\\\1;/\\\" >> \$output_objdir/\$libname.ver~
208 \$echo \\\"local: *; };\\\" >> \$output_objdir/\$libname.ver~
209 \$CC -shared \$libobjs \$deplibs \$compiler_flags \${wl}-soname \$wl\$soname \${wl}-version-script \${wl}\$output_objdir/\$libname.ver -o \$lib"
210 postinstall_cmds=""
211 postuninstall_cmds=""
212
213 # Commands used to build a loadable module (assumed same as above if empty)
214 module_cmds=""
215 module_expsym_cmds=""
216
217 # Commands to strip libraries.
218 old_striplib="strip --strip-debug"
219 striplib="strip --strip-unneeded"
220
221 # Dependencies to place before the objects being linked to create a
222 # shared library.
223 predep_objects=""
224
225 # Dependencies to place after the objects being linked to create a
226 # shared library.
227 postdep_objects=""
228
229 # Dependencies to place before the objects being linked to create a
230 # shared library.
231 predeps=""
232
233 # Dependencies to place after the objects being linked to create a
234 # shared library.
235 postdeps=""
236
237 # The library search path used internally by the compiler when linking
238 # a shared library.
239 compiler_lib_search_path=""
240
241 # Method to check whether dependent libraries are shared objects.
242 deplibs_check_method="pass_all"
243
244 # Command to use when deplibs_check_method == file_magic.
245 file_magic_cmd="\$MAGIC_CMD"
246
247 # Flag that allows shared libraries with undefined symbols to be built.
248 allow_undefined_flag=""
249
250 # Flag that forces no undefined symbols.
251 no_undefined_flag=""
252
253 # Commands used to finish a libtool library installation in a directory.
254 finish_cmds="PATH=\\\"\\\$PATH:/sbin\\\" ldconfig -n \$libdir"
255
256 # Same as above, but a single script fragment to be evaled but not shown.
257 finish_eval=""
258
259 # Take the output of nm and produce a listing of raw symbols and C names.
260 global_symbol_pipe="sed -n -e 's/^.*[ ]\\([ABCDGIRSTW][ABCDGIRSTW]*\\)[ ][ ]*\\(\\)\\([_A-Za-z][_A-Za-z0-9]*\\)\$/\\1 \\2\\3 \\3/p'"
261
262 # Transform the output of nm in a proper C declaration
263 global_symbol_to_cdecl="sed -n -e 's/^. .* \\(.*\\)\$/extern int \\1;/p'"
264
265 # Transform the output of nm in a C name address pair
266 global_symbol_to_c_name_address="sed -n -e 's/^: \\([^ ]*\\) \$/ {\\\"\\1\\\", (lt_ptr) 0},/p' -e 's/^[BCDEGRST] \\([^ ]*\\) \\([^ ]*\\)\$/ {\"\\2\", (lt_ptr) \\&\\2},/p'"
267
268 # This is the shared library runtime path variable.
269 runpath_var=LD_RUN_PATH
270
271 # This is the shared library path variable.
272 shlibpath_var=LD_LIBRARY_PATH
273
274 # Is shlibpath searched before the hard-coded library search path?
275 shlibpath_overrides_runpath=no
276
277 # How to hardcode a shared library path into an executable.
278 hardcode_action=immediate
279
280 # Whether we should hardcode library paths into libraries.
281 hardcode_into_libs=yes
282
283 # Flag to hardcode $libdir into a binary during linking.
284 # This must work even if $libdir does not exist.
285 hardcode_libdir_flag_spec="\${wl}--rpath \${wl}\$libdir"
286
287 # If ld is used when linking, flag to hardcode $libdir into
288 # a binary during linking. This must work even if $libdir does
289 # not exist.
290 hardcode_libdir_flag_spec_ld=""
291
292 # Whether we need a single -rpath flag with a separated argument.
293 hardcode_libdir_separator=""
294
295 # Set to yes if using DIR/libNAME during linking hardcodes DIR into the
296 # resulting binary.
297 hardcode_direct=no
298
299 # Set to yes if using the -LDIR flag during linking hardcodes DIR into the
300 # resulting binary.
301 hardcode_minus_L=no
302
303 # Set to yes if using SHLIBPATH_VAR=DIR during linking hardcodes DIR into
304 # the resulting binary.
305 hardcode_shlibpath_var=unsupported
306
307 # Set to yes if building a shared library automatically hardcodes DIR into the library
308 # and all subsequent libraries and executables linked against it.
309 hardcode_automatic=no
310
311 # Variables whose values should be saved in libtool wrapper scripts and
312 # restored at relink time.
313 variables_saved_for_relink="PATH LD_RUN_PATH GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH"
314
315 # Whether libtool must link a program against all its dependency libraries.
316 link_all_deplibs=unknown
317
318 # Compile-time system search path for libraries
319 sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib"
320
321 # Run-time system search path for libraries
322 sys_lib_dlsearch_path_spec="/lib /usr/lib"
323
324 # Fix the shell variable $srcfile for the compiler.
325 fix_srcfile_path=""
326
327 # Set to yes if exported symbols are required.
328 always_export_symbols=no
329
330 # The commands to list exported symbols.
331 export_symbols_cmds="\$NM \$libobjs \$convenience | \$global_symbol_pipe | \$SED 's/.* //' | sort | uniq > \$export_symbols"
332
333 # The commands to extract the exported symbol list from a shared archive.
334 extract_expsyms_cmds=""
335
336 # Symbols that should not be listed in the preloaded symbols.
337 exclude_expsyms="_GLOBAL_OFFSET_TABLE_"
338
339 # Symbols that must always be exported.
340 include_expsyms=""
341
342 # ### END LIBTOOL CONFIG
343
344 # ltmain.sh - Provide generalized library-building support services.
345 # NOTE: Changing this file will not affect anything until you rerun configure.
346 #
347 # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003
348 # Free Software Foundation, Inc.
349 # Originally by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996
350 #
351 # This program is free software; you can redistribute it and/or modify
352 # it under the terms of the GNU General Public License as published by
353 # the Free Software Foundation; either version 2 of the License, or
354 # (at your option) any later version.
355 #
356 # This program is distributed in the hope that it will be useful, but
357 # WITHOUT ANY WARRANTY; without even the implied warranty of
358 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
359 # General Public License for more details.
360 #
361 # You should have received a copy of the GNU General Public License
362 # along with this program; if not, write to the Free Software
363 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
364 #
365 # As a special exception to the GNU General Public License, if you
366 # distribute this file as part of a program that contains a
367 # configuration script generated by Autoconf, you may include it under
368 # the same distribution terms that you use for the rest of that program.
369
370 # Check that we have a working $echo.
371 if test "X$1" = X--no-reexec; then
372 # Discard the --no-reexec flag, and continue.
373 shift
374 elif test "X$1" = X--fallback-echo; then
375 # Avoid inline document here, it may be left over
376 :
377 elif test "X`($echo '\t') 2>/dev/null`" = 'X\t'; then
378 # Yippee, $echo works!
379 :
380 else
381 # Restart under the correct shell, and then maybe $echo will work.
382 exec $SHELL "$0" --no-reexec ${1+"$@"}
383 fi
384
385 if test "X$1" = X--fallback-echo; then
386 # used as fallback echo
387 shift
388 cat <<EOF
389 $*
390 EOF
391 exit 0
392 fi
393
394 # define SED for historic ltconfig's generated by Libtool 1.3
395 test -z "$SED" && SED=sed
396
397 # The name of this program.
398 progname=`$echo "$0" | ${SED} 's%^.*/%%'`
399 modename="$progname"
400
401 # Constants.
402 PROGRAM=ltmain.sh
403 PACKAGE=libtool
404 VERSION=1.5.2
405 TIMESTAMP=" (1.1220.2.60 2004/01/25 12:25:08)"
406
407 default_mode=
408 help="Try \`$progname --help' for more information."
409 magic="%%%MAGIC variable%%%"
410 mkdir="mkdir"
411 mv="mv -f"
412 rm="rm -f"
413
414 # Sed substitution that helps us do robust quoting. It backslashifies
415 # metacharacters that are still active within double-quoted strings.
416 Xsed="${SED}"' -e 1s/^X//'
417 sed_quote_subst='s/\([\\`\\"$\\\\]\)/\\\1/g'
418 # test EBCDIC or ASCII
419 case `echo A|tr A '\301'` in
420 A) # EBCDIC based system
421 SP2NL="tr '\100' '\n'"
422 NL2SP="tr '\r\n' '\100\100'"
423 ;;
424 *) # Assume ASCII based system
425 SP2NL="tr '\040' '\012'"
426 NL2SP="tr '\015\012' '\040\040'"
427 ;;
428 esac
429
430 # NLS nuisances.
431 # Only set LANG and LC_ALL to C if already set.
432 # These must not be set unconditionally because not all systems understand
433 # e.g. LANG=C (notably SCO).
434 # We save the old values to restore during execute mode.
435 if test "${LC_ALL+set}" = set; then
436 save_LC_ALL="$LC_ALL"; LC_ALL=C; export LC_ALL
437 fi
438 if test "${LANG+set}" = set; then
439 save_LANG="$LANG"; LANG=C; export LANG
440 fi
441
442 # Make sure IFS has a sensible default
443 : ${IFS="
444 "}
445
446 if test "$build_libtool_libs" != yes && test "$build_old_libs" != yes; then
447 $echo "$modename: not configured to build any kind of library" 1>&2
448 $echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2
449 exit 1
450 fi
451
452 # Global variables.
453 mode=$default_mode
454 nonopt=
455 prev=
456 prevopt=
457 run=
458 show="$echo"
459 show_help=
460 execute_dlfiles=
461 lo2o="s/\\.lo\$/.${objext}/"
462 o2lo="s/\\.${objext}\$/.lo/"
463
464 if test -z "$max_cmd_len"; then
465 i=0
466 testring="ABCD"
467 new_result=
468
469 # If test is not a shell built-in, we'll probably end up computing a
470 # maximum length that is only half of the actual maximum length, but
471 # we can't tell.
472 while (test "X"`$SHELL $0 --fallback-echo "X$testring" 2>/dev/null` \
473 = "XX$testring") >/dev/null 2>&1 &&
474 new_result=`expr "X$testring" : ".*" 2>&1` &&
475 max_cmd_len="$new_result" &&
476 test $i != 17 # 1/2 MB should be enough
477 do
478 i=`expr $i + 1`
479 testring="$testring$testring"
480 done
481 testring=
482 # Add a significant safety factor because C++ compilers can tack on massive
483 # amounts of additional arguments before passing them to the linker.
484 # It appears as though 1/2 is a usable value.
485 max_cmd_len=`expr $max_cmd_len \/ 2`
486 fi
487
488 #####################################
489 # Shell function definitions:
490 # This seems to be the best place for them
491
492 # Need a lot of goo to handle *both* DLLs and import libs
493 # Has to be a shell function in order to 'eat' the argument
494 # that is supplied when $file_magic_command is called.
495 win32_libid () {
496 win32_libid_type="unknown"
497 win32_fileres=`file -L $1 2>/dev/null`
498 case $win32_fileres in
499 *ar\ archive\ import\ library*) # definitely import
500 win32_libid_type="x86 archive import"
501 ;;
502 *ar\ archive*) # could be an import, or static
503 if eval $OBJDUMP -f $1 | $SED -e '10q' 2>/dev/null | \
504 grep -E 'file format pe-i386(.*architecture: i386)?' >/dev/null ; then
505 win32_nmres=`eval $NM -f posix -A $1 | \
506 sed -n -e '1,100{/ I /{x;/import/!{s/^/import/;h;p;};x;};}'`
507 if test "X$win32_nmres" = "Ximport" ; then
508 win32_libid_type="x86 archive import"
509 else
510 win32_libid_type="x86 archive static"
511 fi
512 fi
513 ;;
514 *DLL*)
515 win32_libid_type="x86 DLL"
516 ;;
517 *executable*) # but shell scripts are "executable" too...
518 case $win32_fileres in
519 *MS\ Windows\ PE\ Intel*)
520 win32_libid_type="x86 DLL"
521 ;;
522 esac
523 ;;
524 esac
525 $echo $win32_libid_type
526 }
527
528 # End of Shell function definitions
529 #####################################
530
531 # Parse our command line options once, thoroughly.
532 while test "$#" -gt 0
533 do
534 arg="$1"
535 shift
536
537 case $arg in
538 -*=*) optarg=`$echo "X$arg" | $Xsed -e 's/[-_a-zA-Z0-9]*=//'` ;;
539 *) optarg= ;;
540 esac
541
542 # If the previous option needs an argument, assign it.
543 if test -n "$prev"; then
544 case $prev in
545 execute_dlfiles)
546 execute_dlfiles="$execute_dlfiles $arg"
547 ;;
548 tag)
549 tagname="$arg"
550 preserve_args="${preserve_args}=$arg"
551
552 # Check whether tagname contains only valid characters
553 case $tagname in
554 *[!-_A-Za-z0-9,/]*)
555 $echo "$progname: invalid tag name: $tagname" 1>&2
556 exit 1
557 ;;
558 esac
559
560 case $tagname in
561 CC)
562 # Don't test for the "default" C tag, as we know, it's there, but
563 # not specially marked.
564 ;;
565 *)
566 if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$" < "$0" > /dev/null; then
567 taglist="$taglist $tagname"
568 # Evaluate the configuration.
569 eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$tagname'$/,/^# ### END LIBTOOL TAG CONFIG: '$tagname'$/p' < $0`"
570 else
571 $echo "$progname: ignoring unknown tag $tagname" 1>&2
572 fi
573 ;;
574 esac
575 ;;
576 *)
577 eval "$prev=\$arg"
578 ;;
579 esac
580
581 prev=
582 prevopt=
583 continue
584 fi
585
586 # Have we seen a non-optional argument yet?
587 case $arg in
588 --help)
589 show_help=yes
590 ;;
591
592 --version)
593 $echo "$PROGRAM (GNU $PACKAGE) $VERSION$TIMESTAMP"
594 $echo
595 $echo "Copyright (C) 2003 Free Software Foundation, Inc."
596 $echo "This is free software; see the source for copying conditions. There is NO"
597 $echo "warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
598 exit 0
599 ;;
600
601 --config)
602 ${SED} -e '1,/^# ### BEGIN LIBTOOL CONFIG/d' -e '/^# ### END LIBTOOL CONFIG/,$d' $0
603 # Now print the configurations for the tags.
604 for tagname in $taglist; do
605 ${SED} -n -e "/^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$/,/^# ### END LIBTOOL TAG CONFIG: $tagname$/p" < "$0"
606 done
607 exit 0
608 ;;
609
610 --debug)
611 $echo "$progname: enabling shell trace mode"
612 set -x
613 preserve_args="$preserve_args $arg"
614 ;;
615
616 --dry-run | -n)
617 run=:
618 ;;
619
620 --features)
621 $echo "host: $host"
622 if test "$build_libtool_libs" = yes; then
623 $echo "enable shared libraries"
624 else
625 $echo "disable shared libraries"
626 fi
627 if test "$build_old_libs" = yes; then
628 $echo "enable static libraries"
629 else
630 $echo "disable static libraries"
631 fi
632 exit 0
633 ;;
634
635 --finish) mode="finish" ;;
636
637 --mode) prevopt="--mode" prev=mode ;;
638 --mode=*) mode="$optarg" ;;
639
640 --preserve-dup-deps) duplicate_deps="yes" ;;
641
642 --quiet | --silent)
643 show=:
644 preserve_args="$preserve_args $arg"
645 ;;
646
647 --tag) prevopt="--tag" prev=tag ;;
648 --tag=*)
649 set tag "$optarg" ${1+"$@"}
650 shift
651 prev=tag
652 preserve_args="$preserve_args --tag"
653 ;;
654
655 -dlopen)
656 prevopt="-dlopen"
657 prev=execute_dlfiles
658 ;;
659
660 -*)
661 $echo "$modename: unrecognized option \`$arg'" 1>&2
662 $echo "$help" 1>&2
663 exit 1
664 ;;
665
666 *)
667 nonopt="$arg"
668 break
669 ;;
670 esac
671 done
672
673 if test -n "$prevopt"; then
674 $echo "$modename: option \`$prevopt' requires an argument" 1>&2
675 $echo "$help" 1>&2
676 exit 1
677 fi
678
679 # If this variable is set in any of the actions, the command in it
680 # will be execed at the end. This prevents here-documents from being
681 # left over by shells.
682 exec_cmd=
683
684 if test -z "$show_help"; then
685
686 # Infer the operation mode.
687 if test -z "$mode"; then
688 $echo "*** Warning: inferring the mode of operation is deprecated." 1>&2
689 $echo "*** Future versions of Libtool will require -mode=MODE be specified." 1>&2
690 case $nonopt in
691 *cc | cc* | *++ | gcc* | *-gcc* | g++* | xlc*)
692 mode=link
693 for arg
694 do
695 case $arg in
696 -c)
697 mode=compile
698 break
699 ;;
700 esac
701 done
702 ;;
703 *db | *dbx | *strace | *truss)
704 mode=execute
705 ;;
706 *install*|cp|mv)
707 mode=install
708 ;;
709 *rm)
710 mode=uninstall
711 ;;
712 *)
713 # If we have no mode, but dlfiles were specified, then do execute mode.
714 test -n "$execute_dlfiles" && mode=execute
715
716 # Just use the default operation mode.
717 if test -z "$mode"; then
718 if test -n "$nonopt"; then
719 $echo "$modename: warning: cannot infer operation mode from \`$nonopt'" 1>&2
720 else
721 $echo "$modename: warning: cannot infer operation mode without MODE-ARGS" 1>&2
722 fi
723 fi
724 ;;
725 esac
726 fi
727
728 # Only execute mode is allowed to have -dlopen flags.
729 if test -n "$execute_dlfiles" && test "$mode" != execute; then
730 $echo "$modename: unrecognized option \`-dlopen'" 1>&2
731 $echo "$help" 1>&2
732 exit 1
733 fi
734
735 # Change the help message to a mode-specific one.
736 generic_help="$help"
737 help="Try \`$modename --help --mode=$mode' for more information."
738
739 # These modes are in order of execution frequency so that they run quickly.
740 case $mode in
741 # libtool compile mode
742 compile)
743 modename="$modename: compile"
744 # Get the compilation command and the source file.
745 base_compile=
746 srcfile="$nonopt" # always keep a non-empty value in "srcfile"
747 suppress_opt=yes
748 suppress_output=
749 arg_mode=normal
750 libobj=
751 later=
752
753 for arg
754 do
755 case "$arg_mode" in
756 arg )
757 # do not "continue". Instead, add this to base_compile
758 lastarg="$arg"
759 arg_mode=normal
760 ;;
761
762 target )
763 libobj="$arg"
764 arg_mode=normal
765 continue
766 ;;
767
768 normal )
769 # Accept any command-line options.
770 case $arg in
771 -o)
772 if test -n "$libobj" ; then
773 $echo "$modename: you cannot specify \`-o' more than once" 1>&2
774 exit 1
775 fi
776 arg_mode=target
777 continue
778 ;;
779
780 -static | -prefer-pic | -prefer-non-pic)
781 later="$later $arg"
782 continue
783 ;;
784
785 -no-suppress)
786 suppress_opt=no
787 continue
788 ;;
789
790 -Xcompiler)
791 arg_mode=arg # the next one goes into the "base_compile" arg list
792 continue # The current "srcfile" will either be retained or
793 ;; # replaced later. I would guess that would be a bug.
794
795 -Wc,*)
796 args=`$echo "X$arg" | $Xsed -e "s/^-Wc,//"`
797 lastarg=
798 save_ifs="$IFS"; IFS=','
799 for arg in $args; do
800 IFS="$save_ifs"
801
802 # Double-quote args containing other shell metacharacters.
803 # Many Bourne shells cannot handle close brackets correctly
804 # in scan sets, so we specify it separately.
805 case $arg in
806 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
807 arg="\"$arg\""
808 ;;
809 esac
810 lastarg="$lastarg $arg"
811 done
812 IFS="$save_ifs"
813 lastarg=`$echo "X$lastarg" | $Xsed -e "s/^ //"`
814
815 # Add the arguments to base_compile.
816 base_compile="$base_compile $lastarg"
817 continue
818 ;;
819
820 * )
821 # Accept the current argument as the source file.
822 # The previous "srcfile" becomes the current argument.
823 #
824 lastarg="$srcfile"
825 srcfile="$arg"
826 ;;
827 esac # case $arg
828 ;;
829 esac # case $arg_mode
830
831 # Aesthetically quote the previous argument.
832 lastarg=`$echo "X$lastarg" | $Xsed -e "$sed_quote_subst"`
833
834 case $lastarg in
835 # Double-quote args containing other shell metacharacters.
836 # Many Bourne shells cannot handle close brackets correctly
837 # in scan sets, so we specify it separately.
838 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
839 lastarg="\"$lastarg\""
840 ;;
841 esac
842
843 base_compile="$base_compile $lastarg"
844 done # for arg
845
846 case $arg_mode in
847 arg)
848 $echo "$modename: you must specify an argument for -Xcompile"
849 exit 1
850 ;;
851 target)
852 $echo "$modename: you must specify a target with \`-o'" 1>&2
853 exit 1
854 ;;
855 *)
856 # Get the name of the library object.
857 [ -z "$libobj" ] && libobj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%'`
858 ;;
859 esac
860
861 # Recognize several different file suffixes.
862 # If the user specifies -o file.o, it is replaced with file.lo
863 xform='[cCFSifmso]'
864 case $libobj in
865 *.ada) xform=ada ;;
866 *.adb) xform=adb ;;
867 *.ads) xform=ads ;;
868 *.asm) xform=asm ;;
869 *.c++) xform=c++ ;;
870 *.cc) xform=cc ;;
871 *.ii) xform=ii ;;
872 *.class) xform=class ;;
873 *.cpp) xform=cpp ;;
874 *.cxx) xform=cxx ;;
875 *.f90) xform=f90 ;;
876 *.for) xform=for ;;
877 *.java) xform=java ;;
878 esac
879
880 libobj=`$echo "X$libobj" | $Xsed -e "s/\.$xform$/.lo/"`
881
882 case $libobj in
883 *.lo) obj=`$echo "X$libobj" | $Xsed -e "$lo2o"` ;;
884 *)
885 $echo "$modename: cannot determine name of library object from \`$libobj'" 1>&2
886 exit 1
887 ;;
888 esac
889
890 # Infer tagged configuration to use if any are available and
891 # if one wasn't chosen via the "--tag" command line option.
892 # Only attempt this if the compiler in the base compile
893 # command doesn't match the default compiler.
894 if test -n "$available_tags" && test -z "$tagname"; then
895 case $base_compile in
896 # Blanks in the command may have been stripped by the calling shell,
897 # but not from the CC environment variable when configure was run.
898 " $CC "* | "$CC "* | " `$echo $CC` "* | "`$echo $CC` "*) ;;
899 # Blanks at the start of $base_compile will cause this to fail
900 # if we don't check for them as well.
901 *)
902 for z in $available_tags; do
903 if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $z$" < "$0" > /dev/null; then
904 # Evaluate the configuration.
905 eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^# ### END LIBTOOL TAG CONFIG: '$z'$/p' < $0`"
906 case "$base_compile " in
907 "$CC "* | " $CC "* | "`$echo $CC` "* | " `$echo $CC` "*)
908 # The compiler in the base compile command matches
909 # the one in the tagged configuration.
910 # Assume this is the tagged configuration we want.
911 tagname=$z
912 break
913 ;;
914 esac
915 fi
916 done
917 # If $tagname still isn't set, then no tagged configuration
918 # was found and let the user know that the "--tag" command
919 # line option must be used.
920 if test -z "$tagname"; then
921 $echo "$modename: unable to infer tagged configuration"
922 $echo "$modename: specify a tag with \`--tag'" 1>&2
923 exit 1
924 # else
925 # $echo "$modename: using $tagname tagged configuration"
926 fi
927 ;;
928 esac
929 fi
930
931 for arg in $later; do
932 case $arg in
933 -static)
934 build_old_libs=yes
935 continue
936 ;;
937
938 -prefer-pic)
939 pic_mode=yes
940 continue
941 ;;
942
943 -prefer-non-pic)
944 pic_mode=no
945 continue
946 ;;
947 esac
948 done
949
950 objname=`$echo "X$obj" | $Xsed -e 's%^.*/%%'`
951 xdir=`$echo "X$obj" | $Xsed -e 's%/[^/]*$%%'`
952 if test "X$xdir" = "X$obj"; then
953 xdir=
954 else
955 xdir=$xdir/
956 fi
957 lobj=${xdir}$objdir/$objname
958
959 if test -z "$base_compile"; then
960 $echo "$modename: you must specify a compilation command" 1>&2
961 $echo "$help" 1>&2
962 exit 1
963 fi
964
965 # Delete any leftover library objects.
966 if test "$build_old_libs" = yes; then
967 removelist="$obj $lobj $libobj ${libobj}T"
968 else
969 removelist="$lobj $libobj ${libobj}T"
970 fi
971
972 $run $rm $removelist
973 trap "$run $rm $removelist; exit 1" 1 2 15
974
975 # On Cygwin there's no "real" PIC flag so we must build both object types
976 case $host_os in
977 cygwin* | mingw* | pw32* | os2*)
978 pic_mode=default
979 ;;
980 esac
981 if test "$pic_mode" = no && test "$deplibs_check_method" != pass_all; then
982 # non-PIC code in shared libraries is not supported
983 pic_mode=default
984 fi
985
986 # Calculate the filename of the output object if compiler does
987 # not support -o with -c
988 if test "$compiler_c_o" = no; then
989 output_obj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%' -e 's%\.[^.]*$%%'`.${objext}
990 lockfile="$output_obj.lock"
991 removelist="$removelist $output_obj $lockfile"
992 trap "$run $rm $removelist; exit 1" 1 2 15
993 else
994 output_obj=
995 need_locks=no
996 lockfile=
997 fi
998
999 # Lock this critical section if it is needed
1000 # We use this script file to make the link, it avoids creating a new file
1001 if test "$need_locks" = yes; then
1002 until $run ln "$0" "$lockfile" 2>/dev/null; do
1003 $show "Waiting for $lockfile to be removed"
1004 sleep 2
1005 done
1006 elif test "$need_locks" = warn; then
1007 if test -f "$lockfile"; then
1008 $echo "\
1009 *** ERROR, $lockfile exists and contains:
1010 `cat $lockfile 2>/dev/null`
1011
1012 This indicates that another process is trying to use the same
1013 temporary object file, and libtool could not work around it because
1014 your compiler does not support \`-c' and \`-o' together. If you
1015 repeat this compilation, it may succeed, by chance, but you had better
1016 avoid parallel builds (make -j) in this platform, or get a better
1017 compiler."
1018
1019 $run $rm $removelist
1020 exit 1
1021 fi
1022 $echo $srcfile > "$lockfile"
1023 fi
1024
1025 if test -n "$fix_srcfile_path"; then
1026 eval srcfile=\"$fix_srcfile_path\"
1027 fi
1028
1029 $run $rm "$libobj" "${libobj}T"
1030
1031 # Create a libtool object file (analogous to a ".la" file),
1032 # but don't create it if we're doing a dry run.
1033 test -z "$run" && cat > ${libobj}T <<EOF
1034 # $libobj - a libtool object file
1035 # Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
1036 #
1037 # Please DO NOT delete this file!
1038 # It is necessary for linking the library.
1039
1040 # Name of the PIC object.
1041 EOF
1042
1043 # Only build a PIC object if we are building libtool libraries.
1044 if test "$build_libtool_libs" = yes; then
1045 # Without this assignment, base_compile gets emptied.
1046 fbsd_hideous_sh_bug=$base_compile
1047
1048 if test "$pic_mode" != no; then
1049 command="$base_compile $srcfile $pic_flag"
1050 else
1051 # Don't build PIC code
1052 command="$base_compile $srcfile"
1053 fi
1054
1055 if test ! -d "${xdir}$objdir"; then
1056 $show "$mkdir ${xdir}$objdir"
1057 $run $mkdir ${xdir}$objdir
1058 status=$?
1059 if test "$status" -ne 0 && test ! -d "${xdir}$objdir"; then
1060 exit $status
1061 fi
1062 fi
1063
1064 if test -z "$output_obj"; then
1065 # Place PIC objects in $objdir
1066 command="$command -o $lobj"
1067 fi
1068
1069 $run $rm "$lobj" "$output_obj"
1070
1071 $show "$command"
1072 if $run eval "$command"; then :
1073 else
1074 test -n "$output_obj" && $run $rm $removelist
1075 exit 1
1076 fi
1077
1078 if test "$need_locks" = warn &&
1079 test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then
1080 $echo "\
1081 *** ERROR, $lockfile contains:
1082 `cat $lockfile 2>/dev/null`
1083
1084 but it should contain:
1085 $srcfile
1086
1087 This indicates that another process is trying to use the same
1088 temporary object file, and libtool could not work around it because
1089 your compiler does not support \`-c' and \`-o' together. If you
1090 repeat this compilation, it may succeed, by chance, but you had better
1091 avoid parallel builds (make -j) in this platform, or get a better
1092 compiler."
1093
1094 $run $rm $removelist
1095 exit 1
1096 fi
1097
1098 # Just move the object if needed, then go on to compile the next one
1099 if test -n "$output_obj" && test "X$output_obj" != "X$lobj"; then
1100 $show "$mv $output_obj $lobj"
1101 if $run $mv $output_obj $lobj; then :
1102 else
1103 error=$?
1104 $run $rm $removelist
1105 exit $error
1106 fi
1107 fi
1108
1109 # Append the name of the PIC object to the libtool object file.
1110 test -z "$run" && cat >> ${libobj}T <<EOF
1111 pic_object='$objdir/$objname'
1112
1113 EOF
1114
1115 # Allow error messages only from the first compilation.
1116 if test "$suppress_opt" = yes; then
1117 suppress_output=' >/dev/null 2>&1'
1118 fi
1119 else
1120 # No PIC object so indicate it doesn't exist in the libtool
1121 # object file.
1122 test -z "$run" && cat >> ${libobj}T <<EOF
1123 pic_object=none
1124
1125 EOF
1126 fi
1127
1128 # Only build a position-dependent object if we build old libraries.
1129 if test "$build_old_libs" = yes; then
1130 if test "$pic_mode" != yes; then
1131 # Don't build PIC code
1132 command="$base_compile $srcfile"
1133 else
1134 command="$base_compile $srcfile $pic_flag"
1135 fi
1136 if test "$compiler_c_o" = yes; then
1137 command="$command -o $obj"
1138 fi
1139
1140 # Suppress compiler output if we already did a PIC compilation.
1141 command="$command$suppress_output"
1142 $run $rm "$obj" "$output_obj"
1143 $show "$command"
1144 if $run eval "$command"; then :
1145 else
1146 $run $rm $removelist
1147 exit 1
1148 fi
1149
1150 if test "$need_locks" = warn &&
1151 test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then
1152 $echo "\
1153 *** ERROR, $lockfile contains:
1154 `cat $lockfile 2>/dev/null`
1155
1156 but it should contain:
1157 $srcfile
1158
1159 This indicates that another process is trying to use the same
1160 temporary object file, and libtool could not work around it because
1161 your compiler does not support \`-c' and \`-o' together. If you
1162 repeat this compilation, it may succeed, by chance, but you had better
1163 avoid parallel builds (make -j) in this platform, or get a better
1164 compiler."
1165
1166 $run $rm $removelist
1167 exit 1
1168 fi
1169
1170 # Just move the object if needed
1171 if test -n "$output_obj" && test "X$output_obj" != "X$obj"; then
1172 $show "$mv $output_obj $obj"
1173 if $run $mv $output_obj $obj; then :
1174 else
1175 error=$?
1176 $run $rm $removelist
1177 exit $error
1178 fi
1179 fi
1180
1181 # Append the name of the non-PIC object the libtool object file.
1182 # Only append if the libtool object file exists.
1183 test -z "$run" && cat >> ${libobj}T <<EOF
1184 # Name of the non-PIC object.
1185 non_pic_object='$objname'
1186
1187 EOF
1188 else
1189 # Append the name of the non-PIC object the libtool object file.
1190 # Only append if the libtool object file exists.
1191 test -z "$run" && cat >> ${libobj}T <<EOF
1192 # Name of the non-PIC object.
1193 non_pic_object=none
1194
1195 EOF
1196 fi
1197
1198 $run $mv "${libobj}T" "${libobj}"
1199
1200 # Unlock the critical section if it was locked
1201 if test "$need_locks" != no; then
1202 $run $rm "$lockfile"
1203 fi
1204
1205 exit 0
1206 ;;
1207
1208 # libtool link mode
1209 link | relink)
1210 modename="$modename: link"
1211 case $host in
1212 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
1213 # It is impossible to link a dll without this setting, and
1214 # we shouldn't force the makefile maintainer to figure out
1215 # which system we are compiling for in order to pass an extra
1216 # flag for every libtool invocation.
1217 # allow_undefined=no
1218
1219 # FIXME: Unfortunately, there are problems with the above when trying
1220 # to make a dll which has undefined symbols, in which case not
1221 # even a static library is built. For now, we need to specify
1222 # -no-undefined on the libtool link line when we can be certain
1223 # that all symbols are satisfied, otherwise we get a static library.
1224 allow_undefined=yes
1225 ;;
1226 *)
1227 allow_undefined=yes
1228 ;;
1229 esac
1230 libtool_args="$nonopt"
1231 base_compile="$nonopt $@"
1232 compile_command="$nonopt"
1233 finalize_command="$nonopt"
1234
1235 compile_rpath=
1236 finalize_rpath=
1237 compile_shlibpath=
1238 finalize_shlibpath=
1239 convenience=
1240 old_convenience=
1241 deplibs=
1242 old_deplibs=
1243 compiler_flags=
1244 linker_flags=
1245 dllsearchpath=
1246 lib_search_path=`pwd`
1247 inst_prefix_dir=
1248
1249 avoid_version=no
1250 dlfiles=
1251 dlprefiles=
1252 dlself=no
1253 export_dynamic=no
1254 export_symbols=
1255 export_symbols_regex=
1256 generated=
1257 libobjs=
1258 ltlibs=
1259 module=no
1260 no_install=no
1261 objs=
1262 non_pic_objects=
1263 precious_files_regex=
1264 prefer_static_libs=no
1265 preload=no
1266 prev=
1267 prevarg=
1268 release=
1269 rpath=
1270 xrpath=
1271 perm_rpath=
1272 temp_rpath=
1273 thread_safe=no
1274 vinfo=
1275 vinfo_number=no
1276
1277 # Infer tagged configuration to use if any are available and
1278 # if one wasn't chosen via the "--tag" command line option.
1279 # Only attempt this if the compiler in the base link
1280 # command doesn't match the default compiler.
1281 if test -n "$available_tags" && test -z "$tagname"; then
1282 case $base_compile in
1283 # Blanks in the command may have been stripped by the calling shell,
1284 # but not from the CC environment variable when configure was run.
1285 "$CC "* | " $CC "* | "`$echo $CC` "* | " `$echo $CC` "*) ;;
1286 # Blanks at the start of $base_compile will cause this to fail
1287 # if we don't check for them as well.
1288 *)
1289 for z in $available_tags; do
1290 if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $z$" < "$0" > /dev/null; then
1291 # Evaluate the configuration.
1292 eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^# ### END LIBTOOL TAG CONFIG: '$z'$/p' < $0`"
1293 case $base_compile in
1294 "$CC "* | " $CC "* | "`$echo $CC` "* | " `$echo $CC` "*)
1295 # The compiler in $compile_command matches
1296 # the one in the tagged configuration.
1297 # Assume this is the tagged configuration we want.
1298 tagname=$z
1299 break
1300 ;;
1301 esac
1302 fi
1303 done
1304 # If $tagname still isn't set, then no tagged configuration
1305 # was found and let the user know that the "--tag" command
1306 # line option must be used.
1307 if test -z "$tagname"; then
1308 $echo "$modename: unable to infer tagged configuration"
1309 $echo "$modename: specify a tag with \`--tag'" 1>&2
1310 exit 1
1311 # else
1312 # $echo "$modename: using $tagname tagged configuration"
1313 fi
1314 ;;
1315 esac
1316 fi
1317
1318 # We need to know -static, to get the right output filenames.
1319 for arg
1320 do
1321 case $arg in
1322 -all-static | -static)
1323 if test "X$arg" = "X-all-static"; then
1324 if test "$build_libtool_libs" = yes && test -z "$link_static_flag"; then
1325 $echo "$modename: warning: complete static linking is impossible in this configuration" 1>&2
1326 fi
1327 if test -n "$link_static_flag"; then
1328 dlopen_self=$dlopen_self_static
1329 fi
1330 else
1331 if test -z "$pic_flag" && test -n "$link_static_flag"; then
1332 dlopen_self=$dlopen_self_static
1333 fi
1334 fi
1335 build_libtool_libs=no
1336 build_old_libs=yes
1337 prefer_static_libs=yes
1338 break
1339 ;;
1340 esac
1341 done
1342
1343 # See if our shared archives depend on static archives.
1344 test -n "$old_archive_from_new_cmds" && build_old_libs=yes
1345
1346 # Go through the arguments, transforming them on the way.
1347 while test "$#" -gt 0; do
1348 arg="$1"
1349 shift
1350 case $arg in
1351 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
1352 qarg=\"`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`\" ### testsuite: skip nested quoting test
1353 ;;
1354 *) qarg=$arg ;;
1355 esac
1356 libtool_args="$libtool_args $qarg"
1357
1358 # If the previous option needs an argument, assign it.
1359 if test -n "$prev"; then
1360 case $prev in
1361 output)
1362 compile_command="$compile_command @OUTPUT@"
1363 finalize_command="$finalize_command @OUTPUT@"
1364 ;;
1365 esac
1366
1367 case $prev in
1368 dlfiles|dlprefiles)
1369 if test "$preload" = no; then
1370 # Add the symbol object into the linking commands.
1371 compile_command="$compile_command @SYMFILE@"
1372 finalize_command="$finalize_command @SYMFILE@"
1373 preload=yes
1374 fi
1375 case $arg in
1376 *.la | *.lo) ;; # We handle these cases below.
1377 force)
1378 if test "$dlself" = no; then
1379 dlself=needless
1380 export_dynamic=yes
1381 fi
1382 prev=
1383 continue
1384 ;;
1385 self)
1386 if test "$prev" = dlprefiles; then
1387 dlself=yes
1388 elif test "$prev" = dlfiles && test "$dlopen_self" != yes; then
1389 dlself=yes
1390 else
1391 dlself=needless
1392 export_dynamic=yes
1393 fi
1394 prev=
1395 continue
1396 ;;
1397 *)
1398 if test "$prev" = dlfiles; then
1399 dlfiles="$dlfiles $arg"
1400 else
1401 dlprefiles="$dlprefiles $arg"
1402 fi
1403 prev=
1404 continue
1405 ;;
1406 esac
1407 ;;
1408 expsyms)
1409 export_symbols="$arg"
1410 if test ! -f "$arg"; then
1411 $echo "$modename: symbol file \`$arg' does not exist"
1412 exit 1
1413 fi
1414 prev=
1415 continue
1416 ;;
1417 expsyms_regex)
1418 export_symbols_regex="$arg"
1419 prev=
1420 continue
1421 ;;
1422 inst_prefix)
1423 inst_prefix_dir="$arg"
1424 prev=
1425 continue
1426 ;;
1427 precious_regex)
1428 precious_files_regex="$arg"
1429 prev=
1430 continue
1431 ;;
1432 release)
1433 release="-$arg"
1434 prev=
1435 continue
1436 ;;
1437 objectlist)
1438 if test -f "$arg"; then
1439 save_arg=$arg
1440 moreargs=
1441 for fil in `cat $save_arg`
1442 do
1443 # moreargs="$moreargs $fil"
1444 arg=$fil
1445 # A libtool-controlled object.
1446
1447 # Check to see that this really is a libtool object.
1448 if (${SED} -e '2q' $arg | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
1449 pic_object=
1450 non_pic_object=
1451
1452 # Read the .lo file
1453 # If there is no directory component, then add one.
1454 case $arg in
1455 */* | *\\*) . $arg ;;
1456 *) . ./$arg ;;
1457 esac
1458
1459 if test -z "$pic_object" || \
1460 test -z "$non_pic_object" ||
1461 test "$pic_object" = none && \
1462 test "$non_pic_object" = none; then
1463 $echo "$modename: cannot find name of object for \`$arg'" 1>&2
1464 exit 1
1465 fi
1466
1467 # Extract subdirectory from the argument.
1468 xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
1469 if test "X$xdir" = "X$arg"; then
1470 xdir=
1471 else
1472 xdir="$xdir/"
1473 fi
1474
1475 if test "$pic_object" != none; then
1476 # Prepend the subdirectory the object is found in.
1477 pic_object="$xdir$pic_object"
1478
1479 if test "$prev" = dlfiles; then
1480 if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then
1481 dlfiles="$dlfiles $pic_object"
1482 prev=
1483 continue
1484 else
1485 # If libtool objects are unsupported, then we need to preload.
1486 prev=dlprefiles
1487 fi
1488 fi
1489
1490 # CHECK ME: I think I busted this. -Ossama
1491 if test "$prev" = dlprefiles; then
1492 # Preload the old-style object.
1493 dlprefiles="$dlprefiles $pic_object"
1494 prev=
1495 fi
1496
1497 # A PIC object.
1498 libobjs="$libobjs $pic_object"
1499 arg="$pic_object"
1500 fi
1501
1502 # Non-PIC object.
1503 if test "$non_pic_object" != none; then
1504 # Prepend the subdirectory the object is found in.
1505 non_pic_object="$xdir$non_pic_object"
1506
1507 # A standard non-PIC object
1508 non_pic_objects="$non_pic_objects $non_pic_object"
1509 if test -z "$pic_object" || test "$pic_object" = none ; then
1510 arg="$non_pic_object"
1511 fi
1512 fi
1513 else
1514 # Only an error if not doing a dry-run.
1515 if test -z "$run"; then
1516 $echo "$modename: \`$arg' is not a valid libtool object" 1>&2
1517 exit 1
1518 else
1519 # Dry-run case.
1520
1521 # Extract subdirectory from the argument.
1522 xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
1523 if test "X$xdir" = "X$arg"; then
1524 xdir=
1525 else
1526 xdir="$xdir/"
1527 fi
1528
1529 pic_object=`$echo "X${xdir}${objdir}/${arg}" | $Xsed -e "$lo2o"`
1530 non_pic_object=`$echo "X${xdir}${arg}" | $Xsed -e "$lo2o"`
1531 libobjs="$libobjs $pic_object"
1532 non_pic_objects="$non_pic_objects $non_pic_object"
1533 fi
1534 fi
1535 done
1536 else
1537 $echo "$modename: link input file \`$save_arg' does not exist"
1538 exit 1
1539 fi
1540 arg=$save_arg
1541 prev=
1542 continue
1543 ;;
1544 rpath | xrpath)
1545 # We need an absolute path.
1546 case $arg in
1547 [\\/]* | [A-Za-z]:[\\/]*) ;;
1548 *)
1549 $echo "$modename: only absolute run-paths are allowed" 1>&2
1550 exit 1
1551 ;;
1552 esac
1553 if test "$prev" = rpath; then
1554 case "$rpath " in
1555 *" $arg "*) ;;
1556 *) rpath="$rpath $arg" ;;
1557 esac
1558 else
1559 case "$xrpath " in
1560 *" $arg "*) ;;
1561 *) xrpath="$xrpath $arg" ;;
1562 esac
1563 fi
1564 prev=
1565 continue
1566 ;;
1567 xcompiler)
1568 compiler_flags="$compiler_flags $qarg"
1569 prev=
1570 compile_command="$compile_command $qarg"
1571 finalize_command="$finalize_command $qarg"
1572 continue
1573 ;;
1574 xlinker)
1575 linker_flags="$linker_flags $qarg"
1576 compiler_flags="$compiler_flags $wl$qarg"
1577 prev=
1578 compile_command="$compile_command $wl$qarg"
1579 finalize_command="$finalize_command $wl$qarg"
1580 continue
1581 ;;
1582 xcclinker)
1583 linker_flags="$linker_flags $qarg"
1584 compiler_flags="$compiler_flags $qarg"
1585 prev=
1586 compile_command="$compile_command $qarg"
1587 finalize_command="$finalize_command $qarg"
1588 continue
1589 ;;
1590 *)
1591 eval "$prev=\"\$arg\""
1592 prev=
1593 continue
1594 ;;
1595 esac
1596 fi # test -n "$prev"
1597
1598 prevarg="$arg"
1599
1600 case $arg in
1601 -all-static)
1602 if test -n "$link_static_flag"; then
1603 compile_command="$compile_command $link_static_flag"
1604 finalize_command="$finalize_command $link_static_flag"
1605 fi
1606 continue
1607 ;;
1608
1609 -allow-undefined)
1610 # FIXME: remove this flag sometime in the future.
1611 $echo "$modename: \`-allow-undefined' is deprecated because it is the default" 1>&2
1612 continue
1613 ;;
1614
1615 -avoid-version)
1616 avoid_version=yes
1617 continue
1618 ;;
1619
1620 -dlopen)
1621 prev=dlfiles
1622 continue
1623 ;;
1624
1625 -dlpreopen)
1626 prev=dlprefiles
1627 continue
1628 ;;
1629
1630 -export-dynamic)
1631 export_dynamic=yes
1632 continue
1633 ;;
1634
1635 -export-symbols | -export-symbols-regex)
1636 if test -n "$export_symbols" || test -n "$export_symbols_regex"; then
1637 $echo "$modename: more than one -exported-symbols argument is not allowed"
1638 exit 1
1639 fi
1640 if test "X$arg" = "X-export-symbols"; then
1641 prev=expsyms
1642 else
1643 prev=expsyms_regex
1644 fi
1645 continue
1646 ;;
1647
1648 -inst-prefix-dir)
1649 prev=inst_prefix
1650 continue
1651 ;;
1652
1653 # The native IRIX linker understands -LANG:*, -LIST:* and -LNO:*
1654 # so, if we see these flags be careful not to treat them like -L
1655 -L[A-Z][A-Z]*:*)
1656 case $with_gcc/$host in
1657 no/*-*-irix* | /*-*-irix*)
1658 compile_command="$compile_command $arg"
1659 finalize_command="$finalize_command $arg"
1660 ;;
1661 esac
1662 continue
1663 ;;
1664
1665 -L*)
1666 dir=`$echo "X$arg" | $Xsed -e 's/^-L//'`
1667 # We need an absolute path.
1668 case $dir in
1669 [\\/]* | [A-Za-z]:[\\/]*) ;;
1670 *)
1671 absdir=`cd "$dir" && pwd`
1672 if test -z "$absdir"; then
1673 $echo "$modename: cannot determine absolute directory name of \`$dir'" 1>&2
1674 exit 1
1675 fi
1676 dir="$absdir"
1677 ;;
1678 esac
1679 case "$deplibs " in
1680 *" -L$dir "*) ;;
1681 *)
1682 deplibs="$deplibs -L$dir"
1683 lib_search_path="$lib_search_path $dir"
1684 ;;
1685 esac
1686 case $host in
1687 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
1688 case :$dllsearchpath: in
1689 *":$dir:"*) ;;
1690 *) dllsearchpath="$dllsearchpath:$dir";;
1691 esac
1692 ;;
1693 esac
1694 continue
1695 ;;
1696
1697 -l*)
1698 if test "X$arg" = "X-lc" || test "X$arg" = "X-lm"; then
1699 case $host in
1700 *-*-cygwin* | *-*-pw32* | *-*-beos*)
1701 # These systems don't actually have a C or math library (as such)
1702 continue
1703 ;;
1704 *-*-mingw* | *-*-os2*)
1705 # These systems don't actually have a C library (as such)
1706 test "X$arg" = "X-lc" && continue
1707 ;;
1708 *-*-openbsd* | *-*-freebsd*)
1709 # Do not include libc due to us having libc/libc_r.
1710 test "X$arg" = "X-lc" && continue
1711 ;;
1712 *-*-rhapsody* | *-*-darwin1.[012])
1713 # Rhapsody C and math libraries are in the System framework
1714 deplibs="$deplibs -framework System"
1715 continue
1716 esac
1717 elif test "X$arg" = "X-lc_r"; then
1718 case $host in
1719 *-*-openbsd* | *-*-freebsd*)
1720 # Do not include libc_r directly, use -pthread flag.
1721 continue
1722 ;;
1723 esac
1724 fi
1725 deplibs="$deplibs $arg"
1726 continue
1727 ;;
1728
1729 -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe)
1730 deplibs="$deplibs $arg"
1731 continue
1732 ;;
1733
1734 -module)
1735 module=yes
1736 continue
1737 ;;
1738
1739 # gcc -m* arguments should be passed to the linker via $compiler_flags
1740 # in order to pass architecture information to the linker
1741 # (e.g. 32 vs 64-bit). This may also be accomplished via -Wl,-mfoo
1742 # but this is not reliable with gcc because gcc may use -mfoo to
1743 # select a different linker, different libraries, etc, while
1744 # -Wl,-mfoo simply passes -mfoo to the linker.
1745 -m*)
1746 # Unknown arguments in both finalize_command and compile_command need
1747 # to be aesthetically quoted because they are evaled later.
1748 arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
1749 case $arg in
1750 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
1751 arg="\"$arg\""
1752 ;;
1753 esac
1754 compile_command="$compile_command $arg"
1755 finalize_command="$finalize_command $arg"
1756 if test "$with_gcc" = "yes" ; then
1757 compiler_flags="$compiler_flags $arg"
1758 fi
1759 continue
1760 ;;
1761
1762 -shrext)
1763 prev=shrext
1764 continue
1765 ;;
1766
1767 -no-fast-install)
1768 fast_install=no
1769 continue
1770 ;;
1771
1772 -no-install)
1773 case $host in
1774 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
1775 # The PATH hackery in wrapper scripts is required on Windows
1776 # in order for the loader to find any dlls it needs.
1777 $echo "$modename: warning: \`-no-install' is ignored for $host" 1>&2
1778 $echo "$modename: warning: assuming \`-no-fast-install' instead" 1>&2
1779 fast_install=no
1780 ;;
1781 *) no_install=yes ;;
1782 esac
1783 continue
1784 ;;
1785
1786 -no-undefined)
1787 allow_undefined=no
1788 continue
1789 ;;
1790
1791 -objectlist)
1792 prev=objectlist
1793 continue
1794 ;;
1795
1796 -o) prev=output ;;
1797
1798 -precious-files-regex)
1799 prev=precious_regex
1800 continue
1801 ;;
1802
1803 -release)
1804 prev=release
1805 continue
1806 ;;
1807
1808 -rpath)
1809 prev=rpath
1810 continue
1811 ;;
1812
1813 -R)
1814 prev=xrpath
1815 continue
1816 ;;
1817
1818 -R*)
1819 dir=`$echo "X$arg" | $Xsed -e 's/^-R//'`
1820 # We need an absolute path.
1821 case $dir in
1822 [\\/]* | [A-Za-z]:[\\/]*) ;;
1823 *)
1824 $echo "$modename: only absolute run-paths are allowed" 1>&2
1825 exit 1
1826 ;;
1827 esac
1828 case "$xrpath " in
1829 *" $dir "*) ;;
1830 *) xrpath="$xrpath $dir" ;;
1831 esac
1832 continue
1833 ;;
1834
1835 -static)
1836 # The effects of -static are defined in a previous loop.
1837 # We used to do the same as -all-static on platforms that
1838 # didn't have a PIC flag, but the assumption that the effects
1839 # would be equivalent was wrong. It would break on at least
1840 # Digital Unix and AIX.
1841 continue
1842 ;;
1843
1844 -thread-safe)
1845 thread_safe=yes
1846 continue
1847 ;;
1848
1849 -version-info)
1850 prev=vinfo
1851 continue
1852 ;;
1853 -version-number)
1854 prev=vinfo
1855 vinfo_number=yes
1856 continue
1857 ;;
1858
1859 -Wc,*)
1860 args=`$echo "X$arg" | $Xsed -e "$sed_quote_subst" -e 's/^-Wc,//'`
1861 arg=
1862 save_ifs="$IFS"; IFS=','
1863 for flag in $args; do
1864 IFS="$save_ifs"
1865 case $flag in
1866 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
1867 flag="\"$flag\""
1868 ;;
1869 esac
1870 arg="$arg $wl$flag"
1871 compiler_flags="$compiler_flags $flag"
1872 done
1873 IFS="$save_ifs"
1874 arg=`$echo "X$arg" | $Xsed -e "s/^ //"`
1875 ;;
1876
1877 -Wl,*)
1878 args=`$echo "X$arg" | $Xsed -e "$sed_quote_subst" -e 's/^-Wl,//'`
1879 arg=
1880 save_ifs="$IFS"; IFS=','
1881 for flag in $args; do
1882 IFS="$save_ifs"
1883 case $flag in
1884 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
1885 flag="\"$flag\""
1886 ;;
1887 esac
1888 arg="$arg $wl$flag"
1889 compiler_flags="$compiler_flags $wl$flag"
1890 linker_flags="$linker_flags $flag"
1891 done
1892 IFS="$save_ifs"
1893 arg=`$echo "X$arg" | $Xsed -e "s/^ //"`
1894 ;;
1895
1896 -Xcompiler)
1897 prev=xcompiler
1898 continue
1899 ;;
1900
1901 -Xlinker)
1902 prev=xlinker
1903 continue
1904 ;;
1905
1906 -XCClinker)
1907 prev=xcclinker
1908 continue
1909 ;;
1910
1911 -Kthread | -mthreads | -mt | -pthread | -pthreads | -threads | -qthreaded | -kthread )
1912 compiler_flags="$compiler_flags $arg"
1913 continue
1914 ;;
1915
1916 # Some other compiler flag.
1917 -* | +*)
1918 # Unknown arguments in both finalize_command and compile_command need
1919 # to be aesthetically quoted because they are evaled later.
1920 arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
1921 case $arg in
1922 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
1923 arg="\"$arg\""
1924 ;;
1925 esac
1926 ;;
1927
1928 *.$objext)
1929 # A standard object.
1930 objs="$objs $arg"
1931 ;;
1932
1933 *.lo)
1934 # A libtool-controlled object.
1935
1936 # Check to see that this really is a libtool object.
1937 if (${SED} -e '2q' $arg | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
1938 pic_object=
1939 non_pic_object=
1940
1941 # Read the .lo file
1942 # If there is no directory component, then add one.
1943 case $arg in
1944 */* | *\\*) . $arg ;;
1945 *) . ./$arg ;;
1946 esac
1947
1948 if test -z "$pic_object" || \
1949 test -z "$non_pic_object" ||
1950 test "$pic_object" = none && \
1951 test "$non_pic_object" = none; then
1952 $echo "$modename: cannot find name of object for \`$arg'" 1>&2
1953 exit 1
1954 fi
1955
1956 # Extract subdirectory from the argument.
1957 xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
1958 if test "X$xdir" = "X$arg"; then
1959 xdir=
1960 else
1961 xdir="$xdir/"
1962 fi
1963
1964 if test "$pic_object" != none; then
1965 # Prepend the subdirectory the object is found in.
1966 pic_object="$xdir$pic_object"
1967
1968 if test "$prev" = dlfiles; then
1969 if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then
1970 dlfiles="$dlfiles $pic_object"
1971 prev=
1972 continue
1973 else
1974 # If libtool objects are unsupported, then we need to preload.
1975 prev=dlprefiles
1976 fi
1977 fi
1978
1979 # CHECK ME: I think I busted this. -Ossama
1980 if test "$prev" = dlprefiles; then
1981 # Preload the old-style object.
1982 dlprefiles="$dlprefiles $pic_object"
1983 prev=
1984 fi
1985
1986 # A PIC object.
1987 libobjs="$libobjs $pic_object"
1988 arg="$pic_object"
1989 fi
1990
1991 # Non-PIC object.
1992 if test "$non_pic_object" != none; then
1993 # Prepend the subdirectory the object is found in.
1994 non_pic_object="$xdir$non_pic_object"
1995
1996 # A standard non-PIC object
1997 non_pic_objects="$non_pic_objects $non_pic_object"
1998 if test -z "$pic_object" || test "$pic_object" = none ; then
1999 arg="$non_pic_object"
2000 fi
2001 fi
2002 else
2003 # Only an error if not doing a dry-run.
2004 if test -z "$run"; then
2005 $echo "$modename: \`$arg' is not a valid libtool object" 1>&2
2006 exit 1
2007 else
2008 # Dry-run case.
2009
2010 # Extract subdirectory from the argument.
2011 xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
2012 if test "X$xdir" = "X$arg"; then
2013 xdir=
2014 else
2015 xdir="$xdir/"
2016 fi
2017
2018 pic_object=`$echo "X${xdir}${objdir}/${arg}" | $Xsed -e "$lo2o"`
2019 non_pic_object=`$echo "X${xdir}${arg}" | $Xsed -e "$lo2o"`
2020 libobjs="$libobjs $pic_object"
2021 non_pic_objects="$non_pic_objects $non_pic_object"
2022 fi
2023 fi
2024 ;;
2025
2026 *.$libext)
2027 # An archive.
2028 deplibs="$deplibs $arg"
2029 old_deplibs="$old_deplibs $arg"
2030 continue
2031 ;;
2032
2033 *.la)
2034 # A libtool-controlled library.
2035
2036 if test "$prev" = dlfiles; then
2037 # This library was specified with -dlopen.
2038 dlfiles="$dlfiles $arg"
2039 prev=
2040 elif test "$prev" = dlprefiles; then
2041 # The library was specified with -dlpreopen.
2042 dlprefiles="$dlprefiles $arg"
2043 prev=
2044 else
2045 deplibs="$deplibs $arg"
2046 fi
2047 continue
2048 ;;
2049
2050 # Some other compiler argument.
2051 *)
2052 # Unknown arguments in both finalize_command and compile_command need
2053 # to be aesthetically quoted because they are evaled later.
2054 arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
2055 case $arg in
2056 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
2057 arg="\"$arg\""
2058 ;;
2059 esac
2060 ;;
2061 esac # arg
2062
2063 # Now actually substitute the argument into the commands.
2064 if test -n "$arg"; then
2065 compile_command="$compile_command $arg"
2066 finalize_command="$finalize_command $arg"
2067 fi
2068 done # argument parsing loop
2069
2070 if test -n "$prev"; then
2071 $echo "$modename: the \`$prevarg' option requires an argument" 1>&2
2072 $echo "$help" 1>&2
2073 exit 1
2074 fi
2075
2076 if test "$export_dynamic" = yes && test -n "$export_dynamic_flag_spec"; then
2077 eval arg=\"$export_dynamic_flag_spec\"
2078 compile_command="$compile_command $arg"
2079 finalize_command="$finalize_command $arg"
2080 fi
2081
2082 oldlibs=
2083 # calculate the name of the file, without its directory
2084 outputname=`$echo "X$output" | $Xsed -e 's%^.*/%%'`
2085 libobjs_save="$libobjs"
2086
2087 if test -n "$shlibpath_var"; then
2088 # get the directories listed in $shlibpath_var
2089 eval shlib_search_path=\`\$echo \"X\${$shlibpath_var}\" \| \$Xsed -e \'s/:/ /g\'\`
2090 else
2091 shlib_search_path=
2092 fi
2093 eval sys_lib_search_path=\"$sys_lib_search_path_spec\"
2094 eval sys_lib_dlsearch_path=\"$sys_lib_dlsearch_path_spec\"
2095
2096 output_objdir=`$echo "X$output" | $Xsed -e 's%/[^/]*$%%'`
2097 if test "X$output_objdir" = "X$output"; then
2098 output_objdir="$objdir"
2099 else
2100 output_objdir="$output_objdir/$objdir"
2101 fi
2102 # Create the object directory.
2103 if test ! -d "$output_objdir"; then
2104 $show "$mkdir $output_objdir"
2105 $run $mkdir $output_objdir
2106 status=$?
2107 if test "$status" -ne 0 && test ! -d "$output_objdir"; then
2108 exit $status
2109 fi
2110 fi
2111
2112 # Determine the type of output
2113 case $output in
2114 "")
2115 $echo "$modename: you must specify an output file" 1>&2
2116 $echo "$help" 1>&2
2117 exit 1
2118 ;;
2119 *.$libext) linkmode=oldlib ;;
2120 *.lo | *.$objext) linkmode=obj ;;
2121 *.la) linkmode=lib ;;
2122 *) linkmode=prog ;; # Anything else should be a program.
2123 esac
2124
2125 case $host in
2126 *cygwin* | *mingw* | *pw32*)
2127 # don't eliminate duplcations in $postdeps and $predeps
2128 duplicate_compiler_generated_deps=yes
2129 ;;
2130 *)
2131 duplicate_compiler_generated_deps=$duplicate_deps
2132 ;;
2133 esac
2134 specialdeplibs=
2135
2136 libs=
2137 # Find all interdependent deplibs by searching for libraries
2138 # that are linked more than once (e.g. -la -lb -la)
2139 for deplib in $deplibs; do
2140 if test "X$duplicate_deps" = "Xyes" ; then
2141 case "$libs " in
2142 *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
2143 esac
2144 fi
2145 libs="$libs $deplib"
2146 done
2147
2148 if test "$linkmode" = lib; then
2149 libs="$predeps $libs $compiler_lib_search_path $postdeps"
2150
2151 # Compute libraries that are listed more than once in $predeps
2152 # $postdeps and mark them as special (i.e., whose duplicates are
2153 # not to be eliminated).
2154 pre_post_deps=
2155 if test "X$duplicate_compiler_generated_deps" = "Xyes" ; then
2156 for pre_post_dep in $predeps $postdeps; do
2157 case "$pre_post_deps " in
2158 *" $pre_post_dep "*) specialdeplibs="$specialdeplibs $pre_post_deps" ;;
2159 esac
2160 pre_post_deps="$pre_post_deps $pre_post_dep"
2161 done
2162 fi
2163 pre_post_deps=
2164 fi
2165
2166 deplibs=
2167 newdependency_libs=
2168 newlib_search_path=
2169 need_relink=no # whether we're linking any uninstalled libtool libraries
2170 notinst_deplibs= # not-installed libtool libraries
2171 notinst_path= # paths that contain not-installed libtool libraries
2172 case $linkmode in
2173 lib)
2174 passes="conv link"
2175 for file in $dlfiles $dlprefiles; do
2176 case $file in
2177 *.la) ;;
2178 *)
2179 $echo "$modename: libraries can \`-dlopen' only libtool libraries: $file" 1>&2
2180 exit 1
2181 ;;
2182 esac
2183 done
2184 ;;
2185 prog)
2186 compile_deplibs=
2187 finalize_deplibs=
2188 alldeplibs=no
2189 newdlfiles=
2190 newdlprefiles=
2191 passes="conv scan dlopen dlpreopen link"
2192 ;;
2193 *) passes="conv"
2194 ;;
2195 esac
2196 for pass in $passes; do
2197 if test "$linkmode,$pass" = "lib,link" ||
2198 test "$linkmode,$pass" = "prog,scan"; then
2199 libs="$deplibs"
2200 deplibs=
2201 fi
2202 if test "$linkmode" = prog; then
2203 case $pass in
2204 dlopen) libs="$dlfiles" ;;
2205 dlpreopen) libs="$dlprefiles" ;;
2206 link) libs="$deplibs %DEPLIBS% $dependency_libs" ;;
2207 esac
2208 fi
2209 if test "$pass" = dlopen; then
2210 # Collect dlpreopened libraries
2211 save_deplibs="$deplibs"
2212 deplibs=
2213 fi
2214 for deplib in $libs; do
2215 lib=
2216 found=no
2217 case $deplib in
2218 -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe)
2219 if test "$linkmode,$pass" = "prog,link"; then
2220 compile_deplibs="$deplib $compile_deplibs"
2221 finalize_deplibs="$deplib $finalize_deplibs"
2222 else
2223 deplibs="$deplib $deplibs"
2224 fi
2225 continue
2226 ;;
2227 -l*)
2228 if test "$linkmode" != lib && test "$linkmode" != prog; then
2229 $echo "$modename: warning: \`-l' is ignored for archives/objects" 1>&2
2230 continue
2231 fi
2232 if test "$pass" = conv; then
2233 deplibs="$deplib $deplibs"
2234 continue
2235 fi
2236 name=`$echo "X$deplib" | $Xsed -e 's/^-l//'`
2237 for searchdir in $newlib_search_path $lib_search_path $sys_lib_search_path $shlib_search_path; do
2238 for search_ext in .la $shrext .so .a; do
2239 # Search the libtool library
2240 lib="$searchdir/lib${name}${search_ext}"
2241 if test -f "$lib"; then
2242 if test "$search_ext" = ".la"; then
2243 found=yes
2244 else
2245 found=no
2246 fi
2247 break 2
2248 fi
2249 done
2250 done
2251 if test "$found" != yes; then
2252 # deplib doesn't seem to be a libtool library
2253 if test "$linkmode,$pass" = "prog,link"; then
2254 compile_deplibs="$deplib $compile_deplibs"
2255 finalize_deplibs="$deplib $finalize_deplibs"
2256 else
2257 deplibs="$deplib $deplibs"
2258 test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs"
2259 fi
2260 continue
2261 else # deplib is a libtool library
2262 # If $allow_libtool_libs_with_static_runtimes && $deplib is a stdlib,
2263 # We need to do some special things here, and not later.
2264 if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
2265 case " $predeps $postdeps " in
2266 *" $deplib "*)
2267 if (${SED} -e '2q' $lib |
2268 grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
2269 library_names=
2270 old_library=
2271 case $lib in
2272 */* | *\\*) . $lib ;;
2273 *) . ./$lib ;;
2274 esac
2275 for l in $old_library $library_names; do
2276 ll="$l"
2277 done
2278 if test "X$ll" = "X$old_library" ; then # only static version available
2279 found=no
2280 ladir=`$echo "X$lib" | $Xsed -e 's%/[^/]*$%%'`
2281 test "X$ladir" = "X$lib" && ladir="."
2282 lib=$ladir/$old_library
2283 if test "$linkmode,$pass" = "prog,link"; then
2284 compile_deplibs="$deplib $compile_deplibs"
2285 finalize_deplibs="$deplib $finalize_deplibs"
2286 else
2287 deplibs="$deplib $deplibs"
2288 test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs"
2289 fi
2290 continue
2291 fi
2292 fi
2293 ;;
2294 *) ;;
2295 esac
2296 fi
2297 fi
2298 ;; # -l
2299 -L*)
2300 case $linkmode in
2301 lib)
2302 deplibs="$deplib $deplibs"
2303 test "$pass" = conv && continue
2304 newdependency_libs="$deplib $newdependency_libs"
2305 newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`
2306 ;;
2307 prog)
2308 if test "$pass" = conv; then
2309 deplibs="$deplib $deplibs"
2310 continue
2311 fi
2312 if test "$pass" = scan; then
2313 deplibs="$deplib $deplibs"
2314 newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`
2315 else
2316 compile_deplibs="$deplib $compile_deplibs"
2317 finalize_deplibs="$deplib $finalize_deplibs"
2318 fi
2319 ;;
2320 *)
2321 $echo "$modename: warning: \`-L' is ignored for archives/objects" 1>&2
2322 ;;
2323 esac # linkmode
2324 continue
2325 ;; # -L
2326 -R*)
2327 if test "$pass" = link; then
2328 dir=`$echo "X$deplib" | $Xsed -e 's/^-R//'`
2329 # Make sure the xrpath contains only unique directories.
2330 case "$xrpath " in
2331 *" $dir "*) ;;
2332 *) xrpath="$xrpath $dir" ;;
2333 esac
2334 fi
2335 deplibs="$deplib $deplibs"
2336 continue
2337 ;;
2338 *.la) lib="$deplib" ;;
2339 *.$libext)
2340 if test "$pass" = conv; then
2341 deplibs="$deplib $deplibs"
2342 continue
2343 fi
2344 case $linkmode in
2345 lib)
2346 if test "$deplibs_check_method" != pass_all; then
2347 $echo
2348 $echo "*** Warning: Trying to link with static lib archive $deplib."
2349 $echo "*** I have the capability to make that library automatically link in when"
2350 $echo "*** you link to this library. But I can only do this if you have a"
2351 $echo "*** shared version of the library, which you do not appear to have"
2352 $echo "*** because the file extensions .$libext of this argument makes me believe"
2353 $echo "*** that it is just a static archive that I should not used here."
2354 else
2355 $echo
2356 $echo "*** Warning: Linking the shared library $output against the"
2357 $echo "*** static library $deplib is not portable!"
2358 deplibs="$deplib $deplibs"
2359 fi
2360 continue
2361 ;;
2362 prog)
2363 if test "$pass" != link; then
2364 deplibs="$deplib $deplibs"
2365 else
2366 compile_deplibs="$deplib $compile_deplibs"
2367 finalize_deplibs="$deplib $finalize_deplibs"
2368 fi
2369 continue
2370 ;;
2371 esac # linkmode
2372 ;; # *.$libext
2373 *.lo | *.$objext)
2374 if test "$pass" = conv; then
2375 deplibs="$deplib $deplibs"
2376 elif test "$linkmode" = prog; then
2377 if test "$pass" = dlpreopen || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then
2378 # If there is no dlopen support or we're linking statically,
2379 # we need to preload.
2380 newdlprefiles="$newdlprefiles $deplib"
2381 compile_deplibs="$deplib $compile_deplibs"
2382 finalize_deplibs="$deplib $finalize_deplibs"
2383 else
2384 newdlfiles="$newdlfiles $deplib"
2385 fi
2386 fi
2387 continue
2388 ;;
2389 %DEPLIBS%)
2390 alldeplibs=yes
2391 continue
2392 ;;
2393 esac # case $deplib
2394 if test "$found" = yes || test -f "$lib"; then :
2395 else
2396 $echo "$modename: cannot find the library \`$lib'" 1>&2
2397 exit 1
2398 fi
2399
2400 # Check to see that this really is a libtool archive.
2401 if (${SED} -e '2q' $lib | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
2402 else
2403 $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
2404 exit 1
2405 fi
2406
2407 ladir=`$echo "X$lib" | $Xsed -e 's%/[^/]*$%%'`
2408 test "X$ladir" = "X$lib" && ladir="."
2409
2410 dlname=
2411 dlopen=
2412 dlpreopen=
2413 libdir=
2414 library_names=
2415 old_library=
2416 # If the library was installed with an old release of libtool,
2417 # it will not redefine variables installed, or shouldnotlink
2418 installed=yes
2419 shouldnotlink=no
2420
2421 # Read the .la file
2422 case $lib in
2423 */* | *\\*) . $lib ;;
2424 *) . ./$lib ;;
2425 esac
2426
2427 if test "$linkmode,$pass" = "lib,link" ||
2428 test "$linkmode,$pass" = "prog,scan" ||
2429 { test "$linkmode" != prog && test "$linkmode" != lib; }; then
2430 test -n "$dlopen" && dlfiles="$dlfiles $dlopen"
2431 test -n "$dlpreopen" && dlprefiles="$dlprefiles $dlpreopen"
2432 fi
2433
2434 if test "$pass" = conv; then
2435 # Only check for convenience libraries
2436 deplibs="$lib $deplibs"
2437 if test -z "$libdir"; then
2438 if test -z "$old_library"; then
2439 $echo "$modename: cannot find name of link library for \`$lib'" 1>&2
2440 exit 1
2441 fi
2442 # It is a libtool convenience library, so add in its objects.
2443 convenience="$convenience $ladir/$objdir/$old_library"
2444 old_convenience="$old_convenience $ladir/$objdir/$old_library"
2445 tmp_libs=
2446 for deplib in $dependency_libs; do
2447 deplibs="$deplib $deplibs"
2448 if test "X$duplicate_deps" = "Xyes" ; then
2449 case "$tmp_libs " in
2450 *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
2451 esac
2452 fi
2453 tmp_libs="$tmp_libs $deplib"
2454 done
2455 elif test "$linkmode" != prog && test "$linkmode" != lib; then
2456 $echo "$modename: \`$lib' is not a convenience library" 1>&2
2457 exit 1
2458 fi
2459 continue
2460 fi # $pass = conv
2461
2462
2463 # Get the name of the library we link against.
2464 linklib=
2465 for l in $old_library $library_names; do
2466 linklib="$l"
2467 done
2468 if test -z "$linklib"; then
2469 $echo "$modename: cannot find name of link library for \`$lib'" 1>&2
2470 exit 1
2471 fi
2472
2473 # This library was specified with -dlopen.
2474 if test "$pass" = dlopen; then
2475 if test -z "$libdir"; then
2476 $echo "$modename: cannot -dlopen a convenience library: \`$lib'" 1>&2
2477 exit 1
2478 fi
2479 if test -z "$dlname" || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then
2480 # If there is no dlname, no dlopen support or we're linking
2481 # statically, we need to preload. We also need to preload any
2482 # dependent libraries so libltdl's deplib preloader doesn't
2483 # bomb out in the load deplibs phase.
2484 dlprefiles="$dlprefiles $lib $dependency_libs"
2485 else
2486 newdlfiles="$newdlfiles $lib"
2487 fi
2488 continue
2489 fi # $pass = dlopen
2490
2491 # We need an absolute path.
2492 case $ladir in
2493 [\\/]* | [A-Za-z]:[\\/]*) abs_ladir="$ladir" ;;
2494 *)
2495 abs_ladir=`cd "$ladir" && pwd`
2496 if test -z "$abs_ladir"; then
2497 $echo "$modename: warning: cannot determine absolute directory name of \`$ladir'" 1>&2
2498 $echo "$modename: passing it literally to the linker, although it might fail" 1>&2
2499 abs_ladir="$ladir"
2500 fi
2501 ;;
2502 esac
2503 laname=`$echo "X$lib" | $Xsed -e 's%^.*/%%'`
2504
2505 # Find the relevant object directory and library name.
2506 if test "X$installed" = Xyes; then
2507 if test ! -f "$libdir/$linklib" && test -f "$abs_ladir/$linklib"; then
2508 $echo "$modename: warning: library \`$lib' was moved." 1>&2
2509 dir="$ladir"
2510 absdir="$abs_ladir"
2511 libdir="$abs_ladir"
2512 else
2513 dir="$libdir"
2514 absdir="$libdir"
2515 fi
2516 else
2517 dir="$ladir/$objdir"
2518 absdir="$abs_ladir/$objdir"
2519 # Remove this search path later
2520 notinst_path="$notinst_path $abs_ladir"
2521 fi # $installed = yes
2522 name=`$echo "X$laname" | $Xsed -e 's/\.la$//' -e 's/^lib//'`
2523
2524 # This library was specified with -dlpreopen.
2525 if test "$pass" = dlpreopen; then
2526 if test -z "$libdir"; then
2527 $echo "$modename: cannot -dlpreopen a convenience library: \`$lib'" 1>&2
2528 exit 1
2529 fi
2530 # Prefer using a static library (so that no silly _DYNAMIC symbols
2531 # are required to link).
2532 if test -n "$old_library"; then
2533 newdlprefiles="$newdlprefiles $dir/$old_library"
2534 # Otherwise, use the dlname, so that lt_dlopen finds it.
2535 elif test -n "$dlname"; then
2536 newdlprefiles="$newdlprefiles $dir/$dlname"
2537 else
2538 newdlprefiles="$newdlprefiles $dir/$linklib"
2539 fi
2540 fi # $pass = dlpreopen
2541
2542 if test -z "$libdir"; then
2543 # Link the convenience library
2544 if test "$linkmode" = lib; then
2545 deplibs="$dir/$old_library $deplibs"
2546 elif test "$linkmode,$pass" = "prog,link"; then
2547 compile_deplibs="$dir/$old_library $compile_deplibs"
2548 finalize_deplibs="$dir/$old_library $finalize_deplibs"
2549 else
2550 deplibs="$lib $deplibs" # used for prog,scan pass
2551 fi
2552 continue
2553 fi
2554
2555
2556 if test "$linkmode" = prog && test "$pass" != link; then
2557 newlib_search_path="$newlib_search_path $ladir"
2558 deplibs="$lib $deplibs"
2559
2560 linkalldeplibs=no
2561 if test "$link_all_deplibs" != no || test -z "$library_names" ||
2562 test "$build_libtool_libs" = no; then
2563 linkalldeplibs=yes
2564 fi
2565
2566 tmp_libs=
2567 for deplib in $dependency_libs; do
2568 case $deplib in
2569 -L*) newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`;; ### testsuite: skip nested quoting test
2570 esac
2571 # Need to link against all dependency_libs?
2572 if test "$linkalldeplibs" = yes; then
2573 deplibs="$deplib $deplibs"
2574 else
2575 # Need to hardcode shared library paths
2576 # or/and link against static libraries
2577 newdependency_libs="$deplib $newdependency_libs"
2578 fi
2579 if test "X$duplicate_deps" = "Xyes" ; then
2580 case "$tmp_libs " in
2581 *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
2582 esac
2583 fi
2584 tmp_libs="$tmp_libs $deplib"
2585 done # for deplib
2586 continue
2587 fi # $linkmode = prog...
2588
2589 if test "$linkmode,$pass" = "prog,link"; then
2590 if test -n "$library_names" &&
2591 { test "$prefer_static_libs" = no || test -z "$old_library"; }; then
2592 # We need to hardcode the library path
2593 if test -n "$shlibpath_var"; then
2594 # Make sure the rpath contains only unique directories.
2595 case "$temp_rpath " in
2596 *" $dir "*) ;;
2597 *" $absdir "*) ;;
2598 *) temp_rpath="$temp_rpath $dir" ;;
2599 esac
2600 fi
2601
2602 # Hardcode the library path.
2603 # Skip directories that are in the system default run-time
2604 # search path.
2605 case " $sys_lib_dlsearch_path " in
2606 *" $absdir "*) ;;
2607 *)
2608 case "$compile_rpath " in
2609 *" $absdir "*) ;;
2610 *) compile_rpath="$compile_rpath $absdir"
2611 esac
2612 ;;
2613 esac
2614 case " $sys_lib_dlsearch_path " in
2615 *" $libdir "*) ;;
2616 *)
2617 case "$finalize_rpath " in
2618 *" $libdir "*) ;;
2619 *) finalize_rpath="$finalize_rpath $libdir"
2620 esac
2621 ;;
2622 esac
2623 fi # $linkmode,$pass = prog,link...
2624
2625 if test "$alldeplibs" = yes &&
2626 { test "$deplibs_check_method" = pass_all ||
2627 { test "$build_libtool_libs" = yes &&
2628 test -n "$library_names"; }; }; then
2629 # We only need to search for static libraries
2630 continue
2631 fi
2632 fi
2633
2634 link_static=no # Whether the deplib will be linked statically
2635 if test -n "$library_names" &&
2636 { test "$prefer_static_libs" = no || test -z "$old_library"; }; then
2637 if test "$installed" = no; then
2638 notinst_deplibs="$notinst_deplibs $lib"
2639 need_relink=yes
2640 fi
2641 # This is a shared library
2642
2643 # Warn about portability, can't link against -module's on some systems (darwin)
2644 if test "$shouldnotlink" = yes && test "$pass" = link ; then
2645 $echo
2646 if test "$linkmode" = prog; then
2647 $echo "*** Warning: Linking the executable $output against the loadable module"
2648 else
2649 $echo "*** Warning: Linking the shared library $output against the loadable module"
2650 fi
2651 $echo "*** $linklib is not portable!"
2652 fi
2653 if test "$linkmode" = lib &&
2654 test "$hardcode_into_libs" = yes; then
2655 # Hardcode the library path.
2656 # Skip directories that are in the system default run-time
2657 # search path.
2658 case " $sys_lib_dlsearch_path " in
2659 *" $absdir "*) ;;
2660 *)
2661 case "$compile_rpath " in
2662 *" $absdir "*) ;;
2663 *) compile_rpath="$compile_rpath $absdir"
2664 esac
2665 ;;
2666 esac
2667 case " $sys_lib_dlsearch_path " in
2668 *" $libdir "*) ;;
2669 *)
2670 case "$finalize_rpath " in
2671 *" $libdir "*) ;;
2672 *) finalize_rpath="$finalize_rpath $libdir"
2673 esac
2674 ;;
2675 esac
2676 fi
2677
2678 if test -n "$old_archive_from_expsyms_cmds"; then
2679 # figure out the soname
2680 set dummy $library_names
2681 realname="$2"
2682 shift; shift
2683 libname=`eval \\$echo \"$libname_spec\"`
2684 # use dlname if we got it. it's perfectly good, no?
2685 if test -n "$dlname"; then
2686 soname="$dlname"
2687 elif test -n "$soname_spec"; then
2688 # bleh windows
2689 case $host in
2690 *cygwin* | mingw*)
2691 major=`expr $current - $age`
2692 versuffix="-$major"
2693 ;;
2694 esac
2695 eval soname=\"$soname_spec\"
2696 else
2697 soname="$realname"
2698 fi
2699
2700 # Make a new name for the extract_expsyms_cmds to use
2701 soroot="$soname"
2702 soname=`$echo $soroot | ${SED} -e 's/^.*\///'`
2703 newlib="libimp-`$echo $soname | ${SED} 's/^lib//;s/\.dll$//'`.a"
2704
2705 # If the library has no export list, then create one now
2706 if test -f "$output_objdir/$soname-def"; then :
2707 else
2708 $show "extracting exported symbol list from \`$soname'"
2709 save_ifs="$IFS"; IFS='~'
2710 cmds=$extract_expsyms_cmds
2711 for cmd in $cmds; do
2712 IFS="$save_ifs"
2713 eval cmd=\"$cmd\"
2714 $show "$cmd"
2715 $run eval "$cmd" || exit $?
2716 done
2717 IFS="$save_ifs"
2718 fi
2719
2720 # Create $newlib
2721 if test -f "$output_objdir/$newlib"; then :; else
2722 $show "generating import library for \`$soname'"
2723 save_ifs="$IFS"; IFS='~'
2724 cmds=$old_archive_from_expsyms_cmds
2725 for cmd in $cmds; do
2726 IFS="$save_ifs"
2727 eval cmd=\"$cmd\"
2728 $show "$cmd"
2729 $run eval "$cmd" || exit $?
2730 done
2731 IFS="$save_ifs"
2732 fi
2733 # make sure the library variables are pointing to the new library
2734 dir=$output_objdir
2735 linklib=$newlib
2736 fi # test -n "$old_archive_from_expsyms_cmds"
2737
2738 if test "$linkmode" = prog || test "$mode" != relink; then
2739 add_shlibpath=
2740 add_dir=
2741 add=
2742 lib_linked=yes
2743 case $hardcode_action in
2744 immediate | unsupported)
2745 if test "$hardcode_direct" = no; then
2746 add="$dir/$linklib"
2747 case $host in
2748 *-*-sco3.2v5* ) add_dir="-L$dir" ;;
2749 *-*-darwin* )
2750 # if the lib is a module then we can not link against it, someone
2751 # is ignoring the new warnings I added
2752 if /usr/bin/file -L $add 2> /dev/null | grep "bundle" >/dev/null ; then
2753 $echo "** Warning, lib $linklib is a module, not a shared library"
2754 if test -z "$old_library" ; then
2755 $echo
2756 $echo "** And there doesn't seem to be a static archive available"
2757 $echo "** The link will probably fail, sorry"
2758 else
2759 add="$dir/$old_library"
2760 fi
2761 fi
2762 esac
2763 elif test "$hardcode_minus_L" = no; then
2764 case $host in
2765 *-*-sunos*) add_shlibpath="$dir" ;;
2766 esac
2767 add_dir="-L$dir"
2768 add="-l$name"
2769 elif test "$hardcode_shlibpath_var" = no; then
2770 add_shlibpath="$dir"
2771 add="-l$name"
2772 else
2773 lib_linked=no
2774 fi
2775 ;;
2776 relink)
2777 if test "$hardcode_direct" = yes; then
2778 add="$dir/$linklib"
2779 elif test "$hardcode_minus_L" = yes; then
2780 add_dir="-L$dir"
2781 # Try looking first in the location we're being installed to.
2782 if test -n "$inst_prefix_dir"; then
2783 case "$libdir" in
2784 [\\/]*)
2785 add_dir="$add_dir -L$inst_prefix_dir$libdir"
2786 ;;
2787 esac
2788 fi
2789 add="-l$name"
2790 elif test "$hardcode_shlibpath_var" = yes; then
2791 add_shlibpath="$dir"
2792 add="-l$name"
2793 else
2794 lib_linked=no
2795 fi
2796 ;;
2797 *) lib_linked=no ;;
2798 esac
2799
2800 if test "$lib_linked" != yes; then
2801 $echo "$modename: configuration error: unsupported hardcode properties"
2802 exit 1
2803 fi
2804
2805 if test -n "$add_shlibpath"; then
2806 case :$compile_shlibpath: in
2807 *":$add_shlibpath:"*) ;;
2808 *) compile_shlibpath="$compile_shlibpath$add_shlibpath:" ;;
2809 esac
2810 fi
2811 if test "$linkmode" = prog; then
2812 test -n "$add_dir" && compile_deplibs="$add_dir $compile_deplibs"
2813 test -n "$add" && compile_deplibs="$add $compile_deplibs"
2814 else
2815 test -n "$add_dir" && deplibs="$add_dir $deplibs"
2816 test -n "$add" && deplibs="$add $deplibs"
2817 if test "$hardcode_direct" != yes && \
2818 test "$hardcode_minus_L" != yes && \
2819 test "$hardcode_shlibpath_var" = yes; then
2820 case :$finalize_shlibpath: in
2821 *":$libdir:"*) ;;
2822 *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;;
2823 esac
2824 fi
2825 fi
2826 fi
2827
2828 if test "$linkmode" = prog || test "$mode" = relink; then
2829 add_shlibpath=
2830 add_dir=
2831 add=
2832 # Finalize command for both is simple: just hardcode it.
2833 if test "$hardcode_direct" = yes; then
2834 add="$libdir/$linklib"
2835 elif test "$hardcode_minus_L" = yes; then
2836 add_dir="-L$libdir"
2837 add="-l$name"
2838 elif test "$hardcode_shlibpath_var" = yes; then
2839 case :$finalize_shlibpath: in
2840 *":$libdir:"*) ;;
2841 *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;;
2842 esac
2843 add="-l$name"
2844 elif test "$hardcode_automatic" = yes; then
2845 if test -n "$inst_prefix_dir" && test -f "$inst_prefix_dir$libdir/$linklib" ; then
2846 add="$inst_prefix_dir$libdir/$linklib"
2847 else
2848 add="$libdir/$linklib"
2849 fi
2850 else
2851 # We cannot seem to hardcode it, guess we'll fake it.
2852 add_dir="-L$libdir"
2853 # Try looking first in the location we're being installed to.
2854 if test -n "$inst_prefix_dir"; then
2855 case "$libdir" in
2856 [\\/]*)
2857 add_dir="$add_dir -L$inst_prefix_dir$libdir"
2858 ;;
2859 esac
2860 fi
2861 add="-l$name"
2862 fi
2863
2864 if test "$linkmode" = prog; then
2865 test -n "$add_dir" && finalize_deplibs="$add_dir $finalize_deplibs"
2866 test -n "$add" && finalize_deplibs="$add $finalize_deplibs"
2867 else
2868 test -n "$add_dir" && deplibs="$add_dir $deplibs"
2869 test -n "$add" && deplibs="$add $deplibs"
2870 fi
2871 fi
2872 elif test "$linkmode" = prog; then
2873 # Here we assume that one of hardcode_direct or hardcode_minus_L
2874 # is not unsupported. This is valid on all known static and
2875 # shared platforms.
2876 if test "$hardcode_direct" != unsupported; then
2877 test -n "$old_library" && linklib="$old_library"
2878 compile_deplibs="$dir/$linklib $compile_deplibs"
2879 finalize_deplibs="$dir/$linklib $finalize_deplibs"
2880 else
2881 compile_deplibs="-l$name -L$dir $compile_deplibs"
2882 finalize_deplibs="-l$name -L$dir $finalize_deplibs"
2883 fi
2884 elif test "$build_libtool_libs" = yes; then
2885 # Not a shared library
2886 if test "$deplibs_check_method" != pass_all; then
2887 # We're trying link a shared library against a static one
2888 # but the system doesn't support it.
2889
2890 # Just print a warning and add the library to dependency_libs so
2891 # that the program can be linked against the static library.
2892 $echo
2893 $echo "*** Warning: This system can not link to static lib archive $lib."
2894 $echo "*** I have the capability to make that library automatically link in when"
2895 $echo "*** you link to this library. But I can only do this if you have a"
2896 $echo "*** shared version of the library, which you do not appear to have."
2897 if test "$module" = yes; then
2898 $echo "*** But as you try to build a module library, libtool will still create "
2899 $echo "*** a static module, that should work as long as the dlopening application"
2900 $echo "*** is linked with the -dlopen flag to resolve symbols at runtime."
2901 if test -z "$global_symbol_pipe"; then
2902 $echo
2903 $echo "*** However, this would only work if libtool was able to extract symbol"
2904 $echo "*** lists from a program, using \`nm' or equivalent, but libtool could"
2905 $echo "*** not find such a program. So, this module is probably useless."
2906 $echo "*** \`nm' from GNU binutils and a full rebuild may help."
2907 fi
2908 if test "$build_old_libs" = no; then
2909 build_libtool_libs=module
2910 build_old_libs=yes
2911 else
2912 build_libtool_libs=no
2913 fi
2914 fi
2915 else
2916 convenience="$convenience $dir/$old_library"
2917 old_convenience="$old_convenience $dir/$old_library"
2918 deplibs="$dir/$old_library $deplibs"
2919 link_static=yes
2920 fi
2921 fi # link shared/static library?
2922
2923 if test "$linkmode" = lib; then
2924 if test -n "$dependency_libs" &&
2925 { test "$hardcode_into_libs" != yes || test "$build_old_libs" = yes ||
2926 test "$link_static" = yes; }; then
2927 # Extract -R from dependency_libs
2928 temp_deplibs=
2929 for libdir in $dependency_libs; do
2930 case $libdir in
2931 -R*) temp_xrpath=`$echo "X$libdir" | $Xsed -e 's/^-R//'`
2932 case " $xrpath " in
2933 *" $temp_xrpath "*) ;;
2934 *) xrpath="$xrpath $temp_xrpath";;
2935 esac;;
2936 *) temp_deplibs="$temp_deplibs $libdir";;
2937 esac
2938 done
2939 dependency_libs="$temp_deplibs"
2940 fi
2941
2942 newlib_search_path="$newlib_search_path $absdir"
2943 # Link against this library
2944 test "$link_static" = no && newdependency_libs="$abs_ladir/$laname $newdependency_libs"
2945 # ... and its dependency_libs
2946 tmp_libs=
2947 for deplib in $dependency_libs; do
2948 newdependency_libs="$deplib $newdependency_libs"
2949 if test "X$duplicate_deps" = "Xyes" ; then
2950 case "$tmp_libs " in
2951 *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
2952 esac
2953 fi
2954 tmp_libs="$tmp_libs $deplib"
2955 done
2956
2957 if test "$link_all_deplibs" != no; then
2958 # Add the search paths of all dependency libraries
2959 for deplib in $dependency_libs; do
2960 case $deplib in
2961 -L*) path="$deplib" ;;
2962 *.la)
2963 dir=`$echo "X$deplib" | $Xsed -e 's%/[^/]*$%%'`
2964 test "X$dir" = "X$deplib" && dir="."
2965 # We need an absolute path.
2966 case $dir in
2967 [\\/]* | [A-Za-z]:[\\/]*) absdir="$dir" ;;
2968 *)
2969 absdir=`cd "$dir" && pwd`
2970 if test -z "$absdir"; then
2971 $echo "$modename: warning: cannot determine absolute directory name of \`$dir'" 1>&2
2972 absdir="$dir"
2973 fi
2974 ;;
2975 esac
2976 if grep "^installed=no" $deplib > /dev/null; then
2977 path="$absdir/$objdir"
2978 else
2979 eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
2980 if test -z "$libdir"; then
2981 $echo "$modename: \`$deplib' is not a valid libtool archive" 1>&2
2982 exit 1
2983 fi
2984 if test "$absdir" != "$libdir"; then
2985 $echo "$modename: warning: \`$deplib' seems to be moved" 1>&2
2986 fi
2987 path="$absdir"
2988 fi
2989 depdepl=
2990 case $host in
2991 *-*-darwin*)
2992 # we do not want to link against static libs, but need to link against shared
2993 eval deplibrary_names=`${SED} -n -e 's/^library_names=\(.*\)$/\1/p' $deplib`
2994 if test -n "$deplibrary_names" ; then
2995 for tmp in $deplibrary_names ; do
2996 depdepl=$tmp
2997 done
2998 if test -f "$path/$depdepl" ; then
2999 depdepl="$path/$depdepl"
3000 fi
3001 # do not add paths which are already there
3002 case " $newlib_search_path " in
3003 *" $path "*) ;;
3004 *) newlib_search_path="$newlib_search_path $path";;
3005 esac
3006 fi
3007 path=""
3008 ;;
3009 *)
3010 path="-L$path"
3011 ;;
3012 esac
3013
3014 ;;
3015 -l*)
3016 case $host in
3017 *-*-darwin*)
3018 # Again, we only want to link against shared libraries
3019 eval tmp_libs=`$echo "X$deplib" | $Xsed -e "s,^\-l,,"`
3020 for tmp in $newlib_search_path ; do
3021 if test -f "$tmp/lib$tmp_libs.dylib" ; then
3022 eval depdepl="$tmp/lib$tmp_libs.dylib"
3023 break
3024 fi
3025 done
3026 path=""
3027 ;;
3028 *) continue ;;
3029 esac
3030 ;;
3031 *) continue ;;
3032 esac
3033 case " $deplibs " in
3034 *" $depdepl "*) ;;
3035 *) deplibs="$deplibs $depdepl" ;;
3036 esac
3037 case " $deplibs " in
3038 *" $path "*) ;;
3039 *) deplibs="$deplibs $path" ;;
3040 esac
3041 done
3042 fi # link_all_deplibs != no
3043 fi # linkmode = lib
3044 done # for deplib in $libs
3045 dependency_libs="$newdependency_libs"
3046 if test "$pass" = dlpreopen; then
3047 # Link the dlpreopened libraries before other libraries
3048 for deplib in $save_deplibs; do
3049 deplibs="$deplib $deplibs"
3050 done
3051 fi
3052 if test "$pass" != dlopen; then
3053 if test "$pass" != conv; then
3054 # Make sure lib_search_path contains only unique directories.
3055 lib_search_path=
3056 for dir in $newlib_search_path; do
3057 case "$lib_search_path " in
3058 *" $dir "*) ;;
3059 *) lib_search_path="$lib_search_path $dir" ;;
3060 esac
3061 done
3062 newlib_search_path=
3063 fi
3064
3065 if test "$linkmode,$pass" != "prog,link"; then
3066 vars="deplibs"
3067 else
3068 vars="compile_deplibs finalize_deplibs"
3069 fi
3070 for var in $vars dependency_libs; do
3071 # Add libraries to $var in reverse order
3072 eval tmp_libs=\"\$$var\"
3073 new_libs=
3074 for deplib in $tmp_libs; do
3075 # FIXME: Pedantically, this is the right thing to do, so
3076 # that some nasty dependency loop isn't accidentally
3077 # broken:
3078 #new_libs="$deplib $new_libs"
3079 # Pragmatically, this seems to cause very few problems in
3080 # practice:
3081 case $deplib in
3082 -L*) new_libs="$deplib $new_libs" ;;
3083 -R*) ;;
3084 *)
3085 # And here is the reason: when a library appears more
3086 # than once as an explicit dependence of a library, or
3087 # is implicitly linked in more than once by the
3088 # compiler, it is considered special, and multiple
3089 # occurrences thereof are not removed. Compare this
3090 # with having the same library being listed as a
3091 # dependency of multiple other libraries: in this case,
3092 # we know (pedantically, we assume) the library does not
3093 # need to be listed more than once, so we keep only the
3094 # last copy. This is not always right, but it is rare
3095 # enough that we require users that really mean to play
3096 # such unportable linking tricks to link the library
3097 # using -Wl,-lname, so that libtool does not consider it
3098 # for duplicate removal.
3099 case " $specialdeplibs " in
3100 *" $deplib "*) new_libs="$deplib $new_libs" ;;
3101 *)
3102 case " $new_libs " in
3103 *" $deplib "*) ;;
3104 *) new_libs="$deplib $new_libs" ;;
3105 esac
3106 ;;
3107 esac
3108 ;;
3109 esac
3110 done
3111 tmp_libs=
3112 for deplib in $new_libs; do
3113 case $deplib in
3114 -L*)
3115 case " $tmp_libs " in
3116 *" $deplib "*) ;;
3117 *) tmp_libs="$tmp_libs $deplib" ;;
3118 esac
3119 ;;
3120 *) tmp_libs="$tmp_libs $deplib" ;;
3121 esac
3122 done
3123 eval $var=\"$tmp_libs\"
3124 done # for var
3125 fi
3126 # Last step: remove runtime libs from dependency_libs (they stay in deplibs)
3127 tmp_libs=
3128 for i in $dependency_libs ; do
3129 case " $predeps $postdeps $compiler_lib_search_path " in
3130 *" $i "*)
3131 i=""
3132 ;;
3133 esac
3134 if test -n "$i" ; then
3135 tmp_libs="$tmp_libs $i"
3136 fi
3137 done
3138 dependency_libs=$tmp_libs
3139 done # for pass
3140 if test "$linkmode" = prog; then
3141 dlfiles="$newdlfiles"
3142 dlprefiles="$newdlprefiles"
3143 fi
3144
3145 case $linkmode in
3146 oldlib)
3147 if test -n "$deplibs"; then
3148 $echo "$modename: warning: \`-l' and \`-L' are ignored for archives" 1>&2
3149 fi
3150
3151 if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
3152 $echo "$modename: warning: \`-dlopen' is ignored for archives" 1>&2
3153 fi
3154
3155 if test -n "$rpath"; then
3156 $echo "$modename: warning: \`-rpath' is ignored for archives" 1>&2
3157 fi
3158
3159 if test -n "$xrpath"; then
3160 $echo "$modename: warning: \`-R' is ignored for archives" 1>&2
3161 fi
3162
3163 if test -n "$vinfo"; then
3164 $echo "$modename: warning: \`-version-info/-version-number' is ignored for archives" 1>&2
3165 fi
3166
3167 if test -n "$release"; then
3168 $echo "$modename: warning: \`-release' is ignored for archives" 1>&2
3169 fi
3170
3171 if test -n "$export_symbols" || test -n "$export_symbols_regex"; then
3172 $echo "$modename: warning: \`-export-symbols' is ignored for archives" 1>&2
3173 fi
3174
3175 # Now set the variables for building old libraries.
3176 build_libtool_libs=no
3177 oldlibs="$output"
3178 objs="$objs$old_deplibs"
3179 ;;
3180
3181 lib)
3182 # Make sure we only generate libraries of the form `libNAME.la'.
3183 case $outputname in
3184 lib*)
3185 name=`$echo "X$outputname" | $Xsed -e 's/\.la$//' -e 's/^lib//'`
3186 eval shared_ext=\"$shrext\"
3187 eval libname=\"$libname_spec\"
3188 ;;
3189 *)
3190 if test "$module" = no; then
3191 $echo "$modename: libtool library \`$output' must begin with \`lib'" 1>&2
3192 $echo "$help" 1>&2
3193 exit 1
3194 fi
3195 if test "$need_lib_prefix" != no; then
3196 # Add the "lib" prefix for modules if required
3197 name=`$echo "X$outputname" | $Xsed -e 's/\.la$//'`
3198 eval shared_ext=\"$shrext\"
3199 eval libname=\"$libname_spec\"
3200 else
3201 libname=`$echo "X$outputname" | $Xsed -e 's/\.la$//'`
3202 fi
3203 ;;
3204 esac
3205
3206 if test -n "$objs"; then
3207 if test "$deplibs_check_method" != pass_all; then
3208 $echo "$modename: cannot build libtool library \`$output' from non-libtool objects on this host:$objs" 2>&1
3209 exit 1
3210 else
3211 $echo
3212 $echo "*** Warning: Linking the shared library $output against the non-libtool"
3213 $echo "*** objects $objs is not portable!"
3214 libobjs="$libobjs $objs"
3215 fi
3216 fi
3217
3218 if test "$dlself" != no; then
3219 $echo "$modename: warning: \`-dlopen self' is ignored for libtool libraries" 1>&2
3220 fi
3221
3222 set dummy $rpath
3223 if test "$#" -gt 2; then
3224 $echo "$modename: warning: ignoring multiple \`-rpath's for a libtool library" 1>&2
3225 fi
3226 install_libdir="$2"
3227
3228 oldlibs=
3229 if test -z "$rpath"; then
3230 if test "$build_libtool_libs" = yes; then
3231 # Building a libtool convenience library.
3232 # Some compilers have problems with a `.al' extension so
3233 # convenience libraries should have the same extension an
3234 # archive normally would.
3235 oldlibs="$output_objdir/$libname.$libext $oldlibs"
3236 build_libtool_libs=convenience
3237 build_old_libs=yes
3238 fi
3239
3240 if test -n "$vinfo"; then
3241 $echo "$modename: warning: \`-version-info/-version-number' is ignored for convenience libraries" 1>&2
3242 fi
3243
3244 if test -n "$release"; then
3245 $echo "$modename: warning: \`-release' is ignored for convenience libraries" 1>&2
3246 fi
3247 else
3248
3249 # Parse the version information argument.
3250 save_ifs="$IFS"; IFS=':'
3251 set dummy $vinfo 0 0 0
3252 IFS="$save_ifs"
3253
3254 if test -n "$8"; then
3255 $echo "$modename: too many parameters to \`-version-info'" 1>&2
3256 $echo "$help" 1>&2
3257 exit 1
3258 fi
3259
3260 # convert absolute version numbers to libtool ages
3261 # this retains compatibility with .la files and attempts
3262 # to make the code below a bit more comprehensible
3263
3264 case $vinfo_number in
3265 yes)
3266 number_major="$2"
3267 number_minor="$3"
3268 number_revision="$4"
3269 #
3270 # There are really only two kinds -- those that
3271 # use the current revision as the major version
3272 # and those that subtract age and use age as
3273 # a minor version. But, then there is irix
3274 # which has an extra 1 added just for fun
3275 #
3276 case $version_type in
3277 darwin|linux|osf|windows)
3278 current=`expr $number_major + $number_minor`
3279 age="$number_minor"
3280 revision="$number_revision"
3281 ;;
3282 freebsd-aout|freebsd-elf|sunos)
3283 current="$number_major"
3284 revision="$number_minor"
3285 age="0"
3286 ;;
3287 irix|nonstopux)
3288 current=`expr $number_major + $number_minor - 1`
3289 age="$number_minor"
3290 revision="$number_minor"
3291 ;;
3292 esac
3293 ;;
3294 no)
3295 current="$2"
3296 revision="$3"
3297 age="$4"
3298 ;;
3299 esac
3300
3301 # Check that each of the things are valid numbers.
3302 case $current in
3303 [0-9]*) ;;
3304 *)
3305 $echo "$modename: CURRENT \`$current' is not a nonnegative integer" 1>&2
3306 $echo "$modename: \`$vinfo' is not valid version information" 1>&2
3307 exit 1
3308 ;;
3309 esac
3310
3311 case $revision in
3312 [0-9]*) ;;
3313 *)
3314 $echo "$modename: REVISION \`$revision' is not a nonnegative integer" 1>&2
3315 $echo "$modename: \`$vinfo' is not valid version information" 1>&2
3316 exit 1
3317 ;;
3318 esac
3319
3320 case $age in
3321 [0-9]*) ;;
3322 *)
3323 $echo "$modename: AGE \`$age' is not a nonnegative integer" 1>&2
3324 $echo "$modename: \`$vinfo' is not valid version information" 1>&2
3325 exit 1
3326 ;;
3327 esac
3328
3329 if test "$age" -gt "$current"; then
3330 $echo "$modename: AGE \`$age' is greater than the current interface number \`$current'" 1>&2
3331 $echo "$modename: \`$vinfo' is not valid version information" 1>&2
3332 exit 1
3333 fi
3334
3335 # Calculate the version variables.
3336 major=
3337 versuffix=
3338 verstring=
3339 case $version_type in
3340 none) ;;
3341
3342 darwin)
3343 # Like Linux, but with the current version available in
3344 # verstring for coding it into the library header
3345 major=.`expr $current - $age`
3346 versuffix="$major.$age.$revision"
3347 # Darwin ld doesn't like 0 for these options...
3348 minor_current=`expr $current + 1`
3349 verstring="-compatibility_version $minor_current -current_version $minor_current.$revision"
3350 ;;
3351
3352 freebsd-aout)
3353 major=".$current"
3354 versuffix=".$current.$revision";
3355 ;;
3356
3357 freebsd-elf)
3358 major=".$current"
3359 versuffix=".$current";
3360 ;;
3361
3362 irix | nonstopux)
3363 major=`expr $current - $age + 1`
3364
3365 case $version_type in
3366 nonstopux) verstring_prefix=nonstopux ;;
3367 *) verstring_prefix=sgi ;;
3368 esac
3369 verstring="$verstring_prefix$major.$revision"
3370
3371 # Add in all the interfaces that we are compatible with.
3372 loop=$revision
3373 while test "$loop" -ne 0; do
3374 iface=`expr $revision - $loop`
3375 loop=`expr $loop - 1`
3376 verstring="$verstring_prefix$major.$iface:$verstring"
3377 done
3378
3379 # Before this point, $major must not contain `.'.
3380 major=.$major
3381 versuffix="$major.$revision"
3382 ;;
3383
3384 linux)
3385 major=.`expr $current - $age`
3386 versuffix="$major.$age.$revision"
3387 ;;
3388
3389 osf)
3390 major=.`expr $current - $age`
3391 versuffix=".$current.$age.$revision"
3392 verstring="$current.$age.$revision"
3393
3394 # Add in all the interfaces that we are compatible with.
3395 loop=$age
3396 while test "$loop" -ne 0; do
3397 iface=`expr $current - $loop`
3398 loop=`expr $loop - 1`
3399 verstring="$verstring:${iface}.0"
3400 done
3401
3402 # Make executables depend on our current version.
3403 verstring="$verstring:${current}.0"
3404 ;;
3405
3406 sunos)
3407 major=".$current"
3408 versuffix=".$current.$revision"
3409 ;;
3410
3411 windows)
3412 # Use '-' rather than '.', since we only want one
3413 # extension on DOS 8.3 filesystems.
3414 major=`expr $current - $age`
3415 versuffix="-$major"
3416 ;;
3417
3418 *)
3419 $echo "$modename: unknown library version type \`$version_type'" 1>&2
3420 $echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2
3421 exit 1
3422 ;;
3423 esac
3424
3425 # Clear the version info if we defaulted, and they specified a release.
3426 if test -z "$vinfo" && test -n "$release"; then
3427 major=
3428 case $version_type in
3429 darwin)
3430 # we can't check for "0.0" in archive_cmds due to quoting
3431 # problems, so we reset it completely
3432 verstring=
3433 ;;
3434 *)
3435 verstring="0.0"
3436 ;;
3437 esac
3438 if test "$need_version" = no; then
3439 versuffix=
3440 else
3441 versuffix=".0.0"
3442 fi
3443 fi
3444
3445 # Remove version info from name if versioning should be avoided
3446 if test "$avoid_version" = yes && test "$need_version" = no; then
3447 major=
3448 versuffix=
3449 verstring=""
3450 fi
3451
3452 # Check to see if the archive will have undefined symbols.
3453 if test "$allow_undefined" = yes; then
3454 if test "$allow_undefined_flag" = unsupported; then
3455 $echo "$modename: warning: undefined symbols not allowed in $host shared libraries" 1>&2
3456 build_libtool_libs=no
3457 build_old_libs=yes
3458 fi
3459 else
3460 # Don't allow undefined symbols.
3461 allow_undefined_flag="$no_undefined_flag"
3462 fi
3463 fi
3464
3465 if test "$mode" != relink; then
3466 # Remove our outputs, but don't remove object files since they
3467 # may have been created when compiling PIC objects.
3468 removelist=
3469 tempremovelist=`$echo "$output_objdir/*"`
3470 for p in $tempremovelist; do
3471 case $p in
3472 *.$objext)
3473 ;;
3474 $output_objdir/$outputname | $output_objdir/$libname.* | $output_objdir/${libname}${release}.*)
3475 if echo $p | $EGREP -e "$precious_files_regex" >/dev/null 2>&1
3476 then
3477 continue
3478 fi
3479 removelist="$removelist $p"
3480 ;;
3481 *) ;;
3482 esac
3483 done
3484 if test -n "$removelist"; then
3485 $show "${rm}r $removelist"
3486 $run ${rm}r $removelist
3487 fi
3488 fi
3489
3490 # Now set the variables for building old libraries.
3491 if test "$build_old_libs" = yes && test "$build_libtool_libs" != convenience ; then
3492 oldlibs="$oldlibs $output_objdir/$libname.$libext"
3493
3494 # Transform .lo files to .o files.
3495 oldobjs="$objs "`$echo "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}'$/d' -e "$lo2o" | $NL2SP`
3496 fi
3497
3498 # Eliminate all temporary directories.
3499 for path in $notinst_path; do
3500 lib_search_path=`$echo "$lib_search_path " | ${SED} -e 's% $path % %g'`
3501 deplibs=`$echo "$deplibs " | ${SED} -e 's% -L$path % %g'`
3502 dependency_libs=`$echo "$dependency_libs " | ${SED} -e 's% -L$path % %g'`
3503 done
3504
3505 if test -n "$xrpath"; then
3506 # If the user specified any rpath flags, then add them.
3507 temp_xrpath=
3508 for libdir in $xrpath; do
3509 temp_xrpath="$temp_xrpath -R$libdir"
3510 case "$finalize_rpath " in
3511 *" $libdir "*) ;;
3512 *) finalize_rpath="$finalize_rpath $libdir" ;;
3513 esac
3514 done
3515 if test "$hardcode_into_libs" != yes || test "$build_old_libs" = yes; then
3516 dependency_libs="$temp_xrpath $dependency_libs"
3517 fi
3518 fi
3519
3520 # Make sure dlfiles contains only unique files that won't be dlpreopened
3521 old_dlfiles="$dlfiles"
3522 dlfiles=
3523 for lib in $old_dlfiles; do
3524 case " $dlprefiles $dlfiles " in
3525 *" $lib "*) ;;
3526 *) dlfiles="$dlfiles $lib" ;;
3527 esac
3528 done
3529
3530 # Make sure dlprefiles contains only unique files
3531 old_dlprefiles="$dlprefiles"
3532 dlprefiles=
3533 for lib in $old_dlprefiles; do
3534 case "$dlprefiles " in
3535 *" $lib "*) ;;
3536 *) dlprefiles="$dlprefiles $lib" ;;
3537 esac
3538 done
3539
3540 if test "$build_libtool_libs" = yes; then
3541 if test -n "$rpath"; then
3542 case $host in
3543 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-beos*)
3544 # these systems don't actually have a c library (as such)!
3545 ;;
3546 *-*-rhapsody* | *-*-darwin1.[012])
3547 # Rhapsody C library is in the System framework
3548 deplibs="$deplibs -framework System"
3549 ;;
3550 *-*-netbsd*)
3551 # Don't link with libc until the a.out ld.so is fixed.
3552 ;;
3553 *-*-openbsd* | *-*-freebsd*)
3554 # Do not include libc due to us having libc/libc_r.
3555 test "X$arg" = "X-lc" && continue
3556 ;;
3557 *)
3558 # Add libc to deplibs on all other systems if necessary.
3559 if test "$build_libtool_need_lc" = "yes"; then
3560 deplibs="$deplibs -lc"
3561 fi
3562 ;;
3563 esac
3564 fi
3565
3566 # Transform deplibs into only deplibs that can be linked in shared.
3567 name_save=$name
3568 libname_save=$libname
3569 release_save=$release
3570 versuffix_save=$versuffix
3571 major_save=$major
3572 # I'm not sure if I'm treating the release correctly. I think
3573 # release should show up in the -l (ie -lgmp5) so we don't want to
3574 # add it in twice. Is that correct?
3575 release=""
3576 versuffix=""
3577 major=""
3578 newdeplibs=
3579 droppeddeps=no
3580 case $deplibs_check_method in
3581 pass_all)
3582 # Don't check for shared/static. Everything works.
3583 # This might be a little naive. We might want to check
3584 # whether the library exists or not. But this is on
3585 # osf3 & osf4 and I'm not really sure... Just
3586 # implementing what was already the behavior.
3587 newdeplibs=$deplibs
3588 ;;
3589 test_compile)
3590 # This code stresses the "libraries are programs" paradigm to its
3591 # limits. Maybe even breaks it. We compile a program, linking it
3592 # against the deplibs as a proxy for the library. Then we can check
3593 # whether they linked in statically or dynamically with ldd.
3594 $rm conftest.c
3595 cat > conftest.c <<EOF
3596 int main() { return 0; }
3597 EOF
3598 $rm conftest
3599 $LTCC -o conftest conftest.c $deplibs
3600 if test "$?" -eq 0 ; then
3601 ldd_output=`ldd conftest`
3602 for i in $deplibs; do
3603 name="`expr $i : '-l\(.*\)'`"
3604 # If $name is empty we are operating on a -L argument.
3605 if test "$name" != "" && test "$name" -ne "0"; then
3606 if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
3607 case " $predeps $postdeps " in
3608 *" $i "*)
3609 newdeplibs="$newdeplibs $i"
3610 i=""
3611 ;;
3612 esac
3613 fi
3614 if test -n "$i" ; then
3615 libname=`eval \\$echo \"$libname_spec\"`
3616 deplib_matches=`eval \\$echo \"$library_names_spec\"`
3617 set dummy $deplib_matches
3618 deplib_match=$2
3619 if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then
3620 newdeplibs="$newdeplibs $i"
3621 else
3622 droppeddeps=yes
3623 $echo
3624 $echo "*** Warning: dynamic linker does not accept needed library $i."
3625 $echo "*** I have the capability to make that library automatically link in when"
3626 $echo "*** you link to this library. But I can only do this if you have a"
3627 $echo "*** shared version of the library, which I believe you do not have"
3628 $echo "*** because a test_compile did reveal that the linker did not use it for"
3629 $echo "*** its dynamic dependency list that programs get resolved with at runtime."
3630 fi
3631 fi
3632 else
3633 newdeplibs="$newdeplibs $i"
3634 fi
3635 done
3636 else
3637 # Error occurred in the first compile. Let's try to salvage
3638 # the situation: Compile a separate program for each library.
3639 for i in $deplibs; do
3640 name="`expr $i : '-l\(.*\)'`"
3641 # If $name is empty we are operating on a -L argument.
3642 if test "$name" != "" && test "$name" != "0"; then
3643 $rm conftest
3644 $LTCC -o conftest conftest.c $i
3645 # Did it work?
3646 if test "$?" -eq 0 ; then
3647 ldd_output=`ldd conftest`
3648 if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
3649 case " $predeps $postdeps " in
3650 *" $i "*)
3651 newdeplibs="$newdeplibs $i"
3652 i=""
3653 ;;
3654 esac
3655 fi
3656 if test -n "$i" ; then
3657 libname=`eval \\$echo \"$libname_spec\"`
3658 deplib_matches=`eval \\$echo \"$library_names_spec\"`
3659 set dummy $deplib_matches
3660 deplib_match=$2
3661 if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then
3662 newdeplibs="$newdeplibs $i"
3663 else
3664 droppeddeps=yes
3665 $echo
3666 $echo "*** Warning: dynamic linker does not accept needed library $i."
3667 $echo "*** I have the capability to make that library automatically link in when"
3668 $echo "*** you link to this library. But I can only do this if you have a"
3669 $echo "*** shared version of the library, which you do not appear to have"
3670 $echo "*** because a test_compile did reveal that the linker did not use this one"
3671 $echo "*** as a dynamic dependency that programs can get resolved with at runtime."
3672 fi
3673 fi
3674 else
3675 droppeddeps=yes
3676 $echo
3677 $echo "*** Warning! Library $i is needed by this library but I was not able to"
3678 $echo "*** make it link in! You will probably need to install it or some"
3679 $echo "*** library that it depends on before this library will be fully"
3680 $echo "*** functional. Installing it before continuing would be even better."
3681 fi
3682 else
3683 newdeplibs="$newdeplibs $i"
3684 fi
3685 done
3686 fi
3687 ;;
3688 file_magic*)
3689 set dummy $deplibs_check_method
3690 file_magic_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"`
3691 for a_deplib in $deplibs; do
3692 name="`expr $a_deplib : '-l\(.*\)'`"
3693 # If $name is empty we are operating on a -L argument.
3694 if test "$name" != "" && test "$name" != "0"; then
3695 if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
3696 case " $predeps $postdeps " in
3697 *" $a_deplib "*)
3698 newdeplibs="$newdeplibs $a_deplib"
3699 a_deplib=""
3700 ;;
3701 esac
3702 fi
3703 if test -n "$a_deplib" ; then
3704 libname=`eval \\$echo \"$libname_spec\"`
3705 for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
3706 potential_libs=`ls $i/$libname[.-]* 2>/dev/null`
3707 for potent_lib in $potential_libs; do
3708 # Follow soft links.
3709 if ls -lLd "$potent_lib" 2>/dev/null \
3710 | grep " -> " >/dev/null; then
3711 continue
3712 fi
3713 # The statement above tries to avoid entering an
3714 # endless loop below, in case of cyclic links.
3715 # We might still enter an endless loop, since a link
3716 # loop can be closed while we follow links,
3717 # but so what?
3718 potlib="$potent_lib"
3719 while test -h "$potlib" 2>/dev/null; do
3720 potliblink=`ls -ld $potlib | ${SED} 's/.* -> //'`
3721 case $potliblink in
3722 [\\/]* | [A-Za-z]:[\\/]*) potlib="$potliblink";;
3723 *) potlib=`$echo "X$potlib" | $Xsed -e 's,[^/]*$,,'`"$potliblink";;
3724 esac
3725 done
3726 # It is ok to link against an archive when
3727 # building a shared library.
3728 if $AR -t $potlib > /dev/null 2>&1; then
3729 newdeplibs="$newdeplibs $a_deplib"
3730 a_deplib=""
3731 break 2
3732 fi
3733 if eval $file_magic_cmd \"\$potlib\" 2>/dev/null \
3734 | ${SED} 10q \
3735 | $EGREP "$file_magic_regex" > /dev/null; then
3736 newdeplibs="$newdeplibs $a_deplib"
3737 a_deplib=""
3738 break 2
3739 fi
3740 done
3741 done
3742 fi
3743 if test -n "$a_deplib" ; then
3744 droppeddeps=yes
3745 $echo
3746 $echo "*** Warning: linker path does not have real file for library $a_deplib."
3747 $echo "*** I have the capability to make that library automatically link in when"
3748 $echo "*** you link to this library. But I can only do this if you have a"
3749 $echo "*** shared version of the library, which you do not appear to have"
3750 $echo "*** because I did check the linker path looking for a file starting"
3751 if test -z "$potlib" ; then
3752 $echo "*** with $libname but no candidates were found. (...for file magic test)"
3753 else
3754 $echo "*** with $libname and none of the candidates passed a file format test"
3755 $echo "*** using a file magic. Last file checked: $potlib"
3756 fi
3757 fi
3758 else
3759 # Add a -L argument.
3760 newdeplibs="$newdeplibs $a_deplib"
3761 fi
3762 done # Gone through all deplibs.
3763 ;;
3764 match_pattern*)
3765 set dummy $deplibs_check_method
3766 match_pattern_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"`
3767 for a_deplib in $deplibs; do
3768 name="`expr $a_deplib : '-l\(.*\)'`"
3769 # If $name is empty we are operating on a -L argument.
3770 if test -n "$name" && test "$name" != "0"; then
3771 if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
3772 case " $predeps $postdeps " in
3773 *" $a_deplib "*)
3774 newdeplibs="$newdeplibs $a_deplib"
3775 a_deplib=""
3776 ;;
3777 esac
3778 fi
3779 if test -n "$a_deplib" ; then
3780 libname=`eval \\$echo \"$libname_spec\"`
3781 for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
3782 potential_libs=`ls $i/$libname[.-]* 2>/dev/null`
3783 for potent_lib in $potential_libs; do
3784 potlib="$potent_lib" # see symlink-check above in file_magic test
3785 if eval $echo \"$potent_lib\" 2>/dev/null \
3786 | ${SED} 10q \
3787 | $EGREP "$match_pattern_regex" > /dev/null; then
3788 newdeplibs="$newdeplibs $a_deplib"
3789 a_deplib=""
3790 break 2
3791 fi
3792 done
3793 done
3794 fi
3795 if test -n "$a_deplib" ; then
3796 droppeddeps=yes
3797 $echo
3798 $echo "*** Warning: linker path does not have real file for library $a_deplib."
3799 $echo "*** I have the capability to make that library automatically link in when"
3800 $echo "*** you link to this library. But I can only do this if you have a"
3801 $echo "*** shared version of the library, which you do not appear to have"
3802 $echo "*** because I did check the linker path looking for a file starting"
3803 if test -z "$potlib" ; then
3804 $echo "*** with $libname but no candidates were found. (...for regex pattern test)"
3805 else
3806 $echo "*** with $libname and none of the candidates passed a file format test"
3807 $echo "*** using a regex pattern. Last file checked: $potlib"
3808 fi
3809 fi
3810 else
3811 # Add a -L argument.
3812 newdeplibs="$newdeplibs $a_deplib"
3813 fi
3814 done # Gone through all deplibs.
3815 ;;
3816 none | unknown | *)
3817 newdeplibs=""
3818 tmp_deplibs=`$echo "X $deplibs" | $Xsed -e 's/ -lc$//' \
3819 -e 's/ -[LR][^ ]*//g'`
3820 if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
3821 for i in $predeps $postdeps ; do
3822 # can't use Xsed below, because $i might contain '/'
3823 tmp_deplibs=`$echo "X $tmp_deplibs" | ${SED} -e "1s,^X,," -e "s,$i,,"`
3824 done
3825 fi
3826 if $echo "X $tmp_deplibs" | $Xsed -e 's/[ ]//g' \
3827 | grep . >/dev/null; then
3828 $echo
3829 if test "X$deplibs_check_method" = "Xnone"; then
3830 $echo "*** Warning: inter-library dependencies are not supported in this platform."
3831 else
3832 $echo "*** Warning: inter-library dependencies are not known to be supported."
3833 fi
3834 $echo "*** All declared inter-library dependencies are being dropped."
3835 droppeddeps=yes
3836 fi
3837 ;;
3838 esac
3839 versuffix=$versuffix_save
3840 major=$major_save
3841 release=$release_save
3842 libname=$libname_save
3843 name=$name_save
3844
3845 case $host in
3846 *-*-rhapsody* | *-*-darwin1.[012])
3847 # On Rhapsody replace the C library is the System framework
3848 newdeplibs=`$echo "X $newdeplibs" | $Xsed -e 's/ -lc / -framework System /'`
3849 ;;
3850 esac
3851
3852 if test "$droppeddeps" = yes; then
3853 if test "$module" = yes; then
3854 $echo
3855 $echo "*** Warning: libtool could not satisfy all declared inter-library"
3856 $echo "*** dependencies of module $libname. Therefore, libtool will create"
3857 $echo "*** a static module, that should work as long as the dlopening"
3858 $echo "*** application is linked with the -dlopen flag."
3859 if test -z "$global_symbol_pipe"; then
3860 $echo
3861 $echo "*** However, this would only work if libtool was able to extract symbol"
3862 $echo "*** lists from a program, using \`nm' or equivalent, but libtool could"
3863 $echo "*** not find such a program. So, this module is probably useless."
3864 $echo "*** \`nm' from GNU binutils and a full rebuild may help."
3865 fi
3866 if test "$build_old_libs" = no; then
3867 oldlibs="$output_objdir/$libname.$libext"
3868 build_libtool_libs=module
3869 build_old_libs=yes
3870 else
3871 build_libtool_libs=no
3872 fi
3873 else
3874 $echo "*** The inter-library dependencies that have been dropped here will be"
3875 $echo "*** automatically added whenever a program is linked with this library"
3876 $echo "*** or is declared to -dlopen it."
3877
3878 if test "$allow_undefined" = no; then
3879 $echo
3880 $echo "*** Since this library must not contain undefined symbols,"
3881 $echo "*** because either the platform does not support them or"
3882 $echo "*** it was explicitly requested with -no-undefined,"
3883 $echo "*** libtool will only create a static version of it."
3884 if test "$build_old_libs" = no; then
3885 oldlibs="$output_objdir/$libname.$libext"
3886 build_libtool_libs=module
3887 build_old_libs=yes
3888 else
3889 build_libtool_libs=no
3890 fi
3891 fi
3892 fi
3893 fi
3894 # Done checking deplibs!
3895 deplibs=$newdeplibs
3896 fi
3897
3898 # All the library-specific variables (install_libdir is set above).
3899 library_names=
3900 old_library=
3901 dlname=
3902
3903 # Test again, we may have decided not to build it any more
3904 if test "$build_libtool_libs" = yes; then
3905 if test "$hardcode_into_libs" = yes; then
3906 # Hardcode the library paths
3907 hardcode_libdirs=
3908 dep_rpath=
3909 rpath="$finalize_rpath"
3910 test "$mode" != relink && rpath="$compile_rpath$rpath"
3911 for libdir in $rpath; do
3912 if test -n "$hardcode_libdir_flag_spec"; then
3913 if test -n "$hardcode_libdir_separator"; then
3914 if test -z "$hardcode_libdirs"; then
3915 hardcode_libdirs="$libdir"
3916 else
3917 # Just accumulate the unique libdirs.
3918 case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
3919 *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
3920 ;;
3921 *)
3922 hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
3923 ;;
3924 esac
3925 fi
3926 else
3927 eval flag=\"$hardcode_libdir_flag_spec\"
3928 dep_rpath="$dep_rpath $flag"
3929 fi
3930 elif test -n "$runpath_var"; then
3931 case "$perm_rpath " in
3932 *" $libdir "*) ;;
3933 *) perm_rpath="$perm_rpath $libdir" ;;
3934 esac
3935 fi
3936 done
3937 # Substitute the hardcoded libdirs into the rpath.
3938 if test -n "$hardcode_libdir_separator" &&
3939 test -n "$hardcode_libdirs"; then
3940 libdir="$hardcode_libdirs"
3941 if test -n "$hardcode_libdir_flag_spec_ld"; then
3942 eval dep_rpath=\"$hardcode_libdir_flag_spec_ld\"
3943 else
3944 eval dep_rpath=\"$hardcode_libdir_flag_spec\"
3945 fi
3946 fi
3947 if test -n "$runpath_var" && test -n "$perm_rpath"; then
3948 # We should set the runpath_var.
3949 rpath=
3950 for dir in $perm_rpath; do
3951 rpath="$rpath$dir:"
3952 done
3953 eval "$runpath_var='$rpath\$$runpath_var'; export $runpath_var"
3954 fi
3955 test -n "$dep_rpath" && deplibs="$dep_rpath $deplibs"
3956 fi
3957
3958 shlibpath="$finalize_shlibpath"
3959 test "$mode" != relink && shlibpath="$compile_shlibpath$shlibpath"
3960 if test -n "$shlibpath"; then
3961 eval "$shlibpath_var='$shlibpath\$$shlibpath_var'; export $shlibpath_var"
3962 fi
3963
3964 # Get the real and link names of the library.
3965 eval shared_ext=\"$shrext\"
3966 eval library_names=\"$library_names_spec\"
3967 set dummy $library_names
3968 realname="$2"
3969 shift; shift
3970
3971 if test -n "$soname_spec"; then
3972 eval soname=\"$soname_spec\"
3973 else
3974 soname="$realname"
3975 fi
3976 if test -z "$dlname"; then
3977 dlname=$soname
3978 fi
3979
3980 lib="$output_objdir/$realname"
3981 for link
3982 do
3983 linknames="$linknames $link"
3984 done
3985
3986 # Use standard objects if they are pic
3987 test -z "$pic_flag" && libobjs=`$echo "X$libobjs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
3988
3989 # Prepare the list of exported symbols
3990 if test -z "$export_symbols"; then
3991 if test "$always_export_symbols" = yes || test -n "$export_symbols_regex"; then
3992 $show "generating symbol list for \`$libname.la'"
3993 export_symbols="$output_objdir/$libname.exp"
3994 $run $rm $export_symbols
3995 cmds=$export_symbols_cmds
3996 save_ifs="$IFS"; IFS='~'
3997 for cmd in $cmds; do
3998 IFS="$save_ifs"
3999 eval cmd=\"$cmd\"
4000 if len=`expr "X$cmd" : ".*"` &&
4001 test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then
4002 $show "$cmd"
4003 $run eval "$cmd" || exit $?
4004 skipped_export=false
4005 else
4006 # The command line is too long to execute in one step.
4007 $show "using reloadable object file for export list..."
4008 skipped_export=:
4009 fi
4010 done
4011 IFS="$save_ifs"
4012 if test -n "$export_symbols_regex"; then
4013 $show "$EGREP -e \"$export_symbols_regex\" \"$export_symbols\" > \"${export_symbols}T\""
4014 $run eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"'
4015 $show "$mv \"${export_symbols}T\" \"$export_symbols\""
4016 $run eval '$mv "${export_symbols}T" "$export_symbols"'
4017 fi
4018 fi
4019 fi
4020
4021 if test -n "$export_symbols" && test -n "$include_expsyms"; then
4022 $run eval '$echo "X$include_expsyms" | $SP2NL >> "$export_symbols"'
4023 fi
4024
4025 tmp_deplibs=
4026 for test_deplib in $deplibs; do
4027 case " $convenience " in
4028 *" $test_deplib "*) ;;
4029 *)
4030 tmp_deplibs="$tmp_deplibs $test_deplib"
4031 ;;
4032 esac
4033 done
4034 deplibs="$tmp_deplibs"
4035
4036 if test -n "$convenience"; then
4037 if test -n "$whole_archive_flag_spec"; then
4038 save_libobjs=$libobjs
4039 eval libobjs=\"\$libobjs $whole_archive_flag_spec\"
4040 else
4041 gentop="$output_objdir/${outputname}x"
4042 $show "${rm}r $gentop"
4043 $run ${rm}r "$gentop"
4044 $show "$mkdir $gentop"
4045 $run $mkdir "$gentop"
4046 status=$?
4047 if test "$status" -ne 0 && test ! -d "$gentop"; then
4048 exit $status
4049 fi
4050 generated="$generated $gentop"
4051
4052 for xlib in $convenience; do
4053 # Extract the objects.
4054 case $xlib in
4055 [\\/]* | [A-Za-z]:[\\/]*) xabs="$xlib" ;;
4056 *) xabs=`pwd`"/$xlib" ;;
4057 esac
4058 xlib=`$echo "X$xlib" | $Xsed -e 's%^.*/%%'`
4059 xdir="$gentop/$xlib"
4060
4061 $show "${rm}r $xdir"
4062 $run ${rm}r "$xdir"
4063 $show "$mkdir $xdir"
4064 $run $mkdir "$xdir"
4065 status=$?
4066 if test "$status" -ne 0 && test ! -d "$xdir"; then
4067 exit $status
4068 fi
4069 # We will extract separately just the conflicting names and we will no
4070 # longer touch any unique names. It is faster to leave these extract
4071 # automatically by $AR in one run.
4072 $show "(cd $xdir && $AR x $xabs)"
4073 $run eval "(cd \$xdir && $AR x \$xabs)" || exit $?
4074 if ($AR t "$xabs" | sort | sort -uc >/dev/null 2>&1); then
4075 :
4076 else
4077 $echo "$modename: warning: object name conflicts; renaming object files" 1>&2
4078 $echo "$modename: warning: to ensure that they will not overwrite" 1>&2
4079 $AR t "$xabs" | sort | uniq -cd | while read -r count name
4080 do
4081 i=1
4082 while test "$i" -le "$count"
4083 do
4084 # Put our $i before any first dot (extension)
4085 # Never overwrite any file
4086 name_to="$name"
4087 while test "X$name_to" = "X$name" || test -f "$xdir/$name_to"
4088 do
4089 name_to=`$echo "X$name_to" | $Xsed -e "s/\([^.]*\)/\1-$i/"`
4090 done
4091 $show "(cd $xdir && $AR xN $i $xabs '$name' && $mv '$name' '$name_to')"
4092 $run eval "(cd \$xdir && $AR xN $i \$xabs '$name' && $mv '$name' '$name_to')" || exit $?
4093 i=`expr $i + 1`
4094 done
4095 done
4096 fi
4097
4098 libobjs="$libobjs "`find $xdir -name \*.$objext -print -o -name \*.lo -print | $NL2SP`
4099 done
4100 fi
4101 fi
4102
4103 if test "$thread_safe" = yes && test -n "$thread_safe_flag_spec"; then
4104 eval flag=\"$thread_safe_flag_spec\"
4105 linker_flags="$linker_flags $flag"
4106 fi
4107
4108 # Make a backup of the uninstalled library when relinking
4109 if test "$mode" = relink; then
4110 $run eval '(cd $output_objdir && $rm ${realname}U && $mv $realname ${realname}U)' || exit $?
4111 fi
4112
4113 # Do each of the archive commands.
4114 if test "$module" = yes && test -n "$module_cmds" ; then
4115 if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then
4116 eval test_cmds=\"$module_expsym_cmds\"
4117 cmds=$module_expsym_cmds
4118 else
4119 eval test_cmds=\"$module_cmds\"
4120 cmds=$module_cmds
4121 fi
4122 else
4123 if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
4124 eval test_cmds=\"$archive_expsym_cmds\"
4125 cmds=$archive_expsym_cmds
4126 else
4127 eval test_cmds=\"$archive_cmds\"
4128 cmds=$archive_cmds
4129 fi
4130 fi
4131
4132 if test "X$skipped_export" != "X:" && len=`expr "X$test_cmds" : ".*"` &&
4133 test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then
4134 :
4135 else
4136 # The command line is too long to link in one step, link piecewise.
4137 $echo "creating reloadable object files..."
4138
4139 # Save the value of $output and $libobjs because we want to
4140 # use them later. If we have whole_archive_flag_spec, we
4141 # want to use save_libobjs as it was before
4142 # whole_archive_flag_spec was expanded, because we can't
4143 # assume the linker understands whole_archive_flag_spec.
4144 # This may have to be revisited, in case too many
4145 # convenience libraries get linked in and end up exceeding
4146 # the spec.
4147 if test -z "$convenience" || test -z "$whole_archive_flag_spec"; then
4148 save_libobjs=$libobjs
4149 fi
4150 save_output=$output
4151
4152 # Clear the reloadable object creation command queue and
4153 # initialize k to one.
4154 test_cmds=
4155 concat_cmds=
4156 objlist=
4157 delfiles=
4158 last_robj=
4159 k=1
4160 output=$output_objdir/$save_output-${k}.$objext
4161 # Loop over the list of objects to be linked.
4162 for obj in $save_libobjs
4163 do
4164 eval test_cmds=\"$reload_cmds $objlist $last_robj\"
4165 if test "X$objlist" = X ||
4166 { len=`expr "X$test_cmds" : ".*"` &&
4167 test "$len" -le "$max_cmd_len"; }; then
4168 objlist="$objlist $obj"
4169 else
4170 # The command $test_cmds is almost too long, add a
4171 # command to the queue.
4172 if test "$k" -eq 1 ; then
4173 # The first file doesn't have a previous command to add.
4174 eval concat_cmds=\"$reload_cmds $objlist $last_robj\"
4175 else
4176 # All subsequent reloadable object files will link in
4177 # the last one created.
4178 eval concat_cmds=\"\$concat_cmds~$reload_cmds $objlist $last_robj\"
4179 fi
4180 last_robj=$output_objdir/$save_output-${k}.$objext
4181 k=`expr $k + 1`
4182 output=$output_objdir/$save_output-${k}.$objext
4183 objlist=$obj
4184 len=1
4185 fi
4186 done
4187 # Handle the remaining objects by creating one last
4188 # reloadable object file. All subsequent reloadable object
4189 # files will link in the last one created.
4190 test -z "$concat_cmds" || concat_cmds=$concat_cmds~
4191 eval concat_cmds=\"\${concat_cmds}$reload_cmds $objlist $last_robj\"
4192
4193 if ${skipped_export-false}; then
4194 $show "generating symbol list for \`$libname.la'"
4195 export_symbols="$output_objdir/$libname.exp"
4196 $run $rm $export_symbols
4197 libobjs=$output
4198 # Append the command to create the export file.
4199 eval concat_cmds=\"\$concat_cmds~$export_symbols_cmds\"
4200 fi
4201
4202 # Set up a command to remove the reloadale object files
4203 # after they are used.
4204 i=0
4205 while test "$i" -lt "$k"
4206 do
4207 i=`expr $i + 1`
4208 delfiles="$delfiles $output_objdir/$save_output-${i}.$objext"
4209 done
4210
4211 $echo "creating a temporary reloadable object file: $output"
4212
4213 # Loop through the commands generated above and execute them.
4214 save_ifs="$IFS"; IFS='~'
4215 for cmd in $concat_cmds; do
4216 IFS="$save_ifs"
4217 eval cmd=\"$cmd\"
4218 $show "$cmd"
4219 $run eval "$cmd" || exit $?
4220 done
4221 IFS="$save_ifs"
4222
4223 libobjs=$output
4224 # Restore the value of output.
4225 output=$save_output
4226
4227 if test -n "$convenience" && test -n "$whole_archive_flag_spec"; then
4228 eval libobjs=\"\$libobjs $whole_archive_flag_spec\"
4229 fi
4230 # Expand the library linking commands again to reset the
4231 # value of $libobjs for piecewise linking.
4232
4233 # Do each of the archive commands.
4234 if test "$module" = yes && test -n "$module_cmds" ; then
4235 if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then
4236 cmds=$module_expsym_cmds
4237 else
4238 cmds=$module_cmds
4239 fi
4240 else
4241 if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
4242 cmds=$archive_expsym_cmds
4243 else
4244 cmds=$archive_cmds
4245 fi
4246 fi
4247
4248 # Append the command to remove the reloadable object files
4249 # to the just-reset $cmds.
4250 eval cmds=\"\$cmds~\$rm $delfiles\"
4251 fi
4252 save_ifs="$IFS"; IFS='~'
4253 for cmd in $cmds; do
4254 IFS="$save_ifs"
4255 eval cmd=\"$cmd\"
4256 $show "$cmd"
4257 $run eval "$cmd" || exit $?
4258 done
4259 IFS="$save_ifs"
4260
4261 # Restore the uninstalled library and exit
4262 if test "$mode" = relink; then
4263 $run eval '(cd $output_objdir && $rm ${realname}T && $mv $realname ${realname}T && $mv "$realname"U $realname)' || exit $?
4264 exit 0
4265 fi
4266
4267 # Create links to the real library.
4268 for linkname in $linknames; do
4269 if test "$realname" != "$linkname"; then
4270 $show "(cd $output_objdir && $rm $linkname && $LN_S $realname $linkname)"
4271 $run eval '(cd $output_objdir && $rm $linkname && $LN_S $realname $linkname)' || exit $?
4272 fi
4273 done
4274
4275 # If -module or -export-dynamic was specified, set the dlname.
4276 if test "$module" = yes || test "$export_dynamic" = yes; then
4277 # On all known operating systems, these are identical.
4278 dlname="$soname"
4279 fi
4280 fi
4281 ;;
4282
4283 obj)
4284 if test -n "$deplibs"; then
4285 $echo "$modename: warning: \`-l' and \`-L' are ignored for objects" 1>&2
4286 fi
4287
4288 if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
4289 $echo "$modename: warning: \`-dlopen' is ignored for objects" 1>&2
4290 fi
4291
4292 if test -n "$rpath"; then
4293 $echo "$modename: warning: \`-rpath' is ignored for objects" 1>&2
4294 fi
4295
4296 if test -n "$xrpath"; then
4297 $echo "$modename: warning: \`-R' is ignored for objects" 1>&2
4298 fi
4299
4300 if test -n "$vinfo"; then
4301 $echo "$modename: warning: \`-version-info' is ignored for objects" 1>&2
4302 fi
4303
4304 if test -n "$release"; then
4305 $echo "$modename: warning: \`-release' is ignored for objects" 1>&2
4306 fi
4307
4308 case $output in
4309 *.lo)
4310 if test -n "$objs$old_deplibs"; then
4311 $echo "$modename: cannot build library object \`$output' from non-libtool objects" 1>&2
4312 exit 1
4313 fi
4314 libobj="$output"
4315 obj=`$echo "X$output" | $Xsed -e "$lo2o"`
4316 ;;
4317 *)
4318 libobj=
4319 obj="$output"
4320 ;;
4321 esac
4322
4323 # Delete the old objects.
4324 $run $rm $obj $libobj
4325
4326 # Objects from convenience libraries. This assumes
4327 # single-version convenience libraries. Whenever we create
4328 # different ones for PIC/non-PIC, this we'll have to duplicate
4329 # the extraction.
4330 reload_conv_objs=
4331 gentop=
4332 # reload_cmds runs $LD directly, so let us get rid of
4333 # -Wl from whole_archive_flag_spec
4334 wl=
4335
4336 if test -n "$convenience"; then
4337 if test -n "$whole_archive_flag_spec"; then
4338 eval reload_conv_objs=\"\$reload_objs $whole_archive_flag_spec\"
4339 else
4340 gentop="$output_objdir/${obj}x"
4341 $show "${rm}r $gentop"
4342 $run ${rm}r "$gentop"
4343 $show "$mkdir $gentop"
4344 $run $mkdir "$gentop"
4345 status=$?
4346 if test "$status" -ne 0 && test ! -d "$gentop"; then
4347 exit $status
4348 fi
4349 generated="$generated $gentop"
4350
4351 for xlib in $convenience; do
4352 # Extract the objects.
4353 case $xlib in
4354 [\\/]* | [A-Za-z]:[\\/]*) xabs="$xlib" ;;
4355 *) xabs=`pwd`"/$xlib" ;;
4356 esac
4357 xlib=`$echo "X$xlib" | $Xsed -e 's%^.*/%%'`
4358 xdir="$gentop/$xlib"
4359
4360 $show "${rm}r $xdir"
4361 $run ${rm}r "$xdir"
4362 $show "$mkdir $xdir"
4363 $run $mkdir "$xdir"
4364 status=$?
4365 if test "$status" -ne 0 && test ! -d "$xdir"; then
4366 exit $status
4367 fi
4368 # We will extract separately just the conflicting names and we will no
4369 # longer touch any unique names. It is faster to leave these extract
4370 # automatically by $AR in one run.
4371 $show "(cd $xdir && $AR x $xabs)"
4372 $run eval "(cd \$xdir && $AR x \$xabs)" || exit $?
4373 if ($AR t "$xabs" | sort | sort -uc >/dev/null 2>&1); then
4374 :
4375 else
4376 $echo "$modename: warning: object name conflicts; renaming object files" 1>&2
4377 $echo "$modename: warning: to ensure that they will not overwrite" 1>&2
4378 $AR t "$xabs" | sort | uniq -cd | while read -r count name
4379 do
4380 i=1
4381 while test "$i" -le "$count"
4382 do
4383 # Put our $i before any first dot (extension)
4384 # Never overwrite any file
4385 name_to="$name"
4386 while test "X$name_to" = "X$name" || test -f "$xdir/$name_to"
4387 do
4388 name_to=`$echo "X$name_to" | $Xsed -e "s/\([^.]*\)/\1-$i/"`
4389 done
4390 $show "(cd $xdir && $AR xN $i $xabs '$name' && $mv '$name' '$name_to')"
4391 $run eval "(cd \$xdir && $AR xN $i \$xabs '$name' && $mv '$name' '$name_to')" || exit $?
4392 i=`expr $i + 1`
4393 done
4394 done
4395 fi
4396
4397 reload_conv_objs="$reload_objs "`find $xdir -name \*.$objext -print -o -name \*.lo -print | $NL2SP`
4398 done
4399 fi
4400 fi
4401
4402 # Create the old-style object.
4403 reload_objs="$objs$old_deplibs "`$echo "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}$'/d' -e '/\.lib$/d' -e "$lo2o" | $NL2SP`" $reload_conv_objs" ### testsuite: skip nested quoting test
4404
4405 output="$obj"
4406 cmds=$reload_cmds
4407 save_ifs="$IFS"; IFS='~'
4408 for cmd in $cmds; do
4409 IFS="$save_ifs"
4410 eval cmd=\"$cmd\"
4411 $show "$cmd"
4412 $run eval "$cmd" || exit $?
4413 done
4414 IFS="$save_ifs"
4415
4416 # Exit if we aren't doing a library object file.
4417 if test -z "$libobj"; then
4418 if test -n "$gentop"; then
4419 $show "${rm}r $gentop"
4420 $run ${rm}r $gentop
4421 fi
4422
4423 exit 0
4424 fi
4425
4426 if test "$build_libtool_libs" != yes; then
4427 if test -n "$gentop"; then
4428 $show "${rm}r $gentop"
4429 $run ${rm}r $gentop
4430 fi
4431
4432 # Create an invalid libtool object if no PIC, so that we don't
4433 # accidentally link it into a program.
4434 # $show "echo timestamp > $libobj"
4435 # $run eval "echo timestamp > $libobj" || exit $?
4436 exit 0
4437 fi
4438
4439 if test -n "$pic_flag" || test "$pic_mode" != default; then
4440 # Only do commands if we really have different PIC objects.
4441 reload_objs="$libobjs $reload_conv_objs"
4442 output="$libobj"
4443 cmds=$reload_cmds
4444 save_ifs="$IFS"; IFS='~'
4445 for cmd in $cmds; do
4446 IFS="$save_ifs"
4447 eval cmd=\"$cmd\"
4448 $show "$cmd"
4449 $run eval "$cmd" || exit $?
4450 done
4451 IFS="$save_ifs"
4452 fi
4453
4454 if test -n "$gentop"; then
4455 $show "${rm}r $gentop"
4456 $run ${rm}r $gentop
4457 fi
4458
4459 exit 0
4460 ;;
4461
4462 prog)
4463 case $host in
4464 *cygwin*) output=`$echo $output | ${SED} -e 's,.exe$,,;s,$,.exe,'` ;;
4465 esac
4466 if test -n "$vinfo"; then
4467 $echo "$modename: warning: \`-version-info' is ignored for programs" 1>&2
4468 fi
4469
4470 if test -n "$release"; then
4471 $echo "$modename: warning: \`-release' is ignored for programs" 1>&2
4472 fi
4473
4474 if test "$preload" = yes; then
4475 if test "$dlopen_support" = unknown && test "$dlopen_self" = unknown &&
4476 test "$dlopen_self_static" = unknown; then
4477 $echo "$modename: warning: \`AC_LIBTOOL_DLOPEN' not used. Assuming no dlopen support."
4478 fi
4479 fi
4480
4481 case $host in
4482 *-*-rhapsody* | *-*-darwin1.[012])
4483 # On Rhapsody replace the C library is the System framework
4484 compile_deplibs=`$echo "X $compile_deplibs" | $Xsed -e 's/ -lc / -framework System /'`
4485 finalize_deplibs=`$echo "X $finalize_deplibs" | $Xsed -e 's/ -lc / -framework System /'`
4486 ;;
4487 esac
4488
4489 case $host in
4490 *darwin*)
4491 # Don't allow lazy linking, it breaks C++ global constructors
4492 if test "$tagname" = CXX ; then
4493 compile_command="$compile_command ${wl}-bind_at_load"
4494 finalize_command="$finalize_command ${wl}-bind_at_load"
4495 fi
4496 ;;
4497 esac
4498
4499 compile_command="$compile_command $compile_deplibs"
4500 finalize_command="$finalize_command $finalize_deplibs"
4501
4502 if test -n "$rpath$xrpath"; then
4503 # If the user specified any rpath flags, then add them.
4504 for libdir in $rpath $xrpath; do
4505 # This is the magic to use -rpath.
4506 case "$finalize_rpath " in
4507 *" $libdir "*) ;;
4508 *) finalize_rpath="$finalize_rpath $libdir" ;;
4509 esac
4510 done
4511 fi
4512
4513 # Now hardcode the library paths
4514 rpath=
4515 hardcode_libdirs=
4516 for libdir in $compile_rpath $finalize_rpath; do
4517 if test -n "$hardcode_libdir_flag_spec"; then
4518 if test -n "$hardcode_libdir_separator"; then
4519 if test -z "$hardcode_libdirs"; then
4520 hardcode_libdirs="$libdir"
4521 else
4522 # Just accumulate the unique libdirs.
4523 case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
4524 *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
4525 ;;
4526 *)
4527 hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
4528 ;;
4529 esac
4530 fi
4531 else
4532 eval flag=\"$hardcode_libdir_flag_spec\"
4533 rpath="$rpath $flag"
4534 fi
4535 elif test -n "$runpath_var"; then
4536 case "$perm_rpath " in
4537 *" $libdir "*) ;;
4538 *) perm_rpath="$perm_rpath $libdir" ;;
4539 esac
4540 fi
4541 case $host in
4542 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
4543 case :$dllsearchpath: in
4544 *":$libdir:"*) ;;
4545 *) dllsearchpath="$dllsearchpath:$libdir";;
4546 esac
4547 ;;
4548 esac
4549 done
4550 # Substitute the hardcoded libdirs into the rpath.
4551 if test -n "$hardcode_libdir_separator" &&
4552 test -n "$hardcode_libdirs"; then
4553 libdir="$hardcode_libdirs"
4554 eval rpath=\" $hardcode_libdir_flag_spec\"
4555 fi
4556 compile_rpath="$rpath"
4557
4558 rpath=
4559 hardcode_libdirs=
4560 for libdir in $finalize_rpath; do
4561 if test -n "$hardcode_libdir_flag_spec"; then
4562 if test -n "$hardcode_libdir_separator"; then
4563 if test -z "$hardcode_libdirs"; then
4564 hardcode_libdirs="$libdir"
4565 else
4566 # Just accumulate the unique libdirs.
4567 case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
4568 *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
4569 ;;
4570 *)
4571 hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
4572 ;;
4573 esac
4574 fi
4575 else
4576 eval flag=\"$hardcode_libdir_flag_spec\"
4577 rpath="$rpath $flag"
4578 fi
4579 elif test -n "$runpath_var"; then
4580 case "$finalize_perm_rpath " in
4581 *" $libdir "*) ;;
4582 *) finalize_perm_rpath="$finalize_perm_rpath $libdir" ;;
4583 esac
4584 fi
4585 done
4586 # Substitute the hardcoded libdirs into the rpath.
4587 if test -n "$hardcode_libdir_separator" &&
4588 test -n "$hardcode_libdirs"; then
4589 libdir="$hardcode_libdirs"
4590 eval rpath=\" $hardcode_libdir_flag_spec\"
4591 fi
4592 finalize_rpath="$rpath"
4593
4594 if test -n "$libobjs" && test "$build_old_libs" = yes; then
4595 # Transform all the library objects into standard objects.
4596 compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
4597 finalize_command=`$echo "X$finalize_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
4598 fi
4599
4600 dlsyms=
4601 if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
4602 if test -n "$NM" && test -n "$global_symbol_pipe"; then
4603 dlsyms="${outputname}S.c"
4604 else
4605 $echo "$modename: not configured to extract global symbols from dlpreopened files" 1>&2
4606 fi
4607 fi
4608
4609 if test -n "$dlsyms"; then
4610 case $dlsyms in
4611 "") ;;
4612 *.c)
4613 # Discover the nlist of each of the dlfiles.
4614 nlist="$output_objdir/${outputname}.nm"
4615
4616 $show "$rm $nlist ${nlist}S ${nlist}T"
4617 $run $rm "$nlist" "${nlist}S" "${nlist}T"
4618
4619 # Parse the name list into a source file.
4620 $show "creating $output_objdir/$dlsyms"
4621
4622 test -z "$run" && $echo > "$output_objdir/$dlsyms" "\
4623 /* $dlsyms - symbol resolution table for \`$outputname' dlsym emulation. */
4624 /* Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP */
4625
4626 #ifdef __cplusplus
4627 extern \"C\" {
4628 #endif
4629
4630 /* Prevent the only kind of declaration conflicts we can make. */
4631 #define lt_preloaded_symbols some_other_symbol
4632
4633 /* External symbol declarations for the compiler. */\
4634 "
4635
4636 if test "$dlself" = yes; then
4637 $show "generating symbol list for \`$output'"
4638
4639 test -z "$run" && $echo ': @PROGRAM@ ' > "$nlist"
4640
4641 # Add our own program objects to the symbol list.
4642 progfiles=`$echo "X$objs$old_deplibs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
4643 for arg in $progfiles; do
4644 $show "extracting global C symbols from \`$arg'"
4645 $run eval "$NM $arg | $global_symbol_pipe >> '$nlist'"
4646 done
4647
4648 if test -n "$exclude_expsyms"; then
4649 $run eval '$EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T'
4650 $run eval '$mv "$nlist"T "$nlist"'
4651 fi
4652
4653 if test -n "$export_symbols_regex"; then
4654 $run eval '$EGREP -e "$export_symbols_regex" "$nlist" > "$nlist"T'
4655 $run eval '$mv "$nlist"T "$nlist"'
4656 fi
4657
4658 # Prepare the list of exported symbols
4659 if test -z "$export_symbols"; then
4660 export_symbols="$output_objdir/$output.exp"
4661 $run $rm $export_symbols
4662 $run eval "${SED} -n -e '/^: @PROGRAM@$/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"'
4663 else
4664 $run eval "${SED} -e 's/\([][.*^$]\)/\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$output.exp"'
4665 $run eval 'grep -f "$output_objdir/$output.exp" < "$nlist" > "$nlist"T'
4666 $run eval 'mv "$nlist"T "$nlist"'
4667 fi
4668 fi
4669
4670 for arg in $dlprefiles; do
4671 $show "extracting global C symbols from \`$arg'"
4672 name=`$echo "$arg" | ${SED} -e 's%^.*/%%'`
4673 $run eval '$echo ": $name " >> "$nlist"'
4674 $run eval "$NM $arg | $global_symbol_pipe >> '$nlist'"
4675 done
4676
4677 if test -z "$run"; then
4678 # Make sure we have at least an empty file.
4679 test -f "$nlist" || : > "$nlist"
4680
4681 if test -n "$exclude_expsyms"; then
4682 $EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T
4683 $mv "$nlist"T "$nlist"
4684 fi
4685
4686 # Try sorting and uniquifying the output.
4687 if grep -v "^: " < "$nlist" |
4688 if sort -k 3 </dev/null >/dev/null 2>&1; then
4689 sort -k 3
4690 else
4691 sort +2
4692 fi |
4693 uniq > "$nlist"S; then
4694 :
4695 else
4696 grep -v "^: " < "$nlist" > "$nlist"S
4697 fi
4698
4699 if test -f "$nlist"S; then
4700 eval "$global_symbol_to_cdecl"' < "$nlist"S >> "$output_objdir/$dlsyms"'
4701 else
4702 $echo '/* NONE */' >> "$output_objdir/$dlsyms"
4703 fi
4704
4705 $echo >> "$output_objdir/$dlsyms" "\
4706
4707 #undef lt_preloaded_symbols
4708
4709 #if defined (__STDC__) && __STDC__
4710 # define lt_ptr void *
4711 #else
4712 # define lt_ptr char *
4713 # define const
4714 #endif
4715
4716 /* The mapping between symbol names and symbols. */
4717 const struct {
4718 const char *name;
4719 lt_ptr address;
4720 }
4721 lt_preloaded_symbols[] =
4722 {\
4723 "
4724
4725 eval "$global_symbol_to_c_name_address" < "$nlist" >> "$output_objdir/$dlsyms"
4726
4727 $echo >> "$output_objdir/$dlsyms" "\
4728 {0, (lt_ptr) 0}
4729 };
4730
4731 /* This works around a problem in FreeBSD linker */
4732 #ifdef FREEBSD_WORKAROUND
4733 static const void *lt_preloaded_setup() {
4734 return lt_preloaded_symbols;
4735 }
4736 #endif
4737
4738 #ifdef __cplusplus
4739 }
4740 #endif\
4741 "
4742 fi
4743
4744 pic_flag_for_symtable=
4745 case $host in
4746 # compiling the symbol table file with pic_flag works around
4747 # a FreeBSD bug that causes programs to crash when -lm is
4748 # linked before any other PIC object. But we must not use
4749 # pic_flag when linking with -static. The problem exists in
4750 # FreeBSD 2.2.6 and is fixed in FreeBSD 3.1.
4751 *-*-freebsd2*|*-*-freebsd3.0*|*-*-freebsdelf3.0*)
4752 case "$compile_command " in
4753 *" -static "*) ;;
4754 *) pic_flag_for_symtable=" $pic_flag -DFREEBSD_WORKAROUND";;
4755 esac;;
4756 *-*-hpux*)
4757 case "$compile_command " in
4758 *" -static "*) ;;
4759 *) pic_flag_for_symtable=" $pic_flag";;
4760 esac
4761 esac
4762
4763 # Now compile the dynamic symbol file.
4764 $show "(cd $output_objdir && $LTCC -c$no_builtin_flag$pic_flag_for_symtable \"$dlsyms\")"
4765 $run eval '(cd $output_objdir && $LTCC -c$no_builtin_flag$pic_flag_for_symtable "$dlsyms")' || exit $?
4766
4767 # Clean up the generated files.
4768 $show "$rm $output_objdir/$dlsyms $nlist ${nlist}S ${nlist}T"
4769 $run $rm "$output_objdir/$dlsyms" "$nlist" "${nlist}S" "${nlist}T"
4770
4771 # Transform the symbol file into the correct name.
4772 compile_command=`$echo "X$compile_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"`
4773 finalize_command=`$echo "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"`
4774 ;;
4775 *)
4776 $echo "$modename: unknown suffix for \`$dlsyms'" 1>&2
4777 exit 1
4778 ;;
4779 esac
4780 else
4781 # We keep going just in case the user didn't refer to
4782 # lt_preloaded_symbols. The linker will fail if global_symbol_pipe
4783 # really was required.
4784
4785 # Nullify the symbol file.
4786 compile_command=`$echo "X$compile_command" | $Xsed -e "s% @SYMFILE@%%"`
4787 finalize_command=`$echo "X$finalize_command" | $Xsed -e "s% @SYMFILE@%%"`
4788 fi
4789
4790 if test "$need_relink" = no || test "$build_libtool_libs" != yes; then
4791 # Replace the output file specification.
4792 compile_command=`$echo "X$compile_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'`
4793 link_command="$compile_command$compile_rpath"
4794
4795 # We have no uninstalled library dependencies, so finalize right now.
4796 $show "$link_command"
4797 $run eval "$link_command"
4798 status=$?
4799
4800 # Delete the generated files.
4801 if test -n "$dlsyms"; then
4802 $show "$rm $output_objdir/${outputname}S.${objext}"
4803 $run $rm "$output_objdir/${outputname}S.${objext}"
4804 fi
4805
4806 exit $status
4807 fi
4808
4809 if test -n "$shlibpath_var"; then
4810 # We should set the shlibpath_var
4811 rpath=
4812 for dir in $temp_rpath; do
4813 case $dir in
4814 [\\/]* | [A-Za-z]:[\\/]*)
4815 # Absolute path.
4816 rpath="$rpath$dir:"
4817 ;;
4818 *)
4819 # Relative path: add a thisdir entry.
4820 rpath="$rpath\$thisdir/$dir:"
4821 ;;
4822 esac
4823 done
4824 temp_rpath="$rpath"
4825 fi
4826
4827 if test -n "$compile_shlibpath$finalize_shlibpath"; then
4828 compile_command="$shlibpath_var=\"$compile_shlibpath$finalize_shlibpath\$$shlibpath_var\" $compile_command"
4829 fi
4830 if test -n "$finalize_shlibpath"; then
4831 finalize_command="$shlibpath_var=\"$finalize_shlibpath\$$shlibpath_var\" $finalize_command"
4832 fi
4833
4834 compile_var=
4835 finalize_var=
4836 if test -n "$runpath_var"; then
4837 if test -n "$perm_rpath"; then
4838 # We should set the runpath_var.
4839 rpath=
4840 for dir in $perm_rpath; do
4841 rpath="$rpath$dir:"
4842 done
4843 compile_var="$runpath_var=\"$rpath\$$runpath_var\" "
4844 fi
4845 if test -n "$finalize_perm_rpath"; then
4846 # We should set the runpath_var.
4847 rpath=
4848 for dir in $finalize_perm_rpath; do
4849 rpath="$rpath$dir:"
4850 done
4851 finalize_var="$runpath_var=\"$rpath\$$runpath_var\" "
4852 fi
4853 fi
4854
4855 if test "$no_install" = yes; then
4856 # We don't need to create a wrapper script.
4857 link_command="$compile_var$compile_command$compile_rpath"
4858 # Replace the output file specification.
4859 link_command=`$echo "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'`
4860 # Delete the old output file.
4861 $run $rm $output
4862 # Link the executable and exit
4863 $show "$link_command"
4864 $run eval "$link_command" || exit $?
4865 exit 0
4866 fi
4867
4868 if test "$hardcode_action" = relink; then
4869 # Fast installation is not supported
4870 link_command="$compile_var$compile_command$compile_rpath"
4871 relink_command="$finalize_var$finalize_command$finalize_rpath"
4872
4873 $echo "$modename: warning: this platform does not like uninstalled shared libraries" 1>&2
4874 $echo "$modename: \`$output' will be relinked during installation" 1>&2
4875 else
4876 if test "$fast_install" != no; then
4877 link_command="$finalize_var$compile_command$finalize_rpath"
4878 if test "$fast_install" = yes; then
4879 relink_command=`$echo "X$compile_var$compile_command$compile_rpath" | $Xsed -e 's%@OUTPUT@%\$progdir/\$file%g'`
4880 else
4881 # fast_install is set to needless
4882 relink_command=
4883 fi
4884 else
4885 link_command="$compile_var$compile_command$compile_rpath"
4886 relink_command="$finalize_var$finalize_command$finalize_rpath"
4887 fi
4888 fi
4889
4890 # Replace the output file specification.
4891 link_command=`$echo "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output_objdir/$outputname"'%g'`
4892
4893 # Delete the old output files.
4894 $run $rm $output $output_objdir/$outputname $output_objdir/lt-$outputname
4895
4896 $show "$link_command"
4897 $run eval "$link_command" || exit $?
4898
4899 # Now create the wrapper script.
4900 $show "creating $output"
4901
4902 # Quote the relink command for shipping.
4903 if test -n "$relink_command"; then
4904 # Preserve any variables that may affect compiler behavior
4905 for var in $variables_saved_for_relink; do
4906 if eval test -z \"\${$var+set}\"; then
4907 relink_command="{ test -z \"\${$var+set}\" || unset $var || { $var=; export $var; }; }; $relink_command"
4908 elif eval var_value=\$$var; test -z "$var_value"; then
4909 relink_command="$var=; export $var; $relink_command"
4910 else
4911 var_value=`$echo "X$var_value" | $Xsed -e "$sed_quote_subst"`
4912 relink_command="$var=\"$var_value\"; export $var; $relink_command"
4913 fi
4914 done
4915 relink_command="(cd `pwd`; $relink_command)"
4916 relink_command=`$echo "X$relink_command" | $Xsed -e "$sed_quote_subst"`
4917 fi
4918
4919 # Quote $echo for shipping.
4920 if test "X$echo" = "X$SHELL $0 --fallback-echo"; then
4921 case $0 in
4922 [\\/]* | [A-Za-z]:[\\/]*) qecho="$SHELL $0 --fallback-echo";;
4923 *) qecho="$SHELL `pwd`/$0 --fallback-echo";;
4924 esac
4925 qecho=`$echo "X$qecho" | $Xsed -e "$sed_quote_subst"`
4926 else
4927 qecho=`$echo "X$echo" | $Xsed -e "$sed_quote_subst"`
4928 fi
4929
4930 # Only actually do things if our run command is non-null.
4931 if test -z "$run"; then
4932 # win32 will think the script is a binary if it has
4933 # a .exe suffix, so we strip it off here.
4934 case $output in
4935 *.exe) output=`$echo $output|${SED} 's,.exe$,,'` ;;
4936 esac
4937 # test for cygwin because mv fails w/o .exe extensions
4938 case $host in
4939 *cygwin*)
4940 exeext=.exe
4941 outputname=`$echo $outputname|${SED} 's,.exe$,,'` ;;
4942 *) exeext= ;;
4943 esac
4944 case $host in
4945 *cygwin* | *mingw* )
4946 cwrappersource=`$echo ${objdir}/lt-${output}.c`
4947 cwrapper=`$echo ${output}.exe`
4948 $rm $cwrappersource $cwrapper
4949 trap "$rm $cwrappersource $cwrapper; exit 1" 1 2 15
4950
4951 cat > $cwrappersource <<EOF
4952
4953 /* $cwrappersource - temporary wrapper executable for $objdir/$outputname
4954 Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
4955
4956 The $output program cannot be directly executed until all the libtool
4957 libraries that it depends on are installed.
4958
4959 This wrapper executable should never be moved out of the build directory.
4960 If it is, it will not operate correctly.
4961
4962 Currently, it simply execs the wrapper *script* "/bin/sh $output",
4963 but could eventually absorb all of the scripts functionality and
4964 exec $objdir/$outputname directly.
4965 */
4966 EOF
4967 cat >> $cwrappersource<<"EOF"
4968 #include <stdio.h>
4969 #include <stdlib.h>
4970 #include <unistd.h>
4971 #include <malloc.h>
4972 #include <stdarg.h>
4973 #include <assert.h>
4974
4975 #if defined(PATH_MAX)
4976 # define LT_PATHMAX PATH_MAX
4977 #elif defined(MAXPATHLEN)
4978 # define LT_PATHMAX MAXPATHLEN
4979 #else
4980 # define LT_PATHMAX 1024
4981 #endif
4982
4983 #ifndef DIR_SEPARATOR
4984 #define DIR_SEPARATOR '/'
4985 #endif
4986
4987 #if defined (_WIN32) || defined (__MSDOS__) || defined (__DJGPP__) || \
4988 defined (__OS2__)
4989 #define HAVE_DOS_BASED_FILE_SYSTEM
4990 #ifndef DIR_SEPARATOR_2
4991 #define DIR_SEPARATOR_2 '\\'
4992 #endif
4993 #endif
4994
4995 #ifndef DIR_SEPARATOR_2
4996 # define IS_DIR_SEPARATOR(ch) ((ch) == DIR_SEPARATOR)
4997 #else /* DIR_SEPARATOR_2 */
4998 # define IS_DIR_SEPARATOR(ch) \
4999 (((ch) == DIR_SEPARATOR) || ((ch) == DIR_SEPARATOR_2))
5000 #endif /* DIR_SEPARATOR_2 */
5001
5002 #define XMALLOC(type, num) ((type *) xmalloc ((num) * sizeof(type)))
5003 #define XFREE(stale) do { \
5004 if (stale) { free ((void *) stale); stale = 0; } \
5005 } while (0)
5006
5007 const char *program_name = NULL;
5008
5009 void * xmalloc (size_t num);
5010 char * xstrdup (const char *string);
5011 char * basename (const char *name);
5012 char * fnqualify(const char *path);
5013 char * strendzap(char *str, const char *pat);
5014 void lt_fatal (const char *message, ...);
5015
5016 int
5017 main (int argc, char *argv[])
5018 {
5019 char **newargz;
5020 int i;
5021
5022 program_name = (char *) xstrdup ((char *) basename (argv[0]));
5023 newargz = XMALLOC(char *, argc+2);
5024 EOF
5025
5026 cat >> $cwrappersource <<EOF
5027 newargz[0] = "$SHELL";
5028 EOF
5029
5030 cat >> $cwrappersource <<"EOF"
5031 newargz[1] = fnqualify(argv[0]);
5032 /* we know the script has the same name, without the .exe */
5033 /* so make sure newargz[1] doesn't end in .exe */
5034 strendzap(newargz[1],".exe");
5035 for (i = 1; i < argc; i++)
5036 newargz[i+1] = xstrdup(argv[i]);
5037 newargz[argc+1] = NULL;
5038 EOF
5039
5040 cat >> $cwrappersource <<EOF
5041 execv("$SHELL",newargz);
5042 EOF
5043
5044 cat >> $cwrappersource <<"EOF"
5045 }
5046
5047 void *
5048 xmalloc (size_t num)
5049 {
5050 void * p = (void *) malloc (num);
5051 if (!p)
5052 lt_fatal ("Memory exhausted");
5053
5054 return p;
5055 }
5056
5057 char *
5058 xstrdup (const char *string)
5059 {
5060 return string ? strcpy ((char *) xmalloc (strlen (string) + 1), string) : NULL
5061 ;
5062 }
5063
5064 char *
5065 basename (const char *name)
5066 {
5067 const char *base;
5068
5069 #if defined (HAVE_DOS_BASED_FILE_SYSTEM)
5070 /* Skip over the disk name in MSDOS pathnames. */
5071 if (isalpha (name[0]) && name[1] == ':')
5072 name += 2;
5073 #endif
5074
5075 for (base = name; *name; name++)
5076 if (IS_DIR_SEPARATOR (*name))
5077 base = name + 1;
5078 return (char *) base;
5079 }
5080
5081 char *
5082 fnqualify(const char *path)
5083 {
5084 size_t size;
5085 char *p;
5086 char tmp[LT_PATHMAX + 1];
5087
5088 assert(path != NULL);
5089
5090 /* Is it qualified already? */
5091 #if defined (HAVE_DOS_BASED_FILE_SYSTEM)
5092 if (isalpha (path[0]) && path[1] == ':')
5093 return xstrdup (path);
5094 #endif
5095 if (IS_DIR_SEPARATOR (path[0]))
5096 return xstrdup (path);
5097
5098 /* prepend the current directory */
5099 /* doesn't handle '~' */
5100 if (getcwd (tmp, LT_PATHMAX) == NULL)
5101 lt_fatal ("getcwd failed");
5102 size = strlen(tmp) + 1 + strlen(path) + 1; /* +2 for '/' and '\0' */
5103 p = XMALLOC(char, size);
5104 sprintf(p, "%s%c%s", tmp, DIR_SEPARATOR, path);
5105 return p;
5106 }
5107
5108 char *
5109 strendzap(char *str, const char *pat)
5110 {
5111 size_t len, patlen;
5112
5113 assert(str != NULL);
5114 assert(pat != NULL);
5115
5116 len = strlen(str);
5117 patlen = strlen(pat);
5118
5119 if (patlen <= len)
5120 {
5121 str += len - patlen;
5122 if (strcmp(str, pat) == 0)
5123 *str = '\0';
5124 }
5125 return str;
5126 }
5127
5128 static void
5129 lt_error_core (int exit_status, const char * mode,
5130 const char * message, va_list ap)
5131 {
5132 fprintf (stderr, "%s: %s: ", program_name, mode);
5133 vfprintf (stderr, message, ap);
5134 fprintf (stderr, ".\n");
5135
5136 if (exit_status >= 0)
5137 exit (exit_status);
5138 }
5139
5140 void
5141 lt_fatal (const char *message, ...)
5142 {
5143 va_list ap;
5144 va_start (ap, message);
5145 lt_error_core (EXIT_FAILURE, "FATAL", message, ap);
5146 va_end (ap);
5147 }
5148 EOF
5149 # we should really use a build-platform specific compiler
5150 # here, but OTOH, the wrappers (shell script and this C one)
5151 # are only useful if you want to execute the "real" binary.
5152 # Since the "real" binary is built for $host, then this
5153 # wrapper might as well be built for $host, too.
5154 $run $LTCC -s -o $cwrapper $cwrappersource
5155 ;;
5156 esac
5157 $rm $output
5158 trap "$rm $output; exit 1" 1 2 15
5159
5160 $echo > $output "\
5161 #! $SHELL
5162
5163 # $output - temporary wrapper script for $objdir/$outputname
5164 # Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
5165 #
5166 # The $output program cannot be directly executed until all the libtool
5167 # libraries that it depends on are installed.
5168 #
5169 # This wrapper script should never be moved out of the build directory.
5170 # If it is, it will not operate correctly.
5171
5172 # Sed substitution that helps us do robust quoting. It backslashifies
5173 # metacharacters that are still active within double-quoted strings.
5174 Xsed='${SED} -e 1s/^X//'
5175 sed_quote_subst='$sed_quote_subst'
5176
5177 # The HP-UX ksh and POSIX shell print the target directory to stdout
5178 # if CDPATH is set.
5179 if test \"\${CDPATH+set}\" = set; then CDPATH=:; export CDPATH; fi
5180
5181 relink_command=\"$relink_command\"
5182
5183 # This environment variable determines our operation mode.
5184 if test \"\$libtool_install_magic\" = \"$magic\"; then
5185 # install mode needs the following variable:
5186 notinst_deplibs='$notinst_deplibs'
5187 else
5188 # When we are sourced in execute mode, \$file and \$echo are already set.
5189 if test \"\$libtool_execute_magic\" != \"$magic\"; then
5190 echo=\"$qecho\"
5191 file=\"\$0\"
5192 # Make sure echo works.
5193 if test \"X\$1\" = X--no-reexec; then
5194 # Discard the --no-reexec flag, and continue.
5195 shift
5196 elif test \"X\`(\$echo '\t') 2>/dev/null\`\" = 'X\t'; then
5197 # Yippee, \$echo works!
5198 :
5199 else
5200 # Restart under the correct shell, and then maybe \$echo will work.
5201 exec $SHELL \"\$0\" --no-reexec \${1+\"\$@\"}
5202 fi
5203 fi\
5204 "
5205 $echo >> $output "\
5206
5207 # Find the directory that this script lives in.
5208 thisdir=\`\$echo \"X\$file\" | \$Xsed -e 's%/[^/]*$%%'\`
5209 test \"x\$thisdir\" = \"x\$file\" && thisdir=.
5210
5211 # Follow symbolic links until we get to the real thisdir.
5212 file=\`ls -ld \"\$file\" | ${SED} -n 's/.*-> //p'\`
5213 while test -n \"\$file\"; do
5214 destdir=\`\$echo \"X\$file\" | \$Xsed -e 's%/[^/]*\$%%'\`
5215
5216 # If there was a directory component, then change thisdir.
5217 if test \"x\$destdir\" != \"x\$file\"; then
5218 case \"\$destdir\" in
5219 [\\\\/]* | [A-Za-z]:[\\\\/]*) thisdir=\"\$destdir\" ;;
5220 *) thisdir=\"\$thisdir/\$destdir\" ;;
5221 esac
5222 fi
5223
5224 file=\`\$echo \"X\$file\" | \$Xsed -e 's%^.*/%%'\`
5225 file=\`ls -ld \"\$thisdir/\$file\" | ${SED} -n 's/.*-> //p'\`
5226 done
5227
5228 # Try to get the absolute directory name.
5229 absdir=\`cd \"\$thisdir\" && pwd\`
5230 test -n \"\$absdir\" && thisdir=\"\$absdir\"
5231 "
5232
5233 if test "$fast_install" = yes; then
5234 $echo >> $output "\
5235 program=lt-'$outputname'$exeext
5236 progdir=\"\$thisdir/$objdir\"
5237
5238 if test ! -f \"\$progdir/\$program\" || \\
5239 { file=\`ls -1dt \"\$progdir/\$program\" \"\$progdir/../\$program\" 2>/dev/null | ${SED} 1q\`; \\
5240 test \"X\$file\" != \"X\$progdir/\$program\"; }; then
5241
5242 file=\"\$\$-\$program\"
5243
5244 if test ! -d \"\$progdir\"; then
5245 $mkdir \"\$progdir\"
5246 else
5247 $rm \"\$progdir/\$file\"
5248 fi"
5249
5250 $echo >> $output "\
5251
5252 # relink executable if necessary
5253 if test -n \"\$relink_command\"; then
5254 if relink_command_output=\`eval \$relink_command 2>&1\`; then :
5255 else
5256 $echo \"\$relink_command_output\" >&2
5257 $rm \"\$progdir/\$file\"
5258 exit 1
5259 fi
5260 fi
5261
5262 $mv \"\$progdir/\$file\" \"\$progdir/\$program\" 2>/dev/null ||
5263 { $rm \"\$progdir/\$program\";
5264 $mv \"\$progdir/\$file\" \"\$progdir/\$program\"; }
5265 $rm \"\$progdir/\$file\"
5266 fi"
5267 else
5268 $echo >> $output "\
5269 program='$outputname'
5270 progdir=\"\$thisdir/$objdir\"
5271 "
5272 fi
5273
5274 $echo >> $output "\
5275
5276 if test -f \"\$progdir/\$program\"; then"
5277
5278 # Export our shlibpath_var if we have one.
5279 if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then
5280 $echo >> $output "\
5281 # Add our own library path to $shlibpath_var
5282 $shlibpath_var=\"$temp_rpath\$$shlibpath_var\"
5283
5284 # Some systems cannot cope with colon-terminated $shlibpath_var
5285 # The second colon is a workaround for a bug in BeOS R4 sed
5286 $shlibpath_var=\`\$echo \"X\$$shlibpath_var\" | \$Xsed -e 's/::*\$//'\`
5287
5288 export $shlibpath_var
5289 "
5290 fi
5291
5292 # fixup the dll searchpath if we need to.
5293 if test -n "$dllsearchpath"; then
5294 $echo >> $output "\
5295 # Add the dll search path components to the executable PATH
5296 PATH=$dllsearchpath:\$PATH
5297 "
5298 fi
5299
5300 $echo >> $output "\
5301 if test \"\$libtool_execute_magic\" != \"$magic\"; then
5302 # Run the actual program with our arguments.
5303 "
5304 case $host in
5305 # Backslashes separate directories on plain windows
5306 *-*-mingw | *-*-os2*)
5307 $echo >> $output "\
5308 exec \$progdir\\\\\$program \${1+\"\$@\"}
5309 "
5310 ;;
5311
5312 *)
5313 $echo >> $output "\
5314 exec \$progdir/\$program \${1+\"\$@\"}
5315 "
5316 ;;
5317 esac
5318 $echo >> $output "\
5319 \$echo \"\$0: cannot exec \$program \${1+\"\$@\"}\"
5320 exit 1
5321 fi
5322 else
5323 # The program doesn't exist.
5324 \$echo \"\$0: error: \$progdir/\$program does not exist\" 1>&2
5325 \$echo \"This script is just a wrapper for \$program.\" 1>&2
5326 $echo \"See the $PACKAGE documentation for more information.\" 1>&2
5327 exit 1
5328 fi
5329 fi\
5330 "
5331 chmod +x $output
5332 fi
5333 exit 0
5334 ;;
5335 esac
5336
5337 # See if we need to build an old-fashioned archive.
5338 for oldlib in $oldlibs; do
5339
5340 if test "$build_libtool_libs" = convenience; then
5341 oldobjs="$libobjs_save"
5342 addlibs="$convenience"
5343 build_libtool_libs=no
5344 else
5345 if test "$build_libtool_libs" = module; then
5346 oldobjs="$libobjs_save"
5347 build_libtool_libs=no
5348 else
5349 oldobjs="$old_deplibs $non_pic_objects"
5350 fi
5351 addlibs="$old_convenience"
5352 fi
5353
5354 if test -n "$addlibs"; then
5355 gentop="$output_objdir/${outputname}x"
5356 $show "${rm}r $gentop"
5357 $run ${rm}r "$gentop"
5358 $show "$mkdir $gentop"
5359 $run $mkdir "$gentop"
5360 status=$?
5361 if test "$status" -ne 0 && test ! -d "$gentop"; then
5362 exit $status
5363 fi
5364 generated="$generated $gentop"
5365
5366 # Add in members from convenience archives.
5367 for xlib in $addlibs; do
5368 # Extract the objects.
5369 case $xlib in
5370 [\\/]* | [A-Za-z]:[\\/]*) xabs="$xlib" ;;
5371 *) xabs=`pwd`"/$xlib" ;;
5372 esac
5373 xlib=`$echo "X$xlib" | $Xsed -e 's%^.*/%%'`
5374 xdir="$gentop/$xlib"
5375
5376 $show "${rm}r $xdir"
5377 $run ${rm}r "$xdir"
5378 $show "$mkdir $xdir"
5379 $run $mkdir "$xdir"
5380 status=$?
5381 if test "$status" -ne 0 && test ! -d "$xdir"; then
5382 exit $status
5383 fi
5384 # We will extract separately just the conflicting names and we will no
5385 # longer touch any unique names. It is faster to leave these extract
5386 # automatically by $AR in one run.
5387 $show "(cd $xdir && $AR x $xabs)"
5388 $run eval "(cd \$xdir && $AR x \$xabs)" || exit $?
5389 if ($AR t "$xabs" | sort | sort -uc >/dev/null 2>&1); then
5390 :
5391 else
5392 $echo "$modename: warning: object name conflicts; renaming object files" 1>&2
5393 $echo "$modename: warning: to ensure that they will not overwrite" 1>&2
5394 $AR t "$xabs" | sort | uniq -cd | while read -r count name
5395 do
5396 i=1
5397 while test "$i" -le "$count"
5398 do
5399 # Put our $i before any first dot (extension)
5400 # Never overwrite any file
5401 name_to="$name"
5402 while test "X$name_to" = "X$name" || test -f "$xdir/$name_to"
5403 do
5404 name_to=`$echo "X$name_to" | $Xsed -e "s/\([^.]*\)/\1-$i/"`
5405 done
5406 $show "(cd $xdir && $AR xN $i $xabs '$name' && $mv '$name' '$name_to')"
5407 $run eval "(cd \$xdir && $AR xN $i \$xabs '$name' && $mv '$name' '$name_to')" || exit $?
5408 i=`expr $i + 1`
5409 done
5410 done
5411 fi
5412
5413 oldobjs="$oldobjs "`find $xdir -name \*.${objext} -print -o -name \*.lo -print | $NL2SP`
5414 done
5415 fi
5416
5417 # Do each command in the archive commands.
5418 if test -n "$old_archive_from_new_cmds" && test "$build_libtool_libs" = yes; then
5419 cmds=$old_archive_from_new_cmds
5420 else
5421 eval cmds=\"$old_archive_cmds\"
5422
5423 if len=`expr "X$cmds" : ".*"` &&
5424 test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then
5425 cmds=$old_archive_cmds
5426 else
5427 # the command line is too long to link in one step, link in parts
5428 $echo "using piecewise archive linking..."
5429 save_RANLIB=$RANLIB
5430 RANLIB=:
5431 objlist=
5432 concat_cmds=
5433 save_oldobjs=$oldobjs
5434 # GNU ar 2.10+ was changed to match POSIX; thus no paths are
5435 # encoded into archives. This makes 'ar r' malfunction in
5436 # this piecewise linking case whenever conflicting object
5437 # names appear in distinct ar calls; check, warn and compensate.
5438 if (for obj in $save_oldobjs
5439 do
5440 $echo "X$obj" | $Xsed -e 's%^.*/%%'
5441 done | sort | sort -uc >/dev/null 2>&1); then
5442 :
5443 else
5444 $echo "$modename: warning: object name conflicts; overriding AR_FLAGS to 'cq'" 1>&2
5445 $echo "$modename: warning: to ensure that POSIX-compatible ar will work" 1>&2
5446 AR_FLAGS=cq
5447 fi
5448 # Is there a better way of finding the last object in the list?
5449 for obj in $save_oldobjs
5450 do
5451 last_oldobj=$obj
5452 done
5453 for obj in $save_oldobjs
5454 do
5455 oldobjs="$objlist $obj"
5456 objlist="$objlist $obj"
5457 eval test_cmds=\"$old_archive_cmds\"
5458 if len=`expr "X$test_cmds" : ".*"` &&
5459 test "$len" -le "$max_cmd_len"; then
5460 :
5461 else
5462 # the above command should be used before it gets too long
5463 oldobjs=$objlist
5464 if test "$obj" = "$last_oldobj" ; then
5465 RANLIB=$save_RANLIB
5466 fi
5467 test -z "$concat_cmds" || concat_cmds=$concat_cmds~
5468 eval concat_cmds=\"\${concat_cmds}$old_archive_cmds\"
5469 objlist=
5470 fi
5471 done
5472 RANLIB=$save_RANLIB
5473 oldobjs=$objlist
5474 if test "X$oldobjs" = "X" ; then
5475 eval cmds=\"\$concat_cmds\"
5476 else
5477 eval cmds=\"\$concat_cmds~\$old_archive_cmds\"
5478 fi
5479 fi
5480 fi
5481 save_ifs="$IFS"; IFS='~'
5482 for cmd in $cmds; do
5483 eval cmd=\"$cmd\"
5484 IFS="$save_ifs"
5485 $show "$cmd"
5486 $run eval "$cmd" || exit $?
5487 done
5488 IFS="$save_ifs"
5489 done
5490
5491 if test -n "$generated"; then
5492 $show "${rm}r$generated"
5493 $run ${rm}r$generated
5494 fi
5495
5496 # Now create the libtool archive.
5497 case $output in
5498 *.la)
5499 old_library=
5500 test "$build_old_libs" = yes && old_library="$libname.$libext"
5501 $show "creating $output"
5502
5503 # Preserve any variables that may affect compiler behavior
5504 for var in $variables_saved_for_relink; do
5505 if eval test -z \"\${$var+set}\"; then
5506 relink_command="{ test -z \"\${$var+set}\" || unset $var || { $var=; export $var; }; }; $relink_command"
5507 elif eval var_value=\$$var; test -z "$var_value"; then
5508 relink_command="$var=; export $var; $relink_command"
5509 else
5510 var_value=`$echo "X$var_value" | $Xsed -e "$sed_quote_subst"`
5511 relink_command="$var=\"$var_value\"; export $var; $relink_command"
5512 fi
5513 done
5514 # Quote the link command for shipping.
5515 relink_command="(cd `pwd`; $SHELL $0 $preserve_args --mode=relink $libtool_args @inst_prefix_dir@)"
5516 relink_command=`$echo "X$relink_command" | $Xsed -e "$sed_quote_subst"`
5517 if test "$hardcode_automatic" = yes ; then
5518 relink_command=
5519 fi
5520 # Only create the output if not a dry run.
5521 if test -z "$run"; then
5522 for installed in no yes; do
5523 if test "$installed" = yes; then
5524 if test -z "$install_libdir"; then
5525 break
5526 fi
5527 output="$output_objdir/$outputname"i
5528 # Replace all uninstalled libtool libraries with the installed ones
5529 newdependency_libs=
5530 for deplib in $dependency_libs; do
5531 case $deplib in
5532 *.la)
5533 name=`$echo "X$deplib" | $Xsed -e 's%^.*/%%'`
5534 eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
5535 if test -z "$libdir"; then
5536 $echo "$modename: \`$deplib' is not a valid libtool archive" 1>&2
5537 exit 1
5538 fi
5539 # We do not want portage's install root ($D) present. Check only for
5540 # this if the .la is being installed.
5541 if test "$installed" = yes && test "$D"; then
5542 eval mynewdependency_lib="`echo "$libdir/$name" |sed -e "s:$D::g" -e 's://:/:g'`"
5543 else
5544 mynewdependency_lib="$libdir/$name"
5545 fi
5546 # Do not add duplicates
5547 if test "$mynewdependency_lib"; then
5548 if test -z "`echo $newdependency_libs |grep -e "$mynewdependency_lib"`"; then
5549 newdependency_libs="$newdependency_libs $mynewdependency_lib"
5550 fi
5551 fi
5552 ;;
5553 *)
5554 if test "$installed" = yes; then
5555 # Rather use S=WORKDIR if our version of portage supports it.
5556 # This is because some ebuild (gcc) do not use $S as buildroot.
5557 if test "$PWORKDIR"; then
5558 S="$PWORKDIR"
5559 fi
5560 # We do not want portage's build root ($S) present.
5561 if test -n "`echo $deplib |grep -e "$S"`" && test "$S"; then
5562 mynewdependency_lib=""
5563 # We do not want portage's install root ($D) present.
5564 elif test -n "`echo $deplib |grep -e "$D"`" && test "$D"; then
5565 eval mynewdependency_lib="`echo "$deplib" |sed -e "s:$D::g" -e 's://:/:g'`"
5566 else
5567 mynewdependency_lib="$deplib"
5568 fi
5569 else
5570 mynewdependency_lib="$deplib"
5571 fi
5572 # Do not add duplicates
5573 if test "$mynewdependency_lib"; then
5574 if test -z "`echo $newdependency_libs |grep -e "$mynewdependency_lib"`"; then
5575 newdependency_libs="$newdependency_libs $mynewdependency_lib"
5576 fi
5577 fi
5578 ;;
5579 esac
5580 done
5581 dependency_libs="$newdependency_libs"
5582 newdlfiles=
5583 for lib in $dlfiles; do
5584 name=`$echo "X$lib" | $Xsed -e 's%^.*/%%'`
5585 eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
5586 if test -z "$libdir"; then
5587 $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
5588 exit 1
5589 fi
5590 newdlfiles="$newdlfiles $libdir/$name"
5591 done
5592 dlfiles="$newdlfiles"
5593 newdlprefiles=
5594 for lib in $dlprefiles; do
5595 name=`$echo "X$lib" | $Xsed -e 's%^.*/%%'`
5596 eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
5597 if test -z "$libdir"; then
5598 $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
5599 exit 1
5600 fi
5601 newdlprefiles="$newdlprefiles $libdir/$name"
5602 done
5603 dlprefiles="$newdlprefiles"
5604 else
5605 newdlfiles=
5606 for lib in $dlfiles; do
5607 case $lib in
5608 [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;;
5609 *) abs=`pwd`"/$lib" ;;
5610 esac
5611 newdlfiles="$newdlfiles $abs"
5612 done
5613 dlfiles="$newdlfiles"
5614 newdlprefiles=
5615 for lib in $dlprefiles; do
5616 case $lib in
5617 [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;;
5618 *) abs=`pwd`"/$lib" ;;
5619 esac
5620 newdlprefiles="$newdlprefiles $abs"
5621 done
5622 dlprefiles="$newdlprefiles"
5623 fi
5624 $rm $output
5625 # place dlname in correct position for cygwin
5626 tdlname=$dlname
5627 case $host,$output,$installed,$module,$dlname in
5628 *cygwin*,*lai,yes,no,*.dll | *mingw*,*lai,yes,no,*.dll) tdlname=../bin/$dlname ;;
5629 esac
5630 # Do not add duplicates
5631 if test "$installed" = yes && test "$D"; then
5632 install_libdir="`echo "$install_libdir" |sed -e "s:$D::g" -e 's://:/:g'`"
5633 fi
5634 $echo > $output "\
5635 # $outputname - a libtool library file
5636 # Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
5637 #
5638 # Please DO NOT delete this file!
5639 # It is necessary for linking the library.
5640
5641 # The name that we can dlopen(3).
5642 dlname='$tdlname'
5643
5644 # Names of this library.
5645 library_names='$library_names'
5646
5647 # The name of the static archive.
5648 old_library='$old_library'
5649
5650 # Libraries that this one depends upon.
5651 dependency_libs='$dependency_libs'
5652
5653 # Version information for $libname.
5654 current=$current
5655 age=$age
5656 revision=$revision
5657
5658 # Is this an already installed library?
5659 installed=$installed
5660
5661 # Should we warn about portability when linking against -modules?
5662 shouldnotlink=$module
5663
5664 # Files to dlopen/dlpreopen
5665 dlopen='$dlfiles'
5666 dlpreopen='$dlprefiles'
5667
5668 # Directory that this library needs to be installed in:
5669 libdir='$install_libdir'"
5670 if test "$installed" = no && test "$need_relink" = yes; then
5671 $echo >> $output "\
5672 relink_command=\"$relink_command\""
5673 fi
5674 done
5675 fi
5676
5677 # Do a symbolic link so that the libtool archive can be found in
5678 # LD_LIBRARY_PATH before the program is installed.
5679 $show "(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)"
5680 $run eval '(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)' || exit $?
5681 ;;
5682 esac
5683 exit 0
5684 ;;
5685
5686 # libtool install mode
5687 install)
5688 modename="$modename: install"
5689
5690 # There may be an optional sh(1) argument at the beginning of
5691 # install_prog (especially on Windows NT).
5692 if test "$nonopt" = "$SHELL" || test "$nonopt" = /bin/sh ||
5693 # Allow the use of GNU shtool's install command.
5694 $echo "X$nonopt" | $Xsed | grep shtool > /dev/null; then
5695 # Aesthetically quote it.
5696 arg=`$echo "X$nonopt" | $Xsed -e "$sed_quote_subst"`
5697 case $arg in
5698 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*)
5699 arg="\"$arg\""
5700 ;;
5701 esac
5702 install_prog="$arg "
5703 arg="$1"
5704 shift
5705 else
5706 install_prog=
5707 arg="$nonopt"
5708 fi
5709
5710 # The real first argument should be the name of the installation program.
5711 # Aesthetically quote it.
5712 arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
5713 case $arg in
5714 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*)
5715 arg="\"$arg\""
5716 ;;
5717 esac
5718 install_prog="$install_prog$arg"
5719
5720 # We need to accept at least all the BSD install flags.
5721 dest=
5722 files=
5723 opts=
5724 prev=
5725 install_type=
5726 isdir=no
5727 stripme=
5728 for arg
5729 do
5730 if test -n "$dest"; then
5731 files="$files $dest"
5732 dest="$arg"
5733 continue
5734 fi
5735
5736 case $arg in
5737 -d) isdir=yes ;;
5738 -f) prev="-f" ;;
5739 -g) prev="-g" ;;
5740 -m) prev="-m" ;;
5741 -o) prev="-o" ;;
5742 -s)
5743 stripme=" -s"
5744 continue
5745 ;;
5746 -*) ;;
5747
5748 *)
5749 # If the previous option needed an argument, then skip it.
5750 if test -n "$prev"; then
5751 prev=
5752 else
5753 dest="$arg"
5754 continue
5755 fi
5756 ;;
5757 esac
5758
5759 # Aesthetically quote the argument.
5760 arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
5761 case $arg in
5762 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*)
5763 arg="\"$arg\""
5764 ;;
5765 esac
5766 install_prog="$install_prog $arg"
5767 done
5768
5769 if test -z "$install_prog"; then
5770 $echo "$modename: you must specify an install program" 1>&2
5771 $echo "$help" 1>&2
5772 exit 1
5773 fi
5774
5775 if test -n "$prev"; then
5776 $echo "$modename: the \`$prev' option requires an argument" 1>&2
5777 $echo "$help" 1>&2
5778 exit 1
5779 fi
5780
5781 if test -z "$files"; then
5782 if test -z "$dest"; then
5783 $echo "$modename: no file or destination specified" 1>&2
5784 else
5785 $echo "$modename: you must specify a destination" 1>&2
5786 fi
5787 $echo "$help" 1>&2
5788 exit 1
5789 fi
5790
5791 # Strip any trailing slash from the destination.
5792 dest=`$echo "X$dest" | $Xsed -e 's%/$%%'`
5793
5794 # Check to see that the destination is a directory.
5795 test -d "$dest" && isdir=yes
5796 if test "$isdir" = yes; then
5797 destdir="$dest"
5798 destname=
5799 else
5800 destdir=`$echo "X$dest" | $Xsed -e 's%/[^/]*$%%'`
5801 test "X$destdir" = "X$dest" && destdir=.
5802 destname=`$echo "X$dest" | $Xsed -e 's%^.*/%%'`
5803
5804 # Not a directory, so check to see that there is only one file specified.
5805 set dummy $files
5806 if test "$#" -gt 2; then
5807 $echo "$modename: \`$dest' is not a directory" 1>&2
5808 $echo "$help" 1>&2
5809 exit 1
5810 fi
5811 fi
5812 case $destdir in
5813 [\\/]* | [A-Za-z]:[\\/]*) ;;
5814 *)
5815 for file in $files; do
5816 case $file in
5817 *.lo) ;;
5818 *)
5819 $echo "$modename: \`$destdir' must be an absolute directory name" 1>&2
5820 $echo "$help" 1>&2
5821 exit 1
5822 ;;
5823 esac
5824 done
5825 ;;
5826 esac
5827
5828 # This variable tells wrapper scripts just to set variables rather
5829 # than running their programs.
5830 libtool_install_magic="$magic"
5831
5832 staticlibs=
5833 future_libdirs=
5834 current_libdirs=
5835 for file in $files; do
5836
5837 # Do each installation.
5838 case $file in
5839 *.$libext)
5840 # Do the static libraries later.
5841 staticlibs="$staticlibs $file"
5842 ;;
5843
5844 *.la)
5845 # Check to see that this really is a libtool archive.
5846 if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
5847 else
5848 $echo "$modename: \`$file' is not a valid libtool archive" 1>&2
5849 $echo "$help" 1>&2
5850 exit 1
5851 fi
5852
5853 library_names=
5854 old_library=
5855 relink_command=
5856 # If there is no directory component, then add one.
5857 case $file in
5858 */* | *\\*) . $file ;;
5859 *) . ./$file ;;
5860 esac
5861
5862 # Add the libdir to current_libdirs if it is the destination.
5863 if test "X$destdir" = "X$libdir"; then
5864 case "$current_libdirs " in
5865 *" $libdir "*) ;;
5866 *) current_libdirs="$current_libdirs $libdir" ;;
5867 esac
5868 else
5869 # Note the libdir as a future libdir.
5870 case "$future_libdirs " in
5871 *" $libdir "*) ;;
5872 *) future_libdirs="$future_libdirs $libdir" ;;
5873 esac
5874 fi
5875
5876 dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`/
5877 test "X$dir" = "X$file/" && dir=
5878 dir="$dir$objdir"
5879
5880 if test -n "$relink_command"; then
5881 # Determine the prefix the user has applied to our future dir.
5882 inst_prefix_dir=`$echo "$destdir" | $SED "s%$libdir\$%%"`
5883
5884 # Don't allow the user to place us outside of our expected
5885 # location b/c this prevents finding dependent libraries that
5886 # are installed to the same prefix.
5887 # At present, this check doesn't affect windows .dll's that
5888 # are installed into $libdir/../bin (currently, that works fine)
5889 # but it's something to keep an eye on.
5890 if test "$inst_prefix_dir" = "$destdir"; then
5891 $echo "$modename: error: cannot install \`$file' to a directory not ending in $libdir" 1>&2
5892 exit 1
5893 fi
5894
5895 if test -n "$inst_prefix_dir"; then
5896 # Stick the inst_prefix_dir data into the link command.
5897 relink_command=`$echo "$relink_command" | $SED "s%@inst_prefix_dir@%-inst-prefix-dir $inst_prefix_dir%"`
5898 else
5899 relink_command=`$echo "$relink_command" | $SED "s%@inst_prefix_dir@%%"`
5900 fi
5901
5902 $echo "$modename: warning: relinking \`$file'" 1>&2
5903 $show "$relink_command"
5904 if $run eval "$relink_command"; then :
5905 else
5906 $echo "$modename: error: relink \`$file' with the above command before installing it" 1>&2
5907 exit 1
5908 fi
5909 fi
5910
5911 # See the names of the shared library.
5912 set dummy $library_names
5913 if test -n "$2"; then
5914 realname="$2"
5915 shift
5916 shift
5917
5918 srcname="$realname"
5919 test -n "$relink_command" && srcname="$realname"T
5920
5921 # Install the shared library and build the symlinks.
5922 $show "$install_prog $dir/$srcname $destdir/$realname"
5923 $run eval "$install_prog $dir/$srcname $destdir/$realname" || exit $?
5924 if test -n "$stripme" && test -n "$striplib"; then
5925 $show "$striplib $destdir/$realname"
5926 $run eval "$striplib $destdir/$realname" || exit $?
5927 fi
5928
5929 if test "$#" -gt 0; then
5930 # Delete the old symlinks, and create new ones.
5931 for linkname
5932 do
5933 if test "$linkname" != "$realname"; then
5934 $show "(cd $destdir && $rm $linkname && $LN_S $realname $linkname)"
5935 $run eval "(cd $destdir && $rm $linkname && $LN_S $realname $linkname)"
5936 fi
5937 done
5938 fi
5939
5940 # Do each command in the postinstall commands.
5941 lib="$destdir/$realname"
5942 cmds=$postinstall_cmds
5943 save_ifs="$IFS"; IFS='~'
5944 for cmd in $cmds; do
5945 IFS="$save_ifs"
5946 eval cmd=\"$cmd\"
5947 $show "$cmd"
5948 $run eval "$cmd" || exit $?
5949 done
5950 IFS="$save_ifs"
5951 fi
5952
5953 # Install the pseudo-library for information purposes.
5954 name=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
5955 instname="$dir/$name"i
5956 $show "$install_prog $instname $destdir/$name"
5957 $run eval "$install_prog $instname $destdir/$name" || exit $?
5958
5959 # Maybe install the static library, too.
5960 test -n "$old_library" && staticlibs="$staticlibs $dir/$old_library"
5961 ;;
5962
5963 *.lo)
5964 # Install (i.e. copy) a libtool object.
5965
5966 # Figure out destination file name, if it wasn't already specified.
5967 if test -n "$destname"; then
5968 destfile="$destdir/$destname"
5969 else
5970 destfile=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
5971 destfile="$destdir/$destfile"
5972 fi
5973
5974 # Deduce the name of the destination old-style object file.
5975 case $destfile in
5976 *.lo)
5977 staticdest=`$echo "X$destfile" | $Xsed -e "$lo2o"`
5978 ;;
5979 *.$objext)
5980 staticdest="$destfile"
5981 destfile=
5982 ;;
5983 *)
5984 $echo "$modename: cannot copy a libtool object to \`$destfile'" 1>&2
5985 $echo "$help" 1>&2
5986 exit 1
5987 ;;
5988 esac
5989
5990 # Install the libtool object if requested.
5991 if test -n "$destfile"; then
5992 $show "$install_prog $file $destfile"
5993 $run eval "$install_prog $file $destfile" || exit $?
5994 fi
5995
5996 # Install the old object if enabled.
5997 if test "$build_old_libs" = yes; then
5998 # Deduce the name of the old-style object file.
5999 staticobj=`$echo "X$file" | $Xsed -e "$lo2o"`
6000
6001 $show "$install_prog $staticobj $staticdest"
6002 $run eval "$install_prog \$staticobj \$staticdest" || exit $?
6003 fi
6004 exit 0
6005 ;;
6006
6007 *)
6008 # Figure out destination file name, if it wasn't already specified.
6009 if test -n "$destname"; then
6010 destfile="$destdir/$destname"
6011 else
6012 destfile=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
6013 destfile="$destdir/$destfile"
6014 fi
6015
6016 # If the file is missing, and there is a .exe on the end, strip it
6017 # because it is most likely a libtool script we actually want to
6018 # install
6019 stripped_ext=""
6020 case $file in
6021 *.exe)
6022 if test ! -f "$file"; then
6023 file=`$echo $file|${SED} 's,.exe$,,'`
6024 stripped_ext=".exe"
6025 fi
6026 ;;
6027 esac
6028
6029 # Do a test to see if this is really a libtool program.
6030 case $host in
6031 *cygwin*|*mingw*)
6032 wrapper=`$echo $file | ${SED} -e 's,.exe$,,'`
6033 ;;
6034 *)
6035 wrapper=$file
6036 ;;
6037 esac
6038 if (${SED} -e '4q' $wrapper | grep "^# Generated by .*$PACKAGE")>/dev/null 2>&1; then
6039 notinst_deplibs=
6040 relink_command=
6041
6042 # To insure that "foo" is sourced, and not "foo.exe",
6043 # finese the cygwin/MSYS system by explicitly sourcing "foo."
6044 # which disallows the automatic-append-.exe behavior.
6045 case $build in
6046 *cygwin* | *mingw*) wrapperdot=${wrapper}. ;;
6047 *) wrapperdot=${wrapper} ;;
6048 esac
6049 # If there is no directory component, then add one.
6050 case $file in
6051 */* | *\\*) . ${wrapperdot} ;;
6052 *) . ./${wrapperdot} ;;
6053 esac
6054
6055 # Check the variables that should have been set.
6056 if test -z "$notinst_deplibs"; then
6057 $echo "$modename: invalid libtool wrapper script \`$wrapper'" 1>&2
6058 exit 1
6059 fi
6060
6061 finalize=yes
6062 for lib in $notinst_deplibs; do
6063 # Check to see that each library is installed.
6064 libdir=
6065 if test -f "$lib"; then
6066 # If there is no directory component, then add one.
6067 case $lib in
6068 */* | *\\*) . $lib ;;
6069 *) . ./$lib ;;
6070 esac
6071 fi
6072 libfile="$libdir/"`$echo "X$lib" | $Xsed -e 's%^.*/%%g'` ### testsuite: skip nested quoting test
6073 if test -n "$libdir" && test ! -f "$libfile"; then
6074 $echo "$modename: warning: \`$lib' has not been installed in \`$libdir'" 1>&2
6075 finalize=no
6076 fi
6077 done
6078
6079 relink_command=
6080 # To insure that "foo" is sourced, and not "foo.exe",
6081 # finese the cygwin/MSYS system by explicitly sourcing "foo."
6082 # which disallows the automatic-append-.exe behavior.
6083 case $build in
6084 *cygwin* | *mingw*) wrapperdot=${wrapper}. ;;
6085 *) wrapperdot=${wrapper} ;;
6086 esac
6087 # If there is no directory component, then add one.
6088 case $file in
6089 */* | *\\*) . ${wrapperdot} ;;
6090 *) . ./${wrapperdot} ;;
6091 esac
6092
6093 outputname=
6094 if test "$fast_install" = no && test -n "$relink_command"; then
6095 if test "$finalize" = yes && test -z "$run"; then
6096 tmpdir="/tmp"
6097 test -n "$TMPDIR" && tmpdir="$TMPDIR"
6098 tmpdir="$tmpdir/libtool-$$"
6099 if $mkdir "$tmpdir" && chmod 700 "$tmpdir"; then :
6100 else
6101 $echo "$modename: error: cannot create temporary directory \`$tmpdir'" 1>&2
6102 continue
6103 fi
6104 file=`$echo "X$file$stripped_ext" | $Xsed -e 's%^.*/%%'`
6105 outputname="$tmpdir/$file"
6106 # Replace the output file specification.
6107 relink_command=`$echo "X$relink_command" | $Xsed -e 's%@OUTPUT@%'"$outputname"'%g'`
6108
6109 $show "$relink_command"
6110 if $run eval "$relink_command"; then :
6111 else
6112 $echo "$modename: error: relink \`$file' with the above command before installing it" 1>&2
6113 ${rm}r "$tmpdir"
6114 continue
6115 fi
6116 file="$outputname"
6117 else
6118 $echo "$modename: warning: cannot relink \`$file'" 1>&2
6119 fi
6120 else
6121 # Install the binary that we compiled earlier.
6122 file=`$echo "X$file$stripped_ext" | $Xsed -e "s%\([^/]*\)$%$objdir/\1%"`
6123 fi
6124 fi
6125
6126 # remove .exe since cygwin /usr/bin/install will append another
6127 # one anyways
6128 case $install_prog,$host in
6129 */usr/bin/install*,*cygwin*)
6130 case $file:$destfile in
6131 *.exe:*.exe)
6132 # this is ok
6133 ;;
6134 *.exe:*)
6135 destfile=$destfile.exe
6136 ;;
6137 *:*.exe)
6138 destfile=`$echo $destfile | ${SED} -e 's,.exe$,,'`
6139 ;;
6140 esac
6141 ;;
6142 esac
6143 $show "$install_prog$stripme $file $destfile"
6144 $run eval "$install_prog\$stripme \$file \$destfile" || exit $?
6145 test -n "$outputname" && ${rm}r "$tmpdir"
6146 ;;
6147 esac
6148 done
6149
6150 for file in $staticlibs; do
6151 name=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
6152
6153 # Set up the ranlib parameters.
6154 oldlib="$destdir/$name"
6155
6156 $show "$install_prog $file $oldlib"
6157 $run eval "$install_prog \$file \$oldlib" || exit $?
6158
6159 if test -n "$stripme" && test -n "$old_striplib"; then
6160 $show "$old_striplib $oldlib"
6161 $run eval "$old_striplib $oldlib" || exit $?
6162 fi
6163
6164 # Do each command in the postinstall commands.
6165 cmds=$old_postinstall_cmds
6166 save_ifs="$IFS"; IFS='~'
6167 for cmd in $cmds; do
6168 IFS="$save_ifs"
6169 eval cmd=\"$cmd\"
6170 $show "$cmd"
6171 $run eval "$cmd" || exit $?
6172 done
6173 IFS="$save_ifs"
6174 done
6175
6176 if test -n "$future_libdirs"; then
6177 $echo "$modename: warning: remember to run \`$progname --finish$future_libdirs'" 1>&2
6178 fi
6179
6180 if test -n "$current_libdirs"; then
6181 # Maybe just do a dry run.
6182 test -n "$run" && current_libdirs=" -n$current_libdirs"
6183 exec_cmd='$SHELL $0 $preserve_args --finish$current_libdirs'
6184 else
6185 exit 0
6186 fi
6187 ;;
6188
6189 # libtool finish mode
6190 finish)
6191 modename="$modename: finish"
6192 libdirs="$nonopt"
6193 admincmds=
6194
6195 if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then
6196 for dir
6197 do
6198 libdirs="$libdirs $dir"
6199 done
6200
6201 for libdir in $libdirs; do
6202 if test -n "$finish_cmds"; then
6203 # Do each command in the finish commands.
6204 cmds=$finish_cmds
6205 save_ifs="$IFS"; IFS='~'
6206 for cmd in $cmds; do
6207 IFS="$save_ifs"
6208 eval cmd=\"$cmd\"
6209 $show "$cmd"
6210 $run eval "$cmd" || admincmds="$admincmds
6211 $cmd"
6212 done
6213 IFS="$save_ifs"
6214 fi
6215 if test -n "$finish_eval"; then
6216 # Do the single finish_eval.
6217 eval cmds=\"$finish_eval\"
6218 $run eval "$cmds" || admincmds="$admincmds
6219 $cmds"
6220 fi
6221 done
6222 fi
6223
6224 # Exit here if they wanted silent mode.
6225 test "$show" = : && exit 0
6226
6227 $echo "----------------------------------------------------------------------"
6228 $echo "Libraries have been installed in:"
6229 for libdir in $libdirs; do
6230 $echo " $libdir"
6231 done
6232 $echo
6233 $echo "If you ever happen to want to link against installed libraries"
6234 $echo "in a given directory, LIBDIR, you must either use libtool, and"
6235 $echo "specify the full pathname of the library, or use the \`-LLIBDIR'"
6236 $echo "flag during linking and do at least one of the following:"
6237 if test -n "$shlibpath_var"; then
6238 $echo " - add LIBDIR to the \`$shlibpath_var' environment variable"
6239 $echo " during execution"
6240 fi
6241 if test -n "$runpath_var"; then
6242 $echo " - add LIBDIR to the \`$runpath_var' environment variable"
6243 $echo " during linking"
6244 fi
6245 if test -n "$hardcode_libdir_flag_spec"; then
6246 libdir=LIBDIR
6247 eval flag=\"$hardcode_libdir_flag_spec\"
6248
6249 $echo " - use the \`$flag' linker flag"
6250 fi
6251 if test -n "$admincmds"; then
6252 $echo " - have your system administrator run these commands:$admincmds"
6253 fi
6254 if test -f /etc/ld.so.conf; then
6255 $echo " - have your system administrator add LIBDIR to \`/etc/ld.so.conf'"
6256 fi
6257 $echo
6258 $echo "See any operating system documentation about shared libraries for"
6259 $echo "more information, such as the ld(1) and ld.so(8) manual pages."
6260 $echo "----------------------------------------------------------------------"
6261 exit 0
6262 ;;
6263
6264 # libtool execute mode
6265 execute)
6266 modename="$modename: execute"
6267
6268 # The first argument is the command name.
6269 cmd="$nonopt"
6270 if test -z "$cmd"; then
6271 $echo "$modename: you must specify a COMMAND" 1>&2
6272 $echo "$help"
6273 exit 1
6274 fi
6275
6276 # Handle -dlopen flags immediately.
6277 for file in $execute_dlfiles; do
6278 if test ! -f "$file"; then
6279 $echo "$modename: \`$file' is not a file" 1>&2
6280 $echo "$help" 1>&2
6281 exit 1
6282 fi
6283
6284 dir=
6285 case $file in
6286 *.la)
6287 # Check to see that this really is a libtool archive.
6288 if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
6289 else
6290 $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
6291 $echo "$help" 1>&2
6292 exit 1
6293 fi
6294
6295 # Read the libtool library.
6296 dlname=
6297 library_names=
6298
6299 # If there is no directory component, then add one.
6300 case $file in
6301 */* | *\\*) . $file ;;
6302 *) . ./$file ;;
6303 esac
6304
6305 # Skip this library if it cannot be dlopened.
6306 if test -z "$dlname"; then
6307 # Warn if it was a shared library.
6308 test -n "$library_names" && $echo "$modename: warning: \`$file' was not linked with \`-export-dynamic'"
6309 continue
6310 fi
6311
6312 dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`
6313 test "X$dir" = "X$file" && dir=.
6314
6315 if test -f "$dir/$objdir/$dlname"; then
6316 dir="$dir/$objdir"
6317 else
6318 $echo "$modename: cannot find \`$dlname' in \`$dir' or \`$dir/$objdir'" 1>&2
6319 exit 1
6320 fi
6321 ;;
6322
6323 *.lo)
6324 # Just add the directory containing the .lo file.
6325 dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`
6326 test "X$dir" = "X$file" && dir=.
6327 ;;
6328
6329 *)
6330 $echo "$modename: warning \`-dlopen' is ignored for non-libtool libraries and objects" 1>&2
6331 continue
6332 ;;
6333 esac
6334
6335 # Get the absolute pathname.
6336 absdir=`cd "$dir" && pwd`
6337 test -n "$absdir" && dir="$absdir"
6338
6339 # Now add the directory to shlibpath_var.
6340 if eval "test -z \"\$$shlibpath_var\""; then
6341 eval "$shlibpath_var=\"\$dir\""
6342 else
6343 eval "$shlibpath_var=\"\$dir:\$$shlibpath_var\""
6344 fi
6345 done
6346
6347 # This variable tells wrapper scripts just to set shlibpath_var
6348 # rather than running their programs.
6349 libtool_execute_magic="$magic"
6350
6351 # Check if any of the arguments is a wrapper script.
6352 args=
6353 for file
6354 do
6355 case $file in
6356 -*) ;;
6357 *)
6358 # Do a test to see if this is really a libtool program.
6359 if (${SED} -e '4q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
6360 # If there is no directory component, then add one.
6361 case $file in
6362 */* | *\\*) . $file ;;
6363 *) . ./$file ;;
6364 esac
6365
6366 # Transform arg to wrapped name.
6367 file="$progdir/$program"
6368 fi
6369 ;;
6370 esac
6371 # Quote arguments (to preserve shell metacharacters).
6372 file=`$echo "X$file" | $Xsed -e "$sed_quote_subst"`
6373 args="$args \"$file\""
6374 done
6375
6376 if test -z "$run"; then
6377 if test -n "$shlibpath_var"; then
6378 # Export the shlibpath_var.
6379 eval "export $shlibpath_var"
6380 fi
6381
6382 # Restore saved environment variables
6383 if test "${save_LC_ALL+set}" = set; then
6384 LC_ALL="$save_LC_ALL"; export LC_ALL
6385 fi
6386 if test "${save_LANG+set}" = set; then
6387 LANG="$save_LANG"; export LANG
6388 fi
6389
6390 # Now prepare to actually exec the command.
6391 exec_cmd="\$cmd$args"
6392 else
6393 # Display what would be done.
6394 if test -n "$shlibpath_var"; then
6395 eval "\$echo \"\$shlibpath_var=\$$shlibpath_var\""
6396 $echo "export $shlibpath_var"
6397 fi
6398 $echo "$cmd$args"
6399 exit 0
6400 fi
6401 ;;
6402
6403 # libtool clean and uninstall mode
6404 clean | uninstall)
6405 modename="$modename: $mode"
6406 rm="$nonopt"
6407 files=
6408 rmforce=
6409 exit_status=0
6410
6411 # This variable tells wrapper scripts just to set variables rather
6412 # than running their programs.
6413 libtool_install_magic="$magic"
6414
6415 for arg
6416 do
6417 case $arg in
6418 -f) rm="$rm $arg"; rmforce=yes ;;
6419 -*) rm="$rm $arg" ;;
6420 *) files="$files $arg" ;;
6421 esac
6422 done
6423
6424 if test -z "$rm"; then
6425 $echo "$modename: you must specify an RM program" 1>&2
6426 $echo "$help" 1>&2
6427 exit 1
6428 fi
6429
6430 rmdirs=
6431
6432 origobjdir="$objdir"
6433 for file in $files; do
6434 dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`
6435 if test "X$dir" = "X$file"; then
6436 dir=.
6437 objdir="$origobjdir"
6438 else
6439 objdir="$dir/$origobjdir"
6440 fi
6441 name=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
6442 test "$mode" = uninstall && objdir="$dir"
6443
6444 # Remember objdir for removal later, being careful to avoid duplicates
6445 if test "$mode" = clean; then
6446 case " $rmdirs " in
6447 *" $objdir "*) ;;
6448 *) rmdirs="$rmdirs $objdir" ;;
6449 esac
6450 fi
6451
6452 # Don't error if the file doesn't exist and rm -f was used.
6453 if (test -L "$file") >/dev/null 2>&1 \
6454 || (test -h "$file") >/dev/null 2>&1 \
6455 || test -f "$file"; then
6456 :
6457 elif test -d "$file"; then
6458 exit_status=1
6459 continue
6460 elif test "$rmforce" = yes; then
6461 continue
6462 fi
6463
6464 rmfiles="$file"
6465
6466 case $name in
6467 *.la)
6468 # Possibly a libtool archive, so verify it.
6469 if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
6470 . $dir/$name
6471
6472 # Delete the libtool libraries and symlinks.
6473 for n in $library_names; do
6474 rmfiles="$rmfiles $objdir/$n"
6475 done
6476 test -n "$old_library" && rmfiles="$rmfiles $objdir/$old_library"
6477 test "$mode" = clean && rmfiles="$rmfiles $objdir/$name $objdir/${name}i"
6478
6479 if test "$mode" = uninstall; then
6480 if test -n "$library_names"; then
6481 # Do each command in the postuninstall commands.
6482 cmds=$postuninstall_cmds
6483 save_ifs="$IFS"; IFS='~'
6484 for cmd in $cmds; do
6485 IFS="$save_ifs"
6486 eval cmd=\"$cmd\"
6487 $show "$cmd"
6488 $run eval "$cmd"
6489 if test "$?" -ne 0 && test "$rmforce" != yes; then
6490 exit_status=1
6491 fi
6492 done
6493 IFS="$save_ifs"
6494 fi
6495
6496 if test -n "$old_library"; then
6497 # Do each command in the old_postuninstall commands.
6498 cmds=$old_postuninstall_cmds
6499 save_ifs="$IFS"; IFS='~'
6500 for cmd in $cmds; do
6501 IFS="$save_ifs"
6502 eval cmd=\"$cmd\"
6503 $show "$cmd"
6504 $run eval "$cmd"
6505 if test "$?" -ne 0 && test "$rmforce" != yes; then
6506 exit_status=1
6507 fi
6508 done
6509 IFS="$save_ifs"
6510 fi
6511 # FIXME: should reinstall the best remaining shared library.
6512 fi
6513 fi
6514 ;;
6515
6516 *.lo)
6517 # Possibly a libtool object, so verify it.
6518 if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
6519
6520 # Read the .lo file
6521 . $dir/$name
6522
6523 # Add PIC object to the list of files to remove.
6524 if test -n "$pic_object" \
6525