/[svn]/vendor/pxys2-2.1.0/pxyscand/libtool
ViewVC logotype

Contents of /vendor/pxys2-2.1.0/pxyscand/libtool

Parent Directory Parent Directory | Revision Log Revision Log


Revision 3253 - (show annotations)
Wed Apr 2 20:46:18 2014 UTC (6 years, 10 months ago) by michael
File size: 206218 byte(s)
- Imported pxys2-2.1.0

1 #! /bin/sh
2
3 # libtoolT - Provide generalized library-building support services.
4 # Generated automatically by (GNU pxscand 2.0)
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="/usr/bin/sed"
34
35 # Sed that helps us avoid accidentally triggering echo(1) options like -n.
36 Xsed="/usr/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"
44
45 # ### BEGIN LIBTOOL CONFIG
46
47 # Libtool was configured on host avalon.in.thiell.com:
48
49 # Set the command separator (default: ~)
50 _S_=${LIBTOOL_CMD_SEP-\~}
51
52 # Shell to use when invoking shell scripts.
53 SHELL="/bin/sh"
54
55 # Whether or not to build shared libraries.
56 build_libtool_libs=yes
57
58 # Whether or not to build static libraries.
59 build_old_libs=yes
60
61 # Whether or not to add -lc for building shared libraries.
62 build_libtool_need_lc=no
63
64 # Whether or not to disallow shared libs when runtime libs are static
65 allow_libtool_libs_with_static_runtimes=no
66
67 # Whether or not to optimize for fast installation.
68 fast_install=yes
69
70 # The host system.
71 host_alias=
72 host=powerpc-apple-darwin7.0.0
73
74 # An echo program that does not interpret backslashes.
75 echo="echo"
76
77 # The archiver.
78 AR="ar"
79 AR_FLAGS="cru"
80
81 # A C compiler.
82 LTCC="gcc"
83
84 # A language-specific compiler.
85 CC="gcc"
86
87 # Is the compiler the GNU C compiler?
88 with_gcc=yes
89
90 # An ERE matcher.
91 EGREP="grep -E"
92
93 # The linker used to build libraries.
94 LD="/usr/bin/ld"
95
96 # Whether we need hard or soft links.
97 LN_S="ln -s"
98
99 # A BSD-compatible nm program.
100 NM="/usr/bin/nm -p"
101
102 # A symbol stripping program
103 STRIP=strip
104
105 # Used to examine libraries when file_magic_cmd begins "file"
106 MAGIC_CMD=file
107
108 # Used on cygwin: DLL creation program.
109 DLLTOOL="dlltool"
110
111 # Used on cygwin: object dumper.
112 OBJDUMP="objdump"
113
114 # Used on cygwin: assembler.
115 AS="as"
116
117 # The name of the directory that contains temporary libtool files.
118 objdir=.libs
119
120 # How to create reloadable object files.
121 reload_flag=" -r"
122 reload_cmds="\$CC -nostdlib -Xlinker\$reload_flag \$archargs -o \$output\$reload_objs"
123
124 # How to pass a linker flag through the compiler.
125 wl="-Wl,"
126
127 # Object file suffix (normally "o").
128 objext="o"
129
130 # Old archive suffix (normally "a").
131 libext="a"
132
133 # Shared library suffix (normally ".so").
134 shrext='$(test .$module = .yes && echo .so || echo .dylib)'
135
136 # Executable file suffix (normally "").
137 exeext=""
138
139 # Additional compiler flags for building library objects.
140 pic_flag=" -fno-common -DPIC"
141 pic_mode=default
142
143 # What is the maximum length of a command?
144 max_cmd_len=65536
145
146 # Does compiler simultaneously support -c and -o options?
147 compiler_c_o="yes"
148
149 # Must we lock files when doing compilation ?
150 need_locks="no"
151
152 # Do we need the lib prefix for modules?
153 need_lib_prefix=no
154
155 # Do we need a version for libraries?
156 need_version=no
157
158 # Whether dlopen is supported.
159 dlopen_support=unknown
160
161 # Whether dlopen of programs is supported.
162 dlopen_self=unknown
163
164 # Whether dlopen of statically linked programs is supported.
165 dlopen_self_static=unknown
166
167 # Compiler flag to prevent dynamic linking.
168 link_static_flag="-static"
169
170 # Compiler flag to turn off builtin functions.
171 no_builtin_flag=" -fno-builtin"
172
173 # Compiler flag to allow reflexive dlopens.
174 export_dynamic_flag_spec=""
175
176 # Compiler flag to generate shared objects directly from archives.
177 whole_archive_flag_spec="-all_load \$convenience"
178
179 # Compiler flag to generate thread-safe objects.
180 thread_safe_flag_spec=""
181
182 # Library versioning type.
183 version_type=darwin
184
185 # Format of library name prefix.
186 libname_spec="lib\$name"
187
188 # List of archive names. First name is the real one, the rest are links.
189 # The last name is the one that the linker finds with -lNAME.
190 library_names_spec="\${libname}\${release}\${major}\$shared_ext \${libname}\$shared_ext \${libname}\${release}\${versuffix}\$shared_ext"
191
192 # The coded name of the library, if different from the real name.
193 soname_spec="\${libname}\${release}\${major}\$shared_ext"
194
195 # Commands used to build and install an old-style archive.
196 RANLIB="ranlib"
197 old_archive_cmds="\$AR \$AR_FLAGS \$oldlib\$oldobjs\$old_deplibs${_S_}\$RANLIB \$oldlib"
198 old_postinstall_cmds="\$RANLIB \$oldlib${_S_}chmod 644 \$oldlib"
199 old_postuninstall_cmds=""
200
201 # Create an old-style archive from a shared archive.
202 old_archive_from_new_cmds=""
203
204 # Create a temporary old-style archive to link instead of a shared archive.
205 old_archive_from_expsyms_cmds=""
206
207 # Commands used to build and install a shared archive.
208 archive_cmds="\$CC -dynamiclib \$archargs \$allow_undefined_flag -o \$lib \$libobjs \$deplibs\$compiler_flags -install_name \$rpath/\$soname \$verstring"
209 archive_expsym_cmds="sed -e \\\"s,#.*,,\\\" -e \\\"s,^[ ]*,,\\\" -e \\\"s,^\\\\(..*\\\\),_&,\\\" < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym${_S_}\$CC -dynamiclib \$archargs \$allow_undefined_flag -o \$lib \$libobjs \$deplibs\$compiler_flags -install_name \$rpath/\$soname \$verstring${_S_}nmedit -s \$output_objdir/\${libname}-symbols.expsym \${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="\$CC -bundle \$archargs \$allow_undefined_flag -o \$lib \$libobjs \$deplibs\$compiler_flags"
215 module_expsym_cmds="sed -e \\\"s,#.*,,\\\" -e \\\"s,^[ ]*,,\\\" -e \\\"s,^\\\\(..*\\\\),_&,\\\" < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym${_S_}\$CC -bundle \$archargs \$allow_undefined_flag -o \$lib \$libobjs \$deplibs\$compiler_flags${_S_}nmedit -s \$output_objdir/\${libname}-symbols.expsym \${lib}"
216
217 # Commands to strip libraries.
218 old_striplib=""
219 striplib=""
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="/usr/bin/file -L"
246
247 # Flag that allows shared libraries with undefined symbols to be built.
248 allow_undefined_flag="-flat_namespace -undefined suppress"
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=""
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/^.*[ ]\\([BCDEGRST][BCDEGRST]*\\)[ ][ ]*\\(_\\)\\([_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=
270
271 # This is the shared library path variable.
272 shlibpath_var=DYLD_LIBRARY_PATH
273
274 # Is shlibpath searched before the hard-coded library search path?
275 shlibpath_overrides_runpath=yes
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=no
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=""
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=yes
310
311 # Variables whose values should be saved in libtool wrapper scripts and
312 # restored at relink time.
313 variables_saved_for_relink="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=yes
317
318 # Compile-time system search path for libraries
319 sys_lib_search_path_spec=" /usr/libexec/gcc/darwin/ppc/3.3/ /usr/local/libexec/gcc/darwin/ppc/3.3/ /usr/libexec/gcc/darwin/../../ppc-darwin/lib/ppc/3.3/ /usr/libexec/gcc/darwin/../../ppc-darwin/lib/ /usr/lib/gcc/darwin/ppc/3.3/ /usr/lib/gcc/darwin/ /usr/libexec/gcc/darwin/ppc/3.3/../../../ppc/3.3/ /usr/libexec/gcc/darwin/ppc/3.3/../../../ /lib/ppc/3.3/ /lib/ /usr/lib/ppc/3.3/ /usr/lib/ /lib /usr/lib /usr/local/lib"
320
321 # Run-time system search path for libraries
322 sys_lib_dlsearch_path_spec="/usr/local/lib /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 # The name of this program.
395 progname=`$echo "$0" | ${SED} 's%^.*/%%'`
396 modename="$progname"
397
398 # Constants.
399 PROGRAM=ltmain.sh
400 PACKAGE=libtool
401 VERSION=1.5
402 TIMESTAMP=" (1.1220 2003/04/05 19:32:58)"
403
404 default_mode=
405 help="Try \`$progname --help' for more information."
406 magic="%%%MAGIC variable%%%"
407 mkdir="mkdir"
408 mv="mv -f"
409 rm="rm -f"
410
411 # Sed substitution that helps us do robust quoting. It backslashifies
412 # metacharacters that are still active within double-quoted strings.
413 Xsed="${SED}"' -e 1s/^X//'
414 sed_quote_subst='s/\([\\`\\"$\\\\]\)/\\\1/g'
415 # test EBCDIC or ASCII
416 case `echo A|od -x` in
417 *[Cc]1*) # EBCDIC based system
418 SP2NL="tr '\100' '\n'"
419 NL2SP="tr '\r\n' '\100\100'"
420 ;;
421 *) # Assume ASCII based system
422 SP2NL="tr '\040' '\012'"
423 NL2SP="tr '\015\012' '\040\040'"
424 ;;
425 esac
426
427 # NLS nuisances.
428 # Only set LANG and LC_ALL to C if already set.
429 # These must not be set unconditionally because not all systems understand
430 # e.g. LANG=C (notably SCO).
431 # We save the old values to restore during execute mode.
432 if test "${LC_ALL+set}" = set; then
433 save_LC_ALL="$LC_ALL"; LC_ALL=C; export LC_ALL
434 fi
435 if test "${LANG+set}" = set; then
436 save_LANG="$LANG"; LANG=C; export LANG
437 fi
438
439 # Make sure IFS has a sensible default
440 : ${IFS=" "}
441
442 if test "$build_libtool_libs" != yes && test "$build_old_libs" != yes; then
443 $echo "$modename: not configured to build any kind of library" 1>&2
444 $echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2
445 exit 1
446 fi
447
448 # Global variables.
449 mode=$default_mode
450 nonopt=
451 prev=
452 prevopt=
453 run=
454 show="$echo"
455 show_help=
456 execute_dlfiles=
457 lo2o="s/\\.lo\$/.${objext}/"
458 o2lo="s/\\.${objext}\$/.lo/"
459
460 #####################################
461 # Shell function definitions:
462 # This seems to be the best place for them
463
464 # Need a lot of goo to handle *both* DLLs and import libs
465 # Has to be a shell function in order to 'eat' the argument
466 # that is supplied when $file_magic_command is called.
467 win32_libid () {
468 win32_libid_type="unknown"
469 win32_fileres=`file -L $1 2>/dev/null`
470 case $win32_fileres in
471 *ar\ archive\ import\ library*) # definitely import
472 win32_libid_type="x86 archive import"
473 ;;
474 *ar\ archive*) # could be an import, or static
475 if eval $OBJDUMP -f $1 | $SED -e '10q' 2>/dev/null | \
476 grep -E 'file format pe-i386(.*architecture: i386)?' >/dev/null ; then
477 win32_nmres=`eval $NM -f posix -A $1 | \
478 sed -n -e '1,100{/ I /{x;/import/!{s/^/import/;h;p;};x;};}'`
479 if test "X$win32_nmres" = "Ximport" ; then
480 win32_libid_type="x86 archive import"
481 else
482 win32_libid_type="x86 archive static"
483 fi
484 fi
485 ;;
486 *DLL*)
487 win32_libid_type="x86 DLL"
488 ;;
489 *executable*) # but shell scripts are "executable" too...
490 case $win32_fileres in
491 *MS\ Windows\ PE\ Intel*)
492 win32_libid_type="x86 DLL"
493 ;;
494 esac
495 ;;
496 esac
497 $echo $win32_libid_type
498 }
499
500 # End of Shell function definitions
501 #####################################
502
503 # Parse our command line options once, thoroughly.
504 while test "$#" -gt 0
505 do
506 arg="$1"
507 shift
508
509 case $arg in
510 -*=*) optarg=`$echo "X$arg" | $Xsed -e 's/[-_a-zA-Z0-9]*=//'` ;;
511 *) optarg= ;;
512 esac
513
514 # If the previous option needs an argument, assign it.
515 if test -n "$prev"; then
516 case $prev in
517 execute_dlfiles)
518 execute_dlfiles="$execute_dlfiles $arg"
519 ;;
520 tag)
521 tagname="$arg"
522
523 # Check whether tagname contains only valid characters
524 case $tagname in
525 *[!-_A-Za-z0-9,/]*)
526 $echo "$progname: invalid tag name: $tagname" 1>&2
527 exit 1
528 ;;
529 esac
530
531 case $tagname in
532 CC)
533 # Don't test for the "default" C tag, as we know, it's there, but
534 # not specially marked.
535 ;;
536 *)
537 if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$" < "$0" > /dev/null; then
538 taglist="$taglist $tagname"
539 # Evaluate the configuration.
540 eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$tagname'$/,/^# ### END LIBTOOL TAG CONFIG: '$tagname'$/p' < $0`"
541 else
542 $echo "$progname: ignoring unknown tag $tagname" 1>&2
543 fi
544 ;;
545 esac
546 ;;
547 *)
548 eval "$prev=\$arg"
549 ;;
550 esac
551
552 prev=
553 prevopt=
554 continue
555 fi
556
557 # Have we seen a non-optional argument yet?
558 case $arg in
559 --help)
560 show_help=yes
561 ;;
562
563 --version)
564 $echo "$PROGRAM (GNU $PACKAGE) $VERSION$TIMESTAMP"
565 $echo
566 $echo "Copyright (C) 2003 Free Software Foundation, Inc."
567 $echo "This is free software; see the source for copying conditions. There is NO"
568 $echo "warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
569 exit 0
570 ;;
571
572 --config)
573 ${SED} -e '1,/^# ### BEGIN LIBTOOL CONFIG/d' -e '/^# ### END LIBTOOL CONFIG/,$d' $0
574 # Now print the configurations for the tags.
575 for tagname in $taglist; do
576 ${SED} -n -e "/^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$/,/^# ### END LIBTOOL TAG CONFIG: $tagname$/p" < "$0"
577 done
578 exit 0
579 ;;
580
581 --debug)
582 $echo "$progname: enabling shell trace mode"
583 set -x
584 ;;
585
586 --dry-run | -n)
587 run=:
588 ;;
589
590 --features)
591 $echo "host: $host"
592 if test "$build_libtool_libs" = yes; then
593 $echo "enable shared libraries"
594 else
595 $echo "disable shared libraries"
596 fi
597 if test "$build_old_libs" = yes; then
598 $echo "enable static libraries"
599 else
600 $echo "disable static libraries"
601 fi
602 exit 0
603 ;;
604
605 --finish) mode="finish" ;;
606
607 --mode) prevopt="--mode" prev=mode ;;
608 --mode=*) mode="$optarg" ;;
609
610 --preserve-dup-deps) duplicate_deps="yes" ;;
611
612 --quiet | --silent)
613 show=:
614 ;;
615
616 --tag) prevopt="--tag" prev=tag ;;
617 --tag=*)
618 set tag "$optarg" ${1+"$@"}
619 shift
620 prev=tag
621 ;;
622
623 -dlopen)
624 prevopt="-dlopen"
625 prev=execute_dlfiles
626 ;;
627
628 -*)
629 $echo "$modename: unrecognized option \`$arg'" 1>&2
630 $echo "$help" 1>&2
631 exit 1
632 ;;
633
634 *)
635 nonopt="$arg"
636 break
637 ;;
638 esac
639 done
640
641 if test -n "$prevopt"; then
642 $echo "$modename: option \`$prevopt' requires an argument" 1>&2
643 $echo "$help" 1>&2
644 exit 1
645 fi
646
647 # If this variable is set in any of the actions, the command in it
648 # will be execed at the end. This prevents here-documents from being
649 # left over by shells.
650 exec_cmd=
651
652 if test -z "$show_help"; then
653 archargs=
654 case $host in
655 *-*-darwin*)
656 # For darwin, separate arch arguments and apply them to all compile/link
657 # commands
658 doarch=
659 for arg; do
660 if test -n "$doarch"; then
661 archargs="$archargs -arch $arg"
662 doarch=
663 continue
664 fi
665 case $arg in
666 -arch) doarch=y;;
667 esac
668 done
669 esac
670
671 # Infer the operation mode.
672 if test -z "$mode"; then
673 $echo "*** Warning: inferring the mode of operation is deprecated." 1>&2
674 $echo "*** Future versions of Libtool will require -mode=MODE be specified." 1>&2
675 case $nonopt in
676 *cc | cc* | *++ | gcc* | *-gcc* | g++* | xlc*)
677 mode=link
678 for arg
679 do
680 case $arg in
681 -c)
682 mode=compile
683 break
684 ;;
685 esac
686 done
687 ;;
688 *db | *dbx | *strace | *truss)
689 mode=execute
690 ;;
691 *install*|cp|mv)
692 mode=install
693 ;;
694 *rm)
695 mode=uninstall
696 ;;
697 *)
698 # If we have no mode, but dlfiles were specified, then do execute mode.
699 test -n "$execute_dlfiles" && mode=execute
700
701 # Just use the default operation mode.
702 if test -z "$mode"; then
703 if test -n "$nonopt"; then
704 $echo "$modename: warning: cannot infer operation mode from \`$nonopt'" 1>&2
705 else
706 $echo "$modename: warning: cannot infer operation mode without MODE-ARGS" 1>&2
707 fi
708 fi
709 ;;
710 esac
711 fi
712
713 # Only execute mode is allowed to have -dlopen flags.
714 if test -n "$execute_dlfiles" && test "$mode" != execute; then
715 $echo "$modename: unrecognized option \`-dlopen'" 1>&2
716 $echo "$help" 1>&2
717 exit 1
718 fi
719
720 # Change the help message to a mode-specific one.
721 generic_help="$help"
722 help="Try \`$modename --help --mode=$mode' for more information."
723
724 # These modes are in order of execution frequency so that they run quickly.
725 case $mode in
726 # libtool compile mode
727 compile)
728 modename="$modename: compile"
729 # Get the compilation command and the source file.
730 base_compile=
731 srcfile="$nonopt" # always keep a non-empty value in "srcfile"
732 suppress_output=
733 arg_mode=normal
734 libobj=
735
736 for arg
737 do
738 case "$arg_mode" in
739 arg )
740 # do not "continue". Instead, add this to base_compile
741 lastarg="$arg"
742 arg_mode=normal
743 ;;
744
745 target )
746 libobj="$arg"
747 arg_mode=normal
748 continue
749 ;;
750
751 normal )
752 # Accept any command-line options.
753 case $arg in
754 -o)
755 if test -n "$libobj" ; then
756 $echo "$modename: you cannot specify \`-o' more than once" 1>&2
757 exit 1
758 fi
759 arg_mode=target
760 continue
761 ;;
762
763 -static)
764 build_old_libs=yes
765 continue
766 ;;
767
768 -prefer-pic)
769 pic_mode=yes
770 continue
771 ;;
772
773 -prefer-non-pic)
774 pic_mode=no
775 continue
776 ;;
777
778 -Xcompiler)
779 arg_mode=arg # the next one goes into the "base_compile" arg list
780 continue # The current "srcfile" will either be retained or
781 ;; # replaced later. I would guess that would be a bug.
782
783 -Wc,*)
784 args=`$echo "X$arg" | $Xsed -e "s/^-Wc,//"`
785 lastarg=
786 save_ifs="$IFS"; IFS=','
787 for arg in $args; do
788 IFS="$save_ifs"
789
790 # Double-quote args containing other shell metacharacters.
791 # Many Bourne shells cannot handle close brackets correctly
792 # in scan sets, so we specify it separately.
793 case $arg in
794 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
795 arg="\"$arg\""
796 ;;
797 esac
798 lastarg="$lastarg $arg"
799 done
800 IFS="$save_ifs"
801 lastarg=`$echo "X$lastarg" | $Xsed -e "s/^ //"`
802
803 # Add the arguments to base_compile.
804 base_compile="$base_compile $lastarg"
805 continue
806 ;;
807
808 * )
809 # Accept the current argument as the source file.
810 # The previous "srcfile" becomes the current argument.
811 #
812 lastarg="$srcfile"
813 srcfile="$arg"
814 ;;
815 esac # case $arg
816 ;;
817 esac # case $arg_mode
818
819 # Aesthetically quote the previous argument.
820 lastarg=`$echo "X$lastarg" | $Xsed -e "$sed_quote_subst"`
821
822 case $lastarg in
823 # Double-quote args containing other shell metacharacters.
824 # Many Bourne shells cannot handle close brackets correctly
825 # in scan sets, so we specify it separately.
826 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
827 lastarg="\"$lastarg\""
828 ;;
829 esac
830
831 base_compile="$base_compile $lastarg"
832 done # for arg
833
834 case $arg_mode in
835 arg)
836 $echo "$modename: you must specify an argument for -Xcompile"
837 exit 1
838 ;;
839 target)
840 $echo "$modename: you must specify a target with \`-o'" 1>&2
841 exit 1
842 ;;
843 *)
844 # Get the name of the library object.
845 [ -z "$libobj" ] && libobj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%'`
846 ;;
847 esac
848
849 # Recognize several different file suffixes.
850 # If the user specifies -o file.o, it is replaced with file.lo
851 xform='[cCFSifmso]'
852 case $libobj in
853 *.ada) xform=ada ;;
854 *.adb) xform=adb ;;
855 *.ads) xform=ads ;;
856 *.asm) xform=asm ;;
857 *.c++) xform=c++ ;;
858 *.cc) xform=cc ;;
859 *.ii) xform=ii ;;
860 *.class) xform=class ;;
861 *.cpp) xform=cpp ;;
862 *.cxx) xform=cxx ;;
863 *.f90) xform=f90 ;;
864 *.for) xform=for ;;
865 *.java) xform=java ;;
866 esac
867
868 libobj=`$echo "X$libobj" | $Xsed -e "s/\.$xform$/.lo/"`
869
870 case $libobj in
871 *.lo) obj=`$echo "X$libobj" | $Xsed -e "$lo2o"` ;;
872 *)
873 $echo "$modename: cannot determine name of library object from \`$libobj'" 1>&2
874 exit 1
875 ;;
876 esac
877
878 # Infer tagged configuration to use if any are available and
879 # if one wasn't chosen via the "--tag" command line option.
880 # Only attempt this if the compiler in the base compile
881 # command doesn't match the default compiler.
882 if test -n "$available_tags" && test -z "$tagname"; then
883 case $base_compile in
884 # Blanks in the command may have been stripped by the calling shell,
885 # but not from the CC environment variable when configure was run.
886 " $CC "* | "$CC "* | " `$echo $CC` "* | "`$echo $CC` "*) ;;
887 # Blanks at the start of $base_compile will cause this to fail
888 # if we don't check for them as well.
889 *)
890 for z in $available_tags; do
891 if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $z$" < "$0" > /dev/null; then
892 # Evaluate the configuration.
893 eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^# ### END LIBTOOL TAG CONFIG: '$z'$/p' < $0`"
894 case "$base_compile " in
895 "$CC "* | " $CC "* | "`$echo $CC` "* | " `$echo $CC` "*)
896 # The compiler in the base compile command matches
897 # the one in the tagged configuration.
898 # Assume this is the tagged configuration we want.
899 tagname=$z
900 break
901 ;;
902 esac
903 fi
904 done
905 # If $tagname still isn't set, then no tagged configuration
906 # was found and let the user know that the "--tag" command
907 # line option must be used.
908 if test -z "$tagname"; then
909 $echo "$modename: unable to infer tagged configuration"
910 $echo "$modename: specify a tag with \`--tag'" 1>&2
911 exit 1
912 # else
913 # $echo "$modename: using $tagname tagged configuration"
914 fi
915 ;;
916 esac
917 fi
918
919 objname=`$echo "X$obj" | $Xsed -e 's%^.*/%%'`
920 xdir=`$echo "X$obj" | $Xsed -e 's%/[^/]*$%%'`
921 if test "X$xdir" = "X$obj"; then
922 xdir=
923 else
924 xdir=$xdir/
925 fi
926 lobj=${xdir}$objdir/$objname
927
928 if test -z "$base_compile"; then
929 $echo "$modename: you must specify a compilation command" 1>&2
930 $echo "$help" 1>&2
931 exit 1
932 fi
933
934 # Delete any leftover library objects.
935 if test "$build_old_libs" = yes; then
936 removelist="$obj $lobj $libobj ${libobj}T"
937 else
938 removelist="$lobj $libobj ${libobj}T"
939 fi
940
941 $run $rm $removelist
942 trap "$run $rm $removelist; exit 1" 1 2 15
943
944 # On Cygwin there's no "real" PIC flag so we must build both object types
945 case $host_os in
946 cygwin* | mingw* | pw32* | os2*)
947 pic_mode=default
948 ;;
949 esac
950 if test "$pic_mode" = no && test "$deplibs_check_method" != pass_all; then
951 # non-PIC code in shared libraries is not supported
952 pic_mode=default
953 fi
954
955 # Calculate the filename of the output object if compiler does
956 # not support -o with -c
957 if test "$compiler_c_o" = no; then
958 output_obj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%' -e 's%\.[^.]*$%%'`.${objext}
959 lockfile="$output_obj.lock"
960 removelist="$removelist $output_obj $lockfile"
961 trap "$run $rm $removelist; exit 1" 1 2 15
962 else
963 output_obj=
964 need_locks=no
965 lockfile=
966 fi
967
968 # Lock this critical section if it is needed
969 # We use this script file to make the link, it avoids creating a new file
970 if test "$need_locks" = yes; then
971 until $run ln "$0" "$lockfile" 2>/dev/null; do
972 $show "Waiting for $lockfile to be removed"
973 sleep 2
974 done
975 elif test "$need_locks" = warn; then
976 if test -f "$lockfile"; then
977 $echo "\
978 *** ERROR, $lockfile exists and contains:
979 `cat $lockfile 2>/dev/null`
980
981 This indicates that another process is trying to use the same
982 temporary object file, and libtool could not work around it because
983 your compiler does not support \`-c' and \`-o' together. If you
984 repeat this compilation, it may succeed, by chance, but you had better
985 avoid parallel builds (make -j) in this platform, or get a better
986 compiler."
987
988 $run $rm $removelist
989 exit 1
990 fi
991 $echo $srcfile > "$lockfile"
992 fi
993
994 if test -n "$fix_srcfile_path"; then
995 eval srcfile=\"$fix_srcfile_path\"
996 fi
997
998 $run $rm "$libobj" "${libobj}T"
999
1000 # Create a libtool object file (analogous to a ".la" file),
1001 # but don't create it if we're doing a dry run.
1002 test -z "$run" && cat > ${libobj}T <<EOF
1003 # $libobj - a libtool object file
1004 # Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
1005 #
1006 # Please DO NOT delete this file!
1007 # It is necessary for linking the library.
1008
1009 # Name of the PIC object.
1010 EOF
1011
1012 # Only build a PIC object if we are building libtool libraries.
1013 if test "$build_libtool_libs" = yes; then
1014 # Without this assignment, base_compile gets emptied.
1015 fbsd_hideous_sh_bug=$base_compile
1016
1017 if test "$pic_mode" != no; then
1018 command="$base_compile $srcfile $pic_flag"
1019 else
1020 # Don't build PIC code
1021 command="$base_compile $srcfile"
1022 fi
1023
1024 if test ! -d "${xdir}$objdir"; then
1025 $show "$mkdir ${xdir}$objdir"
1026 $run $mkdir ${xdir}$objdir
1027 status=$?
1028 if test "$status" -ne 0 && test ! -d "${xdir}$objdir"; then
1029 exit $status
1030 fi
1031 fi
1032
1033 if test -z "$output_obj"; then
1034 # Place PIC objects in $objdir
1035 command="$command -o $lobj"
1036 fi
1037
1038 $run $rm "$lobj" "$output_obj"
1039
1040 $show "$command"
1041 if $run eval "$command"; then :
1042 else
1043 test -n "$output_obj" && $run $rm $removelist
1044 exit 1
1045 fi
1046
1047 if test "$need_locks" = warn &&
1048 test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then
1049 $echo "\
1050 *** ERROR, $lockfile contains:
1051 `cat $lockfile 2>/dev/null`
1052
1053 but it should contain:
1054 $srcfile
1055
1056 This indicates that another process is trying to use the same
1057 temporary object file, and libtool could not work around it because
1058 your compiler does not support \`-c' and \`-o' together. If you
1059 repeat this compilation, it may succeed, by chance, but you had better
1060 avoid parallel builds (make -j) in this platform, or get a better
1061 compiler."
1062
1063 $run $rm $removelist
1064 exit 1
1065 fi
1066
1067 # Just move the object if needed, then go on to compile the next one
1068 if test -n "$output_obj" && test "X$output_obj" != "X$lobj"; then
1069 $show "$mv $output_obj $lobj"
1070 if $run $mv $output_obj $lobj; then :
1071 else
1072 error=$?
1073 $run $rm $removelist
1074 exit $error
1075 fi
1076 fi
1077
1078 # Append the name of the PIC object to the libtool object file.
1079 test -z "$run" && cat >> ${libobj}T <<EOF
1080 pic_object='$objdir/$objname'
1081
1082 EOF
1083
1084 # Allow error messages only from the first compilation.
1085 suppress_output=' >/dev/null 2>&1'
1086 else
1087 # No PIC object so indicate it doesn't exist in the libtool
1088 # object file.
1089 test -z "$run" && cat >> ${libobj}T <<EOF
1090 pic_object=none
1091
1092 EOF
1093 fi
1094
1095 # Only build a position-dependent object if we build old libraries.
1096 if test "$build_old_libs" = yes; then
1097 if test "$pic_mode" != yes; then
1098 # Don't build PIC code
1099 command="$base_compile $srcfile"
1100 else
1101 command="$base_compile $srcfile $pic_flag"
1102 fi
1103 if test "$compiler_c_o" = yes; then
1104 command="$command -o $obj"
1105 fi
1106
1107 # Suppress compiler output if we already did a PIC compilation.
1108 command="$command$suppress_output"
1109 $run $rm "$obj" "$output_obj"
1110 $show "$command"
1111 if $run eval "$command"; then :
1112 else
1113 $run $rm $removelist
1114 exit 1
1115 fi
1116
1117 if test "$need_locks" = warn &&
1118 test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then
1119 $echo "\
1120 *** ERROR, $lockfile contains:
1121 `cat $lockfile 2>/dev/null`
1122
1123 but it should contain:
1124 $srcfile
1125
1126 This indicates that another process is trying to use the same
1127 temporary object file, and libtool could not work around it because
1128 your compiler does not support \`-c' and \`-o' together. If you
1129 repeat this compilation, it may succeed, by chance, but you had better
1130 avoid parallel builds (make -j) in this platform, or get a better
1131 compiler."
1132
1133 $run $rm $removelist
1134 exit 1
1135 fi
1136
1137 # Just move the object if needed
1138 if test -n "$output_obj" && test "X$output_obj" != "X$obj"; then
1139 $show "$mv $output_obj $obj"
1140 if $run $mv $output_obj $obj; then :
1141 else
1142 error=$?
1143 $run $rm $removelist
1144 exit $error
1145 fi
1146 fi
1147
1148 # Append the name of the non-PIC object the libtool object file.
1149 # Only append if the libtool object file exists.
1150 test -z "$run" && cat >> ${libobj}T <<EOF
1151 # Name of the non-PIC object.
1152 non_pic_object='$objname'
1153
1154 EOF
1155 else
1156 # Append the name of the non-PIC object the libtool object file.
1157 # Only append if the libtool object file exists.
1158 test -z "$run" && cat >> ${libobj}T <<EOF
1159 # Name of the non-PIC object.
1160 non_pic_object=none
1161
1162 EOF
1163 fi
1164
1165 $run $mv "${libobj}T" "${libobj}"
1166
1167 # Unlock the critical section if it was locked
1168 if test "$need_locks" != no; then
1169 $run $rm "$lockfile"
1170 fi
1171
1172 exit 0
1173 ;;
1174
1175 # libtool link mode
1176 link | relink)
1177 modename="$modename: link"
1178 case $host in
1179 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
1180 # It is impossible to link a dll without this setting, and
1181 # we shouldn't force the makefile maintainer to figure out
1182 # which system we are compiling for in order to pass an extra
1183 # flag for every libtool invocation.
1184 # allow_undefined=no
1185
1186 # FIXME: Unfortunately, there are problems with the above when trying
1187 # to make a dll which has undefined symbols, in which case not
1188 # even a static library is built. For now, we need to specify
1189 # -no-undefined on the libtool link line when we can be certain
1190 # that all symbols are satisfied, otherwise we get a static library.
1191 allow_undefined=yes
1192 ;;
1193 *)
1194 allow_undefined=yes
1195 ;;
1196 esac
1197 libtool_args="$nonopt"
1198 base_compile="$nonopt"
1199 compile_command="$nonopt"
1200 finalize_command="$nonopt"
1201
1202 compile_rpath=
1203 finalize_rpath=
1204 compile_shlibpath=
1205 finalize_shlibpath=
1206 convenience=
1207 old_convenience=
1208 deplibs=
1209 old_deplibs=
1210 compiler_flags=
1211 linker_flags=
1212 dllsearchpath=
1213 lib_search_path=`pwd`
1214 inst_prefix_dir=
1215
1216 avoid_version=no
1217 dlfiles=
1218 dlprefiles=
1219 dlself=no
1220 export_dynamic=no
1221 export_symbols=
1222 export_symbols_regex=
1223 generated=
1224 libobjs=
1225 ltlibs=
1226 module=no
1227 no_install=no
1228 objs=
1229 non_pic_objects=
1230 prefer_static_libs=no
1231 preload=no
1232 prev=
1233 prevarg=
1234 release=
1235 rpath=
1236 xrpath=
1237 perm_rpath=
1238 temp_rpath=
1239 thread_safe=no
1240 vinfo=
1241 vinfo_number=no
1242
1243 # We need to know -static, to get the right output filenames.
1244 for arg
1245 do
1246 case $arg in
1247 -all-static | -static)
1248 if test "X$arg" = "X-all-static"; then
1249 if test "$build_libtool_libs" = yes && test -z "$link_static_flag"; then
1250 $echo "$modename: warning: complete static linking is impossible in this configuration" 1>&2
1251 fi
1252 if test -n "$link_static_flag"; then
1253 dlopen_self=$dlopen_self_static
1254 fi
1255 else
1256 if test -z "$pic_flag" && test -n "$link_static_flag"; then
1257 dlopen_self=$dlopen_self_static
1258 fi
1259 fi
1260 build_libtool_libs=no
1261 build_old_libs=yes
1262 prefer_static_libs=yes
1263 break
1264 ;;
1265 esac
1266 done
1267
1268 # See if our shared archives depend on static archives.
1269 test -n "$old_archive_from_new_cmds" && build_old_libs=yes
1270
1271 # Go through the arguments, transforming them on the way.
1272 while test "$#" -gt 0; do
1273 arg="$1"
1274 base_compile="$base_compile $arg"
1275 shift
1276 case $arg in
1277 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
1278 qarg=\"`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`\" ### testsuite: skip nested quoting test
1279 ;;
1280 *) qarg=$arg ;;
1281 esac
1282 libtool_args="$libtool_args $qarg"
1283
1284 # If the previous option needs an argument, assign it.
1285 if test -n "$prev"; then
1286 case $prev in
1287 output)
1288 compile_command="$compile_command @OUTPUT@"
1289 finalize_command="$finalize_command @OUTPUT@"
1290 ;;
1291 esac
1292
1293 case $prev in
1294 dlfiles|dlprefiles)
1295 if test "$preload" = no; then
1296 # Add the symbol object into the linking commands.
1297 compile_command="$compile_command @SYMFILE@"
1298 finalize_command="$finalize_command @SYMFILE@"
1299 preload=yes
1300 fi
1301 case $arg in
1302 *.la | *.lo) ;; # We handle these cases below.
1303 force)
1304 if test "$dlself" = no; then
1305 dlself=needless
1306 export_dynamic=yes
1307 fi
1308 prev=
1309 continue
1310 ;;
1311 self)
1312 if test "$prev" = dlprefiles; then
1313 dlself=yes
1314 elif test "$prev" = dlfiles && test "$dlopen_self" != yes; then
1315 dlself=yes
1316 else
1317 dlself=needless
1318 export_dynamic=yes
1319 fi
1320 prev=
1321 continue
1322 ;;
1323 *)
1324 if test "$prev" = dlfiles; then
1325 dlfiles="$dlfiles $arg"
1326 else
1327 dlprefiles="$dlprefiles $arg"
1328 fi
1329 prev=
1330 continue
1331 ;;
1332 esac
1333 ;;
1334 expsyms)
1335 export_symbols="$arg"
1336 if test ! -f "$arg"; then
1337 $echo "$modename: symbol file \`$arg' does not exist"
1338 exit 1
1339 fi
1340 prev=
1341 continue
1342 ;;
1343 expsyms_regex)
1344 export_symbols_regex="$arg"
1345 prev=
1346 continue
1347 ;;
1348 inst_prefix)
1349 inst_prefix_dir="$arg"
1350 prev=
1351 continue
1352 ;;
1353 release)
1354 release="-$arg"
1355 prev=
1356 continue
1357 ;;
1358 objectlist)
1359 if test -f "$arg"; then
1360 save_arg=$arg
1361 moreargs=
1362 for fil in `cat $save_arg`
1363 do
1364 # moreargs="$moreargs $fil"
1365 arg=$fil
1366 # A libtool-controlled object.
1367
1368 # Check to see that this really is a libtool object.
1369 if (${SED} -e '2q' $arg | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
1370 pic_object=
1371 non_pic_object=
1372
1373 # Read the .lo file
1374 # If there is no directory component, then add one.
1375 case $arg in
1376 */* | *\\*) . $arg ;;
1377 *) . ./$arg ;;
1378 esac
1379
1380 if test -z "$pic_object" || \
1381 test -z "$non_pic_object" ||
1382 test "$pic_object" = none && \
1383 test "$non_pic_object" = none; then
1384 $echo "$modename: cannot find name of object for \`$arg'" 1>&2
1385 exit 1
1386 fi
1387
1388 # Extract subdirectory from the argument.
1389 xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
1390 if test "X$xdir" = "X$arg"; then
1391 xdir=
1392 else
1393 xdir="$xdir/"
1394 fi
1395
1396 if test "$pic_object" != none; then
1397 # Prepend the subdirectory the object is found in.
1398 pic_object="$xdir$pic_object"
1399
1400 if test "$prev" = dlfiles; then
1401 if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then
1402 dlfiles="$dlfiles $pic_object"
1403 prev=
1404 continue
1405 else
1406 # If libtool objects are unsupported, then we need to preload.
1407 prev=dlprefiles
1408 fi
1409 fi
1410
1411 # CHECK ME: I think I busted this. -Ossama
1412 if test "$prev" = dlprefiles; then
1413 # Preload the old-style object.
1414 dlprefiles="$dlprefiles $pic_object"
1415 prev=
1416 fi
1417
1418 # A PIC object.
1419 libobjs="$libobjs $pic_object"
1420 arg="$pic_object"
1421 fi
1422
1423 # Non-PIC object.
1424 if test "$non_pic_object" != none; then
1425 # Prepend the subdirectory the object is found in.
1426 non_pic_object="$xdir$non_pic_object"
1427
1428 # A standard non-PIC object
1429 non_pic_objects="$non_pic_objects $non_pic_object"
1430 if test -z "$pic_object" || test "$pic_object" = none ; then
1431 arg="$non_pic_object"
1432 fi
1433 fi
1434 else
1435 # Only an error if not doing a dry-run.
1436 if test -z "$run"; then
1437 $echo "$modename: \`$arg' is not a valid libtool object" 1>&2
1438 exit 1
1439 else
1440 # Dry-run case.
1441
1442 # Extract subdirectory from the argument.
1443 xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
1444 if test "X$xdir" = "X$arg"; then
1445 xdir=
1446 else
1447 xdir="$xdir/"
1448 fi
1449
1450 pic_object=`$echo "X${xdir}${objdir}/${arg}" | $Xsed -e "$lo2o"`
1451 non_pic_object=`$echo "X${xdir}${arg}" | $Xsed -e "$lo2o"`
1452 libobjs="$libobjs $pic_object"
1453 non_pic_objects="$non_pic_objects $non_pic_object"
1454 fi
1455 fi
1456 done
1457 else
1458 $echo "$modename: link input file \`$save_arg' does not exist"
1459 exit 1
1460 fi
1461 arg=$save_arg
1462 prev=
1463 continue
1464 ;;
1465 rpath | xrpath)
1466 # We need an absolute path.
1467 case $arg in
1468 [\\/]* | [A-Za-z]:[\\/]*) ;;
1469 *)
1470 $echo "$modename: only absolute run-paths are allowed" 1>&2
1471 exit 1
1472 ;;
1473 esac
1474 if test "$prev" = rpath; then
1475 case "$rpath " in
1476 *" $arg "*) ;;
1477 *) rpath="$rpath $arg" ;;
1478 esac
1479 else
1480 case "$xrpath " in
1481 *" $arg "*) ;;
1482 *) xrpath="$xrpath $arg" ;;
1483 esac
1484 fi
1485 prev=
1486 continue
1487 ;;
1488 xcompiler)
1489 compiler_flags="$compiler_flags $qarg"
1490 prev=
1491 compile_command="$compile_command $qarg"
1492 finalize_command="$finalize_command $qarg"
1493 continue
1494 ;;
1495 xlinker)
1496 linker_flags="$linker_flags $qarg"
1497 compiler_flags="$compiler_flags $wl$qarg"
1498 prev=
1499 compile_command="$compile_command $wl$qarg"
1500 finalize_command="$finalize_command $wl$qarg"
1501 continue
1502 ;;
1503 xcclinker)
1504 linker_flags="$linker_flags $qarg"
1505 compiler_flags="$compiler_flags $qarg"
1506 prev=
1507 compile_command="$compile_command $qarg"
1508 finalize_command="$finalize_command $qarg"
1509 continue
1510 ;;
1511 *)
1512 eval "$prev=\"\$arg\""
1513 prev=
1514 continue
1515 ;;
1516 esac
1517 fi # test -n "$prev"
1518
1519 prevarg="$arg"
1520
1521 case $arg in
1522 -all-static)
1523 if test -n "$link_static_flag"; then
1524 compile_command="$compile_command $link_static_flag"
1525 finalize_command="$finalize_command $link_static_flag"
1526 fi
1527 continue
1528 ;;
1529
1530 -allow-undefined)
1531 # FIXME: remove this flag sometime in the future.
1532 $echo "$modename: \`-allow-undefined' is deprecated because it is the default" 1>&2
1533 continue
1534 ;;
1535
1536 -avoid-version)
1537 avoid_version=yes
1538 continue
1539 ;;
1540
1541 -dlopen)
1542 prev=dlfiles
1543 continue
1544 ;;
1545
1546 -dlpreopen)
1547 prev=dlprefiles
1548 continue
1549 ;;
1550
1551 -export-dynamic)
1552 export_dynamic=yes
1553 continue
1554 ;;
1555
1556 -export-symbols | -export-symbols-regex)
1557 if test -n "$export_symbols" || test -n "$export_symbols_regex"; then
1558 $echo "$modename: more than one -exported-symbols argument is not allowed"
1559 exit 1
1560 fi
1561 if test "X$arg" = "X-export-symbols"; then
1562 prev=expsyms
1563 else
1564 prev=expsyms_regex
1565 fi
1566 continue
1567 ;;
1568
1569 -inst-prefix-dir)
1570 prev=inst_prefix
1571 continue
1572 ;;
1573
1574 # The native IRIX linker understands -LANG:*, -LIST:* and -LNO:*
1575 # so, if we see these flags be careful not to treat them like -L
1576 -L[A-Z][A-Z]*:*)
1577 case $with_gcc/$host in
1578 no/*-*-irix* | /*-*-irix*)
1579 compile_command="$compile_command $arg"
1580 finalize_command="$finalize_command $arg"
1581 ;;
1582 esac
1583 continue
1584 ;;
1585
1586 -L*)
1587 dir=`$echo "X$arg" | $Xsed -e 's/^-L//'`
1588 # We need an absolute path.
1589 case $dir in
1590 [\\/]* | [A-Za-z]:[\\/]*) ;;
1591 *)
1592 absdir=`cd "$dir" && pwd`
1593 if test -z "$absdir"; then
1594 $echo "$modename: cannot determine absolute directory name of \`$dir'" 1>&2
1595 exit 1
1596 fi
1597 dir="$absdir"
1598 ;;
1599 esac
1600 case "$deplibs " in
1601 *" -L$dir "*) ;;
1602 *)
1603 deplibs="$deplibs -L$dir"
1604 lib_search_path="$lib_search_path $dir"
1605 ;;
1606 esac
1607 case $host in
1608 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
1609 case :$dllsearchpath: in
1610 *":$dir:"*) ;;
1611 *) dllsearchpath="$dllsearchpath:$dir";;
1612 esac
1613 ;;
1614 esac
1615 continue
1616 ;;
1617
1618 -l*)
1619 if test "X$arg" = "X-lc" || test "X$arg" = "X-lm"; then
1620 case $host in
1621 *-*-cygwin* | *-*-pw32* | *-*-beos*)
1622 # These systems don't actually have a C or math library (as such)
1623 continue
1624 ;;
1625 *-*-mingw* | *-*-os2*)
1626 # These systems don't actually have a C library (as such)
1627 test "X$arg" = "X-lc" && continue
1628 ;;
1629 *-*-openbsd* | *-*-freebsd*)
1630 # Do not include libc due to us having libc/libc_r.
1631 test "X$arg" = "X-lc" && continue
1632 ;;
1633 *-*-rhapsody* | *-*-darwin1.[012])
1634 # Rhapsody C and math libraries are in the System framework
1635 deplibs="$deplibs -framework System"
1636 continue
1637 esac
1638 elif test "X$arg" = "X-lc_r"; then
1639 case $host in
1640 *-*-openbsd* | *-*-freebsd*)
1641 # Do not include libc_r directly, use -pthread flag.
1642 continue
1643 ;;
1644 esac
1645 fi
1646 deplibs="$deplibs $arg"
1647 continue
1648 ;;
1649
1650 -module)
1651 module=yes
1652 continue
1653 ;;
1654
1655 # gcc -m* arguments should be passed to the linker via $compiler_flags
1656 # in order to pass architecture information to the linker
1657 # (e.g. 32 vs 64-bit). This may also be accomplished via -Wl,-mfoo
1658 # but this is not reliable with gcc because gcc may use -mfoo to
1659 # select a different linker, different libraries, etc, while
1660 # -Wl,-mfoo simply passes -mfoo to the linker.
1661 -m*)
1662 # Unknown arguments in both finalize_command and compile_command need
1663 # to be aesthetically quoted because they are evaled later.
1664 arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
1665 case $arg in
1666 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
1667 arg="\"$arg\""
1668 ;;
1669 esac
1670 compile_command="$compile_command $arg"
1671 finalize_command="$finalize_command $arg"
1672 if test "$with_gcc" = "yes" ; then
1673 compiler_flags="$compiler_flags $arg"
1674 fi
1675 continue
1676 ;;
1677
1678 -shrext)
1679 prev=shrext
1680 continue
1681 ;;
1682
1683 -no-fast-install)
1684 fast_install=no
1685 continue
1686 ;;
1687
1688 -no-install)
1689 case $host in
1690 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
1691 # The PATH hackery in wrapper scripts is required on Windows
1692 # in order for the loader to find any dlls it needs.
1693 $echo "$modename: warning: \`-no-install' is ignored for $host" 1>&2
1694 $echo "$modename: warning: assuming \`-no-fast-install' instead" 1>&2
1695 fast_install=no
1696 ;;
1697 *) no_install=yes ;;
1698 esac
1699 continue
1700 ;;
1701
1702 -no-undefined)
1703 allow_undefined=no
1704 continue
1705 ;;
1706
1707 -objectlist)
1708 prev=objectlist
1709 continue
1710 ;;
1711
1712 -o) prev=output ;;
1713
1714 -release)
1715 prev=release
1716 continue
1717 ;;
1718
1719 -rpath)
1720 prev=rpath
1721 continue
1722 ;;
1723
1724 -R)
1725 prev=xrpath
1726 continue
1727 ;;
1728
1729 -R*)
1730 dir=`$echo "X$arg" | $Xsed -e 's/^-R//'`
1731 # We need an absolute path.
1732 case $dir in
1733 [\\/]* | [A-Za-z]:[\\/]*) ;;
1734 *)
1735 $echo "$modename: only absolute run-paths are allowed" 1>&2
1736 exit 1
1737 ;;
1738 esac
1739 case "$xrpath " in
1740 *" $dir "*) ;;
1741 *) xrpath="$xrpath $dir" ;;
1742 esac
1743 continue
1744 ;;
1745
1746 -static)
1747 # The effects of -static are defined in a previous loop.
1748 # We used to do the same as -all-static on platforms that
1749 # didn't have a PIC flag, but the assumption that the effects
1750 # would be equivalent was wrong. It would break on at least
1751 # Digital Unix and AIX.
1752 continue
1753 ;;
1754
1755 -thread-safe)
1756 thread_safe=yes
1757 continue
1758 ;;
1759
1760 -version-info)
1761 prev=vinfo
1762 continue
1763 ;;
1764 -version-number)
1765 prev=vinfo
1766 vinfo_number=yes
1767 continue
1768 ;;
1769
1770 -Wc,*)
1771 args=`$echo "X$arg" | $Xsed -e "$sed_quote_subst" -e 's/^-Wc,//'`
1772 arg=
1773 save_ifs="$IFS"; IFS=','
1774 for flag in $args; do
1775 IFS="$save_ifs"
1776 case $flag in
1777 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
1778 flag="\"$flag\""
1779 ;;
1780 esac
1781 arg="$arg $wl$flag"
1782 compiler_flags="$compiler_flags $flag"
1783 done
1784 IFS="$save_ifs"
1785 arg=`$echo "X$arg" | $Xsed -e "s/^ //"`
1786 ;;
1787
1788 -Wl,*)
1789 args=`$echo "X$arg" | $Xsed -e "$sed_quote_subst" -e 's/^-Wl,//'`
1790 arg=
1791 save_ifs="$IFS"; IFS=','
1792 for flag in $args; do
1793 IFS="$save_ifs"
1794 case $flag in
1795 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
1796 flag="\"$flag\""
1797 ;;
1798 esac
1799 arg="$arg $wl$flag"
1800 compiler_flags="$compiler_flags $wl$flag"
1801 linker_flags="$linker_flags $flag"
1802 done
1803 IFS="$save_ifs"
1804 arg=`$echo "X$arg" | $Xsed -e "s/^ //"`
1805 ;;
1806
1807 -Xcompiler)
1808 prev=xcompiler
1809 continue
1810 ;;
1811
1812 -Xlinker)
1813 prev=xlinker
1814 continue
1815 ;;
1816
1817 -XCClinker)
1818 prev=xcclinker
1819 continue
1820 ;;
1821
1822 # Some other compiler flag.
1823 -* | +*)
1824 # Unknown arguments in both finalize_command and compile_command need
1825 # to be aesthetically quoted because they are evaled later.
1826 arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
1827 case $arg in
1828 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
1829 arg="\"$arg\""
1830 ;;
1831 esac
1832 ;;
1833
1834 *.$objext)
1835 # A standard object.
1836 objs="$objs $arg"
1837 ;;
1838
1839 *.lo)
1840 # A libtool-controlled object.
1841
1842 # Check to see that this really is a libtool object.
1843 if (${SED} -e '2q' $arg | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
1844 pic_object=
1845 non_pic_object=
1846
1847 # Read the .lo file
1848 # If there is no directory component, then add one.
1849 case $arg in
1850 */* | *\\*) . $arg ;;
1851 *) . ./$arg ;;
1852 esac
1853
1854 if test -z "$pic_object" || \
1855 test -z "$non_pic_object" ||
1856 test "$pic_object" = none && \
1857 test "$non_pic_object" = none; then
1858 $echo "$modename: cannot find name of object for \`$arg'" 1>&2
1859 exit 1
1860 fi
1861
1862 # Extract subdirectory from the argument.
1863 xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
1864 if test "X$xdir" = "X$arg"; then
1865 xdir=
1866 else
1867 xdir="$xdir/"
1868 fi
1869
1870 if test "$pic_object" != none; then
1871 # Prepend the subdirectory the object is found in.
1872 pic_object="$xdir$pic_object"
1873
1874 if test "$prev" = dlfiles; then
1875 if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then
1876 dlfiles="$dlfiles $pic_object"
1877 prev=
1878 continue
1879 else
1880 # If libtool objects are unsupported, then we need to preload.
1881 prev=dlprefiles
1882 fi
1883 fi
1884
1885 # CHECK ME: I think I busted this. -Ossama
1886 if test "$prev" = dlprefiles; then
1887 # Preload the old-style object.
1888 dlprefiles="$dlprefiles $pic_object"
1889 prev=
1890 fi
1891
1892 # A PIC object.
1893 libobjs="$libobjs $pic_object"
1894 arg="$pic_object"
1895 fi
1896
1897 # Non-PIC object.
1898 if test "$non_pic_object" != none; then
1899 # Prepend the subdirectory the object is found in.
1900 non_pic_object="$xdir$non_pic_object"
1901
1902 # A standard non-PIC object
1903 non_pic_objects="$non_pic_objects $non_pic_object"
1904 if test -z "$pic_object" || test "$pic_object" = none ; then
1905 arg="$non_pic_object"
1906 fi
1907 fi
1908 else
1909 # Only an error if not doing a dry-run.
1910 if test -z "$run"; then
1911 $echo "$modename: \`$arg' is not a valid libtool object" 1>&2
1912 exit 1
1913 else
1914 # Dry-run case.
1915
1916 # Extract subdirectory from the argument.
1917 xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
1918 if test "X$xdir" = "X$arg"; then
1919 xdir=
1920 else
1921 xdir="$xdir/"
1922 fi
1923
1924 pic_object=`$echo "X${xdir}${objdir}/${arg}" | $Xsed -e "$lo2o"`
1925 non_pic_object=`$echo "X${xdir}${arg}" | $Xsed -e "$lo2o"`
1926 libobjs="$libobjs $pic_object"
1927 non_pic_objects="$non_pic_objects $non_pic_object"
1928 fi
1929 fi
1930 ;;
1931
1932 *.$libext)
1933 # An archive.
1934 deplibs="$deplibs $arg"
1935 old_deplibs="$old_deplibs $arg"
1936 continue
1937 ;;
1938
1939 *.la)
1940 # A libtool-controlled library.
1941
1942 if test "$prev" = dlfiles; then
1943 # This library was specified with -dlopen.
1944 dlfiles="$dlfiles $arg"
1945 prev=
1946 elif test "$prev" = dlprefiles; then
1947 # The library was specified with -dlpreopen.
1948 dlprefiles="$dlprefiles $arg"
1949 prev=
1950 else
1951 deplibs="$deplibs $arg"
1952 fi
1953 continue
1954 ;;
1955
1956 # Some other compiler argument.
1957 *)
1958 # Unknown arguments in both finalize_command and compile_command need
1959 # to be aesthetically quoted because they are evaled later.
1960 arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
1961 case $arg in
1962 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
1963 arg="\"$arg\""
1964 ;;
1965 esac
1966 ;;
1967 esac # arg
1968
1969 # Now actually substitute the argument into the commands.
1970 if test -n "$arg"; then
1971 compile_command="$compile_command $arg"
1972 finalize_command="$finalize_command $arg"
1973 fi
1974 done # argument parsing loop
1975
1976 if test -n "$prev"; then
1977 $echo "$modename: the \`$prevarg' option requires an argument" 1>&2
1978 $echo "$help" 1>&2
1979 exit 1
1980 fi
1981
1982 # Infer tagged configuration to use if any are available and
1983 # if one wasn't chosen via the "--tag" command line option.
1984 # Only attempt this if the compiler in the base link
1985 # command doesn't match the default compiler.
1986 if test -n "$available_tags" && test -z "$tagname"; then
1987 case $base_compile in
1988 # Blanks in the command may have been stripped by the calling shell,
1989 # but not from the CC environment variable when configure was run.
1990 "$CC "* | " $CC "* | "`$echo $CC` "* | " `$echo $CC` "*) ;;
1991 # Blanks at the start of $base_compile will cause this to fail
1992 # if we don't check for them as well.
1993 *)
1994 for z in $available_tags; do
1995 if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $z$" < "$0" > /dev/null; then
1996 # Evaluate the configuration.
1997 eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^# ### END LIBTOOL TAG CONFIG: '$z'$/p' < $0`"
1998 case $base_compile in
1999 "$CC "* | " $CC "* | "`$echo $CC` "* | " `$echo $CC` "*)
2000 # The compiler in $compile_command matches
2001 # the one in the tagged configuration.
2002 # Assume this is the tagged configuration we want.
2003 tagname=$z
2004 break
2005 ;;
2006 esac
2007 fi
2008 done
2009 # If $tagname still isn't set, then no tagged configuration
2010 # was found and let the user know that the "--tag" command
2011 # line option must be used.
2012 if test -z "$tagname"; then
2013 $echo "$modename: unable to infer tagged configuration"
2014 $echo "$modename: specify a tag with \`--tag'" 1>&2
2015 exit 1
2016 # else
2017 # $echo "$modename: using $tagname tagged configuration"
2018 fi
2019 ;;
2020 esac
2021 fi
2022
2023 if test "$export_dynamic" = yes && test -n "$export_dynamic_flag_spec"; then
2024 eval arg=\"$export_dynamic_flag_spec\"
2025 compile_command="$compile_command $arg"
2026 finalize_command="$finalize_command $arg"
2027 fi
2028
2029 oldlibs=
2030 # calculate the name of the file, without its directory
2031 outputname=`$echo "X$output" | $Xsed -e 's%^.*/%%'`
2032 libobjs_save="$libobjs"
2033
2034 if test -n "$shlibpath_var"; then
2035 # get the directories listed in $shlibpath_var
2036 eval shlib_search_path=\`\$echo \"X\${$shlibpath_var}\" \| \$Xsed -e \'s/:/ /g\'\`
2037 else
2038 shlib_search_path=
2039 fi
2040 eval sys_lib_search_path=\"$sys_lib_search_path_spec\"
2041 eval sys_lib_dlsearch_path=\"$sys_lib_dlsearch_path_spec\"
2042
2043 output_objdir=`$echo "X$output" | $Xsed -e 's%/[^/]*$%%'`
2044 if test "X$output_objdir" = "X$output"; then
2045 output_objdir="$objdir"
2046 else
2047 output_objdir="$output_objdir/$objdir"
2048 fi
2049 # Create the object directory.
2050 if test ! -d "$output_objdir"; then
2051 $show "$mkdir $output_objdir"
2052 $run $mkdir $output_objdir
2053 status=$?
2054 if test "$status" -ne 0 && test ! -d "$output_objdir"; then
2055 exit $status
2056 fi
2057 fi
2058
2059 # Determine the type of output
2060 case $output in
2061 "")
2062 $echo "$modename: you must specify an output file" 1>&2
2063 $echo "$help" 1>&2
2064 exit 1
2065 ;;
2066 *.$libext) linkmode=oldlib ;;
2067 *.lo | *.$objext) linkmode=obj ;;
2068 *.la) linkmode=lib ;;
2069 *) linkmode=prog ;; # Anything else should be a program.
2070 esac
2071
2072 case $host in
2073 *cygwin* | *mingw* | *pw32*)
2074 # don't eliminate duplcations in $postdeps and $predeps
2075 duplicate_compiler_generated_deps=yes
2076 ;;
2077 *)
2078 duplicate_compiler_generated_deps=$duplicate_deps
2079 ;;
2080 esac
2081 specialdeplibs=
2082
2083 libs=
2084 # Find all interdependent deplibs by searching for libraries
2085 # that are linked more than once (e.g. -la -lb -la)
2086 for deplib in $deplibs; do
2087 if test "X$duplicate_deps" = "Xyes" ; then
2088 case "$libs " in
2089 *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
2090 esac
2091 fi
2092 libs="$libs $deplib"
2093 done
2094
2095 if test "$linkmode" = lib; then
2096 libs="$predeps $libs $compiler_lib_search_path $postdeps"
2097
2098 # Compute libraries that are listed more than once in $predeps
2099 # $postdeps and mark them as special (i.e., whose duplicates are
2100 # not to be eliminated).
2101 pre_post_deps=
2102 if test "X$duplicate_compiler_generated_deps" = "Xyes" ; then
2103 for pre_post_dep in $predeps $postdeps; do
2104 case "$pre_post_deps " in
2105 *" $pre_post_dep "*) specialdeplibs="$specialdeplibs $pre_post_deps" ;;
2106 esac
2107 pre_post_deps="$pre_post_deps $pre_post_dep"
2108 done
2109 fi
2110 pre_post_deps=
2111 fi
2112
2113 deplibs=
2114 newdependency_libs=
2115 newlib_search_path=
2116 need_relink=no # whether we're linking any uninstalled libtool libraries
2117 notinst_deplibs= # not-installed libtool libraries
2118 notinst_path= # paths that contain not-installed libtool libraries
2119 case $linkmode in
2120 lib)
2121 passes="conv link"
2122 for file in $dlfiles $dlprefiles; do
2123 case $file in
2124 *.la) ;;
2125 *)
2126 $echo "$modename: libraries can \`-dlopen' only libtool libraries: $file" 1>&2
2127 exit 1
2128 ;;
2129 esac
2130 done
2131 ;;
2132 prog)
2133 compile_deplibs=
2134 finalize_deplibs=
2135 alldeplibs=no
2136 newdlfiles=
2137 newdlprefiles=
2138 passes="conv scan dlopen dlpreopen link"
2139 ;;
2140 *) passes="conv"
2141 ;;
2142 esac
2143 for pass in $passes; do
2144 if test "$linkmode,$pass" = "lib,link" ||
2145 test "$linkmode,$pass" = "prog,scan"; then
2146 libs="$deplibs"
2147 deplibs=
2148 fi
2149 if test "$linkmode" = prog; then
2150 case $pass in
2151 dlopen) libs="$dlfiles" ;;
2152 dlpreopen) libs="$dlprefiles" ;;
2153 link) libs="$deplibs %DEPLIBS% $dependency_libs" ;;
2154 esac
2155 fi
2156 if test "$pass" = dlopen; then
2157 # Collect dlpreopened libraries
2158 save_deplibs="$deplibs"
2159 deplibs=
2160 fi
2161 for deplib in $libs; do
2162 lib=
2163 found=no
2164 case $deplib in
2165 -l*)
2166 if test "$linkmode" != lib && test "$linkmode" != prog; then
2167 $echo "$modename: warning: \`-l' is ignored for archives/objects" 1>&2
2168 continue
2169 fi
2170 if test "$pass" = conv; then
2171 deplibs="$deplib $deplibs"
2172 continue
2173 fi
2174 name=`$echo "X$deplib" | $Xsed -e 's/^-l//'`
2175 for searchdir in $newlib_search_path $lib_search_path $sys_lib_search_path $shlib_search_path; do
2176 # Search the libtool library
2177 lib="$searchdir/lib${name}.la"
2178 if test -f "$lib"; then
2179 found=yes
2180 break
2181 fi
2182 done
2183 if test "$found" != yes; then
2184 # deplib doesn't seem to be a libtool library
2185 if test "$linkmode,$pass" = "prog,link"; then
2186 compile_deplibs="$deplib $compile_deplibs"
2187 finalize_deplibs="$deplib $finalize_deplibs"
2188 else
2189 deplibs="$deplib $deplibs"
2190 test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs"
2191 fi
2192 continue
2193 else # deplib is a libtool library
2194 # If $allow_libtool_libs_with_static_runtimes && $deplib is a stdlib,
2195 # We need to do some special things here, and not later.
2196 if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
2197 case " $predeps $postdeps " in
2198 *" $deplib "*)
2199 if (${SED} -e '2q' $lib |
2200 grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
2201 library_names=
2202 old_library=
2203 case $lib in
2204 */* | *\\*) . $lib ;;
2205 *) . ./$lib ;;
2206 esac
2207 for l in $old_library $library_names; do
2208 ll="$l"
2209 done
2210 if test "X$ll" = "X$old_library" ; then # only static version available
2211 found=no
2212 ladir=`$echo "X$lib" | $Xsed -e 's%/[^/]*$%%'`
2213 test "X$ladir" = "X$lib" && ladir="."
2214 lib=$ladir/$old_library
2215 if test "$linkmode,$pass" = "prog,link"; then
2216 compile_deplibs="$deplib $compile_deplibs"
2217 finalize_deplibs="$deplib $finalize_deplibs"
2218 else
2219 deplibs="$deplib $deplibs"
2220 test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs"
2221 fi
2222 continue
2223 fi
2224 fi
2225 ;;
2226 *) ;;
2227 esac
2228 fi
2229 fi
2230 ;; # -l
2231 -L*)
2232 case $linkmode in
2233 lib)
2234 deplibs="$deplib $deplibs"
2235 test "$pass" = conv && continue
2236 newdependency_libs="$deplib $newdependency_libs"
2237 newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`
2238 ;;
2239 prog)
2240 if test "$pass" = conv; then
2241 deplibs="$deplib $deplibs"
2242 continue
2243 fi
2244 if test "$pass" = scan; then
2245 deplibs="$deplib $deplibs"
2246 newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`
2247 else
2248 compile_deplibs="$deplib $compile_deplibs"
2249 finalize_deplibs="$deplib $finalize_deplibs"
2250 fi
2251 ;;
2252 *)
2253 $echo "$modename: warning: \`-L' is ignored for archives/objects" 1>&2
2254 ;;
2255 esac # linkmode
2256 continue
2257 ;; # -L
2258 -R*)
2259 if test "$pass" = link; then
2260 dir=`$echo "X$deplib" | $Xsed -e 's/^-R//'`
2261 # Make sure the xrpath contains only unique directories.
2262 case "$xrpath " in
2263 *" $dir "*) ;;
2264 *) xrpath="$xrpath $dir" ;;
2265 esac
2266 fi
2267 deplibs="$deplib $deplibs"
2268 continue
2269 ;;
2270 *.la) lib="$deplib" ;;
2271 *.$libext)
2272 if test "$pass" = conv; then
2273 deplibs="$deplib $deplibs"
2274 continue
2275 fi
2276 case $linkmode in
2277 lib)
2278 if test "$deplibs_check_method" != pass_all; then
2279 $echo
2280 $echo "*** Warning: Trying to link with static lib archive $deplib."
2281 $echo "*** I have the capability to make that library automatically link in when"
2282 $echo "*** you link to this library. But I can only do this if you have a"
2283 $echo "*** shared version of the library, which you do not appear to have"
2284 $echo "*** because the file extensions .$libext of this argument makes me believe"
2285 $echo "*** that it is just a static archive that I should not used here."
2286 else
2287 $echo
2288 $echo "*** Warning: Linking the shared library $output against the"
2289 $echo "*** static library $deplib is not portable!"
2290 deplibs="$deplib $deplibs"
2291 fi
2292 continue
2293 ;;
2294 prog)
2295 if test "$pass" != link; then
2296 deplibs="$deplib $deplibs"
2297 else
2298 compile_deplibs="$deplib $compile_deplibs"
2299 finalize_deplibs="$deplib $finalize_deplibs"
2300 fi
2301 continue
2302 ;;
2303 esac # linkmode
2304 ;; # *.$libext
2305 *.lo | *.$objext)
2306 if test "$pass" = conv; then
2307 deplibs="$deplib $deplibs"
2308 elif test "$linkmode" = prog; then
2309 if test "$pass" = dlpreopen || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then
2310 # If there is no dlopen support or we're linking statically,
2311 # we need to preload.
2312 newdlprefiles="$newdlprefiles $deplib"
2313 compile_deplibs="$deplib $compile_deplibs"
2314 finalize_deplibs="$deplib $finalize_deplibs"
2315 else
2316 newdlfiles="$newdlfiles $deplib"
2317 fi
2318 fi
2319 continue
2320 ;;
2321 %DEPLIBS%)
2322 alldeplibs=yes
2323 continue
2324 ;;
2325 esac # case $deplib
2326 if test "$found" = yes || test -f "$lib"; then :
2327 else
2328 $echo "$modename: cannot find the library \`$lib'" 1>&2
2329 exit 1
2330 fi
2331
2332 # Check to see that this really is a libtool archive.
2333 if (${SED} -e '2q' $lib | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
2334 else
2335 $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
2336 exit 1
2337 fi
2338
2339 ladir=`$echo "X$lib" | $Xsed -e 's%/[^/]*$%%'`
2340 test "X$ladir" = "X$lib" && ladir="."
2341
2342 dlname=
2343 dlopen=
2344 dlpreopen=
2345 libdir=
2346 library_names=
2347 old_library=
2348 # If the library was installed with an old release of libtool,
2349 # it will not redefine variables installed, or shouldnotlink
2350 installed=yes
2351 shouldnotlink=no
2352
2353 # Read the .la file
2354 case $lib in
2355 */* | *\\*) . $lib ;;
2356 *) . ./$lib ;;
2357 esac
2358
2359 if test "$linkmode,$pass" = "lib,link" ||
2360 test "$linkmode,$pass" = "prog,scan" ||
2361 { test "$linkmode" != prog && test "$linkmode" != lib; }; then
2362 test -n "$dlopen" && dlfiles="$dlfiles $dlopen"
2363 test -n "$dlpreopen" && dlprefiles="$dlprefiles $dlpreopen"
2364 fi
2365
2366 if test "$pass" = conv; then
2367 # Only check for convenience libraries
2368 deplibs="$lib $deplibs"
2369 if test -z "$libdir"; then
2370 if test -z "$old_library"; then
2371 $echo "$modename: cannot find name of link library for \`$lib'" 1>&2
2372 exit 1
2373 fi
2374 # It is a libtool convenience library, so add in its objects.
2375 convenience="$convenience $ladir/$objdir/$old_library"
2376 old_convenience="$old_convenience $ladir/$objdir/$old_library"
2377 tmp_libs=
2378 for deplib in $dependency_libs; do
2379 deplibs="$deplib $deplibs"
2380 if test "X$duplicate_deps" = "Xyes" ; then
2381 case "$tmp_libs " in
2382 *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
2383 esac
2384 fi
2385 tmp_libs="$tmp_libs $deplib"
2386 done
2387 elif test "$linkmode" != prog && test "$linkmode" != lib; then
2388 $echo "$modename: \`$lib' is not a convenience library" 1>&2
2389 exit 1
2390 fi
2391 continue
2392 fi # $pass = conv
2393
2394
2395 # Get the name of the library we link against.
2396 linklib=
2397 for l in $old_library $library_names; do
2398 linklib="$l"
2399 done
2400 if test -z "$linklib"; then
2401 $echo "$modename: cannot find name of link library for \`$lib'" 1>&2
2402 exit 1
2403 fi
2404
2405 # This library was specified with -dlopen.
2406 if test "$pass" = dlopen; then
2407 if test -z "$libdir"; then
2408 $echo "$modename: cannot -dlopen a convenience library: \`$lib'" 1>&2
2409 exit 1
2410 fi
2411 if test -z "$dlname" || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then
2412 # If there is no dlname, no dlopen support or we're linking
2413 # statically, we need to preload. We also need to preload any
2414 # dependent libraries so libltdl's deplib preloader doesn't
2415 # bomb out in the load deplibs phase.
2416 dlprefiles="$dlprefiles $lib $dependency_libs"
2417 else
2418 newdlfiles="$newdlfiles $lib"
2419 fi
2420 continue
2421 fi # $pass = dlopen
2422
2423 # We need an absolute path.
2424 case $ladir in
2425 [\\/]* | [A-Za-z]:[\\/]*) abs_ladir="$ladir" ;;
2426 *)
2427 abs_ladir=`cd "$ladir" && pwd`
2428 if test -z "$abs_ladir"; then
2429 $echo "$modename: warning: cannot determine absolute directory name of \`$ladir'" 1>&2
2430 $echo "$modename: passing it literally to the linker, although it might fail" 1>&2
2431 abs_ladir="$ladir"
2432 fi
2433 ;;
2434 esac
2435 laname=`$echo "X$lib" | $Xsed -e 's%^.*/%%'`
2436
2437 # Find the relevant object directory and library name.
2438 if test "X$installed" = Xyes; then
2439 if test ! -f "$libdir/$linklib" && test -f "$abs_ladir/$linklib"; then
2440 $echo "$modename: warning: library \`$lib' was moved." 1>&2
2441 dir="$ladir"
2442 absdir="$abs_ladir"
2443 libdir="$abs_ladir"
2444 else
2445 dir="$libdir"
2446 absdir="$libdir"
2447 fi
2448 else
2449 dir="$ladir/$objdir"
2450 absdir="$abs_ladir/$objdir"
2451 # Remove this search path later
2452 notinst_path="$notinst_path $abs_ladir"
2453 fi # $installed = yes
2454 name=`$echo "X$laname" | $Xsed -e 's/\.la$//' -e 's/^lib//'`
2455
2456 # This library was specified with -dlpreopen.
2457 if test "$pass" = dlpreopen; then
2458 if test -z "$libdir"; then
2459 $echo "$modename: cannot -dlpreopen a convenience library: \`$lib'" 1>&2
2460 exit 1
2461 fi
2462 # Prefer using a static library (so that no silly _DYNAMIC symbols
2463 # are required to link).
2464 if test -n "$old_library"; then
2465 newdlprefiles="$newdlprefiles $dir/$old_library"
2466 # Otherwise, use the dlname, so that lt_dlopen finds it.
2467 elif test -n "$dlname"; then
2468 newdlprefiles="$newdlprefiles $dir/$dlname"
2469 else
2470 newdlprefiles="$newdlprefiles $dir/$linklib"
2471 fi
2472 fi # $pass = dlpreopen
2473
2474 if test -z "$libdir"; then
2475 # Link the convenience library
2476 if test "$linkmode" = lib; then
2477 deplibs="$dir/$old_library $deplibs"
2478 elif test "$linkmode,$pass" = "prog,link"; then
2479 compile_deplibs="$dir/$old_library $compile_deplibs"
2480 finalize_deplibs="$dir/$old_library $finalize_deplibs"
2481 else
2482 deplibs="$lib $deplibs" # used for prog,scan pass
2483 fi
2484 continue
2485 fi
2486
2487
2488 if test "$linkmode" = prog && test "$pass" != link; then
2489 newlib_search_path="$newlib_search_path $ladir"
2490 deplibs="$lib $deplibs"
2491
2492 linkalldeplibs=no
2493 if test "$link_all_deplibs" != no || test -z "$library_names" ||
2494 test "$build_libtool_libs" = no; then
2495 linkalldeplibs=yes
2496 fi
2497
2498 tmp_libs=
2499 for deplib in $dependency_libs; do
2500 case $deplib in
2501 -L*) newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`;; ### testsuite: skip nested quoting test
2502 esac
2503 # Need to link against all dependency_libs?
2504 if test "$linkalldeplibs" = yes; then
2505 deplibs="$deplib $deplibs"
2506 else
2507 # Need to hardcode shared library paths
2508 # or/and link against static libraries
2509 newdependency_libs="$deplib $newdependency_libs"
2510 fi
2511 if test "X$duplicate_deps" = "Xyes" ; then
2512 case "$tmp_libs " in
2513 *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
2514 esac
2515 fi
2516 tmp_libs="$tmp_libs $deplib"
2517 done # for deplib
2518 continue
2519 fi # $linkmode = prog...
2520
2521 if test "$linkmode,$pass" = "prog,link"; then
2522 if test -n "$library_names" &&
2523 { test "$prefer_static_libs" = no || test -z "$old_library"; }; then
2524 # We need to hardcode the library path
2525 if test -n "$shlibpath_var"; then
2526 # Make sure the rpath contains only unique directories.
2527 case "$temp_rpath " in
2528 *" $dir "*) ;;
2529 *" $absdir "*) ;;
2530 *) temp_rpath="$temp_rpath $dir" ;;
2531 esac
2532 fi
2533
2534 # Hardcode the library path.
2535 # Skip directories that are in the system default run-time
2536 # search path.
2537 case " $sys_lib_dlsearch_path " in
2538 *" $absdir "*) ;;
2539 *)
2540 case "$compile_rpath " in
2541 *" $absdir "*) ;;
2542 *) compile_rpath="$compile_rpath $absdir"
2543 esac
2544 ;;
2545 esac
2546 case " $sys_lib_dlsearch_path " in
2547 *" $libdir "*) ;;
2548 *)
2549 case "$finalize_rpath " in
2550 *" $libdir "*) ;;
2551 *) finalize_rpath="$finalize_rpath $libdir"
2552 esac
2553 ;;
2554 esac
2555 fi # $linkmode,$pass = prog,link...
2556
2557 if test "$alldeplibs" = yes &&
2558 { test "$deplibs_check_method" = pass_all ||
2559 { test "$build_libtool_libs" = yes &&
2560 test -n "$library_names"; }; }; then
2561 # We only need to search for static libraries
2562 continue
2563 fi
2564 fi
2565
2566 link_static=no # Whether the deplib will be linked statically
2567 if test -n "$library_names" &&
2568 { test "$prefer_static_libs" = no || test -z "$old_library"; }; then
2569 if test "$installed" = no; then
2570 notinst_deplibs="$notinst_deplibs $lib"
2571 need_relink=yes
2572 fi
2573 # This is a shared library
2574
2575 # Warn about portability, can't link against -module's on some systems (darwin)
2576 if test "$shouldnotlink" = yes && test "$pass" = link ; then
2577 $echo
2578 if test "$linkmode" = prog; then
2579 $echo "*** Warning: Linking the executable $output against the loadable module"
2580 else
2581 $echo "*** Warning: Linking the shared library $output against the loadable module"
2582 fi
2583 $echo "*** $linklib is not portable!"
2584 fi
2585 if test "$linkmode" = lib &&
2586 test "$hardcode_into_libs" = yes; then
2587 # Hardcode the library path.
2588 # Skip directories that are in the system default run-time
2589 # search path.
2590 case " $sys_lib_dlsearch_path " in
2591 *" $absdir "*) ;;
2592 *)
2593 case "$compile_rpath " in
2594 *" $absdir "*) ;;
2595 *) compile_rpath="$compile_rpath $absdir"
2596 esac
2597 ;;
2598 esac
2599 case " $sys_lib_dlsearch_path " in
2600 *" $libdir "*) ;;
2601 *)
2602 case "$finalize_rpath " in
2603 *" $libdir "*) ;;
2604 *) finalize_rpath="$finalize_rpath $libdir"
2605 esac
2606 ;;
2607 esac
2608 fi
2609
2610 if test -n "$old_archive_from_expsyms_cmds"; then
2611 # figure out the soname
2612 set dummy $library_names
2613 realname="$2"
2614 shift; shift
2615 libname=`eval \\$echo \"$libname_spec\"`
2616 # use dlname if we got it. it's perfectly good, no?
2617 if test -n "$dlname"; then
2618 soname="$dlname"
2619 elif test -n "$soname_spec"; then
2620 # bleh windows
2621 case $host in
2622 *cygwin* | mingw*)
2623 major=`expr $current - $age`
2624 versuffix="-$major"
2625 ;;
2626 esac
2627 eval soname=\"$soname_spec\"
2628 else
2629 soname="$realname"
2630 fi
2631
2632 # Make a new name for the extract_expsyms_cmds to use
2633 soroot="$soname"
2634 soname=`$echo $soroot | ${SED} -e 's/^.*\///'`
2635 newlib="libimp-`$echo $soname | ${SED} 's/^lib//;s/\.dll$//'`.a"
2636
2637 # If the library has no export list, then create one now
2638 if test -f "$output_objdir/$soname-def"; then :
2639 else
2640 $show "extracting exported symbol list from \`$soname'"
2641 save_ifs="$IFS"; IFS=$_S_
2642 eval cmds=\"$extract_expsyms_cmds\"
2643 for cmd in $cmds; do
2644 IFS="$save_ifs"
2645 $show "$cmd"
2646 $run eval "$cmd" || exit $?
2647 done
2648 IFS="$save_ifs"
2649 fi
2650
2651 # Create $newlib
2652 if test -f "$output_objdir/$newlib"; then :; else
2653 $show "generating import library for \`$soname'"
2654 save_ifs="$IFS"; IFS=$_S_
2655 eval cmds=\"$old_archive_from_expsyms_cmds\"
2656 for cmd in $cmds; do
2657 IFS="$save_ifs"
2658 $show "$cmd"
2659 $run eval "$cmd" || exit $?
2660 done
2661 IFS="$save_ifs"
2662 fi
2663 # make sure the library variables are pointing to the new library
2664 dir=$output_objdir
2665 linklib=$newlib
2666 fi # test -n "$old_archive_from_expsyms_cmds"
2667
2668 if test "$linkmode" = prog || test "$mode" != relink; then
2669 add_shlibpath=
2670 add_dir=
2671 add=
2672 lib_linked=yes
2673 case $hardcode_action in
2674 immediate | unsupported)
2675 if test "$hardcode_direct" = no; then
2676 add="$dir/$linklib"
2677 case $host in
2678 *-*-sco3.2v5* ) add_dir="-L$dir" ;;
2679 *-*-darwin* )
2680 # if the lib is a module then we can not link against it, someone
2681 # is ignoring the new warnings I added
2682 if /usr/bin/file -L $add 2> /dev/null | grep "bundle" >/dev/null ; then
2683 $echo "** Warning, lib $linklib is a module, not a shared library"
2684 if test -z "$old_library" ; then
2685 $echo
2686 $echo "** And there doesn't seem to be a static archive available"
2687 $echo "** The link will probably fail, sorry"
2688 else
2689 add="$dir/$old_library"
2690 fi
2691 fi
2692 esac
2693 elif test "$hardcode_minus_L" = no; then
2694 case $host in
2695 *-*-sunos*) add_shlibpath="$dir" ;;
2696 esac
2697 add_dir="-L$dir"
2698 add="-l$name"
2699 elif test "$hardcode_shlibpath_var" = no; then
2700 add_shlibpath="$dir"
2701 add="-l$name"
2702 else
2703 lib_linked=no
2704 fi
2705 ;;
2706 relink)
2707 if test "$hardcode_direct" = yes; then
2708 add="$dir/$linklib"
2709 elif test "$hardcode_minus_L" = yes; then
2710 add_dir="-L$dir"
2711 # Try looking first in the location we're being installed to.
2712 if test -n "$inst_prefix_dir"; then
2713 case "$libdir" in
2714 [\\/]*)
2715 add_dir="-L$inst_prefix_dir$libdir $add_dir"
2716 ;;
2717 esac
2718 fi
2719 add="-l$name"
2720 elif test "$hardcode_shlibpath_var" = yes; then
2721 add_shlibpath="$dir"
2722 add="-l$name"
2723 else
2724 lib_linked=no
2725 fi
2726 ;;
2727 *) lib_linked=no ;;
2728 esac
2729
2730 if test "$lib_linked" != yes; then
2731 $echo "$modename: configuration error: unsupported hardcode properties"
2732 exit 1
2733 fi
2734
2735 if test -n "$add_shlibpath"; then
2736 case :$compile_shlibpath: in
2737 *":$add_shlibpath:"*) ;;
2738 *) compile_shlibpath="$compile_shlibpath$add_shlibpath:" ;;
2739 esac
2740 fi
2741 if test "$linkmode" = prog; then
2742 test -n "$add_dir" && compile_deplibs="$add_dir $compile_deplibs"
2743 test -n "$add" && compile_deplibs="$add $compile_deplibs"
2744 else
2745 test -n "$add_dir" && deplibs="$add_dir $deplibs"
2746 test -n "$add" && deplibs="$add $deplibs"
2747 if test "$hardcode_direct" != yes && \
2748 test "$hardcode_minus_L" != yes && \
2749 test "$hardcode_shlibpath_var" = yes; then
2750 case :$finalize_shlibpath: in
2751 *":$libdir:"*) ;;
2752 *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;;
2753 esac
2754 fi
2755 fi
2756 fi
2757
2758 if test "$linkmode" = prog || test "$mode" = relink; then
2759 add_shlibpath=
2760 add_dir=
2761 add=
2762 # Finalize command for both is simple: just hardcode it.
2763 if test "$hardcode_direct" = yes; then
2764 add="$libdir/$linklib"
2765 elif test "$hardcode_minus_L" = yes; then
2766 add_dir="-L$libdir"
2767 add="-l$name"
2768 elif test "$hardcode_shlibpath_var" = yes; then
2769 case :$finalize_shlibpath: in
2770 *":$libdir:"*) ;;
2771 *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;;
2772 esac
2773 add="-l$name"
2774 elif test "$hardcode_automatic" = yes; then
2775 if test -n "$inst_prefix_dir" && test -f "$inst_prefix_dir$libdir/$linklib" ; then
2776 add="$inst_prefix_dir$libdir/$linklib"
2777 else
2778 add="$libdir/$linklib"
2779 fi
2780 else
2781 # We cannot seem to hardcode it, guess we'll fake it.
2782 add_dir="-L$libdir"
2783 # Try looking first in the location we're being installed to.
2784 if test -n "$inst_prefix_dir"; then
2785 case "$libdir" in
2786 [\\/]*)
2787 add_dir="-L$inst_prefix_dir$libdir $add_dir"
2788 ;;
2789 esac
2790 fi
2791 add="-l$name"
2792 fi
2793
2794 if test "$linkmode" = prog; then
2795 test -n "$add_dir" && finalize_deplibs="$add_dir $finalize_deplibs"
2796 test -n "$add" && finalize_deplibs="$add $finalize_deplibs"
2797 else
2798 test -n "$add_dir" && deplibs="$add_dir $deplibs"
2799 test -n "$add" && deplibs="$add $deplibs"
2800 fi
2801 fi
2802 elif test "$linkmode" = prog; then
2803 # Here we assume that one of hardcode_direct or hardcode_minus_L
2804 # is not unsupported. This is valid on all known static and
2805 # shared platforms.
2806 if test "$hardcode_direct" != unsupported; then
2807 test -n "$old_library" && linklib="$old_library"
2808 compile_deplibs="$dir/$linklib $compile_deplibs"
2809 finalize_deplibs="$dir/$linklib $finalize_deplibs"
2810 else
2811 compile_deplibs="-l$name -L$dir $compile_deplibs"
2812 finalize_deplibs="-l$name -L$dir $finalize_deplibs"
2813 fi
2814 elif test "$build_libtool_libs" = yes; then
2815 # Not a shared library
2816 if test "$deplibs_check_method" != pass_all; then
2817 # We're trying link a shared library against a static one
2818 # but the system doesn't support it.
2819
2820 # Just print a warning and add the library to dependency_libs so
2821 # that the program can be linked against the static library.
2822 $echo
2823 $echo "*** Warning: This system can not link to static lib archive $lib."
2824 $echo "*** I have the capability to make that library automatically link in when"
2825 $echo "*** you link to this library. But I can only do this if you have a"
2826 $echo "*** shared version of the library, which you do not appear to have."
2827 if test "$module" = yes; then
2828 $echo "*** But as you try to build a module library, libtool will still create "
2829 $echo "*** a static module, that should work as long as the dlopening application"
2830 $echo "*** is linked with the -dlopen flag to resolve symbols at runtime."
2831 if test -z "$global_symbol_pipe"; then
2832 $echo
2833 $echo "*** However, this would only work if libtool was able to extract symbol"
2834 $echo "*** lists from a program, using \`nm' or equivalent, but libtool could"
2835 $echo "*** not find such a program. So, this module is probably useless."
2836 $echo "*** \`nm' from GNU binutils and a full rebuild may help."
2837 fi
2838 if test "$build_old_libs" = no; then
2839 build_libtool_libs=module
2840 build_old_libs=yes
2841 else
2842 build_libtool_libs=no
2843 fi
2844 fi
2845 else
2846 convenience="$convenience $dir/$old_library"
2847 old_convenience="$old_convenience $dir/$old_library"
2848 deplibs="$dir/$old_library $deplibs"
2849 link_static=yes
2850 fi
2851 fi # link shared/static library?
2852
2853 if test "$linkmode" = lib; then
2854 if test -n "$dependency_libs" &&
2855 { test "$hardcode_into_libs" != yes || test "$build_old_libs" = yes ||
2856 test "$link_static" = yes; }; then
2857 # Extract -R from dependency_libs
2858 temp_deplibs=
2859 for libdir in $dependency_libs; do
2860 case $libdir in
2861 -R*) temp_xrpath=`$echo "X$libdir" | $Xsed -e 's/^-R//'`
2862 case " $xrpath " in
2863 *" $temp_xrpath "*) ;;
2864 *) xrpath="$xrpath $temp_xrpath";;
2865 esac;;
2866 *) temp_deplibs="$temp_deplibs $libdir";;
2867 esac
2868 done
2869 dependency_libs="$temp_deplibs"
2870 fi
2871
2872 newlib_search_path="$newlib_search_path $absdir"
2873 # Link against this library
2874 test "$link_static" = no && newdependency_libs="$abs_ladir/$laname $newdependency_libs"
2875 # ... and its dependency_libs
2876 tmp_libs=
2877 for deplib in $dependency_libs; do
2878 newdependency_libs="$deplib $newdependency_libs"
2879 if test "X$duplicate_deps" = "Xyes" ; then
2880 case "$tmp_libs " in
2881 *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
2882 esac
2883 fi
2884 tmp_libs="$tmp_libs $deplib"
2885 done
2886
2887 if test "$link_all_deplibs" != no; then
2888 # Add the search paths of all dependency libraries
2889 for deplib in $dependency_libs; do
2890 case $deplib in
2891 -L*) path="$deplib" ;;
2892 *.la)
2893 dir=`$echo "X$deplib" | $Xsed -e 's%/[^/]*$%%'`
2894 test "X$dir" = "X$deplib" && dir="."
2895 # We need an absolute path.
2896 case $dir in
2897 [\\/]* | [A-Za-z]:[\\/]*) absdir="$dir" ;;
2898 *)
2899 absdir=`cd "$dir" && pwd`
2900 if test -z "$absdir"; then
2901 $echo "$modename: warning: cannot determine absolute directory name of \`$dir'" 1>&2
2902 absdir="$dir"
2903 fi
2904 ;;
2905 esac
2906 if grep "^installed=no" $deplib > /dev/null; then
2907 path="$absdir/$objdir"
2908 else
2909 eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
2910 if test -z "$libdir"; then
2911 $echo "$modename: \`$deplib' is not a valid libtool archive" 1>&2
2912 exit 1
2913 fi
2914 if test "$absdir" != "$libdir"; then
2915 $echo "$modename: warning: \`$deplib' seems to be moved" 1>&2
2916 fi
2917 path="$absdir"
2918 fi
2919 depdepl=
2920 case $host in
2921 *-*-darwin*)
2922 # we do not want to link against static libs, but need to link against shared
2923 eval deplibrary_names=`${SED} -n -e 's/^library_names=\(.*\)$/\1/p' $deplib`
2924 if test -n "$deplibrary_names" ; then
2925 for tmp in $deplibrary_names ; do
2926 depdepl=$tmp
2927 done
2928 if test -f "$path/$depdepl" ; then
2929 depdepl="$path/$depdepl"
2930 fi
2931 newlib_search_path="$newlib_search_path $path"
2932 path=""
2933 fi
2934 ;;
2935 *)
2936 path="-L$path"
2937 ;;
2938 esac
2939
2940 ;;
2941 -l*)
2942 case $host in
2943 *-*-darwin*)
2944 # Again, we only want to link against shared libraries
2945 eval tmp_libs=`$echo "X$deplib" | $Xsed -e "s,^\-l,,"`
2946 for tmp in $newlib_search_path ; do
2947 if test -f "$tmp/lib$tmp_libs.dylib" ; then
2948 eval depdepl="$tmp/lib$tmp_libs.dylib"
2949 break
2950 fi
2951 done
2952 path=""
2953 ;;
2954 *) continue ;;
2955 esac
2956 ;;
2957 *) continue ;;
2958 esac
2959 case " $deplibs " in
2960 *" $depdepl "*) ;;
2961 *) deplibs="$deplibs $depdepl" ;;
2962 esac
2963 case " $deplibs " in
2964 *" $path "*) ;;
2965 *) deplibs="$deplibs $path" ;;
2966 esac
2967 done
2968 fi # link_all_deplibs != no
2969 fi # linkmode = lib
2970 done # for deplib in $libs
2971 dependency_libs="$newdependency_libs"
2972 if test "$pass" = dlpreopen; then
2973 # Link the dlpreopened libraries before other libraries
2974 for deplib in $save_deplibs; do
2975 deplibs="$deplib $deplibs"
2976 done
2977 fi
2978 if test "$pass" != dlopen; then
2979 if test "$pass" != conv; then
2980 # Make sure lib_search_path contains only unique directories.
2981 lib_search_path=
2982 for dir in $newlib_search_path; do
2983 case "$lib_search_path " in
2984 *" $dir "*) ;;
2985 *) lib_search_path="$lib_search_path $dir" ;;
2986 esac
2987 done
2988 newlib_search_path=
2989 fi
2990
2991 if test "$linkmode,$pass" != "prog,link"; then
2992 vars="deplibs"
2993 else
2994 vars="compile_deplibs finalize_deplibs"
2995 fi
2996 for var in $vars dependency_libs; do
2997 # Add libraries to $var in reverse order
2998 eval tmp_libs=\"\$$var\"
2999 new_libs=
3000 for deplib in $tmp_libs; do
3001 # FIXME: Pedantically, this is the right thing to do, so
3002 # that some nasty dependency loop isn't accidentally
3003 # broken:
3004 #new_libs="$deplib $new_libs"
3005 # Pragmatically, this seems to cause very few problems in
3006 # practice:
3007 case $deplib in
3008 -L*) new_libs="$deplib $new_libs" ;;
3009 -R*) ;;
3010 *)
3011 # And here is the reason: when a library appears more
3012 # than once as an explicit dependence of a library, or
3013 # is implicitly linked in more than once by the
3014 # compiler, it is considered special, and multiple
3015 # occurrences thereof are not removed. Compare this
3016 # with having the same library being listed as a
3017 # dependency of multiple other libraries: in this case,
3018 # we know (pedantically, we assume) the library does not
3019 # need to be listed more than once, so we keep only the
3020 # last copy. This is not always right, but it is rare
3021 # enough that we require users that really mean to play
3022 # such unportable linking tricks to link the library
3023 # using -Wl,-lname, so that libtool does not consider it
3024 # for duplicate removal.
3025 case " $specialdeplibs " in
3026 *" $deplib "*) new_libs="$deplib $new_libs" ;;
3027 *)
3028 case " $new_libs " in
3029 *" $deplib "*) ;;
3030 *) new_libs="$deplib $new_libs" ;;
3031 esac
3032 ;;
3033 esac
3034 ;;
3035 esac
3036 done
3037 tmp_libs=
3038 for deplib in $new_libs; do
3039 case $deplib in
3040 -L*)
3041 case " $tmp_libs " in
3042 *" $deplib "*) ;;
3043 *) tmp_libs="$tmp_libs $deplib" ;;
3044 esac
3045 ;;
3046 *) tmp_libs="$tmp_libs $deplib" ;;
3047 esac
3048 done
3049 eval $var=\"$tmp_libs\"
3050 done # for var
3051 fi
3052 # Last step: remove runtime libs from dependency_libs (they stay in deplibs)
3053 tmp_libs=
3054 for i in $dependency_libs ; do
3055 case " $predeps $postdeps $compiler_lib_search_path " in
3056 *" $i "*)
3057 i=""
3058 ;;
3059 esac
3060 if test -n "$i" ; then
3061 tmp_libs="$tmp_libs $i"
3062 fi
3063 done
3064 dependency_libs=$tmp_libs
3065 done # for pass
3066 if test "$linkmode" = prog; then
3067 dlfiles="$newdlfiles"
3068 dlprefiles="$newdlprefiles"
3069 fi
3070
3071 case $linkmode in
3072 oldlib)
3073 if test -n "$deplibs"; then
3074 $echo "$modename: warning: \`-l' and \`-L' are ignored for archives" 1>&2
3075 fi
3076
3077 if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
3078 $echo "$modename: warning: \`-dlopen' is ignored for archives" 1>&2
3079 fi
3080
3081 if test -n "$rpath"; then
3082 $echo "$modename: warning: \`-rpath' is ignored for archives" 1>&2
3083 fi
3084
3085 if test -n "$xrpath"; then
3086 $echo "$modename: warning: \`-R' is ignored for archives" 1>&2
3087 fi
3088
3089 if test -n "$vinfo"; then
3090 $echo "$modename: warning: \`-version-info/-version-number' is ignored for archives" 1>&2
3091 fi
3092
3093 if test -n "$release"; then
3094 $echo "$modename: warning: \`-release' is ignored for archives" 1>&2
3095 fi
3096
3097 if test -n "$export_symbols" || test -n "$export_symbols_regex"; then
3098 $echo "$modename: warning: \`-export-symbols' is ignored for archives" 1>&2
3099 fi
3100
3101 # Now set the variables for building old libraries.
3102 build_libtool_libs=no
3103 oldlibs="$output"
3104 objs="$objs$old_deplibs"
3105 ;;
3106
3107 lib)
3108 # Make sure we only generate libraries of the form `libNAME.la'.
3109 case $outputname in
3110 lib*)
3111 name=`$echo "X$outputname" | $Xsed -e 's/\.la$//' -e 's/^lib//'`
3112 eval shared_ext=\"$shrext\"
3113 eval libname=\"$libname_spec\"
3114 ;;
3115 *)
3116 if test "$module" = no; then
3117 $echo "$modename: libtool library \`$output' must begin with \`lib'" 1>&2
3118 $echo "$help" 1>&2
3119 exit 1
3120 fi
3121 if test "$need_lib_prefix" != no; then
3122 # Add the "lib" prefix for modules if required
3123 name=`$echo "X$outputname" | $Xsed -e 's/\.la$//'`
3124 eval shared_ext=\"$shrext\"
3125 eval libname=\"$libname_spec\"
3126 else
3127 libname=`$echo "X$outputname" | $Xsed -e 's/\.la$//'`
3128 fi
3129 ;;
3130 esac
3131
3132 if test -n "$objs"; then
3133 if test "$deplibs_check_method" != pass_all; then
3134 $echo "$modename: cannot build libtool library \`$output' from non-libtool objects on this host:$objs" 2>&1
3135 exit 1
3136 else
3137 $echo
3138 $echo "*** Warning: Linking the shared library $output against the non-libtool"
3139 $echo "*** objects $objs is not portable!"
3140 libobjs="$libobjs $objs"
3141 fi
3142 fi
3143
3144 if test "$dlself" != no; then
3145 $echo "$modename: warning: \`-dlopen self' is ignored for libtool libraries" 1>&2
3146 fi
3147
3148 set dummy $rpath
3149 if test "$#" -gt 2; then
3150 $echo "$modename: warning: ignoring multiple \`-rpath's for a libtool library" 1>&2
3151 fi
3152 install_libdir="$2"
3153
3154 oldlibs=
3155 if test -z "$rpath"; then
3156 if test "$build_libtool_libs" = yes; then
3157 # Building a libtool convenience library.
3158 # Some compilers have problems with a `.al' extension so
3159 # convenience libraries should have the same extension an
3160 # archive normally would.
3161 oldlibs="$output_objdir/$libname.$libext $oldlibs"
3162 build_libtool_libs=convenience
3163 build_old_libs=yes
3164 fi
3165
3166 if test -n "$vinfo"; then
3167 $echo "$modename: warning: \`-version-info/-version-number' is ignored for convenience libraries" 1>&2
3168 fi
3169
3170 if test -n "$release"; then
3171 $echo "$modename: warning: \`-release' is ignored for convenience libraries" 1>&2
3172 fi
3173 else
3174
3175 # Parse the version information argument.
3176 save_ifs="$IFS"; IFS=':'
3177 set dummy $vinfo 0 0 0
3178 IFS="$save_ifs"
3179
3180 if test -n "$8"; then
3181 $echo "$modename: too many parameters to \`-version-info'" 1>&2
3182 $echo "$help" 1>&2
3183 exit 1
3184 fi
3185
3186 # convert absolute version numbers to libtool ages
3187 # this retains compatibility with .la files and attempts
3188 # to make the code below a bit more comprehensible
3189
3190 case $vinfo_number in
3191 yes)
3192 number_major="$2"
3193 number_minor="$3"
3194 number_revision="$4"
3195 #
3196 # There are really only two kinds -- those that
3197 # use the current revision as the major version
3198 # and those that subtract age and use age as
3199 # a minor version. But, then there is irix
3200 # which has an extra 1 added just for fun
3201 #
3202 case $version_type in
3203 darwin|linux|osf|windows)
3204 current=`expr $number_major + $number_minor`
3205 age="$number_minor"
3206 revision="$number_revision"
3207 ;;
3208 freebsd-aout|freebsd-elf|sunos)
3209 current="$number_major"
3210 revision="$number_minor"
3211 age="0"
3212 ;;
3213 irix|nonstopux)
3214 current=`expr $number_major + $number_minor - 1`
3215 age="$number_minor"
3216 revision="$number_minor"
3217 ;;
3218 esac
3219 ;;
3220 no)
3221 current="$2"
3222 revision="$3"
3223 age="$4"
3224 ;;
3225 esac
3226
3227 # Check that each of the things are valid numbers.
3228 case $current in
3229 0 | [1-9] | [1-9][0-9] | [1-9][0-9][0-9]) ;;
3230 *)
3231 $echo "$modename: CURRENT \`$current' is not a nonnegative integer" 1>&2
3232 $echo "$modename: \`$vinfo' is not valid version information" 1>&2
3233 exit 1
3234 ;;
3235 esac
3236
3237 case $revision in
3238 0 | [1-9] | [1-9][0-9] | [1-9][0-9][0-9]) ;;
3239 *)
3240 $echo "$modename: REVISION \`$revision' is not a nonnegative integer" 1>&2
3241 $echo "$modename: \`$vinfo' is not valid version information" 1>&2
3242 exit 1
3243 ;;
3244 esac
3245
3246 case $age in
3247 0 | [1-9] | [1-9][0-9] | [1-9][0-9][0-9]) ;;
3248 *)
3249 $echo "$modename: AGE \`$age' is not a nonnegative integer" 1>&2
3250 $echo "$modename: \`$vinfo' is not valid version information" 1>&2
3251 exit 1
3252 ;;
3253 esac
3254
3255 if test "$age" -gt "$current"; then
3256 $echo "$modename: AGE \`$age' is greater than the current interface number \`$current'" 1>&2
3257 $echo "$modename: \`$vinfo' is not valid version information" 1>&2
3258 exit 1
3259 fi
3260
3261 # Calculate the version variables.
3262 major=
3263 versuffix=
3264 verstring=
3265 case $version_type in
3266 none) ;;
3267
3268 darwin)
3269 # Like Linux, but with the current version available in
3270 # verstring for coding it into the library header
3271 major=.`expr $current - $age`
3272 versuffix="$major.$age.$revision"
3273 # Darwin ld doesn't like 0 for these options...
3274 minor_current=`expr $current + 1`
3275 verstring="-compatibility_version $minor_current -current_version $minor_current.$revision"
3276 ;;
3277
3278 freebsd-aout)
3279 major=".$current"
3280 versuffix=".$current.$revision";
3281 ;;
3282
3283 freebsd-elf)
3284 major=".$current"
3285 versuffix=".$current";
3286 ;;
3287
3288 irix | nonstopux)
3289 major=`expr $current - $age + 1`
3290
3291 case $version_type in
3292 nonstopux) verstring_prefix=nonstopux ;;
3293 *) verstring_prefix=sgi ;;
3294 esac
3295 verstring="$verstring_prefix$major.$revision"
3296
3297 # Add in all the interfaces that we are compatible with.
3298 loop=$revision
3299 while test "$loop" -ne 0; do
3300 iface=`expr $revision - $loop`
3301 loop=`expr $loop - 1`
3302 verstring="$verstring_prefix$major.$iface:$verstring"
3303 done
3304
3305 # Before this point, $major must not contain `.'.
3306 major=.$major
3307 versuffix="$major.$revision"
3308 ;;
3309
3310 linux)
3311 major=.`expr $current - $age`
3312 versuffix="$major.$age.$revision"
3313 ;;
3314
3315 osf)
3316 major=.`expr $current - $age`
3317 versuffix=".$current.$age.$revision"
3318 verstring="$current.$age.$revision"
3319
3320 # Add in all the interfaces that we are compatible with.
3321 loop=$age
3322 while test "$loop" -ne 0; do
3323 iface=`expr $current - $loop`
3324 loop=`expr $loop - 1`
3325 verstring="$verstring:${iface}.0"
3326 done
3327
3328 # Make executables depend on our current version.
3329 verstring="$verstring:${current}.0"
3330 ;;
3331
3332 sunos)
3333 major=".$current"
3334 versuffix=".$current.$revision"
3335 ;;
3336
3337 windows)
3338 # Use '-' rather than '.', since we only want one
3339 # extension on DOS 8.3 filesystems.
3340 major=`expr $current - $age`
3341 versuffix="-$major"
3342 ;;
3343
3344 *)
3345 $echo "$modename: unknown library version type \`$version_type'" 1>&2
3346 $echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2
3347 exit 1
3348 ;;
3349 esac
3350
3351 # Clear the version info if we defaulted, and they specified a release.
3352 if test -z "$vinfo" && test -n "$release"; then
3353 major=
3354 case $version_type in
3355 darwin)
3356 # we can't check for "0.0" in archive_cmds due to quoting
3357 # problems, so we reset it completely
3358 verstring=
3359 ;;
3360 *)
3361 verstring="0.0"
3362 ;;
3363 esac
3364 if test "$need_version" = no; then
3365 versuffix=
3366 else
3367 versuffix=".0.0"
3368 fi
3369 fi
3370
3371 # Remove version info from name if versioning should be avoided
3372 if test "$avoid_version" = yes && test "$need_version" = no; then
3373 major=
3374 versuffix=
3375 verstring=""
3376 fi
3377
3378 # Check to see if the archive will have undefined symbols.
3379 if test "$allow_undefined" = yes; then
3380 if test "$allow_undefined_flag" = unsupported; then
3381 $echo "$modename: warning: undefined symbols not allowed in $host shared libraries" 1>&2
3382 build_libtool_libs=no
3383 build_old_libs=yes
3384 fi
3385 else
3386 # Don't allow undefined symbols.
3387 allow_undefined_flag="$no_undefined_flag"
3388 fi
3389 fi
3390
3391 if test "$mode" != relink; then
3392 # Remove our outputs, but don't remove object files since they
3393 # may have been created when compiling PIC objects.
3394 removelist=
3395 tempremovelist=`$echo "$output_objdir/*"`
3396 for p in $tempremovelist; do
3397 case $p in
3398 *.$objext)
3399 ;;
3400 $output_objdir/$outputname | $output_objdir/$libname.* | $output_objdir/${libname}${release}.*)
3401 removelist="$removelist $p"
3402 ;;
3403 *) ;;
3404 esac
3405 done
3406 if test -n "$removelist"; then
3407 $show "${rm}r $removelist"
3408 $run ${rm}r $removelist
3409 fi
3410 fi
3411
3412 # Now set the variables for building old libraries.
3413 if test "$build_old_libs" = yes && test "$build_libtool_libs" != convenience ; then
3414 oldlibs="$oldlibs $output_objdir/$libname.$libext"
3415
3416 # Transform .lo files to .o files.
3417 oldobjs="$objs "`$echo "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}'$/d' -e "$lo2o" | $NL2SP`
3418 fi
3419
3420 # Eliminate all temporary directories.
3421 for path in $notinst_path; do
3422 lib_search_path=`$echo "$lib_search_path " | ${SED} -e 's% $path % %g'`
3423 deplibs=`$echo "$deplibs " | ${SED} -e 's% -L$path % %g'`
3424 dependency_libs=`$echo "$dependency_libs " | ${SED} -e 's% -L$path % %g'`
3425 done
3426
3427 if test -n "$xrpath"; then
3428 # If the user specified any rpath flags, then add them.
3429 temp_xrpath=
3430 for libdir in $xrpath; do
3431 temp_xrpath="$temp_xrpath -R$libdir"
3432 case "$finalize_rpath " in
3433 *" $libdir "*) ;;
3434 *) finalize_rpath="$finalize_rpath $libdir" ;;
3435 esac
3436 done
3437 if test "$hardcode_into_libs" != yes || test "$build_old_libs" = yes; then
3438 dependency_libs="$temp_xrpath $dependency_libs"
3439 fi
3440 fi
3441
3442 # Make sure dlfiles contains only unique files that won't be dlpreopened
3443 old_dlfiles="$dlfiles"
3444 dlfiles=
3445 for lib in $old_dlfiles; do
3446 case " $dlprefiles $dlfiles " in
3447 *" $lib "*) ;;
3448 *) dlfiles="$dlfiles $lib" ;;
3449 esac
3450 done
3451
3452 # Make sure dlprefiles contains only unique files
3453 old_dlprefiles="$dlprefiles"
3454 dlprefiles=
3455 for lib in $old_dlprefiles; do
3456 case "$dlprefiles " in
3457 *" $lib "*) ;;
3458 *) dlprefiles="$dlprefiles $lib" ;;
3459 esac
3460 done
3461
3462 if test "$build_libtool_libs" = yes; then
3463 if test -n "$rpath"; then
3464 case $host in
3465 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-beos*)
3466 # these systems don't actually have a c library (as such)!
3467 ;;
3468 *-*-rhapsody* | *-*-darwin1.[012])
3469 # Rhapsody C library is in the System framework
3470 deplibs="$deplibs -framework System"
3471 ;;
3472 *-*-netbsd*)
3473 # Don't link with libc until the a.out ld.so is fixed.
3474 ;;
3475 *-*-openbsd* | *-*-freebsd*)
3476 # Do not include libc due to us having libc/libc_r.
3477 test "X$arg" = "X-lc" && continue
3478 ;;
3479 *)
3480 # Add libc to deplibs on all other systems if necessary.
3481 if test "$build_libtool_need_lc" = "yes"; then
3482 deplibs="$deplibs -lc"
3483 fi
3484 ;;
3485 esac
3486 fi
3487
3488 # Transform deplibs into only deplibs that can be linked in shared.
3489 name_save=$name
3490 libname_save=$libname
3491 release_save=$release
3492 versuffix_save=$versuffix
3493 major_save=$major
3494 # I'm not sure if I'm treating the release correctly. I think
3495 # release should show up in the -l (ie -lgmp5) so we don't want to
3496 # add it in twice. Is that correct?
3497 release=""
3498 versuffix=""
3499 major=""
3500 newdeplibs=
3501 droppeddeps=no
3502 case $deplibs_check_method in
3503 pass_all)
3504 # Don't check for shared/static. Everything works.
3505 # This might be a little naive. We might want to check
3506 # whether the library exists or not. But this is on
3507 # osf3 & osf4 and I'm not really sure... Just
3508 # implementing what was already the behavior.
3509 newdeplibs=$deplibs
3510 ;;
3511 test_compile)
3512 # This code stresses the "libraries are programs" paradigm to its
3513 # limits. Maybe even breaks it. We compile a program, linking it
3514 # against the deplibs as a proxy for the library. Then we can check
3515 # whether they linked in statically or dynamically with ldd.
3516 $rm conftest.c
3517 cat > conftest.c <<EOF
3518 int main() { return 0; }
3519 EOF
3520 $rm conftest
3521 $LTCC $archargs -o conftest conftest.c $deplibs
3522 if test "$?" -eq 0 ; then
3523 ldd_output=`ldd conftest`
3524 for i in $deplibs; do
3525 name="`expr $i : '-l\(.*\)'`"
3526 # If $name is empty we are operating on a -L argument.
3527 if test "$name" != "" && test "$name" -ne "0"; then
3528 if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
3529 case " $predeps $postdeps " in
3530 *" $i "*)
3531 newdeplibs="$newdeplibs $i"
3532 i=""
3533 ;;
3534 esac
3535 fi
3536 if test -n "$i" ; then
3537 libname=`eval \\$echo \"$libname_spec\"`
3538 deplib_matches=`eval \\$echo \"$library_names_spec\"`
3539 set dummy $deplib_matches
3540 deplib_match=$2
3541 if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then
3542 newdeplibs="$newdeplibs $i"
3543 else
3544 droppeddeps=yes
3545 $echo
3546 $echo "*** Warning: dynamic linker does not accept needed library $i."
3547 $echo "*** I have the capability to make that library automatically link in when"
3548 $echo "*** you link to this library. But I can only do this if you have a"
3549 $echo "*** shared version of the library, which I believe you do not have"
3550 $echo "*** because a test_compile did reveal that the linker did not use it for"
3551 $echo "*** its dynamic dependency list that programs get resolved with at runtime."
3552 fi
3553 fi
3554 else
3555 newdeplibs="$newdeplibs $i"
3556 fi
3557 done
3558 else
3559 # Error occurred in the first compile. Let's try to salvage
3560 # the situation: Compile a separate program for each library.
3561 for i in $deplibs; do
3562 name="`expr $i : '-l\(.*\)'`"
3563 # If $name is empty we are operating on a -L argument.
3564 if test "$name" != "" && test "$name" != "0"; then
3565 $rm conftest
3566 $LTCC $archargs -o conftest conftest.c $i
3567 # Did it work?
3568 if test "$?" -eq 0 ; then
3569 ldd_output=`ldd conftest`
3570 if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
3571 case " $predeps $postdeps " in
3572 *" $i "*)
3573 newdeplibs="$newdeplibs $i"
3574 i=""
3575 ;;
3576 esac
3577 fi
3578 if test -n "$i" ; then
3579 libname=`eval \\$echo \"$libname_spec\"`
3580 deplib_matches=`eval \\$echo \"$library_names_spec\"`
3581 set dummy $deplib_matches
3582 deplib_match=$2
3583 if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then
3584 newdeplibs="$newdeplibs $i"
3585 else
3586 droppeddeps=yes
3587 $echo
3588 $echo "*** Warning: dynamic linker does not accept needed library $i."
3589 $echo "*** I have the capability to make that library automatically link in when"
3590 $echo "*** you link to this library. But I can only do this if you have a"
3591 $echo "*** shared version of the library, which you do not appear to have"
3592 $echo "*** because a test_compile did reveal that the linker did not use this one"
3593 $echo "*** as a dynamic dependency that programs can get resolved with at runtime."
3594 fi
3595 fi
3596 else
3597 droppeddeps=yes
3598 $echo
3599 $echo "*** Warning! Library $i is needed by this library but I was not able to"
3600 $echo "*** make it link in! You will probably need to install it or some"
3601 $echo "*** library that it depends on before this library will be fully"
3602 $echo "*** functional. Installing it before continuing would be even better."
3603 fi
3604 else
3605 newdeplibs="$newdeplibs $i"
3606 fi
3607 done
3608 fi
3609 ;;
3610 file_magic*)
3611 set dummy $deplibs_check_method
3612 file_magic_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"`
3613 for a_deplib in $deplibs; do
3614 name="`expr $a_deplib : '-l\(.*\)'`"
3615 # If $name is empty we are operating on a -L argument.
3616 if test "$name" != "" && test "$name" != "0"; then
3617 if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
3618 case " $predeps $postdeps " in
3619 *" $a_deplib "*)
3620 newdeplibs="$newdeplibs $a_deplib"
3621 a_deplib=""
3622 ;;
3623 esac
3624 fi
3625 if test -n "$a_deplib" ; then
3626 libname=`eval \\$echo \"$libname_spec\"`
3627 for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
3628 potential_libs=`ls $i/$libname[.-]* 2>/dev/null`
3629 for potent_lib in $potential_libs; do
3630 # Follow soft links.
3631 if ls -lLd "$potent_lib" 2>/dev/null \
3632 | grep " -> " >/dev/null; then
3633 continue
3634 fi
3635 # The statement above tries to avoid entering an
3636 # endless loop below, in case of cyclic links.
3637 # We might still enter an endless loop, since a link
3638 # loop can be closed while we follow links,
3639 # but so what?
3640 potlib="$potent_lib"
3641 while test -h "$potlib" 2>/dev/null; do
3642 potliblink=`ls -ld $potlib | ${SED} 's/.* -> //'`
3643 case $potliblink in
3644 [\\/]* | [A-Za-z]:[\\/]*) potlib="$potliblink";;
3645 *) potlib=`$echo "X$potlib" | $Xsed -e 's,[^/]*$,,'`"$potliblink";;
3646 esac
3647 done
3648 if eval $file_magic_cmd \"\$potlib\" 2>/dev/null \
3649 | ${SED} 10q \
3650 | $EGREP "$file_magic_regex" > /dev/null; then
3651 newdeplibs="$newdeplibs $a_deplib"
3652 a_deplib=""
3653 break 2
3654 fi
3655 done
3656 done
3657 fi
3658 if test -n "$a_deplib" ; then
3659 droppeddeps=yes
3660 $echo
3661 $echo "*** Warning: linker path does not have real file for library $a_deplib."
3662 $echo "*** I have the capability to make that library automatically link in when"
3663 $echo "*** you link to this library. But I can only do this if you have a"
3664 $echo "*** shared version of the library, which you do not appear to have"
3665 $echo "*** because I did check the linker path looking for a file starting"
3666 if test -z "$potlib" ; then
3667 $echo "*** with $libname but no candidates were found. (...for file magic test)"
3668 else
3669 $echo "*** with $libname and none of the candidates passed a file format test"
3670 $echo "*** using a file magic. Last file checked: $potlib"
3671 fi
3672 fi
3673 else
3674 # Add a -L argument.
3675 newdeplibs="$newdeplibs $a_deplib"
3676 fi
3677 done # Gone through all deplibs.
3678 ;;
3679 match_pattern*)
3680 set dummy $deplibs_check_method
3681 match_pattern_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"`
3682 for a_deplib in $deplibs; do
3683 name="`expr $a_deplib : '-l\(.*\)'`"
3684 # If $name is empty we are operating on a -L argument.
3685 if test -n "$name" && test "$name" != "0"; then
3686 if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
3687 case " $predeps $postdeps " in
3688 *" $a_deplib "*)
3689 newdeplibs="$newdeplibs $a_deplib"
3690 a_deplib=""
3691 ;;
3692 esac
3693 fi
3694 if test -n "$a_deplib" ; then
3695 libname=`eval \\$echo \"$libname_spec\"`
3696 for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
3697 potential_libs=`ls $i/$libname[.-]* 2>/dev/null`
3698 for potent_lib in $potential_libs; do
3699 potlib="$potent_lib" # see symlink-check above in file_magic test
3700 if eval $echo \"$potent_lib\" 2>/dev/null \
3701 | ${SED} 10q \
3702 | $EGREP "$match_pattern_regex" > /dev/null; then
3703 newdeplibs="$newdeplibs $a_deplib"
3704 a_deplib=""
3705 break 2
3706 fi
3707 done
3708 done
3709 fi
3710 if test -n "$a_deplib" ; then
3711 droppeddeps=yes
3712 $echo
3713 $echo "*** Warning: linker path does not have real file for library $a_deplib."
3714 $echo "*** I have the capability to make that library automatically link in when"
3715 $echo "*** you link to this library. But I can only do this if you have a"
3716 $echo "*** shared version of the library, which you do not appear to have"
3717 $echo "*** because I did check the linker path looking for a file starting"
3718 if test -z "$potlib" ; then
3719 $echo "*** with $libname but no candidates were found. (...for regex pattern test)"
3720 else
3721 $echo "*** with $libname and none of the candidates passed a file format test"
3722 $echo "*** using a regex pattern. Last file checked: $potlib"
3723 fi
3724 fi
3725 else
3726 # Add a -L argument.
3727 newdeplibs="$newdeplibs $a_deplib"
3728 fi
3729 done # Gone through all deplibs.
3730 ;;
3731 none | unknown | *)
3732 newdeplibs=""
3733 tmp_deplibs=`$echo "X $deplibs" | $Xsed -e 's/ -lc$//' \
3734 -e 's/ -[LR][^ ]*//g'`
3735 if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
3736 for i in $predeps $postdeps ; do
3737 # can't use Xsed below, because $i might contain '/'
3738 tmp_deplibs=`$echo "X $tmp_deplibs" | ${SED} -e "1s,^X,," -e "s,$i,,"`
3739 done
3740 fi
3741 if $echo "X $tmp_deplibs" | $Xsed -e 's/[ ]//g' \
3742 | grep . >/dev/null; then
3743 $echo
3744 if test "X$deplibs_check_method" = "Xnone"; then
3745 $echo "*** Warning: inter-library dependencies are not supported in this platform."
3746 else
3747 $echo "*** Warning: inter-library dependencies are not known to be supported."
3748 fi
3749 $echo "*** All declared inter-library dependencies are being dropped."
3750 droppeddeps=yes
3751 fi
3752 ;;
3753 esac
3754 versuffix=$versuffix_save
3755 major=$major_save
3756 release=$release_save
3757 libname=$libname_save
3758 name=$name_save
3759
3760 case $host in
3761 *-*-rhapsody* | *-*-darwin1.[012])
3762 # On Rhapsody replace the C library is the System framework
3763 newdeplibs=`$echo "X $newdeplibs" | $Xsed -e 's/ -lc / -framework System /'`
3764 ;;
3765 esac
3766
3767 if test "$droppeddeps" = yes; then
3768 if test "$module" = yes; then
3769 $echo
3770 $echo "*** Warning: libtool could not satisfy all declared inter-library"
3771 $echo "*** dependencies of module $libname. Therefore, libtool will create"
3772 $echo "*** a static module, that should work as long as the dlopening"
3773 $echo "*** application is linked with the -dlopen flag."
3774 if test -z "$global_symbol_pipe"; then
3775 $echo
3776 $echo "*** However, this would only work if libtool was able to extract symbol"
3777 $echo "*** lists from a program, using \`nm' or equivalent, but libtool could"
3778 $echo "*** not find such a program. So, this module is probably useless."
3779 $echo "*** \`nm' from GNU binutils and a full rebuild may help."
3780 fi
3781 if test "$build_old_libs" = no; then
3782 oldlibs="$output_objdir/$libname.$libext"
3783 build_libtool_libs=module
3784 build_old_libs=yes
3785 else
3786 build_libtool_libs=no
3787 fi
3788 else
3789 $echo "*** The inter-library dependencies that have been dropped here will be"
3790 $echo "*** automatically added whenever a program is linked with this library"
3791 $echo "*** or is declared to -dlopen it."
3792
3793 if test "$allow_undefined" = no; then
3794