/[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 (11 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
4